Configuring an IAX2 Trunk to Les.Net

Les.net is one of the VOIP providers I’m using, especially for outbound traffic. Their rates are pretty good, however I just can’t get inbound SIP calls working from them, despite configuring sip_nat.conf, turning on insecure=very and port forwarding all the SIP port ranges to my asterisk server. Inbound SIP from Junction Networks works perfectly, but they’re also more expensive, so I only use them for a local DID.

Documentation around the web on getting an IAX2 Trunk working with Les.Net is either sparse or wrong, at least currently. Perhaps some of the older forum posts used to work. I’m not sure, though – many contain some ‘out there’ ideas. This post aligns closely with Les.net configuration examples for SIP, just with the essential unexplained details to get each field just right. Who knows, perhaps some other network configurations need wild-and-crazy setups.

Anyway, on Les.NET, create a new peer, edit it, give it:

Peer Technology: IAX2
Password: YOUR_PEER_PASSWORD

And leave everything else blank or default – but select the codecs you can actually handle.

For Trixbox, create a new IAX2 Trunk.

Outbound Called ID: 1_PLUS_YOUR_NUMBER

Trunk Name: YOUR_LESNET_PEER_ID
PEER Details:
host=did.voip.les.net
secret=YOUR_PEER_PASSWORD
trunk=yes
type=peer
username=YOUR_LESNET_PEER_ID

USER Context: from-trunk
USER Details:
context=from-trunk
type=user

And for Register String:

YOUR_LESNET_PEER_ID:YOUR_PEER_PASSWORD@did.voip.les.net

Now, add that to an outbound route (I have it after the Les.net SIP route, which works in the outgoing direction and they seem to prefer), and create a new inbound route.

Configure:

DID Number: YOUR_DID_WITHOUT_A_1_AT_THE_FRONT

and save. Apply changes and you should be good to go. Now, go back to Les.net and verify that the IAX channel has registered and that it got your IP address. If it has, go ahead and assign your DID to this peer on the Les.net webpage.

If not, go in to a command line and have a look at the IAX2 debugging information:

/usr/sbin/asterisk -r
set iax2 debug

Upon proper registration you’ll see an IAX2 message ACK’ing the registration with your outside IP address.

Somebody really needs to define a schema for these kinds of configurations (a WSDL, perhaps?) and describe a web service such that the providers can provide simple description files and distros like Trixbox can understand how to parse them for setup. There are far too many possible variables, variations, lack of standards, and adherence to those aforementioned standards for the laity to stand a chance at building a working configuration. It took me four hours just to figure this one out, and that ain’t cool.