If you are looking to set up a BSNL SIP Trunk in Asterisk or Vicidial, here’s everything you need to know. A Session Initiation Protocol (SIP) trunk is a VoIP integration between an IP PBX and a VoIP service provider. This is an ideal solution for companies that use a lot of long distance calling and want to integrate their network of international offices. BSNL is a popularly used SIP service in India, and here is a step-by-step guide to configuring a BSNL SIP trunk in Asterisk and Vicidial.
In Asterisk, begin by creating a SIP user in your system’s PBX. This will be used to register with BSNL’s SIP server. Make sure to use a username and password that is provided by your BSNL account. Next add the following to your /etc/asterisk/sip.conf file:
[bsnl]
type=peer
username=USERNAME
secret=PASSWORD
host=sip.bsnl.in
context=sip-inbound
canreinvite=no
qualify=yes
nat=yes
dtmfmode=rfc2833
disallow=all
allow=ulaw
allow=alaw
Now restart the Asterisk system and run the command “sip show peers” to make sure the SIP trunk is created correctly.
To configure this SIP trunk in Vicidial:
1. Go to Admin > Carriers and add a carrier profile giving the name ‘BSNL SIP Trunk’
2. In Profile Settings, click Yes to enable the Carrier
3. Choose ‘SIP/IAX2’ for carrier protocol
4. Enter the username and password in the necessary fields
5. Select ‘Yes’ in ‘Register String’
6. Set ‘Reg Expire:’ to ‘600’
7. In ‘Dialplan Entry:’ type this – ‘exten => _X.,1,Dial(SIP/${EXTEN})’
After adding the profile and making any necessary customizations, click ‘Save and Update Settings’. The BSNL SIP trunk is now ready to use in Vicidial.
The above steps should help you configure the BSNL SIP trunk in Asterisk and Vicidial. Be sure to read through these instructions carefully and in full before setting up the trunk. Any errors during setup can prevent the trunk from working properly.
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
BSNL SIP /VOIP trunk is an advanced voice connectivity solution via network, it replaces traditional multiple fixed PSTN with a single Physical line that support 1000 plus calls simultaneous calls.
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 : +9155555XXXXX
7. SIP Password : XXXXX@m321..
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 [email protected]
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
Time needed: 3 minutes
Steps to Configure BSNL SIP Trunk
- 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 =u003e +9144444XXXXX :PASSWORD:+9144444XXXXX @[email protected]/+9144444XXXXX
note: replace 444444XXXXX with your actual bsnl pilot number/username
BSNL SIP Peer settings
[bsnlsip]
disallow=all
allow=all
type=friend
dtmfmode=rfc2833
qualify=yes
nat=force_rport,comedia
insecure=invite,port
host=kl.stbi.ims.bsnl.in
[email protected]
secret=PASSWORD
fromdomain=kl.stbi.ims.bsnl.in
defaultexpirey=120
canreinvite=no
context=trunkinbound ; change this according to your inbound context
maxexpiry=600
progressinband=yes - STEP 5: BSNL SIP asterisk Dialplan
For Vicidial /goautodial use the below dialplan
exten =u003e _9X.,1,AGI(agi://127.0.0.1:4577/call_log)
exten =u003e _9X.,n,SipAddHeader(P-Preferred-Identity: u003csip:[email protected])
exten =u003e _9X.,n,Progress()
exten =u003e _9X.,n,Dial(SIP/${EXTEN:1}@bsnlsip,,tTor)
exten =u003e _9X.,n,Hangup()
For Plain asterisk or freepbx
exten =u003e _9X.,1,SipAddHeader(P-Preferred-Identity: u003csip:[email protected])
exten =u003e _9X.,n,Progress()
exten =u003e _9X.,n,Dial(SIP/${EXTEN:1}@bsnlsip,,tTor)
exten =u003e _9X.,n,Hangup()
Conclusion:
Hope this article is useful , for professional support reach me at [email protected]