diff options
author | Kevin Harwell <kharwell@digium.com> | 2015-04-06 19:23:57 +0000 |
---|---|---|
committer | Kevin Harwell <kharwell@digium.com> | 2015-04-06 19:23:57 +0000 |
commit | 87d7c90e4e568d5bc7acc05ef1266f088f6a3b8d (patch) | |
tree | 0a943ed8cab6f5032023ccef379067f2db6033ca /res | |
parent | e48f2e7897079936ef2cb91fd15b88c319a3cdc9 (diff) |
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/
........
Merged revisions 434131 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434132 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r-- | res/res_pjsip.c | 5 | ||||
-rw-r--r-- | res/res_pjsip/pjsip_configuration.c | 18 |
2 files changed, 14 insertions, 9 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c index 64cd43e18..c8b8c23a7 100644 --- a/res/res_pjsip.c +++ b/res/res_pjsip.c @@ -347,10 +347,11 @@ <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> diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c index 5a4741d90..eacbef064 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; } |