Project

General

Profile

Actions

Howto

This howto was created and tested using the Debian OBS packages from https://projects.osmocom.org/projects/cellular-infrastructure/wiki/Binary_packages. It is assumed, that a working installation of the nitb stack already exists (osmo-msc, osmo-bsc, osmo-hlr, ...). In the following steps we will show how to integrate that existing installation with Asterisk using osmo-sip-connector.

Note: The attached configuration files are for an older (osmo-nitb) setup.

Preparations

As we assume that we use an existing and working osmo-cn configuration as a starting point most of the relevant dependencies are already installed. However, we're still missing osmo-sip-connector and Asterisk as major components.

  • Install dependencies:
    The extension we are about to make requires to install some additional packages.
    sudo apt-get install libsofia-sip-ua-glib-dev
    sudo apt-get install asterisk
    
  • Install osmo-sip-connector:
    The installation of osmo-sip-connector is as straight forward as you know it already from other osmocom projects:
    apt get install osmo-sip-connector
    

    You can also build it yourself:
    git clone https://gitea.osmocom.org/cellular-infrastructure/osmo-sip-connector
    cd osmo-sip-connector/
    autoreconf -fi
    ./configure
    make
    sudo make install
    

Osmo-sip-connector configuration

In this section we illustrate how equip osmo-msc with a SIP-trunk interface using osmo-sip-connector. The steps are not necessarly Asterisk dependant, the result would work with any PBX software that supports sip-trunk connections.

  • osmo-msc - Add the following to your config:
    msc
     mncc external /tmp/msc_mncc
    
  • osmo-sip-connector:
    Osmo-sip connector acts as a translator between the classic ISDN call control (mncc) and SIP. The configuration is rather simple.
    app
    mncc
      socket-path /tmp/msc_mncc
    sip
      local 127.0.0.1 5061
      remote 127.0.0.1 5060
    

    The socket path between osmo-msc and osmo-sip-connector have to match. For SIP we need to setup a remote and local IP-Address and port. In most cases, Asterisk and osmo-sip-connector will run on one and the same machine, so it is obvious that local and remote IP-Address are the same. The type of connection between osmo-sip-connector and Asterisk is a classic SIP-Trunk. For Asterisk it appears as just another PBX. The service for osmo-sip-connector needs to be enabled and osmo-msc restarted for the change to have an effect:
    # systemctl restart osmo-sip-connector osmo-msc
    # systemctl enable osmo-sip-connector
    

Asterisk configuration

The following section will discuss a minimal Asterisk configuration that is able to route calls between mobile phones. The described case assumes a freshly installed Asterisk with virgin configuration files. In the following we will edit extensions.conf and sip.conf which can be found in the /etc/asterisk directory. The example below is not special to GSM, its rather a normal SIP-trunk configuration.

  • Set up the sip-trunk towards osmo-sip-connector:
    The first that has to be taken care of is the connection to osmo-sip-connector. The following lines need be appended to sip.conf:
    [GSM]
    type=friend
    host=10.9.1.110
    dtmfmode=rfc2833
    canreinvite=no
    disallow=all
    allow=gsm
    context=gsmsubscriber
    port=5069
    

    The connection is named GSM, this name will be used later to reference the connection when routing outgoing calls. The context name “gsmsubscriber” references the context where mobile originated calls are routed into the dialplan.
  • Set up a dialplan to route calls:
    Now Asterisk and osmo-sip-connector are connected. The following example introduces a very basic dialplan configuration to route calls between mobile phones. The following example can be added to extensions.conf:
    [gsmsubscriber]
    exten=>_XXXXX,1,Dial(SIP/GSM/${EXTEN})
    exten=>_XXXXX,n,Playback(vm-nobodyavail)
    exten=>_XXXXX,n,HangUp
    

    The name in “[]” is the context name which we already defined in sip.conf (“gsmsubscriber”). Every incoming call, that is entering through the “GSM” connection is directly routet to “[gsmsubscriber]”. The following three lines will check if the dialed number is exactly 5 digits long. When the check passes Asterisk dials that number through the “GSM” connection. This causes the call to be routed back through the “GSM” connection back to osmo-nitb. If the subscriber is not available, the call will fail and alternatively a voice message “vm-nobodyavail” will be played. Finally the call is hung up.

Note: In this example configuration security considerations are left out. It is up to the user to make sure that the SIP-Trunk interface is not reachable for unauthorized users.

Note: This configuration will route numbers with five digits. If you have three digits for example, replace XXXXX with XXX.

Use Kamailio as an alternative to Asterisk

As already mentioned above it is also possible to use other SIP-PBX server than Astersik. One popular example is Kamailio. The attached kamailio.cfg matches the osmo-sip-connector configuration and conditions discussed above.

The configuration implements a SIP server which can be used to route calls between mobile phones. It also handles 2 special numbers 500 (routed to sip:) and 600 (routed to sip:): by dialing them you can use echo test or hear nice music from your mobile.

Note: in attached kamailio.cfg, for 64bit systems, you may need to adjust

mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/" 

N. B: Those numbers are meant only as an example for quick tests - please consider running your own Asterisk instance if you expect more than couple of calls, do not abuse http://www.iptel.org/service

See also https://www.kamailio.org

Attachments

Updated by daniel about 1 month ago · 9 revisions

Add picture from clipboard (Maximum size: 48.8 MB)