[asterisk-users] Forcing SIP trunk matching order?

Olle E. Johansson oej at edvina.net
Wed Jul 11 07:53:50 CDT 2012


11 jul 2012 kl. 00:26 skrev James Lamanna:

> On Mon, Jul 2, 2012 at 12:13 AM, Olle E. Johansson <oej at edvina.net> wrote:
> 
>> No.
>> 
>> This is probably because you are using phone numbers as names of devices with type=friend in sip.conf.
>> That's generally a bad idea.
>> 
>> The SIP channel matches an incoming call this way:
>> 
>> 1. Take the From: user name and match with the list of type=user and type=friend
>> 2. Take the sender's IP and port and match with the list of peers
>> 3. Send the call to the context defined in the [general] section of sip conf
>> 
>> In Asterisk 1.4 and hopefully 1.8 the last peer in sip.conf will match first. In 1.8 the internal strcutures
>> was changed, but I hope that this functionality was retained. We had a dicussion about it, but I personally
>> haven't tested the result. One needs to know the matching order, so if 1.8 doesn't behave that way, we need
>> to fix it.
>> 
>> The recommended way is to NOT use anything that likely will end up as a caller ID as names
>> of devices in sip.conf. The name is whatever you have within square brackets above definitions
>> of type=friend or type=user. The username= option is another option, not the name of the device.
>> 
>> The quick way to solve your problems is to stop using type=friend and start using type=peer
>> instead.
> 
> Hi Ollie,
> 
> You are correct, I do have callerID-type names as accounts in sip.conf.
> The hosts are set to dynamic. Is this a problem with type=peer?
As stated above, peers only match on IP+port for incoming calls.

> 
> Would the deny/allow suggestion posted earlier also work with type=friend?

Deny/allow is a different thing and doesn't really affect matching. It is applied AFTER matching, not during or before.

Cheers,
/O


More information about the asterisk-users mailing list