[asterisk-dev] unexpected behavior between chan_sip and chan_iax2 configuration files

Paul Belanger pabelanger at digium.com
Wed Sep 7 18:02:52 CDT 2011


On 11-09-03 05:47 PM, Tilghman Lesher wrote:
> On Saturday, September 03, 2011 12:58:57 PM Paul Belanger wrote:
>> Consider the following two configuration files:
>>
>> ---
>> ; sip.conf
>> [general]
>> udpbindaddr = 127.0.0.1:5060
>> #include "sip.general.conf.inc"
>>
>> ---
>> ; sip.general.conf.inc
>> udpbindaddr = 192.168.1.195:5060
>>
>> ---
>> ; iax.conf
>> [general]
>> bindaddr = 127.0.0.1
>> #include "iax.general.conf.inc"
>>
>> ---
>> ; iax.general.conf.inc
>> bindaddr = 192.168.1.195
>>
>> I would expect both to have the same behavior, which chan_sip.c will
>> bind to 192.168.1.195.  This is because, as I understand, chan_sip
>> can actually only bind to one interface (due to how it is written).
>>
>> However with chan_iax2, I am seeing something different.  It not only
>> binds to 192.168.1.195 but it also binds to 127.0.0.1.  It seem with
>> the bindaddr setting for chan_iax2, it does not override the
>> previous setting like chan_sip.c.
>>
>> I took a look into chan_iax2 and can see why, as the configuration
>> setting is read, asterisk binds right away. Where chan_sip, binds
>> after all the configuration file settings have been read.
>>
>> My question is, does chan_iax2 actually support binding to multiple
>> interfaces? Making it different then chan_sip or should the binding
>> happen like chan_sip, after parsing the complete configuration file?
>
> It does, but not in the way that you might expect.  It only supports
> setting a particular peer's sourceaddress in the peer definition to one
> of the alternate bind addresses.  If a packet is received on the "wrong"
> socket, the connection will likely not work correctly, because IAX
> depends upon receiving a response from the same IP as to which it sent
> the original packet.
>
Thanks for the information, personally I don't like it but I'll have to 
live with it.

However, since I am on the topic of 'overwriting' settings in a 
configuration file, is the following example in asterisk supported?

foo.conf
---
bar = yes
bob = smith
bar = no

I would assume bar is 'no', am I correct in thinking this is how 
configuration files should work?  Excluding the original example with 
bindaddr and chan_iax2.

-- 
Paul Belanger
Digium, Inc. | Software Developer
twitter: pabelanger | IRC: pabelanger (Freenode)
Check us out at: http://digium.com & http://asterisk.org



More information about the asterisk-dev mailing list