Open Source Training Seminar FreePBX Paid Support

Ticket #2747 (closed Bugs: fixed)

Opened 4 months ago

Last modified 2 months ago

2.4.0 forces IAX and SIP bind addresses to 0.0.0.0

Reported by: mudslide567 Assigned to: p_lindheimer
Priority: minor Milestone: 2.5
Component: Core Version: 2.4-branch
Keywords: Bind Address, SIP, IAX Cc:
Confirmation: Need Feedback SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

with 2.4.0, the iax.conf (and its SIP counterpart) is now simply a list of includes: { [general]

; These will all be included in the [general] context #include iax_general_additional.conf #include iax_general_custom.conf #include iax_registrations_custom.conf #include iax_registrations.conf

; These should all be expected to come after the [general] context ; #include iax_custom.conf #include iax_additional.conf #include iax_custom_post.conf }

the first file is iax_general_additional.conf which is a created file. the issue is that this file is created by /var/www/html/admin/modules/core/functions.inc.php which places the bindaddr into the file and is hard coded as 0.0.0.0

since this is the first file included, nothing placed in a subsequent x_custom.conf file can override it and basically, any requirement for a different IP address binding is not possible.

Current workarounds: (1) I have modified /var/www/html/admin/modules/core/functions.inc.php to put in the desired bind addresses (not very good workaround since this will be forgotten and next upgrade my system will break and I will wonder why (2)hand edit and then mark the x_general_additional.conf files as "read only" (better).

I think that if these parameters are set in an auto generated file, there needs to be a place in the GUI to actively manage the parameters.

Change History

03/18/08 20:29:57 changed by dallas

The priority of this should be higher. This effects more than port and bind address settings. It also effects available codecs and their selection order. The easiest fix might be to change the include order in sip.conf & iax.conf to put *_general_custom.conf before *_general_additional.conf?

03/30/08 21:20:36 changed by rolly

Why have the bindaddr and port specified at all as Asterisk defaults to 0.0.0.0:4569 for iax and 0.0.0.0:5060 for sip if left unspecified.

04/20/08 10:39:26 changed by mudslide567

when you cluster, the default bind 0.0.0.0 does not function. The bind address has to be the cluster floating address.

04/20/08 10:46:57 changed by p_lindheimer

  • confirmation changed from Unreviewed to Need Feedback.
  • component changed from - choose - to Core.
  • milestone changed from Cut Line to 3.0.

so has sip.conf changed - it should use the last value set, so if you do:

bindaddr=0.0.0.0
bindaddr=10.100.0.3

It should discard 0.0.0.0 as the bind address and use the new one set. Meaning if you do the same in a subsequent include file, it should have the same result. That is how it has worked in the past unless something has changed?

04/20/08 10:55:35 changed by p_lindheimer

Here is the parsing code out of the 1.4 branch - it appears to set the value 'blindly' meaning the last one set will take?

    } else if (!strcasecmp(v->name, "bindaddr")) {
      if (!(hp = ast_gethostbyname(v->value, &ahp))) {
        ast_log(LOG_WARNING, "Invalid address: %s\n", v->value);
      } else {
        memcpy(&bindaddr.sin_addr, hp->h_addr, sizeof(bindaddr.sin_addr));
      }

04/20/08 11:16:20 changed by p_lindheimer

  • status changed from new to closed.
  • resolution set to worksforme.

I just ran some test now on 1.2. and 1.4 to check this and it appears to work as it always has. I tested bindaddr setting by resetting it to a different value in sip_general_custom.conf, which comes after the _addtional.conf (for this reason) and then at the CLI 'sip show settings' and it is properly set to the new value. Similarly for codecs you can override the defaults with:

disallow=all ;override all values auto generated in _addtional
allow=g729
allow=gsm
allow=ulaw

As an example, all in the sip_general_custom.conf file, as above. I have not tested this on 1.6 - hopefully it has not changed, if so, then a new ticket should be opened. I'm going to close this for now as worksforme. If you find otherwise in some circumstances I have not covered, then either comment with specifics and we'll re-open, or file a new bug at the specific scenario if it is more of a corner case situation.

04/20/08 15:56:33 changed by dallas

p_lindheimer, It doesn't work for me. In sip_general_custom I have set bindaddr=192.168.40.56 and in sip_general_additional I set bindaddr=10.10.10.0 and after restating asterisk with restart gracefully the bind address is 10.10.10.0. So it uses the first address read (set in sip_general_additional) not the last. The same applies for codecs. Distribution PBXinaFlash Asterisk version 1.4.18.1 FreePBX version Core 2.4.0.1 Framework 2.4.0.0.

04/20/08 16:19:02 changed by p_lindheimer

hmm - I ran it on a pbxinaflash for testing with the above results, although running a slightly older Asterisk version. But the code excerpt above was from the 1.4 latest branch. Please check to make sure you don't have any typos. The way I describe is how sip conf parsing has always worked. Same with codecs, if you use disallow=all it resets the codecs and you should always be able to then set them to your desired codecs.

04/20/08 17:36:13 changed by p_lindheimer

I just tried it on 1.4.19 and it still works as I describe above.

04/20/08 17:51:02 changed by dallas

I think I found the issue. Here is my sip.conf. Note that sip_general_custom comes BEFORE sip_general_additional! How did that happen? See my comment from 18th March. The same is true for iax.conf.

sip.conf ; do not edit this file, this is an auto-generated file by freepbx ; all modifications must be done from the web gui

[general] ; ; enable and force the sip jitterbuffer. If these settings are desired ; they should be set in the sip_general_custom.conf file as this file ; will get overwritten during reloads and upgrades. ; ; jbenable=yes ; jbforce=yes

; These will all be included in the [general] context ; #include sip_general_custom.conf #include sip_general_additional.conf #include sip_nat.conf #include sip_registrations_custom.conf #include sip_registrations.conf

; These should all be expected to come after the [general] context

04/20/08 18:06:21 changed by p_lindheimer

if you did not change them yourself then you may want to check with the pbxinaflash team to make sure they did not do something. It is not the FreePBX code, you can take a look at svn and view the entire history of that file, it should never have been in that order.

04/20/08 18:13:25 changed by rolly

SIP seems OK from my test, but IAX is not. IAX seems to listen on the 0.0.0.0 address AND any other addresses specified in 'iax_general_custom.conf'

When I have no extra bindaddr entries in 'iax_general_custom.conf', IAX seems to listen on the 0.0.0.0 address AS WELL AS the extra addresses.

<snip output of netstta -an |grep 4569> udp 0 0 143.96.128.49:4569 0.0.0.0:* udp 0 0 143.96.128.111:4569 0.0.0.0:* udp 0 0 0.0.0.0:4569 0.0.0.0:* </snip>

04/20/08 18:29:35 changed by dallas

Thanks p_lindheimer, What is the consequences of changing both sip.conf and iax.conf? Will FreePBX rewrite them the next time I make a change?

04/20/08 18:35:21 changed by rolly

Actually the IAX multi-listen problem shows up on my asterisk-1.4.17 box, but not on my 1.4.18 machines, so maybe this is a bug that has been fixed since 1.4.17??

04/20/08 20:36:27 changed by p_lindheimer

doing a few tests on iax, it does appear that it binds to multiple addresses when you add them so this may be an issue, at least testing on 1.4.19, I have not checked on 1.2 or anything else.

We'll have to investigate, since I believe the default for iax is to bind to 0.0.0.0:4569 if nothing is specified, we may just remove the setting all together.

04/20/08 20:56:47 changed by rolly

Yeah, the real issue with the IAX multi IP bind is not with incoming connections to the extra bind addresses, but with outgoing connections using the wrong address. The reason I use the bindaddr for IAX is to force the source IP for outgoing IAX connections to use the virtual IP and if you have 0.0.0.0 specified, IAX uses the NIC address of the outgoing interface. :(

04/20/08 22:20:53 changed by p_lindheimer

rolly, why don't you open a new ticket against the iax issue specifically, mainly that it ends up dual homing it. Seems to make sense to take it out of the conf file all together and let it default if not sepcified - I'll just want to bounce it off someone else first.

04/24/08 15:02:23 changed by p_lindheimer

  • status changed from closed to reopened.
  • resolution deleted.

04/24/08 15:02:32 changed by p_lindheimer

  • status changed from reopened to closed.
  • resolution set to fixed.
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads