]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6167 --resolve
authorWilliam King <william.king@quentustech.com>
Tue, 4 Mar 2014 21:41:34 +0000 (13:41 -0800)
committerWilliam King <william.king@quentustech.com>
Tue, 4 Mar 2014 21:41:34 +0000 (13:41 -0800)
conf/vanilla/sip_profiles/internal.xml
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_presence.c

index d2af883b9d0c55ae86648d0aa0fa85814c5983aa..583db26db33b57c54bf2e4fa890b1d5716c54015 100644 (file)
     <!--<param name="nat-options-ping" value="true"/>-->
     <!--<param name="sip-options-respond-503-on-busy" value="true"/>-->
     <!--<param name="sip-messages-respond-200-ok" value="true"/>-->
+    <!--<param name="sip-subscribe-respond-200-ok" value="true"/>-->
 
     <!-- TLS: disabled by default, set to "true" to enable -->
     <param name="tls" value="$${internal_ssl_enable}"/>
index 5249bee570a636a6ddf474221f9aef48f91bcf54..71e9862a69450e44d95b53d9de4c8efab6079f93 100644 (file)
@@ -271,6 +271,7 @@ typedef enum {
        PFLAG_TCP_PINGPONG,
        PFLAG_TCP_PING2PONG,
        PFLAG_MESSAGES_RESPOND_200_OK,
+       PFLAG_SUBSCRIBE_RESPOND_200_OK,
        PFLAG_PARSE_ALL_INVITE_HEADERS,
        /* No new flags below this line */
        PFLAG_MAX
index 694d3d48568bad7beab94a35fc5278b6b271e39c..915a6dee647c44cbf8a5ed9d2f3248fe0b802f78 100644 (file)
@@ -4045,6 +4045,12 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
                                                } else {
                                                        sofia_clear_pflag(profile, PFLAG_MESSAGES_RESPOND_200_OK);
                                                }
+                                       } else if (!strcasecmp(var, "sip-subscribe-respond-200-ok") && !zstr(val)) {
+                                               if (switch_true(val)) {
+                                                       sofia_set_pflag(profile, PFLAG_SUBSCRIBE_RESPOND_200_OK);
+                                               } else {
+                                                       sofia_clear_pflag(profile, PFLAG_SUBSCRIBE_RESPOND_200_OK);
+                                               }
                                        } else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
                                                profile->odbc_dsn = switch_core_strdup(profile->pool, val);
                                        } else if (!strcasecmp(var, "db-pre-trans-execute") && !zstr(val)) {
index b6fb25e99235b7c209a73775a1fbf8c08e61ca4c..868bf5ff64a7ff8e4ee463428812c3383d2c0b42 100644 (file)
@@ -3875,8 +3875,11 @@ void sofia_presence_handle_sip_i_subscribe(int status,
                        switch_event_t *params = NULL;
                        /* Grandstream REALLY uses a header called Message Body */
                        extra_headers = switch_mprintf("MessageBody: %s\r\n", profile->pnp_prov_url);
-
-                       nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END());
+                       if (sofia_test_pflag(profile, PFLAG_SUBSCRIBE_RESPOND_200_OK)) {
+                               nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END());
+                       } else {
+                               nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END());
+                       }
 
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sending pnp NOTIFY for %s to provision to %s\n", uri, profile->pnp_prov_url);
 
@@ -3956,11 +3959,19 @@ void sofia_presence_handle_sip_i_subscribe(int status,
                if (mod_sofia_globals.debug_presence > 0) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding to SUBSCRIBE with 202 Accepted\n");
                }
-               nua_respond(nh, SIP_202_ACCEPTED,
-                                       SIPTAG_TO(sip->sip_to),
-                                       TAG_IF(new_contactstr, SIPTAG_CONTACT_STR(new_contactstr)),
-                                       NUTAG_WITH_THIS_MSG(de->data->e_msg),
-                                       SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EXPIRES_STR(exp_delta_str), TAG_IF(sticky, NUTAG_PROXY(sticky)), TAG_END());
+               if (sofia_test_pflag(profile, PFLAG_SUBSCRIBE_RESPOND_200_OK)) {
+                       nua_respond(nh, SIP_200_OK,
+                                               SIPTAG_TO(sip->sip_to),
+                                               TAG_IF(new_contactstr, SIPTAG_CONTACT_STR(new_contactstr)),
+                                               NUTAG_WITH_THIS_MSG(de->data->e_msg),
+                                               SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EXPIRES_STR(exp_delta_str), TAG_IF(sticky, NUTAG_PROXY(sticky)), TAG_END());
+               } else {
+                       nua_respond(nh, SIP_202_ACCEPTED,
+                                               SIPTAG_TO(sip->sip_to),
+                                               TAG_IF(new_contactstr, SIPTAG_CONTACT_STR(new_contactstr)),
+                                               NUTAG_WITH_THIS_MSG(de->data->e_msg),
+                                               SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EXPIRES_STR(exp_delta_str), TAG_IF(sticky, NUTAG_PROXY(sticky)), TAG_END());
+               }
 
                switch_safe_free(new_contactstr);
                switch_safe_free(sticky);