Author: kharwell
Date: Mon Apr  6 14:23:08 2015
New Revision: 434131

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=434131
Log:
res_pjsip: config option 'timers' can't be set to 'no'

When setting the configuration option 'timers' equal to 'no' the bit flag was
not properly negated. This patch clears all associated flags and only sets the
specified one. pjsip will handle any necessary flag combinations. Also went
ahead and did similar for the '100rel' option.

ASTERISK-24910 #close
Reported by: Ray Crumrine
Review: https://reviewboard.asterisk.org/r/4582/

Modified:
    branches/13/res/res_pjsip.c
    branches/13/res/res_pjsip/pjsip_configuration.c

Modified: branches/13/res/res_pjsip.c
URL: 
http://svnview.digium.com/svn/asterisk/branches/13/res/res_pjsip.c?view=diff&rev=434131&r1=434130&r2=434131
==============================================================================
--- branches/13/res/res_pjsip.c (original)
+++ branches/13/res/res_pjsip.c Mon Apr  6 14:23:08 2015
@@ -347,10 +347,11 @@
                                        <synopsis>Session timers for SIP 
packets</synopsis>
                                        <description>
                                                <enumlist>
-                                                       <enum name="forced" />
                                                        <enum name="no" />
+                                                       <enum name="yes" />
                                                        <enum name="required" />
-                                                       <enum name="yes" />
+                                                       <enum name="always" />
+                                                       <enum 
name="forced"><para>Alias of always</para></enum>
                                                </enumlist>
                                        </description>
                                </configOption>

Modified: branches/13/res/res_pjsip/pjsip_configuration.c
URL: 
http://svnview.digium.com/svn/asterisk/branches/13/res/res_pjsip/pjsip_configuration.c?view=diff&rev=434131&r1=434130&r2=434131
==============================================================================
--- branches/13/res/res_pjsip/pjsip_configuration.c (original)
+++ branches/13/res/res_pjsip/pjsip_configuration.c Mon Apr  6 14:23:08 2015
@@ -141,13 +141,14 @@
 {
        struct ast_sip_endpoint *endpoint = obj;
 
+       /* clear all */
+       endpoint->extensions.flags &= ~(PJSIP_INV_SUPPORT_100REL | 
PJSIP_INV_REQUIRE_100REL);
+
        if (ast_true(var->value)) {
                endpoint->extensions.flags |= PJSIP_INV_SUPPORT_100REL;
-       } else if (ast_false(var->value)) {
-               endpoint->extensions.flags &= ~PJSIP_INV_SUPPORT_100REL;
        } else if (!strcasecmp(var->value, "required")) {
                endpoint->extensions.flags |= PJSIP_INV_REQUIRE_100REL;
-       } else {
+       } else if (!ast_false(var->value)){
                return -1;
        }
 
@@ -174,15 +175,18 @@
 {
        struct ast_sip_endpoint *endpoint = obj;
 
+       /* clear all */
+       endpoint->extensions.flags &= ~(PJSIP_INV_SUPPORT_TIMER | 
PJSIP_INV_REQUIRE_TIMER
+                                       | PJSIP_INV_ALWAYS_USE_TIMER);
+
+       /* set only the specified flag and let pjsip normalize if needed */
        if (ast_true(var->value)) {
                endpoint->extensions.flags |= PJSIP_INV_SUPPORT_TIMER;
-       } else if (ast_false(var->value)) {
-               endpoint->extensions.flags &= PJSIP_INV_SUPPORT_TIMER;
        } else if (!strcasecmp(var->value, "required")) {
                endpoint->extensions.flags |= PJSIP_INV_REQUIRE_TIMER;
-       } else if (!strcasecmp(var->value, "always")) {
+       } else if (!strcasecmp(var->value, "always") || !strcasecmp(var->value, 
"forced")) {
                endpoint->extensions.flags |= PJSIP_INV_ALWAYS_USE_TIMER;
-       } else {
+       } else if (!ast_false(var->value)) {
                return -1;
        }
 


-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits

Reply via email to