]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
save via_string when sent to nh so we can use it in session timer re-invites to fix...
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 22 Aug 2011 15:58:33 +0000 (10:58 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 22 Aug 2011 15:58:33 +0000 (10:58 -0500)
libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h
libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h
libs/sofia-sip/libsofia-sip-ua/nua/nua_server.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c
libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h

index 9facd8cd23094b0abe6cc0d938ae1c07f8374aaf..1a3614c6a12bbf64ffd991d48ad92393b54ab988 100644 (file)
@@ -837,6 +837,9 @@ int nua_client_request_sendmsg(nua_client_request_t *cr)
   if (!sip->sip_user_agent && NH_PGET(nh, user_agent))
     sip_add_make(msg, sip, sip_user_agent_class, NH_PGET(nh, user_agent));
 
+  if (!sip->sip_via && NH_PGET(nh, via))
+    sip_add_make(msg, sip, sip_via_class, NH_PGET(nh, via));
+
   /** Any node implementing one or more event packages SHOULD include an
    * appropriate @AllowEvents header indicating all supported events in
    * all methods which initiate dialogs and their responses (such as
index d774b82d8d3eee862446bde7a083b0e8b8a76556..019691b6115676c9e1b70f9f83cbe40d42e92759 100644 (file)
@@ -154,6 +154,7 @@ void nua_dialog_store_peer_info(nua_owner_t *own,
     sip = NULL;                        /* Redirected */
 
   if (sip == NULL) {
+    nr->nr_via = NULL, su_free(own, old->nr_via);
     nr->nr_allow = NULL, su_free(own, old->nr_allow);
     nr->nr_accept = NULL, su_free(own, old->nr_accept);
     nr->nr_require = NULL, su_free(own, old->nr_require);
@@ -182,6 +183,11 @@ void nua_dialog_store_peer_info(nua_owner_t *own,
     su_free(own, old->nr_supported);
   }
 
+  if (sip->sip_via) {
+    nr->nr_via = sip_via_dup(own, sip->sip_via);
+    su_free(own, old->nr_via);
+  }
+
   if (sip->sip_user_agent) {
     nr->nr_user_agent = sip_user_agent_dup(own, sip->sip_user_agent);
     su_free(own, old->nr_user_agent);
index f48b75e4356c40f469a538533053f5c6dec3fed5..707e6a60ec1e9c9563176c85c98f6f6faa648df4 100644 (file)
@@ -83,6 +83,7 @@ struct nua_dialog_state
                                         */
 
   struct nua_dialog_peer_info {
+    sip_via_t        *nr_via;
     sip_allow_t      *nr_allow;
     sip_accept_t     *nr_accept;
     sip_require_t    *nr_require;
index 8f511796b0f8a8bb343f8529f621dd8ad12292e5..58b480440acfb5ca060f6f7ebac79d5cba7785c5 100644 (file)
@@ -957,6 +957,16 @@ static int nhp_set_tags(su_home_t *home,
        value = 0;
       NHP_SET_STR(nhp, organization, value);
     }
+    /* SIPTAG_VIA(via) */
+    else if (tag == siptag_via) {
+      NHP_SET_STR_BY_HEADER(nhp, via, value);
+    }
+    /* SIPTAG_VIA_STR(via_str) */
+    else if (tag == siptag_via_str) {
+      if (value == -1)
+       value = 0;
+      NHP_SET_STR(nhp, via, value);
+    }
     /* NUTAG_REGISTRAR(registrar) */
     else if (tag == nutag_registrar) {
       NHP_SET_STR_BY_URL(nhp, char, registrar, value);
@@ -1134,6 +1144,7 @@ int nhp_save_params(nua_handle_t *nh,
   NHP_ZAP_OVERRIDEN(old, dst, msg_header_free, allow_events);
   NHP_ZAP_OVERRIDEN(old, dst, su_free, user_agent);
   NHP_ZAP_OVERRIDEN(old, dst, su_free, organization);
+  NHP_ZAP_OVERRIDEN(old, dst, su_free, via);
   NHP_ZAP_OVERRIDEN(old, dst, su_free, m_display);
   NHP_ZAP_OVERRIDEN(old, dst, su_free, m_username);
   NHP_ZAP_OVERRIDEN(old, dst, su_free, m_params);
@@ -1673,6 +1684,9 @@ int nua_stack_get_params(nua_t *nua, nua_handle_t *nh, nua_event_t e,
      TIF_SIP(SIPTAG_ORGANIZATION, organization),
      TIF(SIPTAG_ORGANIZATION_STR, organization),
 
+     TIF_SIP(SIPTAG_VIA, via),
+     TIF(SIPTAG_VIA_STR, via),
+
      TIF(NUTAG_INITIAL_ROUTE, initial_route),
      TIF_STR(NUTAG_INITIAL_ROUTE_STR, initial_route),
 
index 7aa726d5f9e68aef281b6af09666e19e7e3935f7..1904a080c54ca8a454760f96022162dc3530f1c0 100644 (file)
@@ -127,6 +127,7 @@ struct nua_handle_preferences
   sip_allow_events_t *nhp_allow_events;
   char const         *nhp_user_agent;
   char const         *nhp_organization;
+  char const         *nhp_via;
 
   char const         *nhp_m_display;
   char const         *nhp_m_username;
@@ -195,6 +196,7 @@ struct nua_handle_preferences
     unsigned nhb_allow_events:1;
     unsigned nhb_user_agent:1;
     unsigned nhb_organization:1;
+    unsigned nhb_via:1;
 
     unsigned nhb_m_display:1;
     unsigned nhb_m_username:1;
index f9649759da498dab5bcacaedf9aec2533caf589d..c8c42f44f9d2cc44caf8726ca4f67228c7aad510 100644 (file)
@@ -537,6 +537,10 @@ int nua_server_respond(nua_server_request_t *sr, tagi_t const *tags)
           sip_add_make(msg, sip, sip_organization_class,
                        NH_PGET(nh, organization)) < 0)
     ;
+  else if (!sip->sip_via && NH_PGET(nh, via) &&
+          sip_add_make(msg, sip, sip_via_class,
+                       NH_PGET(nh, via)) < 0)
+    ;
   else if (!sip->sip_allow && NH_PGET(nh, allow) &&
           sip_add_dup(msg, sip, (void *)NH_PGET(nh, allow)) < 0)
     ;
index caf36e103643e2a5ebbf235451cafe538b2c6435..96ca20baeefbc4c7f32084e29f8d0f79e62b1d9b 100644 (file)
@@ -2458,6 +2458,31 @@ tag_typedef_t nutag_user_agent = STRTAG_TYPEDEF(user_agent);
  */
 
 
+/**@def NUTAG_VIA()
+ *
+ * Via string.
+ *
+ * Indicate the Via header used by the stack.
+ *
+ * @par Used with
+ *    nua_set_params(), nua_set_hparams() \n
+ *    nua_get_params(), nua_get_hparams(), #nua_r_get_params \n
+ *    any handle-specific nua call
+ *
+ * @par Parameter type
+ *    char const *
+ *
+ * @par Values
+ *    See @RFC3261 \n
+ *
+ * Corresponding tag taking reference parameter is NUTAG_VIA_REF().
+ */
+tag_typedef_t nutag_via = STRTAG_TYPEDEF(via);
+
+/**@def NUTAG_VIA_REF(x)
+ * Reference tag for NUTAG_VIA().
+ */
+
 /**@def NUTAG_ALLOW()
  *
  * Allow a method (or methods).
index fe39c329811b78d627baeca8a9747a3e6706dda9..9e710d052d0c2140c21888742b6c80314c131d71 100644 (file)
@@ -437,6 +437,11 @@ SOFIAPUBVAR tag_typedef_t nutag_user_agent;
 #define NUTAG_USER_AGENT_REF(x) nutag_user_agent_ref, tag_str_vr(&(x))
 SOFIAPUBVAR tag_typedef_t nutag_user_agent_ref;
 
+#define NUTAG_VIA(x)     nutag_via, tag_str_v(x)
+SOFIAPUBVAR tag_typedef_t nutag_via;
+#define NUTAG_VIA_REF(x) nutag_via_ref, tag_str_vr(&(x))
+SOFIAPUBVAR tag_typedef_t nutag_via_ref;
+
 #define NUTAG_ALLOW(x)     nutag_allow, tag_str_v(x)
 SOFIAPUBVAR tag_typedef_t nutag_allow;
 #define NUTAG_ALLOW_REF(x) nutag_allow_ref, tag_str_vr(&(x))