[SR-Users] KEMI get_body_part

Igor Olhovskiy igorolhovskiy at gmail.com
Mon Apr 2 11:25:29 CEST 2018


 Actual packet

INVITE sip:555 at 172.31.1.100:5060;transport=UDP SIP/2.0
Via: SIP/2.0/UDP
X.X.X.X:35111;branch=z9hG4bK-524287-1---d6f4a1cf0574662e;rport
Max-Forwards: 70
Contact: <sip:2526839686 at X.X.X.X:35111;transport=UDP>
To: <sip:555 at 172.31.1.100:5060;transport=UDP>
From: <sip:2526839686 at 172.31.1.100:5060;transport=UDP>;tag=a328380c
Call-ID: WPgNxs-lKSWCNLzPGbQ9Zw..
CSeq: 1 INVITE
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO,
SUBSCRIBE
Content-Type: application/sdp
User-Agent: Z 5.2.14 rv2.8.88
Allow-Events: presence, kpml, talk
Content-Length: 649

v=0
o=Z 0 0 IN IP4 192.168.1.233
s=Z
c=IN IP4 192.168.1.233
t=0 0
m=audio 8000 RTP/AVP 106 9 18 3 111 0 8 97 110 112 98 101 100 99 102
a=rtpmap:106 opus/48000/2
a=fmtp:106 minptime=20; cbr=1; maxaveragebitrate=40000; useinbandfec=1
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:111 speex/16000
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=20
a=rtpmap:110 speex/8000
a=rtpmap:112 speex/32000
a=rtpmap:98 telephone-event/48000
a=fmtp:98 0-16
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:100 telephone-event/16000
a=fmtp:100 0-16
a=rtpmap:99 telephone-event/32000
a=fmtp:99 0-16
a=rtpmap:102 G726-32/8000
a=sendrecv


Regards, Igor

On Apr 2, 2018, 9:28 AM +0300, Daniel-Constantin Mierla <miconda at gmail.com>,
wrote:

Hello,

On 30.03.18 14:44, Igor Olhovskiy wrote:

Hi!

I’m trying to get SDP body in my var.

I’m using smth like this

    if (KSR.textops.has_body() ~= -1 and
KSR.textops.has_body_type("application/sdp")
~= -1) then
        KSR.textops.get_body_part("application/sdp", "$var(pbody)»)
local sdp_body = KSR.pv.get("$var(pbody)")
….
    end

But in logs i see this
LUA {INVITE}:  7(20794) DEBUG: <core> [core/parser/msg_parser.c:183]:
get_hdr_field(): content_length=470
LUA {INVITE}:  7(20794) DEBUG: app_lua [app_lua_sr.c:1496]:
sr_kemi_lua_exec_func_ex(): param[0] for: has_body_type is str:
application/sdp
LUA {INVITE}:  7(20794) DEBUG: textops [textops.c:3083]: has_body_helper():
content type is 196611
LUA {INVITE}:  7(20794) DEBUG: app_lua [app_lua_sr.c:1496]:
sr_kemi_lua_exec_func_ex(): param[0] for: get_body_part is str:
application/sdp
LUA {INVITE}:  7(20794) DEBUG: app_lua [app_lua_sr.c:1496]:
sr_kemi_lua_exec_func_ex(): param[1] for: get_body_part is str: $var(pbody)
LUA {INVITE}:  7(20794) DEBUG: <core> [core/pvapi.c:396]:
pv_cache_lookup(): pvar [$var(pbody)] found in cache
LUA {INVITE}:  7(20794) DEBUG: <core> [core/parser/msg_parser.c:89]:
get_hdr_field(): found end of header
LUA {INVITE}:  7(20794) INFO: <core> [core/msg_translator.c:1694]:
get_boundary(): Content-Type hdr has no params <application/sdp>
LUA {INVITE}:  7(20794) ERROR: textops [textops.c:2468]:
ki_get_body_part_helper(): Cannot get boundary. Is body multipart?

Was there a multi-part body? If not, get the body with $rb variable.

Cheers,
Daniel


So, in sdp_body var i got 0. What is wrong here?


--
Daniel-Constantin Mierlawww.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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20180402/0f320536/attachment.html>


More information about the sr-users mailing list