Summary:ASTERISK-06441: asterisk-1.2.x iax.conf bindport= is ignored if bindaddr= is not present
Reporter:dgorski (dgorski)Labels:
Date Opened:2006-02-28 13:23:37.000-0600Date Closed:2006-03-31 12:44:30.000-0600
Versions:Frequency of
Description:iax.conf, [general] when using bindport=xxxx, the setting is completely ignored (defaults to IAX_DEFAULT_PORTNO) if bindaddr= is not also set. This was not the case in <=asterisk-1.0.8 but appears to be an issue in asterisk-1.2.4 and I believe asterisk-1.2.3.


Workaround: use the default IAX port or define bindaddr= when bindport= is required.

It seems to me after looking at chan_iax.c what calling ast_netsock_bind() while still parsing the configuration file is a bad idea. Someone mentioned that in ASTERISK-4814850 (tos tag broken in iax.conf) as well.

This was a real problem during my upgrade from 1.0.x to 1.2.x as none of my IAX trunking worked any more (because I was using bindport= with a non-default port number, and did not use bindaddr=).
Comments:By: Andrey S Pankov (casper) 2006-03-01 21:41:05.000-0600

Your problem is because ast_netsocket_bind is called inside "if (!strcasecmp(v->name, "bindaddr"))" control. In load_module we check whether we've already binded to a socket - "if (defaultsockfd < 0)". So this is not a problem.

By: dgorski (dgorski) 2006-03-01 22:15:31.000-0600

Thank you for reiterating my "additional comments".

As for "this is not a problem", I strongly disagree.

If bindport= comes *before* bindaddr=, it is used. If it comes *after* bindaddr=, it is IGNORED. If bindaddr= is never specified, bindport= is IGNORED.

This is inconsistent behaviour at best. Most people would say it is inappropriate, or even *incorrect* behaviour.

Anyway, it's not *my* problem, it's chan_iax2's problem. I'm just reporting it.

By: Andrey S Pankov (casper) 2006-03-01 22:27:20.000-0600

I meant "the problem"... ;)

By: Russell Bryant (russell) 2006-03-31 12:44:09.000-0600

The reason the order is forced is because we support binding to multiple IP addresses with different ports.  So, we use the last specified bindport with each address specified with bindaddr so that the port can be changed for different bindaddr's.  This is documented in the sample configuration files.

I have fixed in the case where bindport is specified and bindaddr is not in the 1.2 branch and the trunk, in revisions 16744 and 16745.