<div dir="ltr">



<div>
<div name="messageSignatureSection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif"><div name="messageSignatureSection">Actual packet</div><div name="messageSignatureSection"><br></div><div name="messageSignatureSection">INVITE sip:555@172.31.1.100:5060;transport=UDP SIP/2.0</div><div name="messageSignatureSection">Via: SIP/2.0/UDP X.X.X.X:35111;branch=z9hG4bK-524287-1---d6f4a1cf0574662e;rport</div><div name="messageSignatureSection">Max-Forwards: 70</div><div name="messageSignatureSection">Contact: <sip:2526839686@X.X.X.X:35111;transport=UDP></div><div name="messageSignatureSection">To: <sip:555@172.31.1.100:5060;transport=UDP></div><div name="messageSignatureSection">From: <sip:2526839686@172.31.1.100:5060;transport=UDP>;tag=a328380c</div><div name="messageSignatureSection">Call-ID: WPgNxs-lKSWCNLzPGbQ9Zw..</div><div name="messageSignatureSection">CSeq: 1 INVITE</div><div name="messageSignatureSection">Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE</div><div name="messageSignatureSection">Content-Type: application/sdp</div><div name="messageSignatureSection">User-Agent: Z 5.2.14 rv2.8.88</div><div name="messageSignatureSection">Allow-Events: presence, kpml, talk</div><div name="messageSignatureSection">Content-Length: 649</div><div name="messageSignatureSection"><br></div><div name="messageSignatureSection">v=0</div><div name="messageSignatureSection">o=Z 0 0 IN IP4 192.168.1.233</div><div name="messageSignatureSection">s=Z</div><div name="messageSignatureSection">c=IN IP4 192.168.1.233</div><div name="messageSignatureSection">t=0 0</div><div name="messageSignatureSection">m=audio 8000 RTP/AVP 106 9 18 3 111 0 8 97 110 112 98 101 100 99 102</div><div name="messageSignatureSection">a=rtpmap:106 opus/48000/2</div><div name="messageSignatureSection">a=fmtp:106 minptime=20; cbr=1; maxaveragebitrate=40000; useinbandfec=1</div><div name="messageSignatureSection">a=rtpmap:18 G729/8000</div><div name="messageSignatureSection">a=fmtp:18 annexb=no</div><div name="messageSignatureSection">a=rtpmap:111 speex/16000</div><div name="messageSignatureSection">a=rtpmap:97 iLBC/8000</div><div name="messageSignatureSection">a=fmtp:97 mode=20</div><div name="messageSignatureSection">a=rtpmap:110 speex/8000</div><div name="messageSignatureSection">a=rtpmap:112 speex/32000</div><div name="messageSignatureSection">a=rtpmap:98 telephone-event/48000</div><div name="messageSignatureSection">a=fmtp:98 0-16</div><div name="messageSignatureSection">a=rtpmap:101 telephone-event/8000</div><div name="messageSignatureSection">a=fmtp:101 0-16</div><div name="messageSignatureSection">a=rtpmap:100 telephone-event/16000</div><div name="messageSignatureSection">a=fmtp:100 0-16</div><div name="messageSignatureSection">a=rtpmap:99 telephone-event/32000</div><div name="messageSignatureSection">a=fmtp:99 0-16</div><div name="messageSignatureSection">a=rtpmap:102 G726-32/8000</div><div name="messageSignatureSection">a=sendrecv</div></div><div name="messageSignatureSection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif"><br></div><div name="messageSignatureSection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif"><br>
Regards, Igor</div>
<div name="messageReplySection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif"><br>
On Apr 2, 2018, 9:28 AM +0300, Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>>, wrote:<br>
<blockquote type="cite" style="margin:5px;padding-left:10px;border-left-width:thin;border-left-style:solid;border-left-color:rgb(26,188,156)">
<p>Hello,<br></p>
<br>
<div class="gmail-m_-3018862747934596366moz-cite-prefix">On 30.03.18 14:44, Igor Olhovskiy wrote:<br></div>
<blockquote type="cite" style="margin:5px;padding-left:10px;border-left-width:thin;border-left-style:solid;border-left-color:rgb(230,126,34)">
<div name="messageBodySection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif">Hi!
<div><br></div>
<div>I’m trying to get SDP body in my var.</div>
<div><br></div>
<div>I’m using smth like this</div>
<div><br></div>
<div>
<div>    if (KSR.textops.has_body() ~= -1 and KSR.textops.has_body_type("<wbr>application/sdp") ~= -1) then</div>
<div>        KSR.textops.get_body_part("<wbr>application/sdp", "$var(pbody)»)</div>
</div>
<div>  local sdp_body = KSR.pv.get("$var(pbody)")<br></div>
<div>  ….<br></div>
<div>    end</div>
<div><br></div>
<div>But in logs i see this</div>
<div>
<div>LUA {INVITE}:  7(20794) DEBUG: <core> [core/parser/msg_parser.c:183]<wbr>: get_hdr_field(): content_length=470</div>
<div>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</div>
<div>LUA {INVITE}:  7(20794) DEBUG: textops [textops.c:3083]: has_body_helper(): content type is 196611</div>
<div>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</div>
<div>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)</div>
<div>LUA {INVITE}:  7(20794) DEBUG: <core> [core/pvapi.c:396]: pv_cache_lookup(): pvar [$var(pbody)] found in cache</div>
<div>LUA {INVITE}:  7(20794) DEBUG: <core> [core/parser/msg_parser.c:89]: get_hdr_field(): found end of header</div>
<div>LUA {INVITE}:  7(20794) INFO: <core> [core/msg_translator.c:1694]: get_boundary(): Content-Type hdr has no params <application/sdp></div>
<div>LUA {INVITE}:  7(20794) ERROR: textops [textops.c:2468]: ki_get_body_part_helper(): Cannot get boundary. Is body multipart?</div>
</div>
</div>
</blockquote>
Was there a multi-part body? If not, get the body with $rb variable.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<blockquote type="cite" style="margin:5px;padding-left:10px;border-left-width:thin;border-left-style:solid;border-left-color:rgb(230,126,34)">
<div name="messageBodySection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif">
<div></div>
<div><br></div>
<div>So, in sdp_body var i got 0. What is wrong here?</div>
</div>
<div name="messageSignatureSection" style="font-size:14px;font-family:-apple-system,BlinkMacSystemFont,sans-serif"><br></div>
</blockquote>
<br>
<pre class="gmail-m_-3018862747934596366moz-signature" cols="72">--  
Daniel-Constantin Mierla
<a class="gmail-m_-3018862747934596366moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a class="gmail-m_-3018862747934596366moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - April 16-18, 2018, Berlin - <a class="gmail-m_-3018862747934596366moz-txt-link-abbreviated" href="http://www.asipto.com" target="_blank">www.asipto.com</a>
Kamailio World Conference - May 14-16, 2018 - <a class="gmail-m_-3018862747934596366moz-txt-link-abbreviated" href="http://www.kamailioworld.com" target="_blank">www.kamailioworld.com</a></pre></blockquote>
</div>
</div>

</div>