LinuxMCE Forums

General => Users => Topic started by: davegravy on August 27, 2009, 05:00:14 AM

Title: iphone (SIAX client) and asterisk
Post by: davegravy on August 27, 2009, 05:00:14 AM
I'm using SIAX on my iphone as an extension in linuxmce and am experiencing a strange situation.

When using the iphone over wifi (connected to internal linuxmce network) I must use 192.168.80.1 as the host name to register. If I use the internet IP address of my core, i get no registration (asterisk CLI shows nada in the way of connection attempts).

When using the iphone on 3G, using the internet IP address of my core works. Since obviously using 192.168.80.1 when connected via 3G won't work, this means I have to switch the server name each time I go on and off wifi.

Any ideas why I can't use the internet IP when inside the linuxmce network?
Title: Re: iphone (SIAX client) and asterisk
Post by: colinjones on August 27, 2009, 08:24:26 PM
hmm possibly because the LMCE firewall is NAT'ing any traffic coming out of the internal network. You could try temporarily turning off the LMCE firewall and seeing if that changes the behaviour (because this will turn off the NATing as well). Is your external IP address of your core still a private address or is your core getting a public address from your ISP? Do ifconfig -a
Title: Re: iphone (SIAX client) and asterisk
Post by: davegravy on August 27, 2009, 09:24:32 PM
Thanks Colin, I'll try this tonight when I'm home. The external IP is a public internet address.
Title: Re: iphone (SIAX client) and asterisk
Post by: davegravy on August 28, 2009, 12:01:39 AM
Tried your suggestion of disabling the firewall - doesn't work. Any other ideas?
Title: Re: iphone (SIAX client) and asterisk
Post by: colinjones on August 28, 2009, 01:40:08 AM
For a start of, as your core is exposed to the Internet, re-enable the firewall!

I'm not familiar with the IAX protocol so I'm flapping around in the dark!

Can you start by checking what IP address, net mask and default gateway the phone gets whilst it is on the Internal network? Do you have any network tools for the iPhone? (such as ping, traceroute, telnet, arp, etc)
Title: Re: iphone (SIAX client) and asterisk
Post by: dlewis on August 28, 2009, 01:54:04 AM
make sure you have asterisk in verbose mode to see the full output.
Title: Re: iphone (SIAX client) and asterisk
Post by: davegravy on August 28, 2009, 04:39:03 AM
IAX uses port 4569 (udp)... that's about all I can tell you about it.

iPhone It's set up to use DHCP (I've tested static settings as well). Here's the info it gives:

IP - 192.168.80.144
Subnet Mask - 255.255.255.0
Router - 192.168.80.1
DNS - 192.168.80.1
Search Domains - (blank)
Client ID - (blank)

As for tools I have on the iphone, I have an SSH terminal app, a tracert and a ping app.

I've been using verbosity = 9 in the asterisk CLI, I hope this is sufficient.

Thanks for the help,

Dave

Title: Re: iphone (SIAX client) and asterisk
Post by: dlewis on August 28, 2009, 04:43:41 AM
pastebin your cli output...
Title: Re: iphone (SIAX client) and asterisk
Post by: davegravy on August 28, 2009, 03:53:48 PM
That's just it... There isn't any CLI output, unless of course I use the settings that work mentioned in the original post at which point it mentions successful registration etc. 

This suggests the packets sent when the phone tries to register aren't even making it to Asterisk. Is there a way to trace the packets through the various stages of routing that occurs within the core, to see where they are getting stopped? I suppose it's possible they're not even leaving the iPhone (if apple's draconian firmware is meddling with things) This is beyond my level of troubleshooting... Appreciate your help.
Title: Re: iphone (SIAX client) and asterisk
Post by: dlewis on August 28, 2009, 04:07:34 PM
well, there is a bigger issue if the CLI doesn't have any output. At a minimum, it should show some attempt to connect or something.
Title: Re: iphone (SIAX client) and asterisk
Post by: davegravy on August 28, 2009, 07:32:34 PM
Well the issue is NOT specifically with the iphone. I installed an IAX softphone on one of my PCs on the linuxmce internal network, and the same thing happens.
   ie. can connect no problem to 192.168.80.1, but not to <MY INET IP>.

Here is a 30s log of IAX traffic when the client attempts (and succeeds) to register using 192.168.80.1, on both eth0 and eth1 interfaces:

http://pastebin.com/m2efb08bf (http://pastebin.com/m2efb08bf)

Here is a 30s log of IAX traffic when the client attempts (and fails) to register using <MY INET IP>, on both eth0 and eth1 interfaces:

http://pastebin.com/m7dbfc87f

I have no idea what 24.114.232.35 is. It's not my IP, nor does it belong to my VOIP provider (iax04.unlimitel.ca)

Title: Re: iphone (SIAX client) and asterisk
Post by: colinjones on August 28, 2009, 10:58:39 PM
Quote from: davegravy on August 28, 2009, 07:32:34 PM
Well the issue is NOT specifically with the iphone. I installed an IAX softphone on one of my PCs on the linuxmce internal network, and the same thing happens.
   ie. can connect no problem to 192.168.80.1, but not to <MY INET IP>.

Here is a 30s log of IAX traffic when the client attempts (and succeeds) to register using 192.168.80.1, on both eth0 and eth1 interfaces:

http://pastebin.com/m2efb08bf (http://pastebin.com/m2efb08bf)

Here is a 30s log of IAX traffic when the client attempts (and fails) to register using <MY INET IP>, on both eth0 and eth1 interfaces:

