}
linphone_core_update_streams (lc,call,md);
linphone_call_set_state(call,LinphoneCallPaused,"Call paused");
+ if (call->refer_pending)
+ linphone_core_start_refered_call(lc,call);
}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){
ms_message("Automatically pausing current call to accept transfer.");
linphone_core_pause_call(lc,call);
call->was_automatically_paused=TRUE;
- }
- linphone_core_start_refered_call(lc,call);
+ /*then we will start the refered when the pause is accepted, in order to serialize transactions within the dialog.
+ * Indeed we need to avoid to send a NOTIFY to inform about of state of the refered call while the pause isn't completed.
+ **/
+ }else linphone_core_start_refered_call(lc,call);
}else if (lc->vtable.refer_received){
lc->vtable.refer_received(lc,referto);
}
eXosip_call_build_notify(did,EXOSIP_SUBCRSTATE_ACTIVE,&msg);
if (msg==NULL){
eXosip_unlock();
- ms_error("Could not build NOTIFY for refer.");
+ ms_warning("Could not build NOTIFY for refer.");
return -1;
}
osip_message_set_content_type(msg,"message/sipfrag");
}
}else{
if (!newcall->terminated){
- send_notify_for_refer(h->did,"SIP/2.0 200 Ok\r\n");
+ if (send_notify_for_refer(h->did,"SIP/2.0 200 Ok\r\n")==-1){
+ /* we need previous notify transaction to complete, so buffer the request for later*/
+ h->sipfrag_pending="SIP/2.0 200 Ok\r\n";
+ }
}
}
}
}
}
-void process_notify(Sal *sal, eXosip_event_t *ev){
+static void process_notify(Sal *sal, eXosip_event_t *ev){
osip_header_t *h=NULL;
char *from=NULL;
SalOp *op=find_op(sal,ev);
}
}
+static void process_in_call_reply(Sal *sal, eXosip_event_t *ev){
+ SalOp *op=find_op(sal,ev);
+ if (ev->response){
+ if (ev->request && strcmp(osip_message_get_method(ev->request),"NOTIFY")==0){
+ if (op->sipfrag_pending){
+ send_notify_for_refer(op->did,op->sipfrag_pending);
+ op->sipfrag_pending=NULL;
+ }
+ }
+ }
+}
+
static bool_t process_event(Sal *sal, eXosip_event_t *ev){
ms_message("linphone process event get a message %d\n",ev->type);
switch(ev->type){
return process_authentication(sal,ev);
}
break;
+ case EXOSIP_CALL_MESSAGE_ANSWERED:
+ ms_message("EXOSIP_CALL_MESSAGE_ANSWERED ");
+ process_in_call_reply(sal,ev);
+ break;
case EXOSIP_IN_SUBSCRIPTION_NEW:
ms_message("CALL_IN_SUBSCRIPTION_NEW ");
sal_exosip_subscription_recv(sal,ev);