Home » Blog » FreePBX » How to configure bsnl sip trunk in Asterisk – Freepbx – Vicidial

How to configure bsnl sip trunk in Asterisk – Freepbx – Vicidial

How to configure BSNL sip trunk

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:














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 FreepbxVicidial ,Goautodial etc. The configuration includes Asterisk sip.conf settings and Dialplan settings


    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 :    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

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

  1. 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.

  2. 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

  3. 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.               localhost.localdomain localhost
    ::1             localhost6.localdomain6 localhost6         go.goautodial.org go kl.stbi.ims.bsnl.in

    save and exit

  4. 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

    [email protected]
    context=trunkinbound      ; change this according to your inbound context

  5. STEP 5: BSNL SIP asterisk Dialplan

    For Vicidial /goautodial use the below dialplan

    exten =u003e _9X.,1,AGI(agi://
    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()


   Hope this article is useful , for professional support reach me at [email protected]

Scroll to Top