diff --git a/console/linphonec.c b/console/linphonec.c index 024075c..590af22 100644 --- a/console/linphonec.c +++ b/console/linphonec.c @@ -117,6 +117,7 @@ static void linphonec_paused_received(LinphoneCore *lc, LinphoneCall *call); static void linphonec_resumed_received(LinphoneCore *lc, LinphoneCall *call); static void linphonec_prompt_for_auth(LinphoneCore *lc, const char *realm, const char *username); +static void linphonec_inc_time_out_occured(LinphoneCore *lc, LinphoneCall *call); static void linphonec_display_refer (LinphoneCore * lc,LinphoneCall *call, const char *refer_to); static void linphonec_display_something (LinphoneCore * lc, const char *something); static void linphonec_display_url (LinphoneCore * lc, const char *something, const char *url); @@ -204,7 +205,8 @@ LinphoneCoreVTable linphonec_vtable .text_received=linphonec_text_received, .general_state=linphonec_general_state, .dtmf_received=linphonec_dtmf_received, - .refer_received=linphonec_display_refer + .refer_received=linphonec_display_refer, + .inc_time_out_occured=linphonec_inc_time_out_occured } #endif /*_WIN32_WCE*/ ; @@ -216,6 +218,20 @@ LinphoneCoreVTable linphonec_vtable * Linphone core callbacks * ***************************************************************************/ +/* + * Linphone core callback + */ +static void +linphonec_inc_time_out_occured(LinphoneCore *lc, LinphoneCall *call) +{ + // We notify that the incoming call terminated because of time out + + // printing this is unneeded as we'd get a "Communication ended" + // message trough display_status callback anyway + char *from=linphone_call_get_remote_address_as_string(call); + printf("Incoming timeout occured from %s\n", from); + ms_free(from); +} /* * Linphone core callback diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index a158993..b1d654f 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1548,7 +1548,11 @@ void linphone_core_iterate(LinphoneCore *lc){ ms_message("incoming call ringing for %i seconds",elapsed); if (elapsed>lc->sip_conf.inc_timeout){ call->log->status=LinphoneCallMissed; + the_call = the_call->next; //it goes to next one because the current one will not exists anymore after the terminate + if(lc->vtable.inc_time_out_occured) + lc->vtable.inc_time_out_occured(lc,call); linphone_core_terminate_call(lc,call); + continue; //else it will goes to next call without treating the new one } } @@ -2123,6 +2127,7 @@ void linphone_core_start_media_streams(LinphoneCore *lc, LinphoneCall *call){ const char *tool="linphone-" LINPHONE_VERSION; char *cname; int used_pt=-1; + int returned = 0; if(lc->audiostream == NULL) { ms_warning("init media stream is needed before starting"); @@ -2196,20 +2201,30 @@ void linphone_core_start_media_streams(LinphoneCore *lc, LinphoneCall *call){ video_stream_set_sent_video_size(lc->videostream,linphone_core_get_preferred_video_size(lc)); video_stream_enable_self_view(lc->videostream,lc->video_conf.selfview); if (lc->video_conf.display && lc->video_conf.capture) - video_stream_start(lc->videostream, + returned = video_stream_start(lc->videostream, call->video_profile, addr, stream->port, stream->port+1, used_pt, jitt_comp, lc->video_conf.device); else if (lc->video_conf.display) - video_stream_recv_only_start(lc->videostream, + returned = video_stream_recv_only_start(lc->videostream, call->video_profile, addr, stream->port, used_pt, jitt_comp); else if (lc->video_conf.capture) - video_stream_send_only_start(lc->videostream, + returned = video_stream_send_only_start(lc->videostream, call->video_profile, addr, stream->port, stream->port+1, used_pt, jitt_comp, lc->video_conf.device); - video_stream_set_rtcp_information(lc->videostream, cname,tool); + if(returned < 0) + { + if(lc->vtable.display_status) + lc->vtable.display_status(lc,_("the video is not supported in the current call")); + lc->videostream = NULL; + + } + else + { + video_stream_set_rtcp_information(lc->videostream, cname,tool); + } } } #endif diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index c583456..d1eed36 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -446,6 +446,8 @@ typedef void (*DtmfReceived)(struct _LinphoneCore* lc, int dtmf); typedef void (*ReferReceived)(struct _LinphoneCore *lc, LinphoneCall *call, const char *refer_to); /** Callback prototype */ typedef void (*BuddyInfoUpdated)(struct _LinphoneCore *lc, LinphoneFriend *lf); +/** Callback prototype */ +typedef void (*IncTimeOutOccured)(struct _LinphoneCore *lc, LinphoneCall *call); /** * This structure holds all callbacks that the application should implement. @@ -478,6 +480,7 @@ typedef struct _LinphoneVTable ReferReceived refer_received; /**< A refer was received */ BuddyInfoUpdated buddy_info_updated; /**< a LinphoneFriend's BuddyInfo has changed*/ NotifyReceivedCb notify_recv; /**< Other notifications*/ + IncTimeOutOccured inc_time_out_occured; /**< Other notifications*/ } LinphoneCoreVTable; /** diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 32bd677..b25ac3b 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -885,8 +885,9 @@ static void call_accepted(Sal *sal, eXosip_event_t *ev){ _osip_list_set_empty(&msg->contacts,(void (*)(void*))osip_contact_free); osip_message_set_contact(msg,contact); } - if (op->sdp_answer) - set_sdp(msg,op->sdp_answer); +// never add SDP offer into a ACK SIP message +// if (op->sdp_answer) +// set_sdp(msg,op->sdp_answer); eXosip_call_send_ack(ev->did,msg); sal->callbacks.call_accepted(op); }