[Asterisk-code-review] res_pjsip_session: Add custom parameter support. (asterisk[master])

Sean Bright asteriskteam at digium.com
Mon Jul 25 09:46:31 CDT 2022


Attention is currently required from: N A, Joshua Colp, George Joseph.
Sean Bright has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/18830 )

Change subject: res_pjsip_session: Add custom parameter support.
......................................................................


Patch Set 1: Code-Review-1

(3 comments)

File res/res_pjsip_session.c:

https://gerrit.asterisk.org/c/asterisk/+/18830/comment/a48096be_71918dca 
PS1, Line 1703: 	/* Set URI (inside the <>, as opposed to header (outside the <>)) parameters, if requested.
              : 	 * This is often necessary for SS7 trunking over SIP. Most carriers require
              : 	 * that added parameters be URI parameters (as opposed to header parameters).
              : 	 *
              : 	 * other_param is how to add custom URI parameters to the header
              : 	 * XXX: header_param is for header parameters, but doesn't seem to work at the moment.
              : 	 *
              : 	 * Especially when dealing with SS7 or TDM elements over SIP,
              : 	 * injecting parameters into the user and/or method parameters
              : 	 * is required.
              : 	 *
              : 	 * For example, if wanted to set the isup-oli parameter to the channel's ANI2 value:
              : 	 * e.g. pjsip_param_add(dlg_pool, &dlg_info_uri->other_param, "isup-oli", ani2);
This block is needlessly verbose. URIs can have URI parameters and headers. Both of these would be "inside the <>". If they are not "inside the <>" then they are not URI parameters, so all of this just serves to confuse.

The 'XXX: header_param is...' comment is irrelevant since you are setting URI parameters and not URI headers.

I would suggest:

 /*
  * Set URI parameters if requested.
  */


https://gerrit.asterisk.org/c/asterisk/+/18830/comment/99596ded_e942aa73 
PS1, Line 1731: 	while ((param_value = strsep(&params, ","))) {
              : 			param_name = strsep(&param_value, "=");
How do I add a parameter where the value contains a comma or equals sign? For example I want to add:

 ;usertoken=fname%3Dsean


https://gerrit.asterisk.org/c/asterisk/+/18830/comment/99652e6a_cd159e4c 
PS1, Line 1734: 			pjsip_param_add(dlg_pool, &dlg_info_uri->other_param, param_name, S_OR(param_value, ""));
When setting the transport, user, method, ttl, maddr, or lr parameters wouldn't it be better to use the dedicated structure members on pjsip_sip_uri? I assume it's not possible for anything else within Asterisk or the PJSIP stack that would set those parameters first?



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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ifb1bc3c512ad5f6faeaebd7817f004a2ecbd6428
Gerrit-Change-Number: 18830
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Sean Bright <sean at seanbright.com>
Gerrit-Attention: N A <mail at interlinked.x10host.com>
Gerrit-Attention: Joshua Colp <jcolp at sangoma.com>
Gerrit-Attention: George Joseph <gjoseph at digium.com>
Gerrit-Comment-Date: Mon, 25 Jul 2022 14:46:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220725/d02158b2/attachment-0001.html>


More information about the asterisk-code-review mailing list