Commit 78c6a9d0 authored by Simon Morlat's avatar Simon Morlat

add a new LinphoneCallUpdated state to notify acceptance of reINVITEs

parent e33dcf09
...@@ -44,7 +44,7 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia ...@@ -44,7 +44,7 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia
if (call->audiostream && call->audiostream->ticker){ if (call->audiostream && call->audiostream->ticker){
/* we already started media: check if we really need to restart it*/ /* we already started media: check if we really need to restart it*/
if (oldmd){ if (oldmd){
if (sal_media_description_equals(oldmd,new_md)){ if (sal_media_description_equals(oldmd,new_md) && !call->playing_ringbacktone){
sal_media_description_unref(oldmd); sal_media_description_unref(oldmd);
if (call->all_muted){ if (call->all_muted){
ms_message("Early media finished, unmuting inputs..."); ms_message("Early media finished, unmuting inputs...");
...@@ -79,7 +79,8 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia ...@@ -79,7 +79,8 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia
} }
if (call->state==LinphoneCallIncomingEarlyMedia && linphone_core_get_remote_ringback_tone (lc)!=NULL){ if (call->state==LinphoneCallIncomingEarlyMedia && linphone_core_get_remote_ringback_tone (lc)!=NULL){
send_ringbacktone=TRUE; send_ringbacktone=TRUE;
}else if (call->state==LinphoneCallIncomingEarlyMedia || }
if (call->state==LinphoneCallIncomingEarlyMedia ||
(call->state==LinphoneCallOutgoingEarlyMedia && !call->params.real_early_media)){ (call->state==LinphoneCallOutgoingEarlyMedia && !call->params.real_early_media)){
all_muted=TRUE; all_muted=TRUE;
} }
...@@ -296,6 +297,11 @@ static void call_accepted(SalOp *op){ ...@@ -296,6 +297,11 @@ static void call_accepted(SalOp *op){
if (lc->vtable.display_status){ if (lc->vtable.display_status){
lc->vtable.display_status(lc,_("Call answered - connected.")); lc->vtable.display_status(lc,_("Call answered - connected."));
} }
if (call->state==LinphoneCallStreamsRunning){
/*media was running before, the remote as acceted a call modification (that is
a reinvite made by us. We must notify the application this reinvite was accepted*/
linphone_call_set_state(call, LinphoneCallUpdated, "Call updated");
}
linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)"); linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)");
} }
linphone_core_update_streams (lc,call,md); linphone_core_update_streams (lc,call,md);
...@@ -316,6 +322,11 @@ static void call_ack(SalOp *op){ ...@@ -316,6 +322,11 @@ static void call_ack(SalOp *op){
if (call->media_pending){ if (call->media_pending){
SalMediaDescription *md=sal_call_get_final_media_description(op); SalMediaDescription *md=sal_call_get_final_media_description(op);
if (md && !sal_media_description_empty(md)){ if (md && !sal_media_description_empty(md)){
if (call->state==LinphoneCallStreamsRunning){
/*media was running before, the remote as acceted a call modification (that is
a reinvite made by us. We must notify the application this reinvite was accepted*/
linphone_call_set_state(call, LinphoneCallUpdated, "Call updated");
}
linphone_core_update_streams (lc,call,md); linphone_core_update_streams (lc,call,md);
linphone_call_set_state (call,LinphoneCallStreamsRunning,"Connected (streams running)"); linphone_call_set_state (call,LinphoneCallStreamsRunning,"Connected (streams running)");
}else{ }else{
......
...@@ -281,6 +281,8 @@ const char *linphone_call_state_to_string(LinphoneCallState cs){ ...@@ -281,6 +281,8 @@ const char *linphone_call_state_to_string(LinphoneCallState cs){
return "LinphoneCallUpdatedByRemote"; return "LinphoneCallUpdatedByRemote";
case LinphoneCallIncomingEarlyMedia: case LinphoneCallIncomingEarlyMedia:
return "LinphoneCallIncomingEarlyMedia"; return "LinphoneCallIncomingEarlyMedia";
case LinphoneCallUpdated:
return "LinphoneCallUpdated";
} }
return "undefined state"; return "undefined state";
} }
...@@ -829,7 +831,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut ...@@ -829,7 +831,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
captcard, captcard,
captcard==NULL ? FALSE : linphone_core_echo_cancellation_enabled(lc)); captcard==NULL ? FALSE : linphone_core_echo_cancellation_enabled(lc));
post_configure_audio_streams(call); post_configure_audio_streams(call);
if (all_inputs_muted){ if (all_inputs_muted && !send_ringbacktone){
audio_stream_set_mic_gain(call->audiostream,0); audio_stream_set_mic_gain(call->audiostream,0);
} }
if (send_ringbacktone){ if (send_ringbacktone){
...@@ -902,6 +904,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut ...@@ -902,6 +904,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
} }
#endif #endif
call->all_muted=all_inputs_muted; call->all_muted=all_inputs_muted;
call->playing_ringbacktone=send_ringbacktone;
goto end; goto end;
end: end:
......
...@@ -219,7 +219,8 @@ typedef enum _LinphoneCallState{ ...@@ -219,7 +219,8 @@ typedef enum _LinphoneCallState{
LinphoneCallEnd, /**<The call ended normally*/ LinphoneCallEnd, /**<The call ended normally*/
LinphoneCallPausedByRemote, /**<The call is paused by remote end*/ LinphoneCallPausedByRemote, /**<The call is paused by remote end*/
LinphoneCallUpdatedByRemote, /**<The call's parameters are updated, used for example when video is asked by remote */ LinphoneCallUpdatedByRemote, /**<The call's parameters are updated, used for example when video is asked by remote */
LinphoneCallIncomingEarlyMedia /**<We are proposing early media to an incoming call */ LinphoneCallIncomingEarlyMedia, /**<We are proposing early media to an incoming call */
LinphoneCallUpdated /**<The remote accepted the call update initiated by us */
} LinphoneCallState; } LinphoneCallState;
const char *linphone_call_state_to_string(LinphoneCallState cs); const char *linphone_call_state_to_string(LinphoneCallState cs);
......
...@@ -92,6 +92,7 @@ struct _LinphoneCall ...@@ -92,6 +92,7 @@ struct _LinphoneCall
bool_t audio_muted; bool_t audio_muted;
bool_t camera_active; bool_t camera_active;
bool_t all_muted; /*this flag is set during early medias*/ bool_t all_muted; /*this flag is set during early medias*/
bool_t playing_ringbacktone;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment