[Asterisk-code-review] res pjsip: config option 'timers' can't be set to 'no' (asterisk[certified/13.1])

Mark Michelson asteriskteam at digium.com
Mon Jun 1 15:52:58 CDT 2015


Mark Michelson has uploaded a new change for review.

  https://gerrit.asterisk.org/562

Change subject: res_pjsip: config option 'timers' can't be set to 'no'
......................................................................

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

Change-Id: Ibbc25d4592aabf7596ef473447d630961f88c217
---
M res/res_pjsip.c
M res/res_pjsip/pjsip_configuration.c
2 files changed, 14 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/62/562/1

diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 2fb669e..98710ce 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -324,10 +324,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 67cb863..30d7702 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -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;
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/562
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibbc25d4592aabf7596ef473447d630961f88c217
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: certified/13.1
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-code-review mailing list