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

bsnl sip trunk configuration asterisk pbx
bsnl sip trunk configuration in asterisk


    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  : 
2. Customer Gateway : 
3. VoIP Server IP / Outbound Proxy : 
4. Routes toward VoIP Server : via                                                                     via 
5. From domain : 
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

Also you have provided with OPENVPN details and requested you to configure the same in the PBX with below details

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

bsnl sip trunk configuration vicidial

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 =
Subnet mask =
Gateway    =

ifconfig eth1 gw

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

*** Note: 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  and media ip
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 via via
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 via dev eth1
ip route add via dev eth1

Command to check the routes

ip route show 
route -n

Step 3: Add static DNS HOST entry 

BSNL SIP Trunks only accepts traffic with header,
You need to enter a static host entry for 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.               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6 go
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

note: replace 444444XXXXX with your actual bsnl pilot number/username

BSNL SIP Peer settings
context=trunkinbound      ; change this according to your inbound context

STEP 5: BSNL SIP asterisk Dialplan

For Vicidial /goautodial use the below dialplan

exten => _9X.,1,AGI(agi://
exten => _9X.,n,SipAddHeader(P-Preferred-Identity: <>)
exten => _9X.,n,Progress()
exten => _9X.,n,Dial(SIP/${EXTEN:1}@bsnlsip,,tTor)
exten => _9X.,n,Hangup()

For Plain asterisk or freepbx 

exten => _9X.,1,SipAddHeader(P-Preferred-Identity: <>)
exten => _9X.,n,Progress()
exten => _9X.,n,Dial(SIP/${EXTEN:1}@bsnlsip,,tTor)
exten => _9X.,n,Hangup()


   Hope this article is useful , for professional support reach me at skype or Telegram :striker24x7

No Comment
Add Comment
comment url