Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Testing VoIP API with a locally configured VoIP server

From Wiki
Jump to: navigation, search
Featured Article
27 Oct

This article explains how to install and configure a VoIP server on a Linux system and how to connect to it from two separate emulator instances in order to perform a VoIP call. The VoIP server can monitor all registered accounts, as well as all the calls performed from one VoIP client to another.



Before you start, you will need to ensure that

  • the VoIP server runs on a system with a PII 400 MHz or higher processor and minimum 128 MB of RAM
  • the computer the SDK is running on, is connected to the same network where the server is installed (e.g. using a router)
  • You have a DVD burner and an empty DVD.

VoIP server configuration

Asterisk is an open source framework that supports the SIP protocol and comes with a ready-to-install bundle that also installs the CentOS Linux distribution. The following instructions describe how to install and configure AsteriskNOW, the bundle version of Asterisk.

Note.pngNote: If you are already familiar with Linux, and you have a system or virtual machine (VM) that runs another Linux distribution, you can download the standalone Asterisk version

The following instructions describe a clean installation which might result in erasing all your data

  1. Download either the 32-bit or 64-bit .iso bundle of AsteriskNOW, depending on your hardware configuration.
  2. Burn the .iso image on an empty DVD. For more instructions on performing this task on Windows, Mac OS or Linux, see the Burning Iso How To guide.
  3. For a clean installation, insert the DVD you have just burned into the DVD drive and reboot your computer. If your computer already comes installed with another OS or Linux distribution, you need to configure it so that it boots from the DVD drive and not from one of the hard drives. This can be done from the BIOS Utility. The BIOS Utility is operating system independent. It can be accessed by pressing F1, F2 or ESC. The appropriate key is indicated on the very first start screen shown when your computer boots. For more information on changing the boot sequence on your machine, please consult the motherboard manual, provided by the manufacturer.
  4. After the BIOS settings have been saved, the computer should be restarted. The system will boot from the DVD drive and the installation will start. CentOS installation guide will take you through the installation process. You will be asked to provide an administrator password, as well as your current location and preferred language.
  5. Once the installation is complete and the system has been rebooted, the following message should be displayed:
    AsteriskNOW 3.0.0
    To configure AsteriskNOW with FreePBX, point your web browser to
    $ localhost login:
    The AsteriskNOW version might be different, depending on the release you have chosen. The IP address displayed here is the address, where the VoIP service can be found. It can be a different IP address for each installation. You will need to mark this address down, so that you can properly configure the SDK Emulator instances, later on.
  6. Login to CentOS using your credentials. Please ensure that you use an administrator account to login.
  7. Add a minimum of two SIP accounts by editing the sip.conf file. The first SIP account will be used on the emulator instance that will make a call, and the second SIP account will be used on the emulator instance that will receive the call. Run this command:
    $ sudo vi /etc/asterisk/sip.conf
  8. Press i to enter into vi’s insert mode and then add the following lines at the end of the file:
  9. You have now created two user accounts with usernames user1 and user2 that can both access the VoIP service by using the literal password as the actual password. You can modify the file and add more accounts or change the authentication details of existing users according to your needs.
  10. Press ESC in order to exit from the insert mode then type :wq and press ENTER to save the file.
  11. Create extensions for each user by editing the extensions.conf file as follows
    $ sudo vi /etc/asterisk/extensions.conf
    Press i again to enter into insert mode and add the following lines at the end of the file:

    Note.pngNote: 6001 is the extension for user1, where user1 needs to be already defined in the sip.conf file as described above.

  12. Restart the server with the following commands
    $ asterisk –r
    localhost*CLI> core restart now
  13. Check the registration status for each user name with the following commands
    $asterisk –r
    asterisk-server*CLI> sip show peers

The VoIP server is now configured.

Computer with VoIP client network configuration

The computer running the SDK Emulator instances needs to be connected to the same network where the VoIP service is available. This can be done for example, by connecting both systems to the same router. To ensure that the Emulator can see the service, type the following command on your Windows system

C:\> ping

Change the IP address to the one you have marked down as described in step 5. If this command returns the time in ms that it took for the ping request to be received by the remote and return back, then the client system can see the VoIP service. An example for a failed ping attempt follows:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
Pinging with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
If the ping request cannot get through, please ensure that all firewalls are disabled.

Test local VoiP service

The Nokia Developer VoIPExample application can be used to test a locally configured VoIP service.

The steps are as follows:

  1. Checkout the most recent version of the VoIPExample from here
  2. Open the Nokia IDE for Java ME and select File > Import
  3. Click on Existing Projects into Workspace and select Next
  4. On the next window, browse to the location where you have checked out the VoIPExample
  5. Click Finish
  6. Compile, run and launch the first emulator instance by highlighting the VoIPExample in the Project explorer. Then press Ctrl + F11 and select Emulated Java ME MIDlet
  7. Once the first emulator instance is launched, launch the second one, by right clicking on the emulator icon on the Window’s taskbar
  8. Select Nokia Asha SDK 1.1, wait for the second instance to be launched and repeat step 6
  9. By now you should have two emulator instances running both the VoIPExample application. Now you need to configure each Emulator instance so that it gets associated with a different VoIP account. From the Dialer view, swap the bottom of the screen in order to launch the Settings view.
  10. In the Settings view enter the user credentials you have created for the first SIP account along with the server’s IP address
  11. Repeat step 10 for the second Emulator instance, only this time use a different SIP user name. The Registrar IP address should be left the same for both instances
  12. The status icon turns to green

You can now use the extension number to place a call from one Emulator instance to another!

Article Metadata
Tested with
SDK: Nokia Asha SDK 1.1
Devices(s): SDK Emulator
Created: skalogir (22 Oct 2013)
Last edited: croozeus (27 Oct 2013)
This page was last modified on 27 October 2013, at 17:16.
83 page views in the last 30 days.