]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add settings to disable timer and 100rel support by profile (MODENDP-102)
authorMichael Jerris <mike@jerris.com>
Mon, 14 Apr 2008 19:20:12 +0000 (19:20 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 14 Apr 2008 19:20:12 +0000 (19:20 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8114 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/sip_profiles/default.xml
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c

index 905b836ad8e778ac662064ae5824a9ee15977252..5ea701ab10dd2da67835eb2df4f0762718ddda71 100644 (file)
@@ -34,6 +34,8 @@
     <!-- ip address to bind to -->
     <param name="sip-ip" value="$${local_ip_v4}"/>
     <param name="hold-music" value="$${moh_uri}"/>
+    <!--<param name="enable-timer" value="false"/>-->
+    <!--<param name="enable-100rel" value="false"/>-->
     <!--<param name="apply-inbound-acl" value="lan"/>-->
     <!--<param name="apply-register-acl" value="lan"/>-->
     <!--<param name="dtmf-type" value="info"/>-->
index 20add5792902ad5761eb25b630309461b3c42b4b..fe9b0c393c7c2f1cd4e18de608ba431e49698310 100644 (file)
@@ -138,7 +138,9 @@ typedef enum {
        PFLAG_SECURE = (1 << 15),
        PFLAG_BLIND_AUTH = (1 << 16),
        PFLAG_WORKER_RUNNING = (1 << 17),
-       PFLAG_UNREG_OPTIONS_FAIL = (1 << 18)
+       PFLAG_UNREG_OPTIONS_FAIL = (1 << 18),
+       PFLAG_DISABLE_TIMER = (1 << 19),
+       PFLAG_DISABLE_100REL = (1 << 20)
 } PFLAGS;
 
 typedef enum {
index 9eebc52ac45794fe48beafd43c9f2d11ce3ca890..e5040c2e2b8055ee56eeb9f1d9789026bd392fb1 100644 (file)
@@ -497,6 +497,9 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
        sip_alias_node_t *node;
        switch_event_t *s_event;
        int tportlog = 0;
+       int use_100rel = !sofia_test_pflag(profile, PFLAG_DISABLE_100REL);
+       int use_timer = !sofia_test_pflag(profile, PFLAG_DISABLE_TIMER);
+       const char *supported = NULL;
 
        switch_mutex_lock(mod_sofia_globals.mutex);
        mod_sofia_globals.threads++;
@@ -517,6 +520,16 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
                tportlog = 1;
        }
 
+       if (use_100rel && use_timer) {
+               supported = "100rel, precondition, timer";
+       } else if (use_100rel) {
+               supported = "100rel, precondition";
+       } else if (use_timer) {
+               supported = "timer, precondition";
+       } else {
+               supported = "precondition";
+       }
+
        profile->nua = nua_create(profile->s_root,      /* Event loop */
                                                        sofia_event_callback,   /* Callback for processing events */
                                                        profile,        /* Additional data to pass to callback */
@@ -559,7 +572,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
                                   TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("include-session-description")),
                                   TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("presence.winfo")),
                                   TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW_EVENTS("message-summary")),
-                                  SIPTAG_SUPPORTED_STR("100rel, precondition, timer"), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END());
+                                  SIPTAG_SUPPORTED_STR(supported), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END());
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set params for %s\n", profile->name);
 
@@ -579,7 +592,8 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
                                           NUTAG_ALLOW("INFO"),
                                           TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW("PUBLISH")),
                                           TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ENABLEMESSAGE(1)),
-                                          SIPTAG_SUPPORTED_STR("100rel, precondition"), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END());
+                                          SIPTAG_SUPPORTED_STR(supported), 
+                                          SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END());
        }
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "activated db for %s\n", profile->name);
@@ -1223,6 +1237,14 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                if (switch_true(val)) {
                                                        profile->pflags |= PFLAG_CHECKUSER;
                                                }
+                                       } else if (!strcasecmp(var, "enable-timer")) {
+                                               if (!switch_true(val)) {
+                                                       profile->pflags |= PFLAG_DISABLE_TIMER;
+                                               }
+                                       } else if (!strcasecmp(var, "enable-100rel")) {
+                                               if (!switch_true(val)) {
+                                                       profile->pflags |= PFLAG_DISABLE_100REL;
+                                               }
                                        } else if (!strcasecmp(var, "bitpacking")) {
                                                if (!strcasecmp(val, "aal2")) {
                                                        profile->codec_flags = SWITCH_CODEC_FLAG_AAL2;