[asterisk-dev] [Code Review] 3035: Add a function PJSIP_ENDPOINT to retrieve endpoint configuration details from the dialplan

Matt Jordan reviewboard at asterisk.org
Tue Dec 10 16:21:44 CST 2013



> On Dec. 10, 2013, 9:59 p.m., Mark Michelson wrote:
> > /branches/12/funcs/func_pjsip_endpoint.c, lines 126-130
> > <https://reviewboard.asterisk.org/r/3035/diff/2/?file=49267#file49267line126>
> >
> >     Just curious, but why does "disallow" get this special treatment?

ast_getformatname_multiple returns back a list of formats in a pre-formatted string. It doesn't have any knowledge of whether or not the formats or allowed or disallowed - just that you have a list of formats. What's more, this string is already enclosed in paranthesis, so there's no way to individually put a "!" in front of each disallowed codec. So the allow/disallow values can look identical:

allow=ulaw,alaw => (ulaw|alaw)
disallow=ulaw,alaw => (ulaw|alaw)

This puts the "!" in front so that the dialplan can tell that the entire list is disallowed:

disallow=ulaw,alaw => !(ulaw|alaw)


- Matt


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3035/#review10375
-----------------------------------------------------------


On Dec. 10, 2013, 2:34 a.m., Matt Jordan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3035/
> -----------------------------------------------------------
> 
> (Updated Dec. 10, 2013, 2:34 a.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> The impetus for this function came from looking at the CHANNEL function for chan_sip, and starting to map out what properties should be applied to chan_pjsip.
> 
> While I was looking at it, I thought that - other than the name of the endpoint associated with the channel - endpoint details really shouldn't come from the CHANNEL function. They should come from something else. Hence, the PJSIP_ENDPOINT function.
> 
> This function lets you query any property configured on an endpoint, for any endpoint, from the dialplan. Assuming the CHANNEL function gets applied to chan_pjsip, this would let you extract information about a channel's endpoint - or whatever endpoint they're going to go talk to.
> 
> This has some obvious implications in knowing what's about to happen before you go Dial some endpoint.
> 
> As an aside, I think this patch also shows (to a small extent) the usefulness of both Sorcery as well as XML configuration information. More lines of code are spent on sanitizing input than anything else.
> 
> 
> Diffs
> -----
> 
>   /branches/12/main/sorcery.c 403491 
>   /branches/12/funcs/func_pjsip_endpoint.c PRE-CREATION 
>   /branches/12/doc/snapshots.xslt 403491 
>   /branches/12/doc/appdocsxml.xslt PRE-CREATION 
>   /branches/12/doc/appdocsxml.dtd 403491 
>   /branches/12/Makefile 403491 
> 
> Diff: https://reviewboard.asterisk.org/r/3035/diff/
> 
> 
> Testing
> -------
> 
> Testsuite test written and available here:
> 
> https://reviewboard.asterisk.org/r/3034/
> 
> 
> Thanks,
> 
> Matt Jordan
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20131210/e901d9aa/attachment-0001.html>


More information about the asterisk-dev mailing list