[SR-Users] How to extract SIP-I ISUP parameters

Eugene Prokopiev enp at itx.ru
Thu Mar 29 20:53:03 CEST 2018


Tried to use get_body_part and isup_to_json first, but looks like I
can't understand syntax. My config:

loadmodule "tm.so"
loadmodule "sl.so"
loadmodule "xlog.so"
loadmodule "textops.so"
loadmodule "ss7ops.so"

listen=udp:0.0.0.0:5060

route {
  get_body_part("application/isup", "$var(pbody)");
  isup_to_json(8);
  xlog("$isup(1)\n");
  sl_send_reply("503", "Server is not configured");
}

Can't even run it due to:

kamailio_1  |  0(1) ERROR: textops [textops.c:2615]:
fixup_get_body_part(): failed to fixup result pvar
kamailio_1  |  0(1) ERROR: <core> [core/route.c:1154]: fix_actions():
fixing failed (code=-1) at cfg:/etc/kamailio/kamailio.cfg:10
kamailio_1  | error -1 while trying to fix configuration

Can you show me working example with get_body_part and isup_to_json
and json dump to stdout?

2018-03-29 18:21 GMT+03:00 Daniel-Constantin Mierla <miconda at gmail.com>:
> As I got it, there is an ISUP parser inside ss7ops module.
>
> It may require a bit of C coding to build a function for helping with
> what you need -- the two functions that are useful for doing it are:
>
>   *
> https://www.kamailio.org/docs/modules/stable/modules/textops.html#textops.f.get_body_part
>   *
> https://www.kamailio.org/docs/modules/stable/modules/ss7ops.html#ss7ops.f.isup_to_json
>
> The first one shows how to extract the part of the body from the sip
> message with the ISUP, the second one shows to convert the ISUP data to
> json. From there you can use jansson module to extract fields.
>
> If you are not familiar with C coding, open a feature request on
> kamailio issue tracker on github.com, maybe someone can get to it soon,
> otherwise I will look at it when I get a chance.
>
> The other option right now is to use some Python or Lua script to do the
> parsing of ISUP there, maybe there are libraries for it in those
> languages. You get get the body of the SIP message inside these messages
> using $rb variable or the textops function via KSR KEMI module:
>
>   -
> http://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/kemimods/#ksrpvget
>   -
> http://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/modules/#ksrtextopsget_body_part
>
> Cheers,
> Daniel
>
> On 29.03.18 12:50, Eugene Prokopiev wrote:
>> I can attach screenshot of ISUP part of pcap.
>>
>> Is it possible to extract all ISUP parameters or at least 'Redirecting
>> number' or 'Called IN number'? Can extract ISUP part as is in binary
>> form and read by some external script? Are you know about any library
>> to parse ISUP binary data?
>>
>> 2018-03-29 11:30 GMT+03:00 Daniel-Constantin Mierla <miconda at gmail.com>:
>>> Hello,
>>>
>>> can you provide a pcap (or ngrep output) with such invite in order to
>>> see what can be done with existing modules? Maybe it needs just some
>>> script operations.
>>>
>>> Cheers,
>>> Daniel
>>>
>>>
>>> On 28.03.18 17:26, Eugene Prokopiev wrote:
>>>> Hi,
>>>>
>>>> I need to extract ISUP parameter 'Redirecting number' from SIP-I
>>>> INVITE request and add it as SIP header with 'X-' prefix to process in
>>>> FreeSWITCH. I tried to read
>>>> https://kamailio.org/docs/modules/5.1.x/modules/sipt.html (but it is
>>>> about updating headers) and
>>>> https://kamailio.org/docs/modules/5.1.x/modules/ss7ops.html (but I
>>>> have only ISUP encapsulated in SIP), so not found any solution. Help
>>>> me to find it please.
>>>>
>>> --
>>> Daniel-Constantin Mierla
>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>>> Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com
>>> Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com
>>>
>>
>>
>
> --
> Daniel-Constantin Mierla
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com
> Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com
>



-- 
WBR,
Eugene Prokopiev



More information about the sr-users mailing list