On 02/04/2014 01:35 AM, Ramya Ramamurthy wrote:
I am using kamailio for decoding of SIP Packets with Message
Body as a GSM PDU. But I am not sure of the modules which i need to use for the same. Some help on this would be greatly appreciated.
Kamailio doesn't care much about the encapsulated message body, and there are no special modules to deal with GSM message bodies. In fact, the only module that I am aware of that deals with manipulation of encapsulated bodies at all (besides the far-end NAT traversal and rtpproxy modules that modify RTP endpoints and other SDP attributes) is the SIP-T module[1]. But that's ISUP, not GSM.
You can access the message body with $rb:
http://www.kamailio.org/wiki/cookbooks/4.1.x/pseudovariables#rb_-_body_of_re...
The bad news is that pretty much all textops[x] functions operate on the RURI or other existing, predefined parts of the SIP message, so you can't use those. Transformations can be of some help:
http://www.kamailio.org/wiki/cookbooks/4.1.x/transformations
But they mostly expect SIP or URI-like data as well. So, short of cobbling something together with {s.substr}, {s.select} and {re.subst}, those probably aren't going to be very fruitful either.
Depending on how complex the GSM PDU is and how exactly it's formatted, you might be better off passing it to a third-party script for processing. Other languages' generally-oriented programming runtimes and libraries allow free reading and manipulation of strings much more easily than Kamailio's relatively narrow config script environment. Offhand, Kamailio supports embedded Lua, Python, Perl, and I think Java and Mono (.NET) as well, although some of these are easier to use than others. All of these modules, as far as I know, involve some performance-related optimisations, such as only loading the language interpreter into memory once, instead of at every invocation.
-- Alex
[1] http://kamailio.org/docs/modules/4.1.x/modules/sipt.html