Project

General

Profile

Feature #4255

integrate mslookup mDNS client in SIP call agent

Added by neels 9 months ago. Updated 9 months ago.

Status:
Resolved
Priority:
High
Assignee:
Target version:
-
Start date:
11/08/2019
Due date:
% Done:

100%


Description

Integrate an mslookup to redirect SIP calls to an MSISDN's current location.

Taking rhizomatica's dialplan.py as inspiration:
- see whether kamailio has a similar easy way of integrating a dialplan (because we are using that in osmo-dev)
- if it is not trivial, set up a FreeSwitch with a dialplan.py similar to the Rhizomatica setup.
- integrate an mslookup mDNS client

The way it works:

An osmo-hlr.cfg lists each MSC's osmo-sip-connector IP:port (SIP side):

mslookup
 server
  # for all MSCs:
  service sip.voice at 192.168.0.23 5096
  # or individually per MSC:
  msc MSC-901-70-23
   service sip.voice at 192.168.0.23 5096

This address is sent back to an mDNS request for sip.voice.12345.msisdn.

So the remote MO call side's PBX looks up the MSISDN and gets a reply from whichever osmo-hlr last received a LU from an MSC (and proxied it to the home HLR).
The PBX gets the MT side's osmo-sip-connector SIP address:port and forwards the call directly to the MT sipcon:

MO-PBX -----------SIP--\           MT-PBX
MO-sipcon               \--------> MT-sipcon
MO-MSC                             MT-MSC
MO-MS                              MT-MS

History

#1 Updated by neels 9 months ago

  • Assignee set to osmith

#2 Updated by neels 9 months ago

  • Priority changed from Normal to High

#3 Updated by neels 9 months ago

#4 Updated by osmith 9 months ago

  • % Done changed from 0 to 10

- see whether kamailio has a similar easy way of integrating a dialplan (because we are using that in osmo-dev)

As we were talking yesterday, we were wondering if dialplan is some sort of standard protocol that could be used with multiple sip implementations. This is not the case. Furthermore, there is a dialplan module in kamailio, which is completely unrelated to calling python code in order to do the routing:

https://www.kamailio.org/docs/modules/stable/modules/dialplan.html

However, there is a feature called KEMI ("Kamailio EMbedded Interface") for using scripting languages to do the routing. It can be used with python2 and 3.

So we could use this in theory... but we would arrive with a kamailio specific solution then, which would not be helpful for Rhizomatica with their freeswitch setup. I can imagine that freeswitch behaves completely different in some regards, e.g. how we would use a callback once we have the mdns answer (or do we have to block until then?).

- if it is not trivial, set up a FreeSwitch with a dialplan.py similar to the Rhizomatica setup.

I will try this. (Unfortunately freeswitch is not in debian repositories and must be installed from an additional repository)

#5 Updated by osmith 9 months ago

  • % Done changed from 10 to 30

I have started to integrate freeswitch with osmo-dev. It starts properly, osmo-sip-connector forwards calls to it, but freeswitch is rejecting them right now:

2019-11-08 17:50:13.974876 [WARNING] sofia.c:10450 IP 127.0.0.2 Rejected by acl "domains"

I'll continue with this next week.

WIP branch (osmo-dev.git): osmith/freeswitch

#6 Updated by osmith 9 months ago

  • % Done changed from 30 to 70
  • The domains problem above is solved
  • I've created a short, custom dialplan program based on the example from freeswitch, and the Rhizomatica code
  • it's possible to redirect from this dialplan back to osmo-sip-connector (just like it is done in RCCN). I've tested it with two phones, and the second phone shows a missed call (this setup can't negotiate a proper codec yet, so actual calling does not work... but that's not so important for the mdns resolving)
  • I've written a "mslookup.py", which uses libosmo-mslookup to make the mDNS queries (based on the related ctypes-test code in libosmocore). This mslookup.py can be used as standalone to resolve a number, so we don't need the whole setup running, and it gets called from the dialplan program
  • The mDNS request arrives in OsmoHLR, but right now it never answers it for some reason (probably a configuration issue, related to the gsup proxy?)
  • In theory the dialplan should then use the result and freeswitch should bridge the call as desired.
  • The dialplan implementation is simply blocking until there is a result from freeswitch. It seemed like freeswitch is starting a separate python process whenever it needs a dialplan instance.
  • There are a few remaining quirks, such as the OsmoHLR issue, and also freeswitch segfaulted when I attempted to use dialplan twice.

#7 Updated by osmith 9 months ago

  • % Done changed from 70 to 100

We've worked around the segfault issue by starting a separate python process for each mslookup call.

With that in place, it is working! \o/

#8 Updated by osmith 9 months ago

I've tested it with two phones, and the second phone shows a missed call (this setup can't negotiate a proper codec yet, so actual calling does not work... but that's not so important for the mdns resolving)

This needs to be resolved, before we can mark this as solved.

#9 Updated by osmith 9 months ago

  • Status changed from New to Resolved

osmith wrote:

I've tested it with two phones, and the second phone shows a missed call (this setup can't negotiate a proper codec yet, so actual calling does not work... but that's not so important for the mdns resolving)

This needs to be resolved, before we can mark this as solved.

Neels fixed the codec error (we were missing a vars.xml in the freeswitch config dir) and verified that it works properly. He meda a config (in osmo-dev.git) where two villages can make phone calls with each other, just like we envisioned it and it works perfectly :)

#10 Updated by osmith 9 months ago

I've cleaned up the dialplan script a bit, and put it in the contrib-dir of osmo-sip-connector.git (branch osmith/dgsm).

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)