[asterisk-bugs] [JIRA] (ASTERISK-19161) [patch] Add function REGISTRANT() that retrieves the peer that auto-registered an extension
Joshua Colp (JIRA)
noreply at issues.asterisk.org
Tue Dec 19 06:23:07 CST 2017
[ https://issues.asterisk.org/jira/browse/ASTERISK-19161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joshua Colp updated ASTERISK-19161:
-----------------------------------
Affects Version/s: 13.18.4
> [patch] Add function REGISTRANT() that retrieves the peer that auto-registered an extension
> -------------------------------------------------------------------------------------------
>
> Key: ASTERISK-19161
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-19161
> Project: Asterisk
> Issue Type: New Feature
> Security Level: None
> Components: Core/PBX
> Affects Versions: SVN, 13.18.4
> Reporter: Barry Miller
> Severity: Minor
> Attachments: registrant-diffs
>
>
> This little function REGISTRANT([extension][@context]) will return the name of the SIP peer that caused <extension> to be auto-registered, or the null string if the extension does not exist or was not created by SIP. Defaults are the current extension and context.
> Use of regcontext + regexten can be very useful. Peers can have handy names like MAC address or device serial number, while extensions can be human-friendly. This is also helpful in foiling extension enumeration probing attacks. But at present, there is no simple way to do this. Hard-coding in the dialplan is cumbersome and error prone, adding the association to astdb is the same, and using 'setvar= MYDEV=dev_A' is redundant and won't work in cases like "Dial(DAHDI/1&SIP/251)". These methods also cause problems if sip.conf has multiple regcontexts, and regexten adds the same extension to different contexts which are included based on time of day. REGISTRANT() simply returns information already in sip.conf (if regcontext is used).
> REGISTRANT() works based on the fact that when chan_sip auto-registers an extension, it thoughtfully creates "<extension>, 1, Noop(<peername>)". So we just find priority 1 of <extension>, and if its registrant is "SIP" and it executes "Noop", we return <peername>, otherwise "". I stuck this in main/pbx.c because a) it's small, and b) struct ast_exten isn't really defined anywhere else.
> I believe the most common use in the dialplan would be something like:
> include => sip-autoreg ; regextens are in the range 250-299
> exten => _2[5-9]X, 2, Dial(SIP/${REGISTRANT()})
> And it's easy to write a subroutine that converts a pseudo-dialstring like "DAHDI/1&251" into "DAHDI/1&SIP/002699ABD83D".
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list