From: Kevin Harwell Date: Mon, 6 Apr 2015 19:23:08 +0000 (+0000) Subject: res_pjsip: config option 'timers' can't be set to 'no' X-Git-Tag: 13.4.0-rc1~157 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2270c40d33827a605b500e7afe01be9976b1f5e0;p=thirdparty%2Fasterisk.git 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/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@434131 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_pjsip.c b/res/res_pjsip.c index e632817d54..6fc14774f9 100644 --- a/res/res_pjsip.c +++ b/res/res_pjsip.c @@ -347,10 +347,11 @@ Session timers for SIP packets - - + + + Alias of always diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c index 4d8fd0a24e..4f5fc74deb 100644 --- a/res/res_pjsip/pjsip_configuration.c +++ b/res/res_pjsip/pjsip_configuration.c @@ -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; }