Summary: | ASTERISK-24040: [patch]Retrieving source port of sip message in dialplan | ||
Reporter: | dtryba (dtryba) | Labels: | |
Date Opened: | 2014-07-14 06:37:27 | Date Closed: | 2014-08-04 15:39:06 |
Priority: | Trivial | Regression? | |
Status: | Closed/Complete | Components: | Channels/chan_sip/NewFeature |
Versions: | SVN 11.10.2 | Frequency of Occurrence | |
Related Issues: | |||
Environment: | Attachments: | ( 0) dialplan_functions.patch | |
Description: | I need to route calls in the dialplan based on source ip and source port. Source ip can be retrieved with {{$\{CHANNEL(recvip)\}}} but there is no entry in CHANNEL var to retrieve the port (much to my amazement). Attached is a simple patch that appears to do the job for SIP channels: {{$\{CHANNEL(recvport)\}}}:
For {noformat} exten => 1,n,NoOp(ip:port ${CHANNEL(recvip)}:${CHANNEL(recvport)}) {noformat} a sip invite like: {noformat} <--- SIP read from UDP:10.0.3.175:5555 ---> INVITE sip:1@10.0.2.16 SIP/2.0 {noformat} will result in: {noformat} -- Executing [1@default:2] NoOp("SIP/tst-00000004", "ip:port 10.0.3.175:5555") in new stack {noformat} | ||
Comments: | By: dtryba (dtryba) 2014-07-14 06:55:09.611-0500 Patch upload has to wait a little for the lack of a license. But chan_sip.c and sip/dialplan_functions.c where edited to include: *\[Edit: mjordan\] - removed inline patch* just after the recvip else if By: Matt Jordan (mjordan) 2014-07-14 08:14:18.449-0500 I've removed the inline patch, just so there isn't any confusion about attribution and the license contributor agreement. Unfortunately, we can't accept patches that aren't signed and attached to the issue. Since it sounds like that's in process, it should show up here shortly :-) As an FYI, there is a feature freeze for Asterisk 13 on Wednesday, July 16th. If you'd like to make sure that this enhancement makes it in, please post your patch to review board for peer review, using the instructions on the wiki: https://wiki.asterisk.org/wiki/display/AST/Code+Review More information on the patch contribution process can be found here: https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process Thanks! By: dtryba (dtryba) 2014-07-14 11:36:14.695-0500 Working patch for a Debian 11.10.2 source. The exact same patch should apply against trunk (revision 418610) but I didn't compile/test. By: Matt Jordan (mjordan) 2014-07-14 11:39:41.600-0500 New features need to be written against trunk. Requiring others to do that work for your patch will delay when that patch is merged into Asterisk. If you'd like this to get included sooner rather than later, please write the patch against trunk and make sure it compiles and functions correctly. By: dtryba (dtryba) 2014-07-14 12:08:59.743-0500 patch compiles against trunk and behavior is I expected. By: Rusty Newton (rnewton) 2014-07-18 11:53:10.028-0500 [~dtryba] Thanks for updating the patch. You may continue with the code review and patch process that Matt mentioned and linked. The next step is likely putting your patch on Reviewboard. By: Rusty Newton (rnewton) 2014-07-18 11:55:04.200-0500 Be sure to add the reviewboard link URL to this issue once you have it. By: dtryba (dtryba) 2014-07-21 08:24:37.654-0500 reviewboard url added |