<div dir="auto">Thank you.<div dir="auto">And what about the crash when using it with htable api module?</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, 11 Jun 2019, 18:18 Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com">miconda@gmail.com</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>Yes, you must allocate with pkg, because at the end those chunks
are freed, once the new message is built. You can also look at how
other operations with data lumps are done inside the textops
module.<br>
</p>
<div class="m_-6778278166567769176moz-cite-prefix">On 11.06.19 14:44, Mojtaba wrote:<br>
</div>
<blockquote type="cite">
<div dir="auto">I assigned a const sdp string to it just for
checking. Does it matter to allocate new memory for newbody?</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Tue, 11 Jun 2019, 15:22 Daniel-Constantin
Mierla <<a href="mailto:miconda@gmail.com" target="_blank" rel="noreferrer">miconda@gmail.com</a> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
how do you set newbody.s and newbody.len?<br>
<br>
Daniel<br>
<br>
On 11.06.19 12:29, Mojtaba wrote:<br>
> Not yet, because it is under developing, i could paste it
here right away.<br>
><br>
> {<br>
> .<br>
> .<br>
> .<br>
> body.s = get_body(msg);<br>
> if (body.s == 0) {<br>
> LM_ERR("failed to get the message
body\n");<br>
> return -1;<br>
> }<br>
> body.len = msg->len - (int) (body.s -
msg->buf);<br>
> // body.len = strlen(body.s);<br>
> if (body.len == 0) {<br>
> LM_DBG("message body has zero length\n");<br>
> return -1;<br>
> }<br>
> l = del_lump(msg, body.s - msg->buf, body.len, 0);<br>
> if (!l) {<br>
> LM_ERR("del_lump failed\n");<br>
> return -1;<br>
> }<br>
><br>
> if (!insert_new_lump_after(l, newbody.s, newbody.len,
0)) {<br>
> LM_ERR("insert_new_lump_after failed\n");<br>
> return -1;<br>
> }<br>
> }<br>
> I asked related issue in this regards in Kamailio
developer forum,<br>
> before. let me paste it at below. The means of
other_process function<br>
> is above code.<br>
> In during developing new module in Kamailio, I
encountered with<br>
> strange behaviour. I used htable module instead of linked
list for<br>
> save some temporary data during call process.dependencies
module to<br>
> save some information. the skeleton of my code is like
thus:<br>
><br>
> if (SIP_REQUEST &METHOD_INVITE) {<br>
> insert_data_htable("some data");<br>
> other_process(msg);<br>
> }else if(SIP_REPLY){<br>
> get_data_htable("some data");<br>
> other_process(msg);<br>
> }<br>
> In other_process function i have some changes in msg's
body with message lump.<br>
> But after i make first call in kamailio. The kamailio was
crashed.What<br>
> is it's problem?<br>
> In additional if i comment either insert/get_data_htable
function or<br>
> othet_process function, i dont have this issue.<br>
> With best regards.<br>
><br>
><br>
> On Tue, Jun 11, 2019 at 2:46 PM Daniel-Constantin Mierla<br>
> <<a href="mailto:miconda@gmail.com" rel="noreferrer noreferrer" target="_blank">miconda@gmail.com</a>>
wrote:<br>
>> Hello,<br>
>><br>
>> likely you didn't allocate the pointer inserted in
data lump list. Is<br>
>> the code using data lumps available to look at on
git?<br>
>><br>
>> Cheers,<br>
>> Daniel<br>
>><br>
>> On 11.06.19 12:01, Mojtaba wrote:<br>
>>> Hello,<br>
>>> What does this CRITICAL error mean?<br>
>>> Jun 11 05:48:13 debian8
/usr/local/sbin/kamailio[8468]: {1 1 INVITE<br>
>>> Njg0MzNhMzJhOTY3MzQ3NmNlNWY0ODkzMTJmNTM1ZTk.}
CRITICAL: <core><br>
>>> [core/mem/q_malloc.c:486]: qm_free(): BUG: bad
pointer 0xa3c188 (out<br>
>>> of memory block!) called from core:
core/data_lump.c: free_lump(466) -<br>
>>> aborting<br>
>>><br>
>>> I got it when i make new call during debugging
new module in Kamailio?<br>
>>> In module we have to change some message's body
with data_lump.<br>
>>> I asked relaed issue (strange behaviour while
developing new module)<br>
>>> in Kamailio developer forum <<a href="mailto:sr-dev@lists.kamailio.org" rel="noreferrer noreferrer" target="_blank">sr-dev@lists.kamailio.org</a>><br>
>>> With Best Regards.<br>
>>><br>
>> --<br>
>> Daniel-Constantin Mierla -- <a href="http://www.asipto.com" rel="noreferrer noreferrer noreferrer" target="_blank">www.asipto.com</a><br>
>> <a href="http://www.twitter.com/miconda" rel="noreferrer noreferrer noreferrer" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" rel="noreferrer
noreferrer noreferrer" target="_blank">www.linkedin.com/in/miconda</a><br>
>><br>
><br>
> --<br>
> --Mojtaba Esfandiari.S<br>
<br>
-- <br>
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" rel="noreferrer noreferrer noreferrer" target="_blank">www.asipto.com</a><br>
<a href="http://www.twitter.com/miconda" rel="noreferrer
noreferrer noreferrer" target="_blank">www.twitter.com/miconda</a>
-- <a href="http://www.linkedin.com/in/miconda" rel="noreferrer noreferrer noreferrer" target="_blank">www.linkedin.com/in/miconda</a><br>
<br>
</blockquote>
</div>
</blockquote>
<pre class="m_-6778278166567769176moz-signature" cols="72">--
Daniel-Constantin Mierla -- <a class="m_-6778278166567769176moz-txt-link-abbreviated" href="http://www.asipto.com" target="_blank" rel="noreferrer">www.asipto.com</a>
<a class="m_-6778278166567769176moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" target="_blank" rel="noreferrer">www.twitter.com/miconda</a> -- <a class="m_-6778278166567769176moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" target="_blank" rel="noreferrer">www.linkedin.com/in/miconda</a></pre>
</div>
</blockquote></div>