From 46965b6c62c5a222a6bef6731d34714a41a4e6e8 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 30 Mar 2010 11:50:58 +0200 Subject: [PATCH] merge patch to report asked auto-answer for incoming calls. --- coreapi/callbacks.c | 3 ++- coreapi/sal.h | 1 + coreapi/sal_eXosip2.c | 21 ++++++++++++++++++++- coreapi/sal_eXosip2.h | 1 + mediastreamer2 | 2 +- 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 34316149..7da3b4b3 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -91,7 +91,8 @@ static void call_received(SalOp *h){ tmp=linphone_address_as_string(from_parsed); linphone_address_destroy(from_parsed); gstate_new_state(lc, GSTATE_CALL_IN_INVITE, tmp); - barmesg=ortp_strdup_printf(_("%s is contacting you"),tmp); + barmesg=ortp_strdup_printf("%s %s%s",tmp,_("is contacting you"), + (sal_call_autoanswer_asked(h)) ?_(" and asked autoanswer."):_(".")); if (lc->vtable.show) lc->vtable.show(lc); if (lc->vtable.display_status) lc->vtable.display_status(lc,barmesg); diff --git a/coreapi/sal.h b/coreapi/sal.h index e672216c..6c930244 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -258,6 +258,7 @@ SalMediaDescription * sal_call_get_final_media_description(SalOp *h); int sal_refer(SalOp *h, const char *refer_to); int sal_call_send_dtmf(SalOp *h, char dtmf); int sal_call_terminate(SalOp *h); +bool_t sal_call_autoanswer_asked(SalOp *op); /*Registration*/ int sal_register(SalOp *op, const char *proxy, const char *from, int expires); diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index d4ce598a..b160a03b 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -143,9 +143,15 @@ SalOp * sal_op_new(Sal *sal){ op->reinvite=FALSE; op->call_id=NULL; op->masquerade_via=FALSE; + op->auto_answer_asked=FALSE; return op; } +bool_t sal_call_autoanswer_asked(SalOp *op) +{ + return op->auto_answer_asked; +} + void sal_op_release(SalOp *op){ if (op->sdp_answer) sdp_message_free(op->sdp_answer); @@ -616,6 +622,7 @@ static SalOp *find_op(Sal *sal, eXosip_event_t *ev){ static void inc_new_call(Sal *sal, eXosip_event_t *ev){ SalOp *op=sal_op_new(sal); osip_from_t *from,*to; + osip_call_info_t *call_info; char *tmp; sdp_message_t *sdp=eXosip_get_sdp_info(ev->request); @@ -636,7 +643,19 @@ static void inc_new_call(Sal *sal, eXosip_event_t *ev){ osip_from_to_str(to,&tmp); sal_op_set_to(op,tmp); osip_free(tmp); - + + osip_message_get_call_info(ev->request,0,&call_info); + if(call_info) + { + osip_call_info_to_str(call_info,&tmp); + if( strstr(tmp,"answer-after=") != NULL) + { + op->auto_answer_asked=TRUE; + ms_message("The caller asked to automatically answer the call(Emergency?)\n"); + } + osip_free(tmp); + } + op->tid=ev->tid; op->cid=ev->cid; op->did=ev->did; diff --git a/coreapi/sal_eXosip2.h b/coreapi/sal_eXosip2.h index 8c4bd243..1dd11e6a 100644 --- a/coreapi/sal_eXosip2.h +++ b/coreapi/sal_eXosip2.h @@ -58,6 +58,7 @@ struct SalOp{ bool_t sdp_offering; bool_t reinvite; bool_t masquerade_via; + bool_t auto_answer_asked; }; void sal_remove_out_subscribe(Sal *sal, SalOp *op); diff --git a/mediastreamer2 b/mediastreamer2 index af7bfe34..2d8f269f 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit af7bfe348919a44cec3f10cc3a3b5ade3483784f +Subproject commit 2d8f269f26a6e945ed1b7bfe7d880877b93875a7 -- 2.39.2