The script driven SIP B2BUA

The SIP B2B support was a huge leap in OpenSIPS evolution, if we consider that OpenSIPS, by origins, started as a SIP proxy. And this addition of the B2B support came in a natural way, as a result of the urge of the OpenSIPS community/users – it is great to have a fast proxy, but it awesome to be able to control the call, like to be able to change only one of the party involved in the call, without disrupting the other one. And this means acting as a SIP Back-to-Back.

Existing limitations

The original OpenSIPS B2B support (added more than 10 years ago) was designed in a very encapsulated way.

The SIP traffic related to the B2B sessions is not very accessible from the script level. This makes very complicated, and some times impossible, to extract information form the SIP traffic and also to do custom changes over this traffic (again, B2B related).

Also the logic for controlling the B2B engine was outsourced to an external XML script. This logic is responsible for controlling how the legs inside the B2B session do change and communicate, like saying where the caller should be connected to (as new SIP destination) when the callee is hanging up its leg. And there are two major problems with this outsourced to the external XML script:

  • mapping a routing logic over an XML structure is complicated and restrictive. So, the logic that you can do in the XML is very limited.
  • being a separate file, the XML logic has 0 access to the SIP messages and also zero interfacing with the OpenSIPS script, like having access to the variables or using the backends (events, SQL, noSQL) available at OpenSIPS script level.

Script driven B2B

Starting with OpenSIPS 3.2, we decided to tackle all the above limitations, and even more, to leverage the “scripting” in OpenSIPS, by using the same OpenSIPS scripting to control the drive the B2B sessions. So, bye, bye XML !!!

The native OpenSIPS script will hold (as routes) the logic needed to drive the B2B sessions. By doing this we:

  • have the best possible interaction between the driving logic and the actual SIP traffic
  • enhance the actual logic – what you can describe with scripting is definitely more powerful than any XML script.
  • exposes to the B2B engine the access to scripting variables and to various backends provided by OpenSIPS.

With this new script-driven B2B, the B2B engine in OpenSIPS becomes more attractive (in terms of what kind of problems it can address) and simpler (in terms of how easy is to do your custom B2B controller).

For example, for see the huge difference in clarity and simplicity between the XML scenario here and the equivalent script-based scenario here, for implementing a prepaid service.

Not to mention that you do not have to extra learn the XML formatting (not an easy one, just check its definition here) versus simply using what we already master, the native OpenSIPS routing script.

Even more, the script-driven logic gives you the possibility to do partitioning over your B2B scenarios – you can use different script routes for different B2B scenarios. And this is something very handy if you consider mixing multiple B2B scenarios/logics into your OpenSIPS or if you try to micro B2B services.

The 3.2 OpenSIPS B2B Tutorial is an outstanding proof of the boost achieved by this transition to the script-driven logic in the B2B engine.

Migration

When moving to OpenSIPS 3.2 version, there are couple of things you should be aware of when comes to using the B2B engine.

While the b2b_entities module stays more or less the same, the b2b_logic module provides now a script driven logic. If you are still a big fan of XMLs, for a bit of transition time, you can still find the b2b_logic_xml module that still provides the old XML driven logic. NOTE that this module will be removed with the next (>=3.3) releases!!

When comes to the modules using the b2b_logic API (providing features on top of the B2B engine), the only affected one is the call_center module. The change is minor – the xml file controlling the call queuing logic was removed, as not needed any more. Otherwise, in terms of usage, it is exactly the same.

Enjoy it !

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s