The most common way to use an asterisk VoIP PBX is with an internal FXO card like Digium or Sangoma, but there are other ways, like using an external gateway like Quintum or Audiocodes to name just two of the options.

I am not an Asterisk expert, but I prefer the second aproach, as it may save CPU power on the Asterisk server, as the Analog to Digital and Digital to Analog conversion is now done in the external gateway instead of the Asterisk server.

Having said that, I will show you how to route calls to that external gateway, keep in mind that may be other ways to do this, and maybe better ways, but this is the one that worked for me. Create a SIP “user” for the FXO to log in

In the /etc/asterisk/sip.conf file create an entry for your FXO line.


This is tested with an Audiocodes Mediant 1000, with 12 lines, you must create all the twelve users in your sip.conf file, and then create them in the mediant 1000 to make it possible to log into the Asterisk.

Once this is done, you should work with the /etc/asterisk/extensions.conf file, there create the routing lines for external calls.

Create the dial rules

In the extensions.conf file add that, in the context you want to have access to external lines.

exten => _XXXXXXXX,1,Dial(SIP/3580773/${EXTEN}) ; will route only lines with 8 digits
exten => _XXXXXXX,1,Dial(SIP/3580773/${EXTEN}) ; will route only lines with 7 digits

Of course you can create different dial patterns but those will give you an idea about how to do it.

For the incoming calls, I have enables automatic dial in the Mediant (Audiocodes), I have made it call to extension 300.

And in the extensions.conf file this are the entries for that extension

exten => 300,1,NoOp(Ellamada al IVR)
exten => 300,n,Answer()             
exten => 300,n,Background(message-ivr)
exten => 300,n,Background(silence/5)  
exten => 300,n,HangUp                 
exten => 0,1,Dial(SIP/102)            
exten => t,1,Dial(SIP/102) 

I will explain in another post how this works, but basically, the message says “Hi, thank you for calling, blah, blah, blah, if you know the extension please dial it know, otherwise wait for the operator”, and yes, extension 102 is the operator extension.