]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add NUTAG_RETRY_AFTER_ENABLE() tag to lib sofia and use it in mod_sofia to disable...
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 2 Nov 2012 18:54:54 +0000 (13:54 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 2 Nov 2012 18:54:54 +0000 (13:54 -0500)
libs/sofia-sip/.update
libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c
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_tag.c
libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h
src/mod/endpoints/mod_sofia/sofia.c

index e5cf1e495d3c880ea96954f01b77c78ad09a9bea..09f61c0ed459fdf23fcb3f7ccf38173903fc2802 100644 (file)
@@ -1 +1 @@
-Fri Oct 26 14:14:41 CDT 2012
+Fri Nov  2 13:36:06 CDT 2012
index e7ec9fb8902c95c333e4f0ca5733e21e706bfb42..a9fed48ffea1dc4c6f1c1f96ae3fc8dbe37291a8 100644 (file)
@@ -1217,6 +1217,7 @@ int nua_base_client_check_restart(nua_client_request_t *cr,
           status == 500 || status == 503 ||
           status == 600 || status == 603) &&
       sip->sip_retry_after &&
+         NH_PGET(nh, retry_after_enable) &&
       sip->sip_retry_after->af_delta < 3200) {
     su_timer_t *timer;
     char phrase[18];           /* Retry After XXXX\0 */
index 0f6a491dff922a524b1a9e3730ed5614f1713f6f..c63455fc91bd93d6b0e3d997229a27185445fbb9 100644 (file)
@@ -157,6 +157,7 @@ int nua_stack_set_defaults(nua_handle_t *nh,
   NHP_SET(nhp, callee_caps, 0);
   NHP_SET(nhp, service_route_enable, 1);
   NHP_SET(nhp, path_enable, 1);
+  NHP_SET(nhp, retry_after_enable, 1);
 
   NHP_SET(nhp, refer_expires, 300);
   NHP_SET(nhp, refer_with_id, 1);
@@ -295,6 +296,7 @@ int nua_stack_init_instance(nua_handle_t *nh, tagi_t const *tags)
  *   NUTAG_ONLY183_100REL() \n
  *   NUTAG_OUTBOUND() \n
  *   NUTAG_PATH_ENABLE() \n
+ *   NUTAG_RETRY_AFTER_ENABLE() \n
  *   NUTAG_PROXY() (aka NTATAG_DEFAULT_PROXY()) \n
  *   NUTAG_REFER_EXPIRES() \n
  *   NUTAG_REFER_WITH_ID() \n
@@ -417,6 +419,7 @@ int nua_stack_init_instance(nua_handle_t *nh, tagi_t const *tags)
  *   NUTAG_ONLY183_100REL() \n
  *   NUTAG_OUTBOUND() \n
  *   NUTAG_PATH_ENABLE() \n
+ *   NUTAG_RETRY_AFTER_ENABLE() \n
  *   NUTAG_PROXY() (aka NTATAG_DEFAULT_PROXY()) \n
  *   NUTAG_REFER_EXPIRES() \n
  *   NUTAG_REFER_WITH_ID() \n
@@ -801,6 +804,10 @@ static int nhp_set_tags(su_home_t *home,
     else if (tag == nutag_path_enable) {
       NHP_SET(nhp, path_enable, value != 0);
     }
+    /* NUTAG_RETRY_AFTER_ENABLE(retry_after_enable) */
+    else if (tag == nutag_retry_after_enable) {
+      NHP_SET(nhp, retry_after_enable, value != 0);
+    }
     /* NUTAG_AUTH_CACHE(auth_cache) */
     else if (tag == nutag_auth_cache) {
       if (value >= 0 && value < (tag_value_t)_nua_auth_cache_invalid)
@@ -1494,6 +1501,7 @@ int nua_stack_set_smime_params(nua_t *nua, tagi_t const *tags)
  *   NUTAG_ONLY183_100REL() \n
  *   NUTAG_OUTBOUND() \n
  *   NUTAG_PATH_ENABLE() \n
+ *   NUTAG_RETRY_AFTER_ENABLE() \n
  *   NUTAG_REFER_EXPIRES() \n
  *   NUTAG_REFER_WITH_ID() \n
  *   NUTAG_REFRESH_WITHOUT_SDP() \n
@@ -1669,6 +1677,7 @@ int nua_stack_get_params(nua_t *nua, nua_handle_t *nh, nua_event_t e,
      TIF(NUTAG_MEDIA_FEATURES, media_features),
      TIF(NUTAG_SERVICE_ROUTE_ENABLE, service_route_enable),
      TIF(NUTAG_PATH_ENABLE, path_enable),
+     TIF(NUTAG_RETRY_AFTER_ENABLE, retry_after_enable),
      TIF(NUTAG_AUTH_CACHE, auth_cache),
      TIF(NUTAG_REFER_EXPIRES, refer_expires),
      TIF(NUTAG_REFER_WITH_ID, refer_with_id),
index 9fe4a9865205d7900944f0fcd6fc910f08a51723..5c26e4ef1349312ae70ac490909cb8140c686a2d 100644 (file)
@@ -111,6 +111,10 @@ struct nua_handle_preferences
   unsigned         nhp_refer_with_id:1;
 
   unsigned         nhp_timer_autorequire:1;
+
+  /** Enable Retry-After */
+  unsigned         nhp_retry_after_enable:1;
+
   unsigned:0;
 
   /* Default lifetime for implicit subscriptions created by REFER */
@@ -210,6 +214,7 @@ struct nua_handle_preferences
     unsigned nhb_initial_route:1;
     unsigned nhb_proxy:1;
     unsigned nhb_timer_autorequire:1;
+    unsigned nhb_retry_after_enable:1;
     unsigned :0;
   } set_bits;
     unsigned set_unsigned[2];
index 491d4857318bc39029a56170bab352a2c32367c9..9e0c8d85ca36cfdf7f61687da7bd8830734dcc5f 100644 (file)
  * - NUTAG_M_USERNAME()
  * - NUTAG_OUTBOUND()
  * - NUTAG_PATH_ENABLE()
+ * - NUTAG_RETRY_AFTER_ENABLE()
  * - NUTAG_SERVICE_ROUTE_ENABLE()
  * Specifications:
  * - @RFC3261 section 10, @RFC3327, @RFC3608, @RFC3680, @RFC3840,
@@ -2663,6 +2664,29 @@ tag_typedef_t nutag_path_enable = BOOLTAG_TYPEDEF(path_enable);
  * Reference tag for NUTAG_PATH_ENABLE().
  */
 
+/**@def NUTAG_RETRY_AFTER_ENABLE(x)
+ *
+ * If true, support RFC 3261 Retry-After
+ *
+ * @par Used with
+ * - nua_create(), nua_set_params(), nua_get_params()
+ * - nua_handle(), nua_set_hparams(), nua_get_hparams()
+ * - nua_register()
+ *
+ * @par Parameter type
+ *    int (boolean: nonzero is true, zero is false)
+ *
+ * @par Values
+ *    - 0 (false) - Do not honor Retry-After
+ *    - 1 (true) - honor Retry-After
+ *
+ */
+tag_typedef_t nutag_retry_after_enable = BOOLTAG_TYPEDEF(retry_after_enable);
+
+/**@def NUTAG_RETRY_AFTER_ENABLE_REF(x)
+ * Reference tag for NUTAG_RETRY_AFTER_ENABLE().
+ */
+
 
 
 /**@def NUTAG_SERVICE_ROUTE_ENABLE(x)
index 813e0d757a6d3f78e0886109f750d2b0ded31a0c..be909d6911b3969256aa497ebae24a332580e205 100644 (file)
@@ -550,6 +550,11 @@ SOFIAPUBVAR tag_typedef_t nutag_path_enable;
 #define NUTAG_PATH_ENABLE_REF(x) nutag_path_enable_ref, tag_bool_vr(&(x))
 SOFIAPUBVAR tag_typedef_t nutag_path_enable_ref;
 
+#define NUTAG_RETRY_AFTER_ENABLE(x)   nutag_retry_after_enable, tag_bool_v(x)
+SOFIAPUBVAR tag_typedef_t nutag_retry_after_enable;
+#define NUTAG_RETRY_AFTER_ENABLE_REF(x) nutag_retry_after_enable_ref, tag_bool_vr(&(x))
+SOFIAPUBVAR tag_typedef_t nutag_retry_after_enable_ref;
+
 #define NUTAG_SERVICE_ROUTE_ENABLE(x) nutag_service_route_enable, tag_bool_v(x)
 SOFIAPUBVAR tag_typedef_t nutag_service_route_enable;
 #define NUTAG_SERVICE_ROUTE_ENABLE_REF(x) \
index 4a074088fc706b0aa426d5e21bea7d82ac3fd0c8..ebc8f2aa6bc2a17d1fcb0c1b884a5d73c014455c 100644 (file)
@@ -2408,6 +2408,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
                                                          profile,      /* Additional data to pass to callback */
                                                          TAG_IF( ! sofia_test_pflag(profile, PFLAG_TLS) || ! profile->tls_only, NUTAG_URL(profile->bindurl)),
                                                          NTATAG_USER_VIA(1),
+                                                         NUTAG_RETRY_AFTER_ENABLE(0),
                                                          TAG_IF(!strchr(profile->sipip, ':'),
                                                                         SOATAG_AF(SOA_AF_IP4_ONLY)),
                                                          TAG_IF(strchr(profile->sipip, ':'),