Project

General

Profile

Osmo-sip-connector » History » Version 78

laforge, 05/11/2018 11:12 AM
source code

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 74 laforge
h2. osmo-sip-connector with [[OsmoNITB:]]
10
11 64 dexter
{{graphviz_link()
12
digraph G{
13 76 laforge
  "osmo-sip-connector" [color="red"];
14 64 dexter
  rankdir = LR;
15
  MS -> BTS [label = "Um"];
16
  BTS -> "osmo-nitb" [label = "Abis"];
17
  "osmo-nitb" -> "osmo-sip-connector" [label = "MNCC"];
18 66 dexter
  "osmo-sip-connector" -> "PBX" [label = "SIP"];
19
  "BTS" -> "PBX" [label = "RTP"];
20 64 dexter
}
21
}}
22
23 74 laforge
h2. osmo-sip-connector with [[OsmoBSC:]] and [[OsmoMSC:]]
24
25
{{graphviz_link()
26
digraph G{
27
  rankdir = LR;
28 1 msuraev
  "osmo-sip-connector" [color="red"];
29 77 laforge
  OsmoMGWB [label="OsmoMGW\n(BSC)"];
30
  OsmoMGWM [label="OsmoMGW\n(MSC)"];
31 74 laforge
  MS -> BTS [label = "Um"];
32
  BTS -> OsmoBSC [label = "Abis"];
33
  OsmoBSC -> OsmoMSC [label = "AoIP" ];
34 1 msuraev
  OsmoMSC -> "osmo-sip-connector" [label = "MNCC"];
35
  "osmo-sip-connector" -> "PBX" [label = "SIP"];
36 77 laforge
  BTS -> OsmoMGWB [label = "RTP"];
37
  OsmoMGWB -> OsmoMGWM [label = "RTP"];
38
  OsmoMGWM -> "PBX" [label = "RTP"];
39
  OsmoBSC -> OsmoMGWB [label = "MGCP" ];
40
  OsmoMSC -> OsmoMGWM [label = "MGCP" ];
41
  { rank = same; OsmoBSC; OsmoMGWB; }
42
  { rank = same; OsmoMSC; OsmoMGWM; }
43 74 laforge
}
44
}}
45 64 dexter
46 75 laforge
{{include(cellular-infrastructure:MacroBinaryPackages)}}
47
48
h2. Manuals
49
50
Unfortunately, contrary to other Osmocom network elements, there is no user manual available yet at http://ftp.osmocom.org/docs/latest/
51
52 78 laforge
h2. Source code
53
54
The source code is available from @git.osmocom.org@ (module @osmo-sip-connector@).
55
56
Public read-only access is available via
57
<pre>
58
git clone git://git.osmocom.org/osmo-sip-connector.git
59
</pre>
60
61
You can browse it via cgit:  https://git.osmocom.org/osmo-sip-connector
62
63
Contributions are welcome via [[Cellular Infrastructure:Gerrit]].
64
65 65 dexter
h2. Howto
66 8 dexter
67 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.
68 71 dexter
69 72 dexter
Note: All configuration files discussed below can also be found in the attachement section
70 41 dexter
71 21 dexter
h3. Preparations
72
73 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.
74 23 dexter
75 28 dexter
* Install dependancies:
76 21 dexter
The extension we are about to make requires to install some additional packages.
77
<pre>
78
sudo apt-get install libsofia-sip-ua-glib-dev
79
sudo apt-get install asterisk
80 1 msuraev
</pre>
81 21 dexter
82 28 dexter
* Install osmo-sip-connector:
83 21 dexter
The installation of osmo-sip-connector is as straight forward as you know it already from other osmocom projects:
84
<pre>
85
git clone git://git.osmocom.org/osmo-sip-connector.git
86
cd osmo-sip-connector/
87
autoreconf -fi
88
./configure
89
make
90
sudo make install
91
</pre>
92 27 dexter
93
94 37 dexter
h3. Osmo-sip-connector configuration
95 1 msuraev
96 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.
97 40 dexter
98 28 dexter
* Osmo-nitb:
99 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”:
100
<pre>
101 1 msuraev
osmo-nitb -c ./openbsc.cfg -d option –debug=DRLL:DCC:DMM:DRR:DRSL:DNM -M /tmp/bsc_mncc
102
</pre>
103
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.
104 28 dexter
105 50 dexter
* osmo-sip-connector:
106 61 dexter
Osmo-sip connector acts as a translator between the classic ISDN call control (mncc) and SIP. The configuration is rather simple.
107 28 dexter
<pre>
108
app
109
mncc
110
  socket-path /tmp/bsc_mncc
111
sip
112
  local 10.9.1.110 5069
113
  remote 10.9.1.110 5060
114
</pre>
115 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:
116 28 dexter
<pre>
117
osmo-sip-connector -c ./osmo-sip-connector.cfg
118
</pre>
119 1 msuraev
120 32 dexter
121 1 msuraev
h3. Asterisk configuration
122
123
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.
124
125
* Set up the sip-trunk towards osmo-sip-connector:
126
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:
127
<pre>
128
[GSM]
129
type=friend
130
host=10.9.1.110
131
dtmfmode=rfc2833
132
canreinvite=no
133 37 dexter
disallow=all
134 32 dexter
allow=gsm
135 57 dexter
context=gsmsubscriber
136 32 dexter
port=5069
137 36 dexter
</pre>
138 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.
139 32 dexter
140
141
* Set up a dialplan to route calls:
142
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:
143
<pre>
144
[gsmsubscriber]
145
exten=>_XXXXX,1,Dial(SIP/GSM/${EXTEN})
146
exten=>_XXXXX,n,Playback(vm-nobodyavail)
147
exten=>_XXXXX,n,HangUp
148
</pre>
149
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.
150 53 dexter
151 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. 
152
153 36 dexter
154 69 dexter
h3. Use Kamailio as an alternative to Asterisk
155 67 dexter
156 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.
157
158
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.
159 67 dexter
160
*Note:* in attached kamailio.cfg, for 64bit systems, you may need to adjust
161
<pre>
162
mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/"
163
</pre>
164
165
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
166
167 70 dexter
See also https://www.kamailio.org
168 73 dexter
169
170
h2. Attachements
Add picture from clipboard (Maximum size: 48.8 MB)