Commit 251ba960 authored by jehan's avatar jehan

add new functions linphone_core_add_listener to enable multiple vtable to be registered

parent 7a68db79
......@@ -351,8 +351,7 @@ static void call_ringing(SalOp *h){
/*set privacy*/
call->current_params->privacy=(LinphonePrivacyMask)sal_op_get_privacy(call->op);
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Remote ringing."));
linphone_core_notify_display_status(lc,_("Remote ringing."));
md=sal_call_get_final_media_description(h);
if (md==NULL){
......@@ -369,8 +368,7 @@ static void call_ringing(SalOp *h){
}
}
ms_message("Remote ringing...");
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Remote ringing..."));
linphone_core_notify_display_status(lc,_("Remote ringing..."));
linphone_call_set_state(call,LinphoneCallOutgoingRinging,"Remote ringing");
}else{
/*accept early media */
......@@ -379,9 +377,8 @@ static void call_ringing(SalOp *h){
try_early_media_forking(call,md);
return;
}
if (lc->vtable.show) lc->vtable.show(lc);
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Early media."));
linphone_core_notify_show_interface(lc);
linphone_core_notify_display_status(lc,_("Early media."));
linphone_call_set_state(call,LinphoneCallOutgoingEarlyMedia,"Early media");
linphone_core_stop_ringing(lc);
ms_message("Doing early media...");
......@@ -430,10 +427,10 @@ static void call_accepted(SalOp *op){
linphone_call_update_remote_session_id_and_ver(call);
if (sal_media_description_has_dir(md,SalStreamSendOnly) ||
sal_media_description_has_dir(md,SalStreamInactive)){
if (lc->vtable.display_status){
{
char *tmp=linphone_call_get_remote_address_as_string (call);
char *msg=ms_strdup_printf(_("Call with %s is paused."),tmp);
lc->vtable.display_status(lc,msg);
linphone_core_notify_display_status(lc,msg);
ms_free(tmp);
ms_free(msg);
}
......@@ -443,10 +440,10 @@ static void call_accepted(SalOp *op){
linphone_core_start_refered_call(lc,call,NULL);
}else if (sal_media_description_has_dir(md,SalStreamRecvOnly)){
/*we are put on hold when the call is initially accepted */
if (lc->vtable.display_status){
{
char *tmp=linphone_call_get_remote_address_as_string (call);
char *msg=ms_strdup_printf(_("Call answered by %s - on hold."),tmp);
lc->vtable.display_status(lc,msg);
linphone_core_notify_display_status(lc,msg);
ms_free(tmp);
ms_free(msg);
}
......@@ -455,14 +452,12 @@ static void call_accepted(SalOp *op){
}else{
if (call->state!=LinphoneCallUpdating){
if (call->state==LinphoneCallResuming){
if (lc->vtable.display_status){
lc->vtable.display_status(lc,_("Call resumed."));
}
linphone_core_notify_display_status(lc,_("Call resumed."));
}else{
if (lc->vtable.display_status){
{
char *tmp=linphone_call_get_remote_address_as_string (call);
char *msg=ms_strdup_printf(_("Call answered by %s."),tmp);
lc->vtable.display_status(lc,msg);
linphone_core_notify_display_status(lc,msg);
ms_free(tmp);
ms_free(msg);
}
......@@ -508,8 +503,7 @@ static void call_ack(SalOp *op){
static void call_resumed(LinphoneCore *lc, LinphoneCall *call){
/*when we are resumed, increment session id, because sdp is changed (a=recvonly disapears)*/
linphone_call_increment_local_media_description(call);
if(lc->vtable.display_status)
lc->vtable.display_status(lc,_("We have been resumed."));
linphone_core_notify_display_status(lc,_("We have been resumed."));
_linphone_core_accept_call_update(lc,call,NULL,LinphoneCallStreamsRunning,"Connected (streams running)");
}
......@@ -517,8 +511,7 @@ static void call_paused_by_remote(LinphoneCore *lc, LinphoneCall *call){
/*when we are paused, increment session id, because sdp is changed (a=recvonly appears)*/
linphone_call_increment_local_media_description(call);
/* we are being paused */
if(lc->vtable.display_status)
lc->vtable.display_status(lc,_("We are paused by other party."));
linphone_core_notify_display_status(lc,_("We are paused by other party."));
_linphone_core_accept_call_update(lc,call,NULL,LinphoneCallPausedByRemote,"Call paused by remote");
}
......@@ -552,8 +545,7 @@ static void call_updated_by_remote(LinphoneCore *lc, LinphoneCall *call, bool_t
if (call->state==LinphoneCallStreamsRunning) {
/*reINVITE and in-dialogs UPDATE go here*/
if(lc->vtable.display_status)
lc->vtable.display_status(lc,_("Call is updated by remote."));
linphone_core_notify_display_status(lc,_("Call is updated by remote."));
call->defer_update=FALSE;
linphone_call_set_state(call, LinphoneCallUpdatedByRemote,"Call updated by remote");
if (call->defer_update==FALSE){
......@@ -652,10 +644,8 @@ static void call_terminated(SalOp *op, const char *from){
linphone_core_stop_ringing(lc);
}
linphone_call_stop_media_streams(call);
if (lc->vtable.show!=NULL)
lc->vtable.show(lc);
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Call terminated."));
linphone_core_notify_show_interface(lc);
linphone_core_notify_display_status(lc,_("Call terminated."));
#ifdef BUILD_UPNP
linphone_call_delete_upnp_session(call);
......@@ -698,24 +688,21 @@ static void call_failure(SalOp *op){
return ;
}
if (lc->vtable.show) lc->vtable.show(lc);
linphone_core_notify_show_interface(lc);
switch(ei->reason){
case SalReasonNone:
break;
case SalReasonRequestTimeout:
msg=_("Request timeout.");
if (lc->vtable.display_status)
lc->vtable.display_status(lc,msg);
linphone_core_notify_display_status(lc,msg);
break;
case SalReasonDeclined:
msg=msg603;
if (lc->vtable.display_status)
lc->vtable.display_status(lc,msg603);
linphone_core_notify_display_status(lc,msg603);
break;
case SalReasonBusy:
msg=msg486;
if (lc->vtable.display_status)
lc->vtable.display_status(lc,msg486);
linphone_core_notify_display_status(lc,msg486);
break;
case SalReasonRedirect:
{
......@@ -735,23 +722,19 @@ static void call_failure(SalOp *op){
}
}
msg=_("Redirected");
if (lc->vtable.display_status)
lc->vtable.display_status(lc,msg);
linphone_core_notify_display_status(lc,msg);
}
break;
case SalReasonTemporarilyUnavailable:
msg=msg480;
if (lc->vtable.display_status)
lc->vtable.display_status(lc,msg480);
linphone_core_notify_display_status(lc,msg480);
break;
case SalReasonNotFound:
if (lc->vtable.display_status)
lc->vtable.display_status(lc,msg);
linphone_core_notify_display_status(lc,msg);
break;
case SalReasonDoNotDisturb:
msg=msg600;
if (lc->vtable.display_status)
lc->vtable.display_status(lc,msg600);
linphone_core_notify_display_status(lc,msg600);
break;
case SalReasonUnsupportedContent: /*<this is for compatibility: linphone sent 415 because of SDP offer answer failure*/
case SalReasonNotAcceptable:
......@@ -785,8 +768,7 @@ static void call_failure(SalOp *op){
}
}
msg=_("Incompatible media parameters.");
if (lc->vtable.display_status)
lc->vtable.display_status(lc,msg);
linphone_core_notify_display_status(lc,msg);
break;
case SalReasonRequestPending:
/*restore previous state, the application will decide to resubmit the action if relevant*/
......@@ -794,8 +776,7 @@ static void call_failure(SalOp *op){
return;
break;
default:
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Call failed."));
linphone_core_notify_display_status(lc,_("Call failed."));
}
/*some call error are not fatal*/
......@@ -855,9 +836,7 @@ static void auth_failure(SalOp *op, SalAuthInfo* info) {
if (ai){
ms_message("%s/%s/%s authentication fails.",info->realm,info->username,info->domain);
/*ask again for password if auth info was already supplied but apparently not working*/
if (lc->vtable.auth_info_requested) {
lc->vtable.auth_info_requested(lc,info->realm,info->username,info->domain);
}
linphone_core_notify_auth_info_requested(lc,info->realm,info->username,info->domain);
}
}
......@@ -874,10 +853,10 @@ static void register_success(SalOp *op, bool_t registered){
}
linphone_proxy_config_set_state(cfg, registered ? LinphoneRegistrationOk : LinphoneRegistrationCleared ,
registered ? "Registration successful" : "Unregistration done");
if (lc->vtable.display_status){
{
if (registered) msg=ms_strdup_printf(_("Registration on %s successful."),sal_op_get_proxy(op));
else msg=ms_strdup_printf(_("Unregistration on %s done."),sal_op_get_proxy(op));
lc->vtable.display_status(lc,msg);
linphone_core_notify_display_status(lc,msg);
ms_free(msg);
}
......@@ -896,9 +875,9 @@ static void register_failure(SalOp *op){
if (details==NULL)
details=_("no response timeout");
if (lc->vtable.display_status) {
{
char *msg=ortp_strdup_printf(_("Registration on %s failed: %s"),sal_op_get_proxy(op), details);
lc->vtable.display_status(lc,msg);
linphone_core_notify_display_status(lc,msg);
ms_free(msg);
}
......@@ -931,8 +910,7 @@ static void vfu_request(SalOp *op){
static void dtmf_received(SalOp *op, char dtmf){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
if (lc->vtable.dtmf_received != NULL)
lc->vtable.dtmf_received(lc, call, dtmf);
linphone_core_notify_dtmf_received(lc, call, dtmf);
}
static void refer_received(Sal *sal, SalOp *op, const char *referto){
......@@ -945,14 +923,14 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){
call->refer_to=ms_strdup(referto);
call->refer_pending=TRUE;
linphone_call_set_state(call,LinphoneCallRefered,"Refered");
if (lc->vtable.display_status){
{
char *msg=ms_strdup_printf(_("We are transferred to %s"),referto);
lc->vtable.display_status(lc,msg);
linphone_core_notify_display_status(lc,msg);
ms_free(msg);
}
if (call->refer_pending) linphone_core_start_refered_call(lc,call,NULL);
}else if (lc->vtable.refer_received){
lc->vtable.refer_received(lc,referto);
}else {
linphone_core_notify_refer_received(lc,referto);
}
}
......@@ -1072,8 +1050,8 @@ static bool_t auth_requested(Sal* sal, SalAuthInfo* sai) {
if (fill_auth_info(lc,sai)) {
return TRUE;
} else {
if (lc->vtable.auth_info_requested) {
lc->vtable.auth_info_requested(lc,sai->realm,sai->username,sai->domain);
{
linphone_core_notify_auth_info_requested(lc,sai->realm,sai->username,sai->domain);
if (fill_auth_info(lc,sai)) {
return TRUE;
}
......@@ -1180,9 +1158,9 @@ static void notify(SalOp *op, SalSubscribeStatus st, const char *eventname, cons
/*out of subscribe notify */
lev=linphone_event_new_with_out_of_dialog_op(lc,op,LinphoneSubscriptionOutgoing,eventname);
}
if (lc->vtable.notify_received){
{
const LinphoneContent *ct=linphone_content_from_sal_body(&content,body);
if (ct) lc->vtable.notify_received(lc,lev,eventname,ct);
if (ct) linphone_core_notify_notify_received(lc,lev,eventname,ct);
}
if (st!=SalSubscribeNone){
linphone_event_set_state(lev,linphone_subscription_state_from_sal(st));
......
......@@ -77,9 +77,7 @@ static void linphone_chat_message_file_transfer_on_progress(belle_sip_body_handl
LinphoneChatMessage* chatMsg=(LinphoneChatMessage *)data;
LinphoneCore *lc = chatMsg->chat_room->lc;
/* call back given by application level */
if (lc->vtable.file_transfer_progress_indication != NULL) {
lc->vtable.file_transfer_progress_indication(lc, chatMsg, chatMsg->file_transfer_information, (size_t)(((double)offset/(double)total)*100.0));
}
linphone_core_notify_file_transfer_progress_indication(lc, chatMsg, chatMsg->file_transfer_information, (size_t)(((double)offset/(double)total)*100.0));
return;
}
......@@ -102,7 +100,7 @@ static int linphone_chat_message_file_transfer_on_send_body(belle_sip_user_body_
/* if we've not reach the end of file yet, ask for more data*/
if (offset<chatMsg->file_transfer_information->size){
/* get data from call back */
lc->vtable.file_transfer_send(lc, chatMsg, chatMsg->file_transfer_information, buf, size);
linphone_core_notify_file_transfer_send(lc, chatMsg, chatMsg->file_transfer_information, buf, size);
}
return BELLE_SIP_CONTINUE;
......@@ -510,12 +508,10 @@ void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg) {
void linphone_chat_room_message_received(LinphoneChatRoom *cr, LinphoneCore *lc, LinphoneChatMessage *msg){
if (msg->message)
//legacy API
if (lc->vtable.text_received!=NULL) lc->vtable.text_received(lc, cr, msg->from, msg->message);
if (lc->vtable.message_received!=NULL) lc->vtable.message_received(lc, cr,msg);
if (cr->lc->vtable.is_composing_received != NULL) {
cr->remote_is_composing = LinphoneIsComposingIdle;
cr->lc->vtable.is_composing_received(cr->lc, cr);
}
linphone_core_notify_text_message_received(lc, cr, msg->from, msg->message);
linphone_core_notify_message_received(lc, cr,msg);
cr->remote_is_composing = LinphoneIsComposingIdle;
linphone_core_notify_is_composing_received(cr->lc, cr);
}
void linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessage *sal_msg){
......@@ -629,8 +625,7 @@ static int linphone_chat_room_remote_refresh_composing_expired(void *data, unsig
belle_sip_object_unref(cr->remote_composing_refresh_timer);
cr->remote_composing_refresh_timer = NULL;
cr->remote_is_composing = LinphoneIsComposingIdle;
if (cr->lc->vtable.is_composing_received != NULL)
cr->lc->vtable.is_composing_received(cr->lc, cr);
linphone_core_notify_is_composing_received(cr->lc, cr);
return BELLE_SIP_STOP;
}
......@@ -675,8 +670,7 @@ static void process_im_is_composing_notification(LinphoneChatRoom *cr, xmlparsin
}
cr->remote_is_composing = state;
if (cr->lc->vtable.is_composing_received != NULL)
cr->lc->vtable.is_composing_received(cr->lc, cr);
linphone_core_notify_is_composing_received(cr->lc, cr);
}
}
......@@ -1034,9 +1028,7 @@ static void on_recv_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t
return;
}
/* call back given by application level */
if (lc->vtable.file_transfer_recv != NULL) {
lc->vtable.file_transfer_recv(lc, chatMsg, chatMsg->file_transfer_information, (char *)buffer, size);
}
linphone_core_notify_file_transfer_recv(lc, chatMsg, chatMsg->file_transfer_information, (char *)buffer, size);
return;
}
......@@ -1101,9 +1093,7 @@ static void linphone_chat_process_response_from_get_file(void *data, const belle
LinphoneChatMessage* chatMsg=(LinphoneChatMessage *)data;
LinphoneCore *lc = chatMsg->chat_room->lc;
/* file downloaded succesfully, call again the callback with size at zero */
if (lc->vtable.file_transfer_recv != NULL) {
lc->vtable.file_transfer_recv(lc, chatMsg, chatMsg->file_transfer_information, NULL, 0);
}
linphone_core_notify_file_transfer_recv(lc, chatMsg, chatMsg->file_transfer_information, NULL, 0);
}
}
}
......
......@@ -89,13 +89,10 @@ LinphoneEvent *linphone_event_new_with_out_of_dialog_op(LinphoneCore *lc, SalOp
}
void linphone_event_set_state(LinphoneEvent *lev, LinphoneSubscriptionState state){
LinphoneCore *lc=lev->lc;
if (lev->subscription_state!=state){
ms_message("LinphoneEvent [%p] moving to subscription state %s",lev,linphone_subscription_state_to_string(state));
lev->subscription_state=state;
if (lc->vtable.subscription_state_changed){
lc->vtable.subscription_state_changed(lev->lc,lev,state);
}
linphone_core_notify_subscription_state_changed(lev->lc,lev,state);
if (state==LinphoneSubscriptionTerminated){
linphone_event_unref(lev);
}
......@@ -103,13 +100,10 @@ void linphone_event_set_state(LinphoneEvent *lev, LinphoneSubscriptionState stat
}
void linphone_event_set_publish_state(LinphoneEvent *lev, LinphonePublishState state){
LinphoneCore *lc=lev->lc;
if (lev->publish_state!=state){
ms_message("LinphoneEvent [%p] moving to publish state %s",lev,linphone_publish_state_to_string(state));
lev->publish_state=state;
if (lc->vtable.publish_state_changed){
lc->vtable.publish_state_changed(lev->lc,lev,state);
}
linphone_core_notify_publish_state_changed(lev->lc,lev,state);
switch(state){
case LinphonePublishCleared:
linphone_event_unref(lev);
......
......@@ -253,8 +253,7 @@ static void linphone_friend_invalidate_subscription(LinphoneFriend *lf){
linphone_presence_model_unref(lf->presence);
}
lf->presence = linphone_presence_model_new_with_activity(LinphonePresenceActivityOffline,"unknown activity");
if (lc->vtable.notify_presence_received)
lc->vtable.notify_presence_received(lc,lf);
linphone_core_notify_notify_presence_received(lc,lf);
}
lf->initial_subscribes_sent=FALSE;
}
......
......@@ -192,8 +192,7 @@ void linphone_core_notify_info_message(LinphoneCore* lc,SalOp *op, const SalBody
LinphoneInfoMessage *info=ms_new0(LinphoneInfoMessage,1);
info->headers=sal_custom_header_clone(sal_op_get_recv_custom_header(op));
if (body) linphone_content_copy_from_sal_body(&info->content,body);
if (lc->vtable.info_received)
lc->vtable.info_received(lc,call,info);
linphone_core_notify_info_received(lc,call,info);
linphone_info_message_destroy(info);
}
}
......@@ -153,17 +153,14 @@ static uint16_t linphone_call_get_avpf_rr_interval(const LinphoneCall *call) {
}
static void propagate_encryption_changed(LinphoneCall *call){
LinphoneCore *lc=call->core;
if (!linphone_call_all_streams_encrypted(call)) {
ms_message("Some streams are not encrypted");
call->current_params->media_encryption=LinphoneMediaEncryptionNone;
if (lc->vtable.call_encryption_changed)
lc->vtable.call_encryption_changed(call->core, call, FALSE, call->auth_token);
linphone_core_notify_call_encryption_changed(call->core, call, FALSE, call->auth_token);
} else {
ms_message("All streams are encrypted");
call->current_params->media_encryption=LinphoneMediaEncryptionZRTP;
if (lc->vtable.call_encryption_changed)
lc->vtable.call_encryption_changed(call->core, call, TRUE, call->auth_token);
linphone_core_notify_call_encryption_changed(call->core, call, TRUE, call->auth_token);
}
}
......@@ -173,9 +170,9 @@ static void linphone_call_audiostream_encryption_changed(void *data, bool_t encr
call = (LinphoneCall *)data;
if (encrypted && call->core->vtable.display_status != NULL) {
if (encrypted) {
snprintf(status,sizeof(status)-1,_("Authentication token is %s"),call->auth_token);
call->core->vtable.display_status(call->core, status);
linphone_core_notify_display_status(call->core, status);
}
propagate_encryption_changed(call);
......@@ -974,8 +971,8 @@ void linphone_call_set_state_base(LinphoneCall *call, LinphoneCallState cstate,
call->media_start_time=time(NULL);
}
if (lc->vtable.call_state_changed && !silently)
lc->vtable.call_state_changed(lc,call,cstate,message);
if (!silently)
linphone_core_notify_call_state_changed(lc,call,cstate,message);
linphone_reporting_call_state_updated(call);
......@@ -1640,8 +1637,7 @@ static void linphone_core_dtmf_received(LinphoneCore *lc, int dtmf){
ms_warning("Bad dtmf value %i",dtmf);
return;
}
if (lc->vtable.dtmf_received != NULL)
lc->vtable.dtmf_received(lc, linphone_core_get_current_call(lc), dtmf_tab[dtmf]);
linphone_core_notify_dtmf_received(lc, linphone_core_get_current_call(lc), dtmf_tab[dtmf]);
}
static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){
......@@ -1728,7 +1724,7 @@ static void post_configure_audio_streams(LinphoneCall*call){
AudioStream *st=call->audiostream;
LinphoneCore *lc=call->core;
_post_configure_audio_stream(st,lc,call->audio_muted);
if (lc->vtable.dtmf_received!=NULL){
if (linphone_core_dtmf_received_has_listener(lc)){
audio_stream_play_received_dtmfs(call->audiostream,FALSE);
}
if (call->record_active)
......@@ -2713,8 +2709,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){
if (from) ms_free(from);
ms_message("On call [%p]: %s",call,temp);
if (lc->vtable.display_warning!=NULL)
lc->vtable.display_warning(lc,temp);
linphone_core_notify_display_warning(lc,temp);
linphone_core_terminate_call(lc,call);
linphone_core_play_named_tone(lc,LinphoneToneCallLost);
}
......@@ -2836,8 +2831,7 @@ void linphone_call_notify_stats_updated(LinphoneCall *call, int stream_index){
LinphoneCore *lc=call->core;
if (stats->updated){
linphone_reporting_on_rtcp_update(call, stream_index);
if (lc->vtable.call_stats_updated)
lc->vtable.call_stats_updated(lc, call, stats);
linphone_core_notify_call_stats_updated(lc, call, stats);
stats->updated = 0;
}
}
......@@ -2932,8 +2926,7 @@ void linphone_call_log_completed(LinphoneCall *call){
info=ortp_strdup_printf(ngettext("You have missed %i call.",
"You have missed %i calls.", lc->missed_calls),
lc->missed_calls);
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,info);
linphone_core_notify_display_status(lc,info);
ms_free(info);
}
lc->call_logs=ms_list_prepend(lc->call_logs,linphone_call_log_ref(call->log));
......@@ -2947,9 +2940,7 @@ void linphone_call_log_completed(LinphoneCall *call){
linphone_call_log_unref((LinphoneCallLog*)elem->data);
lc->call_logs=ms_list_remove_link(lc->call_logs,elem);
}
if (lc->vtable.call_log_updated!=NULL){
lc->vtable.call_log_updated(lc,call->log);
}
linphone_core_notify_call_log_updated(lc,call->log);
call_logs_write_to_config_file(lc);
}
......@@ -2968,8 +2959,7 @@ void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState stat
,linphone_call_state_to_string(call->transfer_state)
,linphone_call_state_to_string(state));
call->transfer_state = state;
if (lc->vtable.transfer_state_changed)
lc->vtable.transfer_state_changed(lc, call, state);
linphone_core_notify_transfer_state_changed(lc, call, state);
}
}
......
......@@ -992,9 +992,7 @@ static void linphone_core_free_payload_types(LinphoneCore *lc){
void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message){
lc->state=gstate;
if (lc->vtable.global_state_changed){
lc->vtable.global_state_changed(lc,gstate,message);
}
linphone_core_notify_global_state_changed(lc,gstate,message);
}
static void misc_config_read(LinphoneCore *lc) {
......@@ -1030,15 +1028,13 @@ static void linphone_core_start(LinphoneCore * lc) {
if (lc->tunnel) linphone_tunnel_configure(lc->tunnel);
#endif
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Ready"));
linphone_core_notify_display_status(lc,_("Ready"));
lc->auto_net_state_mon=lc->sip_conf.auto_net_state_mon;
linphone_core_set_state(lc,LinphoneGlobalOn,"Ready");
}
void linphone_configuring_terminated(LinphoneCore *lc, LinphoneConfiguringState state, const char *message) {
if (lc->vtable.configuring_status)
lc->vtable.configuring_status(lc, state, message);
linphone_core_notify_configuring_status(lc, state, message);
if (state == LinphoneConfiguringSuccessful) {
if (linphone_core_is_provisioning_transient(lc) == TRUE)
......@@ -1051,13 +1047,15 @@ void linphone_configuring_terminated(LinphoneCore *lc, LinphoneConfiguringState
static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtable, LpConfig *config, void * userdata)
{
const char *remote_provisioning_uri = NULL;
LinphoneCoreVTable* local_vtable= linphone_vtable_new();
ms_message("Initializing LinphoneCore %s", linphone_core_get_version());
memset (lc, 0, sizeof (LinphoneCore));
lc->config=lp_config_ref(config);
lc->data=userdata;
lc->ringstream_autorelease=TRUE;
memcpy(&lc->vtable,vtable,sizeof(LinphoneCoreVTable));
memcpy(local_vtable,vtable,sizeof(LinphoneCoreVTable));
lc->vtables=ms_list_append(lc->vtables,local_vtable);
linphone_core_set_state(lc,LinphoneGlobalStartup,"Starting up");
ortp_init();
......@@ -1654,8 +1652,7 @@ const char *linphone_core_get_user_agent_version(void){
static void transport_error(LinphoneCore *lc, const char* transport, int port){
char *msg=ortp_strdup_printf("Could not start %s transport on port %i, maybe this port is already used.",transport,port);
ms_warning("%s",msg);
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,msg);
linphone_core_notify_display_warning(lc,msg);
ms_free(msg);
}
......@@ -1868,8 +1865,7 @@ static void assign_buddy_info(LinphoneCore *lc, BuddyInfo *info){
if (lf!=NULL){
lf->info=info;
ms_message("%s has a BuddyInfo assigned with image %p",info->sip_uri, info->image_data);
if (lc->vtable.buddy_info_updated)
lc->vtable.buddy_info_updated(lc,lf);
linphone_core_notify_buddy_info_updated(lc,lf);
}else{
ms_warning("Could not any friend with uri %s",info->sip_uri);
}
......@@ -1955,7 +1951,10 @@ void linphone_core_iterate(LinphoneCore *lc){
int elapsed;
bool_t one_second_elapsed=FALSE;
const char *remote_provisioning_uri = NULL;
if (lc->network_reachable_to_be_notified) {
lc->network_reachable_to_be_notified=FALSE;
linphone_core_notify_network_reachable(lc,lc->network_reachable);
}
if (linphone_core_get_global_state(lc) == LinphoneGlobalStartup) {
if (sal_get_root_ca(lc->sal)) {
belle_tls_verify_policy_t *tls_policy = belle_tls_verify_policy_new();
......@@ -1963,8 +1962,7 @@ void linphone_core_iterate(LinphoneCore *lc){
belle_http_provider_set_tls_verify_policy(lc->http_provider, tls_policy);
}
if (lc->vtable.display_status)
lc->vtable.display_status(lc, _("Configuring"));
linphone_core_notify_display_status(lc, _("Configuring"));
linphone_core_set_state(lc, LinphoneGlobalConfiguring, "Configuring");
remote_provisioning_uri = linphone_core_get_provisioning_uri(lc);
......@@ -2129,11 +2127,9 @@ LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url)
if (*url=='\0') return NULL;
if (is_enum(url,&enum_domain)){
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Looking for telephone number destination..."));
linphone_core_notify_display_status(lc,_("Looking for telephone number destination..."));
if (enum_lookup(enum_domain,&enumres)<0){
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Could not resolve this number."));
linphone_core_notify_display_status(lc,_("Could not resolve this number."));
ms_free(enum_domain);
return NULL;
}
......@@ -2416,13 +2412,11 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, const Linph
call->log->call_id=ms_strdup(sal_op_get_call_id(call->op)); /*must be known at that time*/
barmsg=ortp_strdup_printf("%s %s", _("Contacting"), real_url);
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,barmsg);
linphone_core_notify_display_status(lc,barmsg);
ms_free(barmsg);
if (err<0){
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Could not call"));
linphone_core_notify_display_status(lc,_("Could not call"));
linphone_call_stop_media_streams(call);
linphone_call_set_state(call,LinphoneCallError,"Call failed");
}else {
......@@ -2572,8 +2566,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
linphone_core_preempt_sound_resources(lc);
if(!linphone_core_can_we_add_call(lc)){
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("Sorry, we have reached the maximum number of simultaneous calls"));
linphone_core_notify_display_warning(lc,_("Sorry, we have reached the maximum number of simultaneous calls"));
return NULL;
}
......@@ -2744,9 +2737,8 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){
linphone_address_destroy(from_parsed);
barmesg=ortp_strdup_printf("%s %s%s",tmp,_("is contacting you"),
(sal_call_autoanswer_asked(call->op)) ?_(" and asked autoanswer."):_("."));
if (lc->vtable.show) lc->vtable.show(lc);
if (lc->vtable.display_status)
lc->vtable.display_status(lc,barmesg);
linphone_core_notify_show_interface(lc);
linphone_core_notify_display_status(lc,barmesg);
/* play the ring if this is the only call*/
if (ms_list_size(lc->calls)==1){
......@@ -2861,8 +2853,7 @@ int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call){
}else{
subject="Refreshing";
}
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Modifying call parameters..."));
linphone_core_notify_display_status(lc,_("Modifying call parameters..."));
sal_call_set_local_media_description (call->op,call->localdesc);
if (call->dest_proxy && call->dest_proxy->op){
/*give a chance to update the contact address if connectivity has changed*/
......@@ -3190,8 +3181,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
linphone_call_update_remote_session_id_and_ver(call);
sal_call_accept(call->op);
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Connected."));
linphone_core_notify_display_status(lc,_("Connected."));
lc->current_call=call;
linphone_call_set_state(call,LinphoneCallConnected,"Connected");
new_md=sal_call_get_final_media_description(call->op);
......@@ -3216,8 +3206,7 @@ int linphone_core_abort_call(LinphoneCore *lc, LinphoneCall *call, const char *e
linphone_call_delete_upnp_session(call);
#endif //BUILD_UPNP
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Call aborted") );
linphone_core_notify_display_status(lc,_("Call aborted") );
linphone_call_set_state(call,LinphoneCallError,error);
return 0;
}
......@@ -3236,8 +3225,7 @@ static void terminate_call(LinphoneCore *lc, LinphoneCall *call){
linphone_call_delete_upnp_session(call);
#endif //BUILD_UPNP
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Call ended") );
linphone_core_notify_display_status(lc,_("Call ended") );
linphone_call_set_state(call,LinphoneCallEnd,"Call terminated");
}
......@@ -3408,13 +3396,11 @@ int _linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call)
}
sal_call_set_local_media_description(call->op,call->localdesc);
if (sal_call_update(call->op,subject,FALSE) != 0){
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("Could not pause the call"));
linphone_core_notify_display_warning(lc,_("Could not pause the call"));
}
lc->current_call=NULL;
linphone_call_set_state(call,LinphoneCallPausing,"Pausing call");
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Pausing the current call..."));
linphone_core_notify_display_status(lc,_("Pausing the current call..."));
if (call->audiostream || call->videostream)
linphone_call_stop_media_streams (call);
call->paused_by_app=FALSE;
......@@ -3499,8 +3485,7 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call){
if (call->params->in_conference==FALSE)
lc->current_call=call;
snprintf(temp,sizeof(temp)-1,"Resuming the call with %s",linphone_call_get_remote_address_as_string(call));
if (lc->vtable.display_status)
lc->vtable.display_status(lc,temp);
linphone_core_notify_display_status(lc,temp);
return 0;
}
......@@ -5767,6 +5752,7 @@ static void linphone_core_uninit(LinphoneCore *lc)
if (liblinphone_serialize_logs == TRUE) {
ortp_set_log_thread_id(0);
}
ms_list_free_with_data(lc->vtables,(void (*)(void *))linphone_vtable_destroy);
}
static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime){
......@@ -5774,7 +5760,7 @@ static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t cu
const MSList *elem=linphone_core_get_proxy_config_list(lc);