how to configure bsnl sip trunk in asterisk – freepbx – vicidial
how to configure BSNL sip trunk in asterisk – freepbx – vicidial?
In this article i have provided the steps to configure the BSNL SIP/Voip trunk in asterisk based PBX like Freepbx, Vicidial ,Goautodial etc. The configuration includes Asterisk sip.conf settings and Dialplan settings
Overview: BSNL SIP-VOIP PRI
Once you have purchased the BSNL SIP/VOIP connectivity , you will receive the below details from the BSNL support/sales team.
1. Customer IP : 172.23.1.149/255.255.224.0
2. Customer Gateway : 172.23.0.1
3. VoIP Server IP / Outbound Proxy : 10.191.5.1
4. Routes toward VoIP Server :
10.191.5.1/255.255.255.255 via 172.23.0.1 10.191.5.8/255.255.255.248 via 172.23.0.1
5. From domain : kl.stbi.ims.bsnl.in
6. SIP Authentication Username : +9144444XXXXX
7. SIP Password : XXXXX@m123..
8. All invite messages should come from same IP & Port on which SIP Trunk is registered.
9. Enable Local Ringback Tone (RBT) in IPPBX.
10.In all SIP messages “FROM” header has to be +91xxxxx@kl.stbi.ims.bsnl.in
Also you have provided with OPENVPN details and requested you to configure the same in the PBX with below details
CA.crt
client.crt
client.key
BSNL bundled .vpn file.
Note: Openvpn installation and connectivity is not covered in this article, kindly refer google for Open vpn client installation and configuraiton
Network Connectivity: BSNL SIP
BSNL SIP trunk is provided to customer via dedicated SBC gateway and router, for which you need a additional ethernet port on your asterisk server or you need to setup your LAN in the same subnet range provide by BSNL. ref below Pic for better understanding

Steps to Configure BSNL SIP Trunk
Once the above connectivity is completed follow the below steps to configure the BSNL SIP Trunk in asterisk or vicidial or freepbx
STEP 1: Configure the BSNL network IP to eth1
Assign the IP provided by BSNL to one of the NIC in you server, for centos based server you may use below commands
IP address = 172.23.1.149
Subnet mask = 255.255.224.0
Gateway = 172.23.0.1
ifconfig eth1 172.23.1.149/19 gw 172.23.0.1
OR edit the ifcfg-eth1 file and manually enter the ip, OR if you have GUI manager configure manually.
vi /etc/sysconfig/network-scripts/ifcfg-eth1
then enter
IPADDR=172.23.1.149
NETMAS=255.255.224.0
GATEWAY=172.23.0.1
PREFIX=30
ONBOOT=YES
*** Note: 172.23.1.149 is an example, you need to enter the airtel ip provided to you.
STEP 2: Static Route to reach BSNL SIP SERVER /SBC IP.
This step is required if the BSNL SBC IP and your IP is in different subnet then you need a static route to reach the SBC IP. and Media IP
for eg : my SBC ip is 10.191.5.1 and media ip 10.191.5.8
Edit the route-eth1 for manual entry for static route. Note this is for centos based server
vi /etc/sysconfig/network-scripts/route-eth1
and add below line
10.191.5.1/32 via 172.23.0.1
10.191.5.8/32 via 172.23.0.1
service network restart or systemctl restart network or reboot
Linux command to set a static route to SIP proxy ip and media ip
ip route add 10.191.5.1/32 via 172.23.0.1 dev eth1
ip route add 10.191.5.8/32 via 172.23.0.1 dev eth1
Command to check the routes
ip route show
or
route -n
Step 3: Add static DNS HOST entry
BSNL SIP Trunks only accepts traffic with header kl.stbi.ims.bsnl.in,
You need to enter a static host entry for kl.stbi.ims.bsnl.in with the SBC IP.
Edit hosts file and add the host entry
vi /etc/hosts
and the line which is in last line below.
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
127.0.0.1 go.goautodial.org go
10.191.5.1 kl.stbi.ims.bsnl.in
save and exit
Step 4: BSNL SIP Carrier settings.
For Vicidial – goautodial you can use the admin utility to configure below settings.
For Freepbx you can use the GUI trunk configuration
For Plain Asterisk enter the below details in vi /etc/asterisk/sip.conf
Asterisk Registration String
register => +9144444XXXXX :PASSWORD:+9144444XXXXX @kl.stbi.ims.bsnl.in@kl.stbi.ims.bsnl.in/+9144444XXXXX
note: replace 444444XXXXX with your actual bsnl pilot number/username
BSNL SIP Peer settings
disallow=all
allow=all
type=friend
dtmfmode=rfc2833
qualify=yes
nat=force_rport,comedia
insecure=invite,port