Help with IAX

Okay, I’ve setup my first Asterisk box with three CO lines, fax detection, and a half-dozen SIP phones. Everything works great.

I’m now trying to figure out IAX to connect this * box to another * box at another office (I’ve inherited management of the remote box). Since these are both “in production” boxes, I can’t really play around with them the way I’d like and so I need to be fairly sure of what I’m doing before I implement changes.

Here’s the setup:

Office 1: (remote)

  • box with TDM400 card and three analog PSTN lines, plus a PRI line with plenty of DID numbers. About 15 extensions on Polycom 500/501 phones.

The extensions are xxx-23xx where the extension is the same as a DID number. Calls into DID numbers are routed to the same name extensions. Outbound calls go out through either (a) PRI or (b) IAX Voipjet account depending on whether the call matches a local telephone number or not.

Office 2: (local)

  • box with TDM400 card and three analog PSTN lines. Six extensions currently 100-105 all on Polycom 501 phones.

Things I need to accomplish:

  1. Convert Office 2 extensions to the xxx-23xx format so that they can be called directly from Office 1’s DID numbers, or called directly as extension numbers.

  2. All calls into PSTN #3 at Office 2 need to be forwarded to a queue at Office 1.

  3. Outgoing calls from Office 2 should go through the local analog PSTN lines for local calls, but may want to route them through Office 1 PRI or IAX voipjet account for long distance.

I’m having a hard time really understanding how IAX works, and I’m particularly wondering about the SWITCH statement and how it would affect usage.

Some general suggestions? Guidelines? Or specific examples (e.g. how do I do #2 above?)

Really I’m not understanding how connecting two * boxes works and how they get information from each other without the use of the switch function, which I guess only one of them can do?


Put the channel into a group with a unique context. From that context you can have your s extension route the call through an IAX trunk and into the queue at Office 1

An IAX trunk allows you to send multiple calls to and from Asterisk boxes over one VOIP channel. All it really boils down to is the same amount of RTP traffic but less control traffic. IAX trunks are not necessary, but they are usefull. The logic related to how calls flow between the boxes comes from your dialplan. I would recommend staying away from using the switch command in your dialplan when both boxes are not on the same LAN.