On Mon, Jul 21, 2008 at 11:49 PM, Magnus Correa Marques Russo
<[EMAIL PROTECTED]> wrote:
> Hello,
> it seems that Sofia-sip is not including a tag in the field "To" when
> answering a CANCEL,

Hi all,

I have also been having this problem and have come up with a hack to
make it work. I'm attaching the patch that I've applied to my stack
which apparently does the job. Please take a look and see if it's
useful.
Thanks.

Fabio
--- nta.c	2008-07-31 10:11:48.000000000 -0300
+++ nta.c.new	2008-07-31 14:46:55.000000000 -0300
@@ -181,6 +181,8 @@
 			   sip_call_id_t const *i,
 			   char const *from_tag,
 			   char const *to_tag);
+static nta_leg_t *leg_find_call_id(nta_agent_t const *sa,
+				   sip_call_id_t const *i);
 static nta_leg_t *dst_find(nta_agent_t const *sa, url_t const *u0,
 			   char const *method);
 static void leg_recv(nta_leg_t *, msg_t *, sip_t *, tport_t *);
@@ -3075,6 +3077,17 @@
     SU_DEBUG_3(("%s: no Via\n", __func__));
   }
   else {
+    if (sip->sip_status && sip->sip_status->st_status > 100 &&
+        sip->sip_to && !sip->sip_to->a_tag &&
+        sip->sip_cseq && sip->sip_cseq->cs_method == sip_method_cancel) {
+      nta_leg_t *leg = leg_find_call_id(agent, sip->sip_call_id);
+      if (leg && leg->leg_local && leg->leg_local->a_tag) {
+        sip_to_tag(msg_home(reply), sip->sip_to, leg->leg_local->a_tag);
+      } else {
+        SU_DEBUG_3(("%s: cannot add To tag in CANCEL reply\n", __func__));
+      }
+    }
+
     if (tport == NULL)
       tport = tport_delivered_by(agent->sa_tports, req_msg);
 
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to