configure Tata Sip Trunk with Asterisk
how to configure Tata Sip Trunk with Asterisk
The TATA SIP trunk will need a need a dedicated lan connectivity to your dialler, so in dialer or pbx you need two Ethernet Port to connect to TATA network and a Dedicated network for phone registration and agent logins
eth1 is used to connect to TATA network, and eth0 is used to connect to customer lan network were ipphones , agents pc will be connected
STEP 1: Configure the TATA network ip to eth1 of dialer/pbx
Either you can use the below command to configure the tata ip in eth1
ifconfig eth1 10.0.70.18/30
OR edit the ifcfg-eth1 file by using below command
vi /etc/sysconfig/network-scripts/ifcfg-eth1
then enter
IPADDR=10.0.70.18
PREFIX=30
ONBOOT=YES
*** Note : the ip address 10.0.70.18 might be differ for each customer.
STEP 2: Configure the route in linux to reach tata network
as SIP trunk network is on different subnet than the customer IP, a static route needed
to reach the TATA SBC .
Goto
vi /etc/sysconfig/network-scripts/route-eth1
and add below line
10.0.70.2/32 via 10.0.70.71
Once file save restart the network by typing
service network restart
then type route -n to make sure route is added
STEP 3: Asterisk sip settings.
Goto vi /etc/asteris/sip.conf and make below changes
defaultexpiry=600
progressinband=yes
STEP 4: Sip Carrier settings
For vicidial/goautodial you can use the admin utility- Carrier settings
for plain asterisk enter the below details in sip.conf.
register => 66810000:1234:66810000@10.0.70.2/66810000
[tatasip]
type=friend
disallow=all
allow=alaw
allow=ulaw
allow=g729
host=10.0.70.2 ;this is tata SBC ip
dtmfmode=rfc2833
nat=no
canreinvite=no
context=tata
This is optional setting:
STEP 5: Dialplan to dialout via tata trunk
For vicidial / goautodial you can use the ADMIN-Carrier- Dialplan entry
For asterisk users you need to enter in extensions.conf under default context
For vicidial/goautodial Dialers dialplan
exten => _7X.,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _7X.,n,SipAddHeader(P-Preferred-Identity: <sip:66810000@10.0.70.18>)
exten => _7X.,n,Progress()
exten => _7X.,n,Dial(SIP/0${EXTEN:1}@tatasip)
exten => _7X.,n,Hangup()
For asterisk/Freepbx Dialers dialplan
exten => _7X.,n,Progress()
exten => _7X.,n,Dial(SIP/0${EXTEN:1}@tatasip)
exten => _7X.,n,Hangup()
once above entry done, do a asterisk reload by typing asterisk -rx “reload”
STEP 6 : Dialplan to Receive inbound calls form tatasip trunk
Enter the below dialplan after the last line of extensions.conf (vi /etc/asterisk/extensions.conf)
For Vicidial/goautodial use the below dialplan in extensions.conf
[tata]
exten => _X.,1,Goto(s,1)
exten => s,1,Noop(Let us look deeper into the soul of the invite)
exten => s,n,Set(pseudodid=${SIP_HEADER(To)})
exten => s,n,Set(pseudodid=${CUT(pseudodid,@,1)})
exten => s,n,Set(pseudodid=${CUT(pseudodid,:,2)})
exten => s,n,Goto(trunkinbound,${pseudodid},1)
Then in Vicidial GUI create DID’s under INBOUND tab with your respective Tata DID no
for me its 66810000
For People using Freepbx/elastix/ or plain asterisk who use from-pstn as inbound context use the below dialplan in extensions.conf
[tata]
exten => _X.,1,Goto(s,1)
exten => s,1,Noop(Let us look deeper into the soul of the invite)
exten => s,n,Set(pseudodid=${SIP_HEADER(To)})
exten => s,n,Set(pseudodid=${CUT(pseudodid,@,1)})
exten => s,n,Set(pseudodid=${CUT(pseudodid,:,2)})
exten => s,n,Goto(from-pstn,${pseudodid},1)
Configure network interfaces for sip trunk
First: Interface LAN was configured by installer itself, then it add mask /24 that must be removed.
iface LAN inet static
address 192.168.1.247/24
gateway 192.168.1.254
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.1.254
allow-hotplug SIP
iface SIP inet static
address 172.xxx.xxx.xxx
netmask 255.255.255.252
Was modified to:
iface LAN inet static
address 192.168.1.247
netmask 255.255.255.0
gateway 192.168.1.254
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.1.254
allow-hotplug SIP
iface SIP inet static
address 172.xxx.xxx.IP
netmask 255.255.255.252
Then at /etc/rc.local must add two static routes
- This route sends all trafic to LAN through LAN interface
route add 192.168.1.0 gw 192.168.1.254
- This route sends all traffic to my sip server through SIP interface
route add [SIP SERVR IP] gw 172.xxx.xxx.GW
This all done the work.
Note:
172.xxx.xxx.IP is the Ip assigned by telecom provider
172.xxx.xxx.GW is the gateway assigned by telecom provider
[SIP SERVR IP] is the Sip server ip assigned by telecom provider.