Setting up an Audiocodes MP-114/118 FXO with Asterisk and FreeSwitch

July 24, 2008 by Garrett Smith

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).


15 Comments

  • Frank Tarczynski

    This works fine for the FXO ports, but I can’t figure-out the FXS ports. Each time I call from IP to Tel for a FXS port the MP-114 wants to route the call to an FXO port instead. Any ideas on setting-up the FXS ports?

  • Are you trying to go through asterisk or just extending dial tone from one MP114 FXO to a MP114 FXS? I have a how to on that also. Show me a schematic like pstn ->MP114-> ? of your telephony design and maybe I can help.

  • Is this unit a 2FXO/2FXS?

  • Mukesh Gaur

    I have following setup. PBX1->MP-118-FXO-A ——- LAN ——- MP-118-FXO-B->PBX2

    I am able to dial extension no. of PBX2 from PBX1 extension, using VoIP. But I have to wait while dialing. I mean I dial 1001 ( dial tone of MP-118-FXO-A is heard, than I dial 5 and wait and than i heard dial tone of MP-118-FXO-B and than I dial extension no. of PBX2. I want this process automatic, How Can I do that ?

  • Terry Stone

    I have the FXO/FXS gateway working fine after much hair tearing. The key is to set up trunk groups. I set up a different trunk group for each FXS which I set to register to asterisk per end point and one trunk group for FXO without registering. I have only just done it but will be producing a how to for my own use, can mail it to anyone who is interested once it is written, just mail me.

    • yes please, if you have a how to that would be great

  • Chris Athavale

    Hi Kevin,
    Could you direct me to the FXO/FXS setup. I have been trying for some time now, but with little success. Any help would be much appreciated.

    Cheers,
    Chris A

  • Noogie AW

    Hi,

    I have setup my FXO – LAN – FXS. the problem now is I can call ext but cannot be call. mean is outgoing fine but in coming cannot. Somebody please help me

  • Barni

    Hi,
    I want to call from asterisk to pstn ext. I have MP-114 hardware and when I call FXO port it give me a ring voice.But I want to call a number.How could I make it? Thanks and best regard

  • FYI:
    The XML examples in your Freeswitch section are not showing up in Firefox or IE. Maybe need to set them off with a or tag to avoid being interpreted?
    HTH,
    JDB

  • Hi,
    I am using GNUGK with Audiocodes MP-118.Everything is working fine for me.I can make the calls.I can hear the voice clearly but the only concern I have now is the call duration in which it is taking the ring time too.So the call duration which is I am taking now is wrong(It should not take the ring time into consideration)
    Please help me with this.You can contact me at [email protected]
    Regards,
    Santosh

  • Jospeh

    Terry Stone can you provide me with your Hunt Group setting;
    [email protected]

  • Saravanan.R

    Hi

    I am using Wellgate 2680 IP-EPBx, and wellgate phones working fine, now i got new model IP Phone AudioCodes 320HD, registration process completed. only incoming work, Outgoing problem. how to solve this

  • Scott

    Terry Stone,

    I’m interested in your setup for the FXO/FXS config. I have the FXO working, and calls from my FXS devices will call out…but no incoming.

    Please advise.

  • Patricia

    Hello, for some reason i can not dial OUT AT&T toll free nos, i believe i can dial OUT any other carrier’s toll free no…..i get nothing when i dial 800, 866, 877, or 888 prefix. AT&T is saying it is not their network, what settings do i have wrong? any advice appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Featured Posts

  • Popular Posts

  • Read Our Feed

  • Latest

  • VoIP Post Categories

  • Archives