[Freeswitch-svn] [commit] r9505 - freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua

Freeswitch SVN mikej at freeswitch.org
Wed Sep 10 12:20:26 EDT 2008


Author: mikej
Date: Wed Sep 10 12:20:25 2008
New Revision: 9505

Modified:
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c

Log:
Wed Sep 10 09:29:17 EDT 2008  Pekka Pessi <first.last at nokia.com>
  * test_s2.c: allow user-specified VIA in requests from s2



Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c	Wed Sep 10 12:20:25 2008
@@ -230,6 +230,8 @@
   *prev = e, e->prev = prev;
 }
 
+/* ---------------------------------------------------------------------- */
+/* SIP messages sent by nua */
 
 struct message *
 s2_remove_message(struct message *m)
@@ -515,6 +517,7 @@
   sip_content_length_t l[1];
   tp_name_t tpn[1];
   tp_magic_t *magic;
+  int user_via = 0;
 
   ta_start(ta, tag, value);
   tags = ta_args(ta);
@@ -598,7 +601,7 @@
   sip_cseq_init(cseq);
   cseq->cs_method = method;
   cseq->cs_method_name = name;
-  
+
   if (d->invite && (method == sip_method_ack || method == sip_method_cancel)) {
     cseq->cs_seq = sip_object(d->invite)->sip_cseq->cs_seq;
   }
@@ -606,7 +609,10 @@
     cseq->cs_seq = ++d->lseq;
   }
 
-  if (d->invite && method == sip_method_cancel) {
+  if (sip->sip_via) {
+    user_via = 1;
+  }
+  else if (d->invite && method == sip_method_cancel) {
     *via = *sip_object(d->invite)->sip_via;
   }
   else {
@@ -626,7 +632,7 @@
 	     TAG_IF(!sip->sip_to, SIPTAG_TO(d->remote)),
 	     TAG_IF(!sip->sip_call_id, SIPTAG_CALL_ID(d->call_id)),
 	     TAG_IF(!sip->sip_cseq, SIPTAG_CSEQ(cseq)),
-	     SIPTAG_VIA(via),
+	     TAG_IF(!user_via, SIPTAG_VIA(via)),
 	     TAG_IF(!sip->sip_content_length, SIPTAG_CONTENT_LENGTH(l)),
 	     TAG_IF(!sip->sip_separator, SIPTAG_SEPARATOR_STR("\r\n")),
 	     TAG_END());



More information about the Freeswitch-svn mailing list