Setting up an Audiocodes MP-114/118 FXO with Asterisk and FreeSwitch
Audiocodes is one of the better, if not the best, SIP PSTN gateways available on the market. Problem has always been its most unfriendly user interface. They sure don’t make it easy. When they say you have to pay for quality one doesn’t consider both literally and figuratively. Any wrong setting can throw the whole thing off. You WILL RTFM!!! Not to say that I’m not the better for all that reading, just my eyes kind of hurt now. If you’re the type, like me, that doesn’t give up easily then Audiocodes may be for you. Quitters should stop reading now.
This is an FXO unit with 4 ports. The setup would be pretty much the same for a 118. I am using a standard vanilla Asterisk 1.4 install. I’ve always preferred a lunchbox Asterisk setup to a user friendly GUI because I find it much easier to troubleshoot when things aren’t working as advertised. This will be the first part in a continuing series on setting up these gateways in different scenarios. My FreeSwitch setup is using the vanilla default profile setup.
We only need to configure sip.conf and extensions.conf to get a working setup on the asterisk end.
Asterisk Setup:
sip.conf : We can use one (type=friend) or two (type=user & type=peer ) entries.
Single or Friend Settings
[pstn]
type=friend
context=inbound
dtmfmode=inband
host=192.168.xxx.xxx ; IP address of MP-114
nat=no
canreinvite=no
Paired or User/Peer Settings
[pstn-out] ; used for dialing out
type=peer ; peers help deliver the calls for us.
allow=ulaw
context=outbound ;not necessary to, but lets us know its function
dtmfmode=inband
host=192.168.xxx.xxx ; (This is the IP of the MP-114)
nat=no
qualify=no
[pstn-in]
canreinvite=no
context=inbound ; Where to deliver the inbound calls in extensions.conf
dtmfmode=inband
host=192.168.xxx.xxx
nat=never
type=user ;we are a user of MP-114 FXO
extensions.conf ; Doesn’t matter much here whether it’s friend or user/peer model
[outbound] ; Context for Outgoing Calls
exten => _NXXXXXX,1,Dial(SIP/${EXTEN}@pstn) ; @pstn-out if you’re using the user/peer model
exten => _NXXNXXXXXX,1,Dial(SIP/${EXTEN}@pstn)
[inbound] ; this is our telephone number
exten => _2125551212,1,Answer() ; let the gateway know we’ll handle it from here
exten => _2125551212,n,Wait(1) ; give a sec to get any passed info
exten => _2125551212,n,Dial(SIP/1001,25) ; or point it to your IVR
FreeSwitch Setup: I’m still a noob here. Originally I really completely over thought this one and made far it more complex than needed be. Failed, of course. Then I went super simple with it. Worked! I hope I don’t get flamed for poor design, but it works!
I needed to create an unauthenticated extension in the directory (extensions for asterisk users). This could dicey /unsafe, but it is internal.
/usr/local/freeswitch/conf/directory/default/pstn.xml:
Now for the dialplan settings that make it actually work . There are two place under the dialplan directory I needed to edit.
1. Let FreeSwitch know we have a number for the public to reach.
/usr/local/freeswitch/conf/dialplan/public.xml
2. Make sure the DID is in the default dialplan so FreeSwitch knows how to handle the calls
/usr/local/freeswitch/conf/dialplan/default.xml
First let’s receive calls.
Now let’s make calls. This is for 7 digit calls, but would apply to long distance also.
AudioCodes Setup
Quick Setup:
IP configuration: If you can’t figure this one out there’s little or no chance you’ll get this working. Put on dunce cap and sit in corner.
SIP parameters:
Gateway Name: I use it’s IP address so no dns issues.
Working with Proxy = Yes
Proxy IP address= the IP of the Asterisk box.
Proxy Name= the IP of the Asterisk box.
Protocol Management:
Protocol Definition ->
General Parameters:
Channel Select Mode=Ascending
And make sure SIP ports are set for 5060
Proxy and Registration:
Proxy Name and Proxy IP Address= Asterisk Server
Enable Registration: I didn’t .
Gateway Name and Registration Name: MP-114 IP address
Subscription and Registration Mode: Per Gateway (don’t remember if this matters).
Coders:make sure ulaw’s there
DTMF & Dialing: Max digits-> put a high number like 32
Routing Tables:
Tel -> IP routing and IP-> Tel routing = I used
Dest IP/Phone Prefix =*
Source IP/Phone Prefix =*
Dest/Source IP Address = Asterisk IP Address
Endpoint Phone Numbers: Match channels to phone numbers.
Channels= 1 -4
Phone numbers = your phone numbers
Hunt Group Settings:
I used Cyclical Ascending
End Point Settings:
Automatic Dialing:Destination Phone Numbers should match the numbers you have in inbound context in extensions.conf. In our example -> exten => _ 2125551212,1,Answer()
Advanced Applications:
FXO Settings: Dialing Mode should be set to One Stage.
That should get you up and running. Although little differences in setups can cause major headaches and frustrations, I hope that this gives you a good starting reference point. We’ll be putting this and other guides on our wiki when it becomes available (with screencaps).