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

Friendly Automation asteriskteam at digium.com
Fri Dec 9 07:53:50 CST 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/19678 )

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(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit




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/+/19678
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I0861a405cd49bbbf532b52f7b47f0e2810832590
Gerrit-Change-Number: 19678
Gerrit-PatchSet: 2
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221209/68305f6c/attachment-0001.html>


More information about the asterisk-code-review mailing list