{"id":1772,"date":"2008-07-24T09:14:13","date_gmt":"2008-07-24T13:14:13","guid":{"rendered":"http:\/\/blog.voipsupply.com\/?p=1772"},"modified":"2024-10-08T17:03:40","modified_gmt":"2024-10-08T21:03:40","slug":"setting-up-an-audiocodes-mp-114118-fxo-with-asterisk-and-freeswitch","status":"publish","type":"post","link":"https:\/\/www.voipsupply.com\/blog\/voip-insider\/setting-up-an-audiocodes-mp-114118-fxo-with-asterisk-and-freeswitch\/","title":{"rendered":"Setting up an Audiocodes MP-114\/118 FXO with Asterisk and FreeSwitch"},"content":{"rendered":"<p>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\u2019t make it easy. When they say you have to pay for quality one doesn\u2019t consider both literally and figuratively. Any wrong setting can throw the whole thing off. You WILL RTFM!!! Not to say that I\u2019m not the better for all that reading, just my eyes kind of hurt now. If you\u2019re the type, like me, that doesn\u2019t give up easily then Audiocodes may be for you. Quitters should stop reading now.<\/p>\n<p>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\u2019ve always preferred a lunchbox Asterisk setup to a user friendly GUI because I find it much easier to troubleshoot when things aren\u2019t 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.<\/p>\n<p>We only need to configure sip.conf and extensions.conf to get a working setup on the asterisk end.<br \/>\n<strong>Asterisk Setup: <\/strong><\/p>\n<blockquote><p>sip.conf : We can use one (type=friend) or two (type=user &amp; type=peer ) entries.<\/p><\/blockquote>\n<p><strong>Single or Friend Settings<\/strong><\/p>\n<blockquote><p>[pstn]<br \/>\ntype=friend<br \/>\ncontext=inbound<br \/>\ndtmfmode=inband<br \/>\nhost=192.168.xxx.xxx ; IP address of MP-114<br \/>\nnat=no<br \/>\ncanreinvite=no<\/p><\/blockquote>\n<p><strong>Paired or User\/Peer Settings<\/strong><\/p>\n<blockquote><p>[pstn-out] ; used for dialing out<br \/>\ntype=peer ; peers help deliver the calls for us.<br \/>\nallow=ulaw<br \/>\ncontext=outbound ;not necessary to, but lets us know its function<br \/>\ndtmfmode=inband<br \/>\nhost=192.168.xxx.xxx ; (This is the IP of the MP-114)<br \/>\nnat=no<br \/>\nqualify=no<br \/>\n[pstn-in]<br \/>\ncanreinvite=no<br \/>\ncontext=inbound ; <strong>Where to deliver the inbound calls in extensions.conf<\/strong><br \/>\ndtmfmode=inband<br \/>\nhost=192.168.xxx.xxx<br \/>\nnat=never<br \/>\ntype=user ;<strong>we are a user of MP-114 FXO<\/strong><\/p><\/blockquote>\n<p><strong>extensions.conf<\/strong> ; Doesn\u2019t matter much here whether it\u2019s friend or user\/peer model<\/p>\n<blockquote><p>[outbound] ; Context for Outgoing Calls<br \/>\nexten =&gt; _NXXXXXX,1,Dial(SIP\/${EXTEN}@pstn) ; @pstn-out if you\u2019re using the user\/peer model<br \/>\nexten =&gt; _NXXNXXXXXX,1,Dial(SIP\/${EXTEN}@pstn)<br \/>\n[inbound] ; this is our telephone number<br \/>\nexten =&gt; _2125551212,1,Answer() ; let the gateway know we\u2019ll handle it from here<br \/>\nexten =&gt; _2125551212,n,Wait(1) ; give a sec to get any passed info<br \/>\nexten =&gt; _2125551212,n,Dial(SIP\/1001,25) ; or point it to your IVR<\/p><\/blockquote>\n<p><strong>FreeSwitch Setup<\/strong>: I\u2019m 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\u2019t get flamed for poor design, but it works!<br \/>\nI needed to create an unauthenticated extension in the directory (extensions for asterisk users). This could dicey \/unsafe, but it is internal.<\/p>\n<p><strong>\/usr\/local\/freeswitch\/conf\/directory\/default\/pstn.xml:<\/strong><\/p>\n<blockquote><p><!-- params--><br \/>\n<!--param name=\"password\" value=\"1234\"\/--><br \/>\n<!--\/params--><\/p><\/blockquote>\n<p>Now for the dialplan settings that make it actually work . There are two place under the dialplan directory I needed to edit.<\/p>\n<p>1. Let FreeSwitch know we have a number for the public to reach.<\/p>\n<p><strong>\/usr\/local\/freeswitch\/conf\/dialplan\/public.xml<\/strong><\/p>\n<blockquote><p><!-- http:\/\/wiki.freeswitch.org\/wiki\/Dialplan_XML --><\/p><\/blockquote>\n<p>2. Make sure the DID is in the default dialplan so FreeSwitch knows how to handle the calls<\/p>\n<p><strong>\/usr\/local\/freeswitch\/conf\/dialplan\/default.xml<\/strong><\/p>\n<p>First let\u2019s receive calls.<\/p>\n<blockquote><p><!-- Inbound calls handled first - You will want to configure one or            --><br \/>\n<!-- If you have a number of similar DID's and they get the same call treatment --><\/p>\n<p><!-- EDIT: change the DID to your inbound DID (DN) number     --><\/p>\n<p><!-- Set the maximum amount of time you want to ring the extensions (seconds) --><\/p>\n<p><!-- Sample single extension bridge --><\/p><\/blockquote>\n<p>Now let\u2019s make calls. This is for 7 digit calls, but would apply to long distance also.<\/p>\n<blockquote><p><!-- Dial any 7 digit number (3334444) as 10 digit dialing  but pass to a local itsp --><\/p>\n<p><!-- Set your outgoing caller ID name here --><br \/>\n<!-- action application=\"set\" data=\"effective_caller_id_name=John Freeswitch\"\/ --><\/p>\n<p><!-- EDIT:  Your Audio Codes IP                          --><\/p>\n<p><!-- action application=\"bridge\" data=\"openzap\/2\/2\/$1\"\/ --><\/p><\/blockquote>\n<p><strong>AudioCodes Setup<\/strong><br \/>\nQuick Setup:<\/p>\n<p><strong>IP configuration:<\/strong> If you can\u2019t figure this one out there\u2019s little or no chance you\u2019ll get this working. Put on dunce cap and sit in corner.<\/p>\n<p><strong>SIP parameters:<\/strong><br \/>\nGateway Name: I use it\u2019s IP address so no dns issues.<br \/>\nWorking with Proxy = Yes<br \/>\nProxy IP address= the IP of the Asterisk box.<br \/>\nProxy Name= the IP of the Asterisk box.<\/p>\n<p><strong>Protocol Management:<br \/>\nProtocol Definition -&gt;<br \/>\nGeneral Parameters:<\/strong><\/p>\n<p>Channel Select Mode=Ascending<\/p>\n<p>And make sure SIP ports are set for 5060<\/p>\n<p><strong>Proxy and Registration:<\/strong><br \/>\nProxy Name and Proxy IP Address= Asterisk Server<\/p>\n<p>Enable Registration: I didn\u2019t .<\/p>\n<p>Gateway Name and Registration Name: MP-114 IP address<\/p>\n<p>Subscription and Registration Mode: Per Gateway (don\u2019t remember if this matters).<\/p>\n<p><strong>Coders:<\/strong>make sure ulaw\u2019s there<\/p>\n<p><strong>DTMF &amp; Dialing:<\/strong> Max digits-&gt; put a high number like 32<\/p>\n<p><strong>Routing Tables:<\/strong><br \/>\nTel -&gt; IP routing and IP-&gt; Tel routing = I used<\/p>\n<p>Dest IP\/Phone Prefix =*<\/p>\n<p>Source IP\/Phone Prefix =*<\/p>\n<p>Dest\/Source IP Address = Asterisk IP Address<\/p>\n<p><strong>Endpoint Phone Numbers:<\/strong> Match channels to phone numbers.<br \/>\nChannels= 1 -4<br \/>\nPhone numbers = your phone numbers<\/p>\n<p><strong>Hunt Group Settings:<\/strong><br \/>\nI used Cyclical Ascending<\/p>\n<p><strong>End Point Settings:<\/strong><br \/>\n<strong>Automatic Dialing:<\/strong>Destination Phone Numbers should match the numbers you have in inbound context in extensions.conf. In our example -&gt; exten =&gt; _ 2125551212,1,Answer()<\/p>\n<p><strong>Advanced Applications:<\/strong><br \/>\n<strong>FXO Settings: <\/strong>Dialing Mode should be set to One Stage.<br \/>\nThat 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\u2019ll be putting this and other guides on our wiki when it becomes available (with screencaps).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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. <\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1222],"tags":[],"class_list":["post-1772","post","type-post","status-publish","format-standard","hentry","category-technical-advice"],"_links":{"self":[{"href":"https:\/\/www.voipsupply.com\/blog\/voip-insider\/wp-json\/wp\/v2\/posts\/1772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.voipsupply.com\/blog\/voip-insider\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.voipsupply.com\/blog\/voip-insider\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.voipsupply.com\/blog\/voip-insider\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.voipsupply.com\/blog\/voip-insider\/wp-json\/wp\/v2\/comments?post=1772"}],"version-history":[{"count":1,"href":"https:\/\/www.voipsupply.com\/blog\/voip-insider\/wp-json\/wp\/v2\/posts\/1772\/revisions"}],"predecessor-version":[{"id":311019,"href":"https:\/\/www.voipsupply.com\/blog\/voip-insider\/wp-json\/wp\/v2\/posts\/1772\/revisions\/311019"}],"wp:attachment":[{"href":"https:\/\/www.voipsupply.com\/blog\/voip-insider\/wp-json\/wp\/v2\/media?parent=1772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.voipsupply.com\/blog\/voip-insider\/wp-json\/wp\/v2\/categories?post=1772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.voipsupply.com\/blog\/voip-insider\/wp-json\/wp\/v2\/tags?post=1772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}