This is a brief description of a FS installation using the Sangoma A200 expandable analog voice card. Mine is a 4 port (2 FXS, 2 FXO) version but it is expandable to 24 ports. I originally was using it with Asterisk but became frustrated when it stopped working and I was unable to get any help from the Asterisk mailing list so I found out about FreeSWITCH and decided to give it a try.
The configuration I'll describe is not necessarily the best nor do I claim to be anything but an informed user. My background is not in telephony and I still have lots of trouble with the concepts. I purchased the FreeSWITCH 1.0.6 book but it does not touch on OpenZAP or FreeTDM other than refering the reader to this wiki (not this page). It was helpful in other ways however. I originally installed the A200 using OpenZAP but switched to FreeTDM with the advice of moy on the #freeswitch IRC channel.
I followed the instructions on http://wiki.sangoma.com/wanpipe-freeswitch-install to install the wanpipe drivers and FreeSWITCH with these exceptions:
- Use the latest source (via git) to be sure you've got the latest FreeTDM sources.
- Be sure to install Wanpipe before FreeSWITCH as the Sangoma wiki says.
- Before compiling FS edit the modules.conf file in the source root directory and uncomment this line
- The /usr/sbin/wancfg utility creates openzap.conf and autoload_configs/openzap.conf.xml files. The names need to be changed to freetdm.conf and autoload_configs/freetdm.conf.xml. I suspect this will not be necessary sometime in the near future.
- Be sure the wanpipe configuration is working OK before compiling FS. Start wanrouter via the '/etc/init.d/wanrouter start' command.
If you are running Freeswitch as a non-root user, the FreeTDM spans may fail to start. This is caused by the /dev/wanpipe* being owned by root. You need to chmod 666 /dev/wanpipe* to clear this issue
These are examples of the config files wancfg generated and my additions/edits.
I wanted to have the following configuration:
- The POTS phones connected to the A200 to be normal extensions and act identical to the SIP phones in my system. This means they will have to follow the same default dialplan with respect to making calls and be available to answer calls from other extensions and/or from the outside lines.
- The POTS lines connected to the A200 will be available as outbound trunks and as inbound lines, will be directed to a specific extension, which might just be a voicemail drop.
Create a file to support the fxs-ports context. I named mine /usr/local/freeswitch/conf/dialplan/00_freetdm.xml. This file is necessary to make a connection between the A200 POTS phones and FS. Since there appears to be no way to set variables in the FreeTDM config files, we need this intermediate step which sets some necessary variables. Once those are set, control is passed to the default context. Big thanks to Michael Collins who furnished the configuration.
There should be a better way of setting the default_gateway, but I was unable to figure it out. Michael didn't have anything to do with that line.
Substitute your gateway for the GATEWAY. If you set a default_gateway in the vars.xml file, you could use the same value. I wanted my POTS phones that are connected to the A200 to use my sip gateway to dial out. If you don't set a default gateway in the vars.xml file, you can leave out that step. If you want to use one of your A200 ports to dial out, you don't need it either.
I added the following to my dialplan/default.xml file:
It's almost the same as the Local_Extension extension block, except I bridge to freetdm/1/1. The numbering system is a bit arcane and I don't understand it but I was able to make it work by guessing. If you look at the freetdm.conf file, you'll see my phones are defined as 1:1 and 1:2 and it's almost logical that they would be addressed as freetdm/1/1 and freetdm/1/2. However if you try to apply that logic to the FXO lines, it doesn't work. 1:3 becomes freetdm/2/1 and 1:4 becomes freetdm/2/2. Multiple times over the last few years I've tried to nail Sangoma down and explain how that works and they give me information that makes no sense. The last explanation I got was
When I asked where I was supposed to get the info to plug into that template, I was told it's in the config file. However nowhere in the config file can I warp anything into what works.
So you're on your own if your A200 is configured differently from mine, but maybe there's enough info here to extrapolate to a different setup. He also told me to ignore the last part. I could never get him to tell me what the last part was, but now that I have it working, I see the last part starts with the word "channel".
Sorry to be so long winded but this has frustrated me literally for years and I hope it helps others.
I don't currently have a second phone attached to the A200 so I didn't add an extension block, but it should be trivial to duplicate that block, changing the extension number and the bridge line.
With this much in place you should be able to dial up extension 1100 and have it ring.
Also you should be able to dial out over the default gateway.
Next we'll want to route the incoming calls from the POTS lines connected to our A200.
I generated the following file, dialplan/public/00_inbound_did.xml
This causes all calls to my 7707190068 POTS line to be routed to extension 1003 which is a SIP phone in my office.
Now the last part of the puzzle is how to use the A200 POTS lines to dial out. Actually that's one of the simpler things if you know the secret to addressing the freetdm ports.
This is a section of my dialplan/default.xml file:
For testing I wanted to use a slightly different dialing pattern to uniquely address the POTS line. To dial using this path, dial 9 and the 10 digit phone number. In our dialing area local numbers require all 10 digits since we have multiple area codes.
Another A200D Configuration
After installation on Debian Squeeze with FreeSwitch Git (29/10/2011) and Wanpipe 3.5.23. Did auto-configuration by wancfg_ftdm script. I had these two files auto generated. While the files referenced the channels as 1:[1-4] it was, as stated above, a little different as they were referenced in the XML dialplan.
Here are two very minimal dialplan examples. Also sending the incoming calls from FXO to the IVR worked OK. As more configuration is done this page will be updated.