Summary: | ASTERISK-25803: [patch] chan_sip: Optionally supply fromuser/fromdomain in SIP dial string | ||
Reporter: | Walter Doekes (wdoekes) | Labels: | |
Date Opened: | 2016-02-19 03:55:31.000-0600 | Date Closed: | 2016-02-25 17:57:58.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Channels/chan_sip/Interoperability |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) all.txt ( 1) cleanup.sed ( 2) fromdomain.txt ( 3) fromuser.txt ( 4) fromuser-fromdomain.txt ( 5) none.txt ( 6) todomain.txt ( 7) touser.txt ( 8) touser-todomain.txt | |
Description: | Hidden deep inside chan_sip.c, there is a feature that allows you to specify the To-URI at Dial time:
{noformat} * SIP Dial string syntax: * SIP/devicename * or SIP/username@domain (SIP uri) ... * and there is an optional [!dnid] argument you can append to alter the * To: header. {noformat} For example: {noformat} Dial(SIP/mydevice!touser@todomain.com) {noformat} will cause a SIP invite with {{To: <sip:touser@todomain.com>}} to be sent out. *I suggest we add the possibility to also supply the From-URI through the Dial string, like this*: {noformat} * and there is an optional [!dnid] argument you can append to alter the - * To: header. + * To: header. And after that, a [![fromuser][@fromdomain]] argument. + * Leave those blank to use the defaults. {noformat} For example: {noformat} Dial(SIP/mydevice!touser@todomain.com!fromuser@fromdomain.com) {noformat} causing a SIP invite with {{To: <sip:touser@todomain.com>}} and {{From: <sip:fromuser@fromdomain.com>}} to get sent. *Why?* Because I need it. I don't think there is any way to specify the From-URI through the dialplan at this moment. *Why here?* Because it fits there nicely along with the {{!dnid}} setting that has existed there. All of the above settings after the first {{!}} are optional, except for: the todomain, but that was already the case before the suggested patch. *INCOMPATIBLE CHANGES*: the patch changes that an exclamation mark in the To-URI -- if anyone uses that -- would not work anymore, since it's now a delimiter. ---- *Tests*: apart from using the feature, I also ran the following tests with {{channel originate}}. {noformat} for x in touser.txt touser-todomain.txt fromuser.txt fromuser-fromdomain.txt fromdomain.txt all.txt do printf '*%s*\n{%s}\n' $x noformat; diff none.txt $x | grep '^[<>]' printf '{%s}\n\n' noformat; done {noformat} *touser.txt* {noformat} < *CLI> channel originate SIP/1.2.3.4 application noop > *CLI> channel originate SIP/1.2.3.4!touser application noop < To: <sip:1.2.3.4> > To: <sip:touser@1.2.3.4> {noformat} *touser-todomain.txt* {noformat} < *CLI> channel originate SIP/1.2.3.4 application noop > *CLI> channel originate SIP/1.2.3.4!touser@todomain application noop < To: <sip:1.2.3.4> > To: <sip:touser@todomain> {noformat} *fromuser.txt* {noformat} < *CLI> channel originate SIP/1.2.3.4 application noop > *CLI> channel originate SIP/1.2.3.4!!fromuser application noop < From: "Anonymous" <sip:anonymous@anonymous.invalid>;tag=TAG > From: "Anonymous" <sip:fromuser@anonymous.invalid>;tag=TAG < Contact: <sip:anonymous@192.168.1.12:5060> > Contact: <sip:fromuser@192.168.1.12:5060> {noformat} *fromuser-fromdomain.txt* {noformat} < *CLI> channel originate SIP/1.2.3.4 application noop > *CLI> channel originate SIP/1.2.3.4!!fromuser@fromdomain application noop < From: "Anonymous" <sip:anonymous@anonymous.invalid>;tag=TAG > From: "Anonymous" <sip:fromuser@fromdomain>;tag=TAG < Contact: <sip:anonymous@192.168.1.12:5060> < Call-ID: RANDOM@192.168.1.12:5060 > Contact: <sip:fromuser@192.168.1.12:5060> > Call-ID: RANDOM@fromdomain {noformat} *fromdomain.txt* {noformat} < *CLI> channel originate SIP/1.2.3.4 application noop > *CLI> channel originate SIP/1.2.3.4!!@fromdomain application noop < From: "Anonymous" <sip:anonymous@anonymous.invalid>;tag=TAG > From: "Anonymous" <sip:anonymous@fromdomain>;tag=TAG < Call-ID: RANDOM@192.168.1.12:5060 > Call-ID: RANDOM@fromdomain {noformat} *all.txt* {noformat} < *CLI> channel originate SIP/1.2.3.4 application noop > *CLI> channel originate SIP/1.2.3.4!touser@todomain!fromuser@fromdomain application noop < From: "Anonymous" <sip:anonymous@anonymous.invalid>;tag=TAG < To: <sip:1.2.3.4> < Contact: <sip:anonymous@192.168.1.12:5060> < Call-ID: RANDOM@192.168.1.12:5060 > From: "Anonymous" <sip:fromuser@fromdomain>;tag=TAG > To: <sip:touser@todomain> > Contact: <sip:fromuser@192.168.1.12:5060> > Call-ID: RANDOM@fromdomain {noformat} | ||
Comments: | By: Asterisk Team (asteriskteam) 2016-02-19 03:55:31.940-0600 Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report. Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process]. |