[Freeswitch-svn] [commit] r11831 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nta

FreeSWITCH SVN mikej at freeswitch.org
Wed Feb 11 09:05:16 PST 2009


Author: mikej
Date: Wed Feb 11 11:05:16 2009
New Revision: 11831

Log:
Thu Jan 15 12:06:00 CST 2009  Pekka Pessi <first.last at nokia.com>
  * nta.c: when sending ACK to [3456]XX, copy the To header as-is from the response
  
  Problem reported by Paulo Pizarro.



Modified:
   freeswitch/trunk/libs/sofia-sip/.update
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c

Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Wed Feb 11 11:05:16 2009
@@ -1 +1 @@
-Wed Feb 11 11:03:50 CST 2009
+Wed Feb 11 11:05:09 CST 2009

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	Wed Feb 11 11:05:16 2009
@@ -7001,7 +7001,7 @@
 
 static void outgoing_ack(nta_outgoing_t *orq, sip_t *sip);
 static msg_t *outgoing_ackmsg(nta_outgoing_t *, sip_method_t, char const *,
-			      tagi_t const *tags);
+			      tag_type_t tag, tag_value_t value, ...);
 static void outgoing_retransmit(nta_outgoing_t *orq);
 static void outgoing_trying(nta_outgoing_t *orq);
 static void outgoing_timeout(nta_outgoing_t *orq, uint32_t now);
@@ -7307,7 +7307,7 @@
 	  TAG_END());
 
   if (!cancel_408)
-    msg = outgoing_ackmsg(orq, SIP_METHOD_CANCEL, ta_args(ta));
+    msg = outgoing_ackmsg(orq, SIP_METHOD_CANCEL, ta_tags(ta));
   else
     msg = NULL;
 
@@ -9193,7 +9193,6 @@
 {
   nta_outgoing_t *ack;
   msg_t *ackmsg;
-  sip_t *acksip;
 
   assert(orq);
 
@@ -9205,13 +9204,9 @@
   assert(sip->sip_status->st_status >= 300);
   assert(orq->orq_tport);
 
-  ackmsg = outgoing_ackmsg(orq, SIP_METHOD_ACK, NULL);
-  acksip = sip_object(ackmsg);
-
-  if (acksip) {
-    if (sip->sip_to->a_tag && !acksip->sip_to->a_tag)
-      sip_to_tag(msg_home(ackmsg), acksip->sip_to, sip->sip_to->a_tag);
+  ackmsg = outgoing_ackmsg(orq, SIP_METHOD_ACK, SIPTAG_TO(sip->sip_to), TAG_END());
 
+  if (ackmsg) {
     if ((ack = outgoing_create(orq->orq_agent, NULL, NULL,
 			       NULL, orq->orq_tpn, ackmsg,
 			       NTATAG_BRANCH_KEY(sip->sip_via->v_branch),
@@ -9227,7 +9222,7 @@
 /** Generate messages for hop-by-hop ACK or CANCEL.
  */
 msg_t *outgoing_ackmsg(nta_outgoing_t *orq, sip_method_t m, char const *mname,
-		       tagi_t const *tags)
+		       tag_type_t tag, tag_value_t value, ...)
 {
   msg_t *msg = nta_msg_create(orq->orq_agent, 0);
   su_home_t *home = msg_home(msg);
@@ -9238,8 +9233,12 @@
   if (!sip)
     return NULL;
 
-  if (tags) {
-    sip_add_tl(msg, sip, TAG_NEXT(tags));
+  if (tag) {
+    ta_list ta;
+
+    ta_start(ta, tag, value);
+
+    sip_add_tl(msg, sip, ta_tags(ta));
     /* Bug sf.net # 173323:
      * Ensure that request-URI, topmost Via, From, To, Call-ID, CSeq,
      * Max-Forward, Route, Accept-Contact, Reject-Contact and
@@ -9247,7 +9246,7 @@
      */
     if (sip->sip_from)
       sip_header_remove(msg, sip, (void *)sip->sip_from);
-    if (sip->sip_to)
+    if (sip->sip_to && m != sip_method_ack)
       sip_header_remove(msg, sip, (void *)sip->sip_to);
     if (sip->sip_call_id)
       sip_header_remove(msg, sip, (void *)sip->sip_call_id);
@@ -9263,12 +9262,15 @@
       sip_header_remove(msg, sip, (void *)sip->sip_via);
     if (sip->sip_max_forwards)
       sip_header_remove(msg, sip, (void *)sip->sip_max_forwards);
+
+    ta_end(ta);
   }
 
   sip->sip_request =
     sip_request_create(home, m, mname, (url_string_t *)orq->orq_url, NULL);
 
-  sip_add_dup(msg, sip, (sip_header_t *)old->sip_to);
+  if (sip->sip_to == NULL)
+    sip_add_dup(msg, sip, (sip_header_t *)old->sip_to);
   sip_add_dup(msg, sip, (sip_header_t *)old->sip_from);
   sip_add_dup(msg, sip, (sip_header_t *)old->sip_call_id);
   sip_add_dup(msg, sip, (sip_header_t *)old->sip_route);



More information about the Freeswitch-svn mailing list