[asterisk-dev] [Code Review] Explicit context set in SIP peer overridden by default domain context

Philip A. Prindeville philipp_subx at redfish-solutions.com
Wed Apr 21 15:50:43 CDT 2010


On 04/20/2010 07:04 AM, Nick Lewis wrote:
>
>   
>> On 2010-04-12 09:35:33, Mark Michelson wrote:
>>     
>>> As far as code integrity and falling within the Asterisk coding guidelines goes, this is very well done. Great work!
>>>
>>> The only thing is that I don't really feel comfortable greenlighting a behavior change such as this one without some sort of discussion and/or consensus being reached first. It's mainly due to the fact that I'm not one who uses SIP domains. I agree with this change myself, for the record. Could someone else please weigh in on this? Olle, perhaps?
>>>       
>> pprindeville wrote:
>>     I've asked Olle to review it as well, but so far I've not had a response.
>>
>>     
> Although the current behaviour of domain-lists is detrimental to peers of type=user (e.g. registered internal phones) it may be expected behaviour for peers of type=peer such as connections to service providers. Therefore to remove domain-contexts from being applied to all specified peers may be problematic in multi-tenancy applications
>
> One way around this would be to add domain-contexts to specific peer definitions as well as to global definitions. The domain-contexts in the global definitions would apply only when there was no peer match but domain-contexts (domain=<sip-to-domain>,<context>) could be added to peer definitions to provide domain-contexts on a per peer basis to those peers that require it.
>
> On a broader point I question the wisdom of having any domain-contexts in chan_sip.c, irrespective of whether they be peer specific or global. domain-contexts are clearly a form of routing and (as oej frequently points out) all routing should be done in the dial-plan. An alternative approach is to advertise SIPTODOMAIN as a variable in the dialplan and in extensions.conf do something like
>
> [guest-domain-contexts]
> exten => _.,1,gotoif($[${SIPTODOMAIN} = "firsttenant.com"]?firsttenant-guest,${EXTEN},1)
> exten => _.,n,gotoif(${${SIPTODOMAIN} = "secondtenant.com"]?secondtenant-guest,${EXTEN},1)
>
> [from-itsp-domain-contexts]
> exten => _.,1,gotoif($[${SIPTODOMAIN} == "firsttenant.com"]?firsttenant,${EXTEN},1)
> exten => _.,n,gotoif($[${SIPTODOMAIN} == "secondtenant.com"]?secondtenant,${EXTEN},1)
>
>
> - Nick
>
>   

I tried to pitch on #asterisk-dev the notion of having a "preamble"
extension optionally in any context that could be used to avoid having
the _. extension match instead, but it was not well received.

I agree that the domain-contexts do more harm than good, and perhaps
adding an additional channel variable would accomplish the same thing
more cleanly.





More information about the asterisk-dev mailing list