VoIP PSTN Gateway
Yate has the functionality of a VoIP - PSTN gateway. It's main task is to provide signaling interworking and to transform the information it receives on one side in information compatible with the other side.
Yate can be configured as a gateway from SIP to ISDN or from SIP to SS7(ISUP) by using local circuits like Sangoma cards or by using remote circuits like Media Gateways.
Yate can connect an existing PBX to alternative VoIP providers providing cost savings for enterprises. It can also be used by providers to connect their TDM network to IP networks providing cost savings for long distance calls.
The setup described in this article will use Sangoma card and will use Yate as a gateway from SIP to ISDN.
We will need a server with linux and a Sangoma card (A104). The linux installed on the server:
# cat /etc/issue Mandriva Linux release 2010.2 (Official) for i586 Kernel 220.127.116.11-desktop-2mnb on a Dual-processor i686
Installing Sangoma cards under Linux
Sangoma Linux Driver (Wanpipe) require a list of packages on your system prior to install.
- C developement tools ...(gcc)
- C++ developement tools
- Make utility
- Ncurses library
- Perl developement tools
Sangoma card driver installation
Download the driver from: ftp://ftp.sangoma.com/linux/current_wanpipe/
# cd /usr/src/ # ls wanpipe-3.5.28.tgz # tar zxvf wanpipe-3.5.28.tgz # cd wanpipe-3.5.28 # ./Setup install
The interface will verify that all required tools are installed and ask you if you want to install Wanpipe now. Press 'Y'(yes) to start the installation. Next, you will be asked if you would like to build the WANPIPE kernel driver modules. Answer 'Y' again.
You will then be asked to specify the absolute pathname of your Linux directory. You can press Enter to accept the default. If this does not work for you, write the path. You will again be asked to confirm that you wish to build the kernel drivers. Press 'Y' again.
Now comes the important question: the Setup program wants to know what compilation mode you wish to use. You'll want to select the option for the Custom Compilation Mode , which in the case of wanpipe-3.5.28 is option 5.
Then you'll be asked about the API Protocols, you have to write: AFT_TE1 and BITSTRM.
Please select a protocol option in [<opt>]: AFT_TE1 Enabling the AFT TE1 Support .................. Please select a protocol option in [<opt>]: BITSTRM Enabling the BITSTRM Protocol ..................
After setting the protocol options, type Q to exit from this setup and continue the installation.
The final question:
Would you like to install WANPIPE start-up scripts? (y/n) y
And that's all:
WANPIPE INSTALLATON: COMPLETE
If you want to test, you can run
#wanrouter hwprobe #wanrouter status
Follow the procedure outlined here to configure Wanpipe into two timeslot groups for YATE. First, as the root user, issue the following command:
This will start the WANPIPE Configuration Utility, which will build the Wanpipe configuration files. Press OK at the first screen, select Create a new Configuration File and press Enter. You will see a list of the configuration files that are possible, and their states. For a new installation, press Enter to select wanpipe1.conf. Select the following from the list of detected cards:
AFT-A104u SLOT=2 BUS=5 IRQ=3 CPU=A PORT=1 V=13
If you are not in North America, you will probably need to change the physical medium from T1 to E1 using the first submenu from the next screen. We will write E1 for the physical medium. Next, you’ll have to configure the timeslot groups using the second submenu. You will need to define two timeslot groups: one for the D-channel, and the other for all the B-channels.
E1 configuration: Timeslot Group 1 Configuration: Timeslots in Group-> 16 HDLC engine--------> Enabled Idle char ---------> 0x7E MTU ---------------> 1200 MRU ---------------> 1200 Timeslot Group 2 Configuration: Timeslots in Group-> 1-15.17-31 HDLC engine--------> Disabled Idle char ---------> 0x7E MTU ---------------> 1200 MRU ---------------> 1200
Specify MTU and MRU values. They should be the same. MTU/MRU values indicate the Rx/Tx CHUNK Size.To calculate MTU/MRU multiply your desired CHUNK size by the number of active channels. eg: 30 channels * 40bytes (which is 5ms voice chunk) = 1200 bytes.
Note: To avoid problems the chunk size must be a multiple of four.
You'll need to tell Wanpipe what each timeslot will be used for. The timeslots will be referred to as w1g1 and w1g2 (Wanpipe 1 group 1 and Wanpipe 1 group 2). If you have a multiport Wanpipe card, you may have other group names as well. For your current purposes, you'll want to be running HDLC streaming on each timeslot, with an operation mode of API. The timeslot group config screens are a little confusing to navigate, but with a bit of back-and-forth you should be able to figure them out. For each timeslot group, set the following:
Protocol: HDLC Streaming Interface Setup--> 1 defined (select and press Enter) Interface 1 – w1g1 (select and press Enter) Operation Mode--> WANPIPE (select and press Enter) You want to change this to: Interface Operation Mode: API
The same actions for configuring the Timeslot for Group 2.
Save the file wanpipe1.conf and Exist.
Note: If you need to make changes in wanpipe configuration file please make sure that wanpipe is not running, to avoid errors.
Configuration in Yate
Use this tutorial to: install Yate.
To configure SIP to ISDN gateway you will need:
- signaling - This is configured in ysigchan.conf.
- - an ISDN trunk (container with a Q.931 call controller, a circuit group (voice circuits), a Q.921 data link and an HDLC signalling interface).
- voice circuits that can be:
- - local: Sangoma. This is configured in Yate in file: wpcard.conf.
[trunk_isdn1] type=isdn-pri-net enable=yes sig=wanpipe1 voice=wanpipe1 switchtype=euro-isdn-e1 strategy=increment format=alaw
[wanpipe1] type=E1 siggroup=w1g1 voicegroup=w1g2
Routing all calls through ISDN trunk:
First the wanpipe must be started and then Yate.
# wanrouter start Starting WAN Router... Loading WAN drivers: wanpipe done. Starting up device: wanpipe1 Configuring interfaces: w1g1 w1g2 done.
# ./run -vvvvv CDo Initializing module Signalling Channel <sig/isup.decode:INFO> ISUP Call Controller pointcode-type=ITU format=alaw plan/type/pres/screen=unknown/unknown/allowed/user-provided caller-category=ordinary remote-pointcode=1-1-1 SIF/SSF=5/128 lockcircuits= userpartavail=false lockgroup=true mediareq=no outboundsls=cic [0x8230488] <sig/isup.encode:INFO> ISUP Call Controller pointcode-type=ITU format=alaw plan/type/pres/screen=unknown/unknown/allowed/user-provided caller-category=ordinary remote-pointcode=1-1-1 SIF/SSF=5/128 lockcircuits= userpartavail=false lockgroup=true mediareq=no outboundsls=cic [0x8230f60] <NOTE> Failed to open config file './conf.d/tdmcard.conf', using defaults (2: No such file or directory) <trunk_isdn1/B:ALL> WpSpan('wanpipe1'). Worker thread started [0x82375d8] <trunk_isdn1/B:INFO> WpSpan('wanpipe1') driver=wanpipe section=wanpipe1 type=E1 card=trunk_isdn1/B/wanpipe1 device=w1g2 samples=50 bitswap=true idlevalue=213 buflen=160 echocancel=false dtmfdetect=false readonly=false channels=1-15,17-31 (30) circuits=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 [0x8231c88] <trunk_isdn1/B:NOTE> WpSocket(trunk_isdn1/B/wanpipe1/w1g2). IOCTL failed dev=/dev/wanec. Can't disable echo canceller. 22: Invalid argument [0x8231cec] <trunk_isdn1/B:NOTE> WpSpan('wanpipe1'). Link status changed to Connecting [0x8231c88] <trunk_isdn1/B:NOTE> Added range wanpipe1: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 [0x8231610] <trunk_isdn1/Q931:INFO> ISDN Call Controller NET type=euro-isdn-e1 pri=true format=alaw channelsync=true [0x823b158] <wanpipe1/Q921:ALL> ISDN Data Link type=NET [0x823b9b8] <trunk_isdn1/Q931:ALL> Attached L2 'NET' (0x823b9b8,'wanpipe1/Q921') [0x823b158] <wanpipe1/Q921:ALL> Attached L3 (0x823b1c8,'trunk_isdn1/Q931') [0x823b9b8] <wanpipe1/D:INFO> D-channel: driver=wanpipe section=wanpipe1 type=E1 card=wanpipe1/D device=w1g1 errormask=250 readonly=false rxunderruninterval=0ms hwrepeatcapable=true [0xa03f888] <wanpipe1/Q921:ALL> Attached interface (0xa03f888,'wanpipe1/D') [0xa03ee4c] <wanpipe1/D:ALL> Attached receiver (0xa03ee4c,'wanpipe1/Q921') [0xa03f888] <wanpipe1/D:ALL> Worker thread started [0xa03fcc8] <wanpipe1/D:NOTE> Link status changed to Connecting [0xa03f888] <wanpipe1/Q921:INFO> Received notification 0: 'LinkUp'
You can configure your users(in regfile.conf or register.conf) and start making calls.
Here you can find a more general installation guide for Sangoma cards under linux:
For other system here is an how to install Sangoma cards under Windows: