static void call_failed_because_of_codecs(void) {
	int begin,leaked_objects;

	belle_sip_object_enable_leak_detector(TRUE);
	begin=belle_sip_object_get_object_count();

	{
		LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
		LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
		LinphoneCall* out_call;

		disable_all_audio_codecs_except_one(marie->lc,"pcmu",-1);
		disable_all_audio_codecs_except_one(pauline->lc,"pcma",-1);
		out_call = linphone_core_invite_address(pauline->lc,marie->identity);
		linphone_call_ref(out_call);
		CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1));

		/*flexisip will retain the 488 until the "urgent reply" timeout (I.E 5s) arrives.*/
		CU_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1,7000));
		CU_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonNotAcceptable);
		CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallIncomingReceived,0);
		CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallReleased,0);

		linphone_call_unref(out_call);
		linphone_core_manager_destroy(marie);
		linphone_core_manager_destroy(pauline);
	}
	leaked_objects=belle_sip_object_get_object_count()-begin;
	CU_ASSERT_TRUE(leaked_objects==0);
	if (leaked_objects>0){
		belle_sip_object_dump_active_objects();
	}
}
Example #2
0
static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState st, const char *msg){
	char *from=linphone_call_get_remote_address_as_string(call);
	long id=(long)linphone_call_get_user_pointer (call);
	switch(st){
		case LinphoneCallEnd:
			linphonec_out("Call %i with %s ended (%s).\n", id, from, linphone_reason_to_string(linphone_call_get_reason(call)));
		break;
		case LinphoneCallResuming:
			linphonec_out("Resuming call %i with %s.\n", id, from);
		break;
		case LinphoneCallStreamsRunning:
			linphonec_out("Media streams established with %s for call %i (%s).\n", from,id,( linphone_call_params_video_enabled( linphone_call_get_current_params(call)) ? "video":"audio"));
		break;
		case LinphoneCallPausing:
			linphonec_out("Pausing call %i with %s.\n", id, from);
		break;
		case LinphoneCallPaused:
			linphonec_out("Call %i with %s is now paused.\n", id, from);
		break;
		case LinphoneCallPausedByRemote:
			linphonec_out("Call %i has been paused by %s.\n",id,from);
		break;
		case LinphoneCallIncomingReceived:
			linphonec_call_identify(call);
			linphone_call_enable_camera (call,linphonec_camera_enabled);
			id=(long)linphone_call_get_user_pointer (call);
			linphonec_set_caller(from);
			if ( auto_answer)  {
				answer_call=TRUE;
			}
			linphonec_out("Receiving new incoming call from %s, assigned id %i\n", from,id);
		break;
		case LinphoneCallOutgoingInit:
			linphonec_call_identify(call);
			id=(long)linphone_call_get_user_pointer (call);
			linphonec_out("Establishing call id to %s, assigned id %i\n", from,id);
		break;
		case LinphoneCallUpdatedByRemote:
			linphonec_call_updated(call);
		break;
		case LinphoneCallOutgoingProgress:
			linphonec_out("Call %i to %s in progress.\n", id, from);
			break;
		case LinphoneCallOutgoingRinging:
			linphonec_out("Call %i to %s ringing.\n", id, from);
			break;
		case LinphoneCallConnected:
			linphonec_out("Call %i with %s connected.\n", id, from);
			break;
		case LinphoneCallOutgoingEarlyMedia:
			linphonec_out("Call %i with %s early media.\n", id, from);
			break;
		case LinphoneCallError:
			linphonec_out("Call %i with %s error.\n", id, from);
			break;
		default:
		break;
	}
	ms_free(from);
}
Example #3
0
static void cb_call_state_changed (LinphoneCore *lc, LinphoneCall *call, LinphoneCallState st, const char *msg){
  char *from;

  from = linphone_call_get_remote_address_as_string (call);
  switch (st) {
    case LinphoneCallEnd:
      ShowStatus ("Call with %s ended (%s).", from, linphone_reason_to_string (linphone_call_get_reason (call)));
      inCall = FALSE;
      if (argCallee) running = FALSE;
      break;
    case LinphoneCallStreamsRunning:
      printf ("I: Media streams established with %s (%s).\n", from, (linphone_call_params_video_enabled( linphone_call_get_current_params(call)) ? "video":"audio"));
      break;
    case LinphoneCallIncomingReceived:
      ShowStatus ("Receiving new incoming call from %s", from, NULL);
      linphone_call_enable_camera (call, TRUE);  // necessary?
      if (inCall)
        linphone_core_decline_call (lc, call, LinphoneReasonBusy);
      else
        linphone_core_accept_call (lc, call);  // TBD: must this call be moved outside this handler?
      break;
    case LinphoneCallOutgoingInit:
      ShowStatus ("Establishing call to %s", from, NULL);
      break;
    case LinphoneCallOutgoingProgress:
      ShowStatus ("Call to %s in progress.", from, NULL);
      break;
    case LinphoneCallOutgoingRinging:
      ShowStatus ("Call to %s ringing.", from, NULL);
      break;
    case LinphoneCallConnected:
      ShowStatus ("Connected to %s.", from, NULL);
      inCall = TRUE;
      break;
    case LinphoneCallOutgoingEarlyMedia:
      printf ("I: Call with %s early media.", from);
      break;
    case LinphoneCallError:
      ShowStatus ("Call error with %s.", from, NULL);
      if (argCallee) error = TRUE;
      break;
    /*
    case LinphoneCallUpdatedByRemote:
      printf ("### cb_call_state_changed: Call %i with %s updated.\n", id, from);
      cp = linphone_call_get_current_params(call);
      // TBD: auto-start camera?
      if (!linphone_call_camera_enabled (call) && linphone_call_params_video_enabled (cp)){
        printf ("Far end requests to share video.\nType 'camera on' if you agree.\n");
      }
      break;
    case LinphoneCallPausing:
      printf ("### cb_call_state_changed: Pausing call %i with %s.\n", id, from);
      break;
    case LinphoneCallPaused:
      printf ("### cb_call_state_changed: Call %i with %s is now paused.\n", id, from);
      break;
    case LinphoneCallPausedByRemote:
      printf ("### cb_call_state_changed: Call %i has been paused by %s.\n",id,from);
      break;
    case LinphoneCallResuming:
      printf ("### cb_call_state_changed: Resuming call %i with %s.\n", id, from);
      break;
    */
    default:
      break;
  }
  ms_free(from);
}