Python scripting interface to OsmoNITB/OsmoMSC MNCC interface
Go to file
Harald Welte b674dcf6be Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage
It seems that 4 years ago in 2020 we merged Change-Id
Iab17f09380d7cd914cf85746b794c6c04ec7de43 to add MNCCv7 support, but
never actually tested mncc_sock.py ever since, as it still tries to
unconditionally access the 'ip' and 'port' members of the message,
which no longer exist due to the introduction of sockaddr_storage.

Working with sockaddr_storage is a bit nasty as it contains
double-underscores in the __ss_padding member, which means ctypes/python
will make it a private member that we cannot access.  Work around this
with a small sed-script that removes the underscores from the
clang2py-generated python source code.

Change-Id: I3aa267a866ffaa54e7d71c19231adc78d3831169
2024-03-19 14:17:54 +01:00
contrib contrib/manual_test_server: Make executable, add #! 2020-03-06 18:49:35 +01:00
rtpsource rtpsourcec: Fix compilation on Debian 11 / gcc-10.2.1 2023-01-17 11:38:53 +00:00
.gitignore update .gitignore with rtpsource object code file names 2020-04-30 07:01:06 +00:00
.gitreview Add git-review config 2019-03-12 17:06:24 +01:00
README recommend stock Debian/Ubuntu package for fysom 2018-08-09 12:01:51 +02:00
ctrl.py mncc_mt_loadgen.py: Program for MT call load testing with rtpsource 2020-03-07 21:48:08 +01:00
gsm_call_fsm.py port over ctypeslib2 2024-03-19 14:17:54 +01:00
mncc.h Update MNCC with LLC+HLC support 2024-03-19 14:17:54 +01:00
mncc.py Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage 2024-03-19 14:17:54 +01:00
mncc.xml Update to MNCC v7 (Support IPv6 addresses) 2020-09-09 20:11:28 +02:00
mncc_mt_loadgen.py Initial port from python2 to python3 2024-03-19 14:17:54 +01:00
mncc_sock.py Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage 2024-03-19 14:17:54 +01:00
mncc_test.py Initial port from python2 to python3 2024-03-19 14:17:54 +01:00
regen-mncc-py.sh Adjust mncc_sock.py to MNCC v7 introducing sockaddr_storage 2024-03-19 14:17:54 +01:00
smpp_test.py Initial port from python2 to python3 2024-03-19 14:17:54 +01:00

README

python MNCC interface for OsmoNITB
(C) 2015 by Harald Welte
======================================================================

I've been working on a small python tool that can be used to attach to 
the MNCC interface of OsmoNITB.  It implements the 04.08 CC state 
machine with our MNCC primitives, including support for RTP bridge mode
of the voice streams.

= Requirements =

mncc-python needs python-pykka, and fysom.

On Debian or Ubuntu you can install them via
	sudo apt-get install python-pykka python-fysom

= Getting the code =

The first working version of the tool is available from
        http://git.osmocom.org/mncc-python/
or
        git clone git://git.osmocom.org/mncc-python

The code is pretty hacky in some places.  That's partially due to the 
fact that I'm much more familiar in the C, Perl and Erlang world than in
python.  Still I thought it's a good idea to do it in python to enable 
more people to use/edit/contribute to it.

I'm happy for review / cleanup suggestion by people with more Python-foo 
than I have.

Architecturally, I decided to do things a bit erlang-like, where we have
finite state machines in an actor models, and message passing between 
the actors.  This is what happens with the GsmCallFsm()'s, which are 
created by the GsmCallConnector() representing both legs of a call and 
the MnccActor() that wraps the MNCC socket towards OsmoNITB.

The actual encoding/decoding of MNCC messages is auto-generated from the
mncc header file #defines, enums and c-structures by means of ctypes 
code generation.

The immediate first use case for this was to be able to generate MT 
calls to a set of known MSISDNs and load all 14 TCH/H channels of a
single-TRX BTS.  It will connect the MT calls in pairs, so you end up 
with 7 MS-to-MS calls.

mncc_test.py currently drops you into a python shell where you can e.g.
start more / new calls by calling functions like
        connect_call("7839", "3802")
from that shell.  Above example initiates MT calls to subscribers with
extension number 7839 and 3802.

Exiting the shell by quit() or Ctrl+C will terminate all call FSMs and
terminate.