static void linphonec_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t encrypted, const char *auth_token) { long id=(long)linphone_call_get_user_pointer (call); if (!encrypted) { linphonec_out("Call %i is not fully encrypted and auth token is %s.\n", id, (auth_token != NULL) ? auth_token : "absent"); } else { linphonec_out("Call %i is fully encrypted and auth token is %s.\n", id, (auth_token != NULL) ? auth_token : "absent"); } }
/* * Close linphonec, cleanly terminating * any pending call */ void linphonec_finish(int exit_status) { // Do not allow concurrent destroying to prevent glibc errors static bool_t terminating=FALSE; if (terminating) return; terminating=TRUE; linphonec_out("Terminating...\n"); /* Terminate any pending call */ linphone_core_terminate_all_calls(linphonec); #ifdef HAVE_READLINE linphonec_finish_readline(); #endif #if !defined(_WIN32_WCE) if (pipe_reader_run) stop_pipe_reader(); #endif /*_WIN32_WCE*/ linphone_core_destroy (linphonec); if (mylogfile != NULL && mylogfile != stdout) { fclose (mylogfile); } printf("\n"); exit(exit_status); }
/* * Linphone core callback */ static void linphonec_text_received(LinphoneCore *lc, LinphoneChatRoom *cr, const LinphoneAddress *from, const char *msg) { linphonec_out("Message received from %s: %s\n", linphone_address_as_string(from), msg); // TODO: provide mechanism for answering.. ('say' command?) }
/* * Linphone core callback */ static void linphonec_notify_received(LinphoneCore *lc, LinphoneCall *call, const char *from,const char *event) { if(!strcmp(event,"refer")) { linphonec_out("The distand endpoint %s of call %li has been transfered, you can safely close the call.\n", from,(long)linphone_call_get_user_pointer (call)); } }
/* * Linphone core callback */ static void linphonec_transfer_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState new_call_state) { char *remote=linphone_call_get_remote_address_as_string(call); if (new_call_state==LinphoneCallConnected){ linphonec_out("The distant endpoint %s of call %li has been transfered, you can safely close the call.\n", remote,(long)linphone_call_get_user_pointer (call)); } ms_free(remote); }
LinphoneCall *linphonec_get_call(long id){ const MSList *elem=linphone_core_get_calls(linphonec); for (;elem!=NULL;elem=elem->next){ LinphoneCall *call=(LinphoneCall*)elem->data; if (linphone_call_get_user_pointer (call)==(void*)id){ return call; } } linphonec_out("Sorry, no call with id %i exists at this time.\n",id); return NULL; }
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); }
static void linphonec_call_updated(LinphoneCall *call){ const LinphoneCallParams *cp=linphone_call_get_current_params(call); if (!linphone_call_camera_enabled (call) && linphone_call_params_video_enabled (cp)){ linphonec_out("Far end requests to share video.\nType 'camera on' if you agree.\n"); } }
/* * Linphone core callback */ static void linphonec_display_refer (LinphoneCore * lc, const char *refer_to) { linphonec_out("Receiving out of call refer to %s\n", refer_to); }