VoIP PSTN Gateway

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
(Components of a gateway)
(Configure users)
 
(95 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
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.
  
A gateway is a device used for connecting two different types of networks. In this case, one network is the VoIP network and the other the PSTN. The gateway’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.
  
==Components of a gateway==
+
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.
  
A gateway can consist of only one piece or it can be distributed into more components. These are:
+
The setup described in this article will use Sangoma card and will use Yate as a gateway from SIP to ISDN.
  
* Signaling Gateway
+
[[File:yate_gateway_VoIP-PSTN.png]]
* Media Gateway
+
* Media Gateway Controller.  
+
  
Let’s talk a little about each part.
+
== Configuration setup==
  
The '''Signaling Gateway''' provides transparent interworking of signaling between switched circuit, in this case, PSTN, and the VoIP networks.
+
We will need a server with linux and a Sangoma card (A104). The linux installed on the server:
  
The '''Media Gateway''' is responsible for extracting audio from the PSTN network, encode it and transport it over the Internet. This component carries the data.  
+
# cat /etc/issue
 +
Mandriva Linux release 2010.2 (Official) for i586
 +
Kernel 2.6.33.7-desktop-2mnb on a Dual-processor i686
  
The '''Media Gateway''' controller is used for controlling the call. It is also known as “Call Agent”.
+
== Installing Sangoma cards under Linux==
  
[[More_About_VoIP|Find more information about VoIP]].
+
===Prerequirements===
  
==The only question now is what is PSTN?==
+
Sangoma Linux Driver (Wanpipe) require a list of packages on your system prior to install.
  
PSTN comes from Public Switched Telephony Network. Very much like the Internet, it is composed of many connections between circuit-switched wires. In fact the Internet is modeled upon this architecture. A telephone number references a single telephone, and a public IP address references a computer. The main difference is that VoIP uses the packet-switched network.
+
*    C developement tools ...(gcc)
 +
*    C++ developement tools
 +
*    Make utility
 +
*    Ncurses library
 +
*    Perl developement tools
 +
*    AWK
 +
*    FLEX
 +
*    Patch
 +
*    libtermcap-devel
 +
*    bison
 +
*    libtools
 +
*    autoconf
 +
*    automake
 +
*    kernel-devel
  
Only a little part of the actual PSTN is still using analogue circuits. Most of it has turned into digital. This allowed the appearance of many more services, like ISDN and DSL. These have facilitated the introduction of new telephony services, like: voice mail, caller id, reminder calls, conference calling, Enhanced 911. Some believe that the final purpose of the PSTN network is to be just an Internet application. But, there are a lot of steps to be made until this will happen.
+
===Sangoma card driver installation===
 +
 
 +
Download the driver from: ftp://ftp.sangoma.com/linux/current_wanpipe/
 +
 
 +
As root:
 +
 
 +
# 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
 +
 
 +
=== Configure Wanpipe===
 +
 
 +
Follow the procedure outlined here to configure Wanpipe into two timeslot groups for YATE.
 +
First, as the root user, issue the following command:
 +
# wancfg
 +
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: [[Installation |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.
 +
 
 +
Configure files:
 +
 
 +
ysigchan.conf
 +
 
 +
[trunk_isdn1]
 +
type=isdn-pri-net
 +
enable=yes
 +
sig=wanpipe1
 +
voice=wanpipe1
 +
switchtype=euro-isdn-e1
 +
strategy=increment
 +
format=alaw
 +
 
 +
wpcard.conf
 +
 +
[wanpipe1]
 +
type=E1
 +
siggroup=w1g1
 +
voicegroup=w1g2
 +
 
 +
Routing all calls through ISDN trunk:
 +
 
 +
regexroute.conf
 +
[default]
 +
.*=sig/\0;trunk=trunk_isdn1
 +
 
 +
==Start devices==
 +
 
 +
First the wanpipe must be started and then Yate.
 +
 
 +
Start wanpipe:
 +
 
 +
# wanrouter start
 +
 +
Starting WAN Router...
 +
Loading WAN drivers: wanpipe done.
 +
Starting up device: wanpipe1
 +
Configuring interfaces: w1g1 w1g2
 +
done.
 +
 
 +
Start Yate:
 +
 
 +
# ./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'
 +
 
 +
==Configure users==
 +
 
 +
You can configure your users(in regfile.conf or register.conf) and start making calls.
 +
 
 +
 
 +
'''See also'''
 +
 
 +
* [[What is Yate]]
 +
 
 +
Here you can find a more general installation guide for Sangoma cards under linux:
 +
* [[Installing Sangoma cards under Linux]]
 +
 
 +
For other system here is an how to install Sangoma cards under Windows:
 +
* [[Installing Sangoma cards under Windows]]
 +
 
 +
[[Category:Gateway]] [[Gategory:Server]] [[Category:ISDN]] [[Category:Sangoma]] [[Category:Wanpipe]]

Latest revision as of 18:11, 31 October 2013

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.

Yate gateway VoIP-PSTN.png

Contents

[edit] Configuration setup

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 2.6.33.7-desktop-2mnb on a Dual-processor i686

[edit] Installing Sangoma cards under Linux

[edit] Prerequirements

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
  • AWK
  • FLEX
  • Patch
  • libtermcap-devel
  • bison
  • libtools
  • autoconf
  • automake
  • kernel-devel

[edit] Sangoma card driver installation

Download the driver from: ftp://ftp.sangoma.com/linux/current_wanpipe/

As root:

# 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

[edit] Configure Wanpipe

Follow the procedure outlined here to configure Wanpipe into two timeslot groups for YATE. First, as the root user, issue the following command:

# wancfg

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.

[edit] 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.

Configure files:

ysigchan.conf

[trunk_isdn1]
type=isdn-pri-net
enable=yes
sig=wanpipe1
voice=wanpipe1
switchtype=euro-isdn-e1
strategy=increment
format=alaw

wpcard.conf

[wanpipe1]
type=E1
siggroup=w1g1
voicegroup=w1g2

Routing all calls through ISDN trunk:

regexroute.conf

[default]
.*=sig/\0;trunk=trunk_isdn1

[edit] Start devices

First the wanpipe must be started and then Yate.

Start wanpipe:

# wanrouter start

Starting WAN Router...
Loading WAN drivers: wanpipe done.
Starting up device: wanpipe1
Configuring interfaces: w1g1 w1g2
done.

Start Yate:

# ./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'

[edit] Configure users

You can configure your users(in regfile.conf or register.conf) and start making calls.


See also

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:

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers