Project

General

Profile

Howto » History » Version 9

daniel, 02/16/2023 01:15 PM

1 1 laforge
h2. Howto
2
3 9 daniel
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.
4 1 laforge
5 9 daniel
Note: The attached configuration files are for an older (osmo-nitb) setup.
6 1 laforge
7
h3. Preparations
8
9 8 daniel
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.
10 1 laforge
11 3 osmith
* Install dependencies:
12 1 laforge
The extension we are about to make requires to install some additional packages.
13
<pre>
14
sudo apt-get install libsofia-sip-ua-glib-dev
15
sudo apt-get install asterisk
16
</pre>
17
18
* Install osmo-sip-connector:
19
The installation of osmo-sip-connector is as straight forward as you know it already from other osmocom projects:
20
<pre>
21 8 daniel
apt get install osmo-sip-connector
22
</pre>
23
You can also build it yourself:
24
<pre>
25 7 laforge
git clone https://gitea.osmocom.org/cellular-infrastructure/osmo-sip-connector
26 1 laforge
cd osmo-sip-connector/
27
autoreconf -fi
28
./configure
29
make
30
sudo make install
31 4 osmith
</pre>
32 1 laforge
33 4 osmith
h3. Osmo-sip-connector configuration
34
35 8 daniel
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.
36 1 laforge
37 8 daniel
* osmo-msc - Add the following to your config:
38 1 laforge
<pre>
39 8 daniel
msc
40
 mncc external /tmp/msc_mncc
41 6 daniel
</pre>
42 1 laforge
43
* osmo-sip-connector:
44
Osmo-sip connector acts as a translator between the classic ISDN call control (mncc) and SIP. The configuration is rather simple.
45
<pre>
46
app
47
mncc
48
  socket-path /tmp/msc_mncc
49 6 daniel
sip
50 8 daniel
  local 127.0.0.1 5061
51
  remote 127.0.0.1 5060
52 1 laforge
</pre>
53 8 daniel
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:
54 4 osmith
<pre>
55 8 daniel
# systemctl restart osmo-sip-connector osmo-msc
56
# systemctl enable osmo-sip-connector
57 1 laforge
</pre>
58
59
h3. Asterisk configuration
60
61
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.
62
63
* Set up the sip-trunk towards osmo-sip-connector:
64
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:
65
<pre>
66
[GSM]
67
type=friend
68
host=10.9.1.110
69
dtmfmode=rfc2833
70
canreinvite=no
71
disallow=all
72
allow=gsm
73
context=gsmsubscriber
74
port=5069
75
</pre>
76
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.
77
78
79
* Set up a dialplan to route calls:
80
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:
81
<pre>
82
[gsmsubscriber]
83
exten=>_XXXXX,1,Dial(SIP/GSM/${EXTEN})
84
exten=>_XXXXX,n,Playback(vm-nobodyavail)
85
exten=>_XXXXX,n,HangUp
86
</pre>
87
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.
88
89 5 osmith
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.
90 1 laforge
91 5 osmith
Note: This configuration will route numbers with five digits. If you have three digits for example, replace XXXXX with XXX.
92 1 laforge
93
h3. Use Kamailio as an alternative to Asterisk
94
95
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.
96
97
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.
98
99
*Note:* in attached kamailio.cfg, for 64bit systems, you may need to adjust
100
<pre>
101
mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/"
102
</pre>
103
104
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
105
106
See also https://www.kamailio.org
107 2 laforge
108
h2. Attachments
Add picture from clipboard (Maximum size: 48.8 MB)