[Asterisk-code-review] res_pjsip_session.c: Map empty extensions in INVITEs to s. (asterisk[20])

N A asteriskteam at digium.com
Thu Dec 8 07:19:29 CST 2022


N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19679 )


Change subject: res_pjsip_session.c: Map empty extensions in INVITEs to s.
......................................................................

res_pjsip_session.c: Map empty extensions in INVITEs to s.

Some SIP devices use an empty extension for PLAR functionality.

Rather than rejecting these empty extensions, we now use the s
extension for such calls to mirror the existing PLAR functionality
in Asterisk (e.g. chan_dahdi).

ASTERISK-30265 #close

Change-Id: I0861a405cd49bbbf532b52f7b47f0e2810832590
---
M res/res_pjsip_session.c
1 file changed, 22 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/79/19679/1

diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index a7bde0d..67dcdf5 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -3665,6 +3665,11 @@
 	}
 
 	ast_copy_pj_str(session->exten, ast_sip_pjsip_uri_get_username(ruri), sizeof(session->exten));
+	if (ast_strlen_zero(session->exten)) {
+		/* Some SIP devices send an empty extension for PLAR: this should map to s */
+		ast_debug(1, "RURI contains no user portion: defaulting to extension 's'\n");
+		ast_copy_string(session->exten, "s", sizeof(session->exten));
+	}
 
 	/*
 	 * We may want to match in the dialplan without any user

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19679
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 20
Gerrit-Change-Id: I0861a405cd49bbbf532b52f7b47f0e2810832590
Gerrit-Change-Number: 19679
Gerrit-PatchSet: 1
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221208/0fc47fb3/attachment.html>


More information about the asterisk-code-review mailing list