Example #1
0
static void early_media_video_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg) {
	LinphoneCallParams *params;

	video_call_state_changed(lc, call, cstate, msg);
	switch (cstate) {
		case LinphoneCallIncomingReceived:
			params = linphone_core_create_default_call_parameters(lc);
			linphone_call_params_enable_video(params, TRUE);
			linphone_call_params_set_audio_direction(params, LinphoneMediaDirectionSendOnly);
			linphone_call_params_set_video_direction(params, LinphoneMediaDirectionRecvOnly);
			linphone_core_accept_early_media_with_params(lc, call, params);
			linphone_call_params_unref(params);
			break;
		default:
			break;
	}
}
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);
			linphonec_out("Receiving new incoming call from %s, assigned id %i\n", from,id);
			if ( auto_answer)  {
				answer_call=TRUE;
			} else if (real_early_media_sending) {
				LinphoneCallParams* callparams = linphone_core_create_call_params(lc, call);
				linphonec_out("Sending early media using real hardware\n");
				linphone_call_params_enable_early_media_sending(callparams, TRUE);
				if (vcap_enabled) linphone_call_params_enable_video(callparams, TRUE);
				linphone_core_accept_early_media_with_params(lc, call, callparams);
				linphone_call_params_destroy(callparams);
			}
		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);
}