ftocc

IAX2 behind PPPoE NAT devices - Script Hack Fix or...can someone help!

wirehead
Posts: 7
Member Since:
2006-09-21

Hello all.

This is something i've run into myself, and my VOIP IAX2 provider has this issue with many clients running Asterisk on TrixBox or custom made systems.

If our PPPoE goes down, we have to reboot our trixbox to get our IAX2 link up. I have the 4569 forwarded internall. I've put TCPDUMP on my Router. I've done my homework. We have a fixed IP.

I as of yet have not gotten around this. BUt i have a dirty script that avoids havig to reboot the TrixBox and restore our service within 2 minutes of a blip automatically, and logs the 'blips'. This will save my a$$ as this is a production system for a small business. Perhaps it will save someone else some pain.

Here is the script. Its dirty, but it works. *IF* someone can help me get this thing working behind our NAT, let me know. I think its related to me not being able to use "Consistent NAT". We're using a Linksys WRT54GS with DD-WRT v230-SP2. Yes SPI is turned off, I tried all types and kinds of forwarding too! I'm a bigtime network guy so reply with detailed info if you have it for me....

---------------------------------
With the script below, use a CRON job to execute it. Say every two minutes. Warning, memory leak will occur over time during LONG outages!

If anyone has feedback let me know. I'm not a bash guru but i solved the problem for us, so hey hey.

I'd say the guys who wrote the chan_iax2.so need to make generate network traffic however this 'hack' does, if they DID, then IAX2 would work behind ANY flavor of NAT device!!!!
---------------------------------

#!/bin/sh
# Written by Greg Jacobs - IAX2 Shitty Nat Reconnect Fix

#We record the status of the IAX2 Trunk

cd /root/ # I have script live in root,
#change to suit or use full
# paths in rest of script,
# i'm not BASH guru

/usr/sbin/asterisk -rx 'iax2 show registry' > reg_status
sleep 1

#We then Scan the Status and see if we're online or not...

TEST="Registered"
if grep $TEST reg_status > /dev/null
then
exit #Abort, we are online, all is well...
fi

#IF we're this far down, we've lost IAX. Log the incident.

date >> slap.log

#Restart the IAX2 trunk. Delay required for some reason.

/usr/sbin/asterisk -rx 'unload chan_iax2.so' > /dev/null
sleep 60
/usr/sbin/asterisk -rx 'load chan_iax2.so' > /dev/null



bubbapcguy
Posts: 3344
Member Since:
2006-06-02
Re: IAX2 behind PPPoE NAT devices - Script Hack Fix or...can som

with dsl I get the bridged connection...PPOE is just dialup it times out...



wirehead
Posts: 7
Member Since:
2006-09-21
Re: IAX2 behind PPPoE NAT devices - Script Hack Fix or...can som

I have a keepalive on the DSL of 20 seconds but yes you are right. Its how most routers/nat boxes that handle DSL PPPoE sessions work, they seem to forget all their NAT mappings when the interface goes down/up or its rebooted etc.

I'll have to push for a ADSL type connection long term, HOWEVER this trick gets around it if you are home user or small business until someone working on Asterisk can emulate protocol/network traffic like what I did here, and they can make IAX2 work superb for PPPoE DSL type users etc. It would also allow IAX2 to work behind nat boxes with no forwarded ports as long as the UDP connections are set to expire greather than 60 seconds (most de-reg delays for most providers/setups). Food for thought!



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.