]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip: config option 'timers' can't be set to 'no' 62/562/1
authorKevin Harwell <kharwell@digium.com>
Mon, 6 Apr 2015 19:23:57 +0000 (19:23 +0000)
committerMark Michelson <mmichelson@digium.com>
Mon, 1 Jun 2015 20:49:40 +0000 (15:49 -0500)
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/
........

Merged revisions 434131 from http://svn.asterisk.org/svn/asterisk/branches/13

Change-Id: Ibbc25d4592aabf7596ef473447d630961f88c217

res/res_pjsip.c
res/res_pjsip/pjsip_configuration.c

index 2fb669ed95aaf7f38b898c15b70af51e602dcc02..98710ce9f3d34782139c5dd605333b165a7cd62b 100644 (file)
                                        <synopsis>Session timers for SIP packets</synopsis>
                                        <description>
                                                <enumlist>
-                                                       <enum name="forced" />
                                                        <enum name="no" />
-                                                       <enum name="required" />
                                                        <enum name="yes" />
+                                                       <enum name="required" />
+                                                       <enum name="always" />
+                                                       <enum name="forced"><para>Alias of always</para></enum>
                                                </enumlist>
                                        </description>
                                </configOption>
index 67cb863051de5f20c96a5ec92e0d99993fca48dc..30d7702ce185974956547ce9e807e675c43156cf 100644 (file)
@@ -141,13 +141,14 @@ static int prack_handler(const struct aco_option *opt, struct ast_variable *var,
 {
        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 @@ static int timers_handler(const struct aco_option *opt, struct ast_variable *var
 {
        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;
        }