diff --git a/my_version_to_patch/linphone_with_chat_message_supported_via_proxy/console/linphonec.c b/my_version_to_patch/linphone_with_improved_refer/console/linphonec.c index ff68fbe..a64c3ba 100644 --- a/my_version_to_patch/linphone_with_chat_message_supported_via_proxy/console/linphonec.c +++ b/my_version_to_patch/linphone_with_improved_refer/console/linphonec.c @@ -115,6 +115,7 @@ static char **linephonec_readline_completion(const char *text, static void linphonec_call_received(LinphoneCore *lc, const char *from); static void linphonec_prompt_for_auth(LinphoneCore *lc, const char *realm, const char *username); +static void linphonec_display_refer (LinphoneCore * lc,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); static void linphonec_display_warning (LinphoneCore * lc, const char *something); @@ -188,7 +189,8 @@ LinphoneCoreVTable linphonec_vtable .display_question=(DisplayQuestionCb)stub, .text_received=linphonec_text_received, .general_state=linphonec_general_state, - .dtmf_received=linphonec_dtmf_received + .dtmf_received=linphonec_dtmf_received, + .refer_received=linphonec_display_refer } #endif /*_WIN32_WCE*/ ; @@ -205,6 +207,16 @@ LinphoneCoreVTable linphonec_vtable * Linphone core callback */ static void +linphonec_display_refer (LinphoneCore * lc,const char *refer_to) +{ + fprintf (stdout, "The distant end point asked to transfer the call to %s,don't forget to terminate the call\n%s", refer_to,prompt); + fflush(stdout); +} + +/* + * Linphone core callback + */ +static void linphonec_display_something (LinphoneCore * lc, const char *something) { fprintf (stdout, "%s\n%s", something,prompt); diff --git a/my_version_to_patch/linphone_with_chat_message_supported_via_proxy/coreapi/callbacks.c b/my_version_to_patch/linphone_with_improved_refer/coreapi/callbacks.c index 7da3b4b..edc8cfa 100644 --- a/my_version_to_patch/linphone_with_chat_message_supported_via_proxy/coreapi/callbacks.c +++ b/my_version_to_patch/linphone_with_improved_refer/coreapi/callbacks.c @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "linphonecore.h" #include "private.h" #include "mediastreamer2/mediastream.h" +#include "sal_eXosip2.h" static void linphone_connect_incoming(LinphoneCore *lc, LinphoneCall *call){ if (lc->vtable.show) @@ -391,7 +392,19 @@ static void dtmf_received(SalOp *op, char dtmf){ } static void refer_received(Sal *sal, SalOp *op, const char *referto){ + osip_message_t *msg; LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal); + if(op != NULL) + { + eXosip_call_build_notify(op->tid,EXOSIP_SUBCRSTATE_ACTIVE,&msg); + if(msg != NULL) + { + osip_message_set_header(msg,(const char *)"event","refer"); + osip_message_set_content_type(msg,"message/sipfrag"); + osip_message_set_body(msg,"SIP/2.0 100 Trying",sizeof("SIP/2.0 100 Trying")); + eXosip_call_send_request(op->tid,msg); + } + } if (lc->vtable.refer_received) lc->vtable.refer_received(lc,referto); } diff --git a/my_version_to_patch/linphone_with_chat_message_supported_via_proxy/coreapi/sal_eXosip2.c b/my_version_to_patch/linphone_with_improved_refer/coreapi/sal_eXosip2.c index 18def9c..82bae96 100644 --- a/my_version_to_patch/linphone_with_chat_message_supported_via_proxy/coreapi/sal_eXosip2.c +++ b/my_version_to_patch/linphone_with_improved_refer/coreapi/sal_eXosip2.c @@ -1086,6 +1086,36 @@ static void call_message_new(Sal *sal, eXosip_event_t *ev){ eXosip_call_send_answer(ev->tid,200,ans); eXosip_unlock(); } + if(MSG_IS_REFER(ev->request)){ + osip_header_t *h=NULL; + ms_message("Receiving REFER request !"); + osip_message_header_get_byname(ev->request,"Refer-To",0,&h); + eXosip_lock(); + eXosip_call_build_answer(ev->tid,202,&ans); + if (ans) + eXosip_call_send_answer(ev->tid,202,ans); + eXosip_unlock(); + if (h){ + SalOp *op=(SalOp*)ev->external_reference; + sal->callbacks.refer_received(sal,op,h->hvalue); + } + } + if(MSG_IS_NOTIFY(ev->request)){ + osip_header_t *h=NULL; + ms_message("Receiving NOTIFY request !"); + osip_message_header_get_byname(ev->request,"Event",0,&h); + if (h){ + if(!strcmp(h->hvalue,"refer")) + { + ms_message("get the notify of the Refer sent"); + } + } + eXosip_lock(); + eXosip_call_build_answer(ev->tid,200,&ans); + if (ans) + eXosip_call_send_answer(ev->tid,200,ans); + eXosip_unlock(); + } }else ms_warning("call_message_new: No request ?"); } @@ -1157,7 +1187,8 @@ static void other_request(Sal *sal, eXosip_event_t *ev){ osip_message_header_get_byname(ev->request,"Refer-To",0,&h); eXosip_message_send_answer(ev->tid,200,NULL); if (h){ - sal->callbacks.refer_received(sal,NULL,h->hvalue); + SalOp *op=(SalOp*)ev->external_reference; + sal->callbacks.refer_received(sal,op,h->hvalue); } }else ms_warning("Ignored REFER not coming from this local loopback interface."); }else if (strncmp(ev->request->sip_method, "UPDATE", 6) == 0){ diff --git a/my_version_to_patch/linphone_with_chat_message_supported_via_proxy/coreapi/sal_eXosip2_presence.c b/my_version_to_patch/linphone_with_improved_refer/coreapi/sal_eXosip2_presence.c index c635141..ed775ab 100644 --- a/my_version_to_patch/linphone_with_chat_message_supported_via_proxy/coreapi/sal_eXosip2_presence.c +++ b/my_version_to_patch/linphone_with_improved_refer/coreapi/sal_eXosip2_presence.c @@ -71,8 +71,6 @@ void sal_remove_in_subscribe(Sal *sal, SalOp *op){ int sal_text_send(SalOp *op, const char *from, const char *to, const char *msg){ osip_message_t *sip=NULL; - static int cseq_of_original_build = 0; - static int cseq_since_last_original_build = 0; if(op->cid == -1) {