http://pastebin.com/m7dbfc87f

I have no idea what 24.114.232.35 is. It's not my IP, nor does it belong to my VOIP provider (iax04.unlimitel.ca)



hmmm... strange.... the 24.114.232.x addresses are Rogers Cable ... are you perhaps using Rogers for your iPhone telco? If so, then it looks like your phone is still attempting to connect externally at that point as well as internally.... realistically the only traffic on that interface you should see (when connecting internally) is your VSP, and probably only SIP traffic even then. Theres a stray 209.217.98.134 address to which is Magma Communications (part of Primus Canada).....

The second capture looks much the same.... still seeing traffic on both sides when really you shouldn't.... stronly suspect that the 24.114.232.x addresses are your iPhone's IP address through your telco..
Title: Re: iphone (SIAX client) and asterisk
Post by: davegravy on August 29, 2009, 03:38:50 PM
Quotehmmm... strange.... the 24.114.232.x addresses are Rogers Cable ... are you perhaps using Rogers for your iPhone telco? If so, then it looks like your phone is still attempting to connect externally at that point as well as internally.... realistically the only traffic on that interface you should see (when connecting internally) is your VSP, and probably only SIP traffic even then. Theres a stray 209.217.98.134 address to which is Magma Communications (part of Primus Canada).....

The second capture looks much the same.... still seeing traffic on both sides when really you shouldn't.... stronly suspect that the 24.114.232.x addresses are your iPhone's IP address through

Rogers is my ISP, but the test below was done with a softphone client installed on a windows PC inside the lmce internal network, not the iPhone. The iPhone was off. It's all very puzzling  ???

Title: Re: iphone (SIAX client) and asterisk
Post by: colinjones on August 29, 2009, 03:47:34 PM
Don't suppose your VSP is using IAX to connect to your core is it?
Title: Re: iphone (SIAX client) and asterisk
Post by: davegravy on August 29, 2009, 03:58:13 PM
By VSP I assume you mean Voip Service Provider. My VSP is iax04.unlimitel.ca (209.217.98.134) and is most definitely connecting to my core via IAX. Why Rogers and Magma Communications IPs are involved is beyond me.
Title: Re: iphone (SIAX client) and asterisk
Post by: colinjones on August 30, 2009, 02:15:47 AM
I don't either, could be some kind of proxy but that doesn't seem likely. Perhaps capture the traffic and take a look at the IAX handshaking .... its probably human readable, and it may confirm whether or not the traffic is actually coming (originally) from your VSP...
Title: Re: iphone (SIAX client) and asterisk
Post by: Raul102801 on August 31, 2009, 05:40:08 PM
Guys this is a common networking issue. What you are trying to do is initiate traffic inside your firewall, reach the firewall and translate the address back to your internal host and send the traffic back inside. To me the easiest way to fix this is to use DNS... I don't know much about VOIP and I don't know if you can use a domain name instead of an IP address. If you can, problem solved. Use DynDNS to give your public address a domain name and then use an internal dns to map the same domain name to the internal address. If this is not possible, then you are looking at hairpin NAT which I do not know if LinuxMCE is capable of doing.

Because an origin endpoint and its router in a subnetwork may not recognize that a message is intended for a destination endpoint in the same subnetwork because it only knows its public IP address, the Internet Network Address Translation (NAT) server must be able to recognize the situation and hairpin the message back to the subnetwork so that it can reach its destination.


I am not an expert by all means, and there might be an easier way to do this so if someone knows of a better way please present it as I would love to know how.


Title: Re: iphone (SIAX client) and asterisk
Post by: davegravy on August 31, 2009, 09:31:14 PM
You can use a domain name with IAX, so your DNS solution should work.

I'm by no means an expert either. If it's a common networking issue, can someone explain why I can access lmce-admin (http) using the public IP of my core from within the lmce internal network, but the same is not true for this IAX service?
Title: Re: iphone (SIAX client) and asterisk
Post by: colinjones on August 31, 2009, 11:14:51 PM
Raul - that's precisely why I asked davegravy to turn off his firewall, to eliminate the possibility of the NAT causing the issue in the way you described. He has done that - without the firewall, it becomes a straight router with no NATing involved - and yet it didn't solve the problem.
Title: Re: iphone (SIAX client) and asterisk
Post by: Raul102801 on August 31, 2009, 11:34:06 PM
Colin you are right... I guess I missed that part.... I am very new to Linux and still learning the basics but one thing comes to mind... If you disable the firewall, does that take effect immediately or would you need to reboot?

Of course that still does not explain the fact that you can access the web admin site on the public address from inside (I understand this happens even with the firewall turned on?).
Title: Re: iphone (SIAX client) and asterisk
Post by: colinjones on August 31, 2009, 11:47:11 PM
yeah, there is a core input rule that allows that, and its not doing the hairpin nat in that case, but either way once the firewall is turned off there is no natting anyway - no, it doesn't need a reboot... so I dunno why it doesn't work (always a bit dubious of the statefulness of UDP protocols, but can't think of anything specific in this case)
Title: Re: iphone (SIAX client) and asterisk
Post by: davegravy on September 21, 2009, 09:29:33 PM
I've fixed this by implementing Raul102801's suggestion above. I modified my named configuration such that my dyndns hostname resolves to 192.168.80.1 from within my internal LMCE network, instead of the public internet IP of the core.

Do you guys consider this a band-aid solution? If not, should I modify the trac ticket (#324) i submitted for this issue and include my solution?