Set up Asterisk Server on Ubuntu VM in VirtualBox to test Linphone : Part 2

We continue from the Set up Asterisk Server on Ubuntu VM in VirtualBox to test Linphone : Part 1, and will show how to configure Asterisk and Linphone as SIP client on two devices to call each other over WiFi.

Step 1: Establish IP connection between the SIP client (Linphone) and the Asterisk server

First let’s put the ubuntu virtual machine on the same IP subnet as your mobile device. Assume that your mobile device running Linphone is on wifi at home. The simplest way to establish IP connection between the virtual machine and your mobile device is to put the virtual machine to be on the same subnet.

To do so, assume the machine the VirtualBox is running on is already on the same WiFi network as your phone. To check, you can check the IP address of your phone and then check that of your VirtualBox host. The first three octets of both IP addresses should match. For example, my iPhone’s IP is and my macbook air hosting VirtualBox has IP of The first three octets are “192.168.1″. To test, you can “ping” your phone from your host machine. Say from my macbook air, to ping my phone, I would run the following command from a terminal


If ping is successful, then you are all set to go.

Next, change the virtual interface to be of type “Bridged Adapter”. 

Then at the ubuntu commandline, type

sudo shutdown now -r

to restart the VM (virtual machine)

After the virtual machine came back up, type “ifconfig” to verify that its network interface is in the same subnet network as your phone. See here if you don’t already know how to check the IP.

Then test pinging the phone from the VM

ping (use your phone’s IP here)

Step 2: Update the sip.conf and extention.conf

Next we will add two SIP clients and create a dial plan for them.

sudo vi /etc/asterisk/sip.conf

Add the following text at the end of sip.conf to create two SIP clients:


And also create a dialplan with include both 6003 and 6004. Open /etc/asterisk/extensions.conf and add the following text at the end:


Then restart Asterisk by connecting to asterisk server then reload.

sudo asterisk -rvvvvv

Let iphone be of account 6003(password test100), and iphone simulator be of account 6004 (password test100).Below is what SIP settings look like on my iPhone.

After my phone connects to the Asterisk server, it shows “Registered” at the upper lefthand corner.

After connecting the other SIP client(6004) to asterisk, you can try calling 6004 from 6003. To call 6004, just type 6004 and press the phone button.

You should hear the phone ringing and the screen would look as followed:

You can download the finished sip.conf and extensions.conf

29 thoughts on “Set up Asterisk Server on Ubuntu VM in VirtualBox to test Linphone : Part 2”

  1. Hi,
    The two mobile phones have successfully registered.

    While calling I am facing this error:

    NOTICE[1165][C-0000000e]: chan_sip.c:25772 handle_request_invite: Call from ‘6004’ ( to extension ‘sip/6003’ rejected because extension not found in context ‘public’.

    Can you please help me…

    • Hi vijay, please make sure 6003 and 6004 are in “my-phone” context and that “my-phone” context info is added to extensions.conf

      • Hi Jessica Chiang,

        In this Path: /etc/asterisk/extensions.conf I added these 3 lines.


        I reload the Asterisk Server. And in mobile accounts are registered, while making calling 6004 from 6003 it showing user not found.

        • Hey vijay glad that SIP is working out for you. To configure IAX, you would need to enable the IAX module. I will update the blog sometime this week to add that as part 3

          • Hey vijay, I have to correct myself. Linphone currently only supports SIP and not IAX. You could configure two asterisk servers to communicate to each other over IAX, but I doubt that’s what you want.

  2. Hi Jessica,
    Yes, Linphone supports only SIP.
    I am trying both Linphone and Zoiper. Zoiper suppors IAX so for that I need to enable IAX protocol.

  3. hi Jessica : ) how about accessing the phones behind NATs (i.e. without public IP) ? i’ve read that Linphone somehow deals with this issue, making use of STUN, but i don’t know how. maybe you have any idea or may suggest some article to read?

  4. Hi Jessica,
    I have problem when connect to Asterisk server with Linphone, it shows “Register failed”? Can I fix it?
    Sorry but you can explains for me about domain in Settings?
    What is that?
    Thank you.

    • Hi Long,
      If it says register failed, then it’s likely the following
      1) Linphone can’t reach the asterisk server via IP
      – Asterisk not running
      – Asterisk not accepting IP of the Linphone (Are your asterisk server and Linphone on the same machine? Say Linphone is simulated?)
      – Linphone can’t ping the host that the asterisk server runs on
      2) Authentication failed
      – check the password

      Also, does your asterisk server show any error message? To increase the debug level, log on to asterisk cli, and enter “set verbose 11”

  5. Hi Jessica,
    Everytime I try to use linphone to call it says “Forbidden”. What can I do to solve this problem?

  6. dude, thanks! BUT…

    you need to homologate the passwords between the ones on this page (“test100”) and the ones on the finished sip.conf (“ping”). this little mistake cost my newbie ass about 20 minutes of confusion-induced headache.

    still, this straightforward tutorial gave me the confidence to “get it done” in a deliciously offhand, essential and preliminary manner, on which i can totally build on and perfect.

    again, much thanks!

    ps: it seems like you also skipped the part about modules.conf!

Leave a Comment