Project

General

Profile

Osmo-sip-connector » History » Version 72

dexter, 02/20/2017 02:37 PM

1 1 msuraev
h1. Osmo-sip-connector
2
3 63 dexter
{{>toc}}
4
5 18 dexter
h2. Introduction
6
7 64 dexter
osmo-sip-connector translates between MNCC and SIP protocols and hereby replaces the old LCR based approach. Osmo-sip-connector does not handle RTP by itself, an external SIP-PBX server which can accept SIP-Trunks is still required. The following image illustrates how the network components are laid out:
8 1 msuraev
9 64 dexter
{{graphviz_link()
10
digraph G{
11
  rankdir = LR;
12
  MS -> BTS [label = "Um"];
13
  BTS -> "osmo-nitb" [label = "Abis"];
14
  "osmo-nitb" -> "osmo-sip-connector" [label = "MNCC"];
15 66 dexter
  "osmo-sip-connector" -> "PBX" [label = "SIP"];
16
  "BTS" -> "PBX" [label = "RTP"];
17 64 dexter
}
18
}}
19
20
21 65 dexter
h2. Howto
22 8 dexter
23 64 dexter
This howto was created and tested using Debian 8.7.1. It is assumed, that a working installation of osmo-nitb already exists. In the following steps we will show how to integrate that existing installation with Asterisk using osmo-sip-connector.
24 71 dexter
25 72 dexter
Note: All configuration files discussed below can also be found in the attachement section
26 41 dexter
27 21 dexter
h3. Preparations
28
29 57 dexter
As we assume that we use an existing and working osmo-nitb configuration as a starting point most of the relevant dependencies are already installed. However, we still miss osmo-sip-connector and Asterisk as a major components.
30 23 dexter
31 28 dexter
* Install dependancies:
32 21 dexter
The extension we are about to make requires to install some additional packages.
33
<pre>
34
sudo apt-get install libsofia-sip-ua-glib-dev
35
sudo apt-get install asterisk
36 1 msuraev
</pre>
37 21 dexter
38 28 dexter
* Install osmo-sip-connector:
39 21 dexter
The installation of osmo-sip-connector is as straight forward as you know it already from other osmocom projects:
40
<pre>
41
git clone git://git.osmocom.org/osmo-sip-connector.git
42
cd osmo-sip-connector/
43
autoreconf -fi
44
./configure
45
make
46
sudo make install
47
</pre>
48 27 dexter
49
50 37 dexter
h3. Osmo-sip-connector configuration
51 1 msuraev
52 57 dexter
In this section we illustrate how equip osmo-nitb 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.
53 40 dexter
54 28 dexter
* Osmo-nitb:
55 27 dexter
Osmo-nitb does not require any change of of its configuration. The connection between osmo-sip-connector is configured using the command line option “-M”:
56
<pre>
57 1 msuraev
osmo-nitb -c ./openbsc.cfg -d option –debug=DRLL:DCC:DMM:DRR:DRSL:DNM -M /tmp/bsc_mncc
58
</pre>
59
The “-M” option disables the internal call control handler of osmo-nitb and offers an unix domain socket, where an external call control handler can be connected. In the described situation this will be osmo-sip-connector.
60 28 dexter
61 50 dexter
* osmo-sip-connector:
62 61 dexter
Osmo-sip connector acts as a translator between the classic ISDN call control (mncc) and SIP. The configuration is rather simple.
63 28 dexter
<pre>
64
app
65
mncc
66
  socket-path /tmp/bsc_mncc
67
sip
68
  local 10.9.1.110 5069
69
  remote 10.9.1.110 5060
70
</pre>
71 57 dexter
Again, we have to setup a socket path. This path has to be the same as we provided with the commandline option “-M” for osmo-nitb earlier. 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 ovious 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. Osmo-sip-connector is started via commandline as follows:
72 28 dexter
<pre>
73
osmo-sip-connector -c ./osmo-sip-connector.cfg
74
</pre>
75 1 msuraev
76 32 dexter
77 1 msuraev
h3. Asterisk configuration
78
79
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.
80
81
* Set up the sip-trunk towards osmo-sip-connector:
82
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:
83
<pre>
84
[GSM]
85
type=friend
86
host=10.9.1.110
87
dtmfmode=rfc2833
88
canreinvite=no
89 37 dexter
disallow=all
90 32 dexter
allow=gsm
91 57 dexter
context=gsmsubscriber
92 32 dexter
port=5069
93 36 dexter
</pre>
94 51 dexter
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.
95 32 dexter
96
97
* Set up a dialplan to route calls:
98
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:
99
<pre>
100
[gsmsubscriber]
101
exten=>_XXXXX,1,Dial(SIP/GSM/${EXTEN})
102
exten=>_XXXXX,n,Playback(vm-nobodyavail)
103
exten=>_XXXXX,n,HangUp
104
</pre>
105
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.
106 53 dexter
107 34 dexter
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. 
108
109 36 dexter
110 69 dexter
h3. Use Kamailio as an alternative to Asterisk
111 67 dexter
112 68 dexter
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.
113
114
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:music@iptel.org) and 600 (routed to sip:echo@iptel.org): by dialing them you can use echo test or hear nice music from your mobile.
115 67 dexter
116
*Note:* in attached kamailio.cfg, for 64bit systems, you may need to adjust
117
<pre>
118
mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/"
119
</pre>
120
121
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
122
123 70 dexter
See also https://www.kamailio.org
Add picture from clipboard (Maximum size: 48.8 MB)