[SR-Users] SIPT append_body_part \x00 how to?..

Daniel-Constantin Mierla miconda at gmail.com
Fri Apr 6 14:54:29 CEST 2018


Hello,


On 06.04.18 10:42, Sergey Basov wrote:
> Hi Daniel.
>
> Thank you.
>
> It works like expected!
ok, thanks for testing and reporting back!
>
> Now when i do
>
> set_body_multipart(,"2123894789_1257887457");
> msg_apply_changes();
> append_body_part_hex("01 10 48 00 0a 00 02 09 07 03 90 90 13 71 32 20
> 0a 04 02 13 73 12
> 00","application/isup;version=itu-t92+","signal;handling=optional");
> msg_apply_changes();
> sipt_destination($(rU{s.strip,1}), 31, 3, 0);
> sipt_set_calling($fU, 3, 0, 3);
>
> I got correct ISUP part.
>
> Now I will try to document and commit some SIPT module functions to
> get forwarding info.

This would be useful indeed, such contribution will be good.

Cheers,
Daniel

>
> Thank you Daniel.
>
>
> --
> Best regards,
> Sergey Basov                     e-mail: sergey.v.basov at gmail.com
> <mailto:sergey.v.basov at gmail.com>
>
> 2018-04-05 21:12 GMT+03:00 Daniel-Constantin Mierla <miconda at gmail.com
> <mailto:miconda at gmail.com>>:
>
>     I pushed append_body_part_hex() function in master branch, which
>     expects the parameter in hexa format and it will decode it before
>     adding it as a body part. Can you test the function and see if it
>     works ok?
>
>     Cheers,
>     Daniel
>
>
>     On 05.04.18 09:32, Daniel-Constantin Mierla wrote:
>>
>>
>>
>>     On 05.04.18 09:19, Sergey Basov wrote:
>>>
>>>     > Are you doing msg_apply_changes before use of sipt_destination()?
>>>
>>>     Yes I do.
>>>
>>>     > Why you had to do changes inside sipt module and not inside
>>>     append_body_part()?
>>>     I have added line to debug append_body_part() function and it
>>>     receives string till first \x00 in input...
>>>
>>>     May be this problem goes from configuration parser? Can it parse
>>>     \x00 as end of value?
>>>
>>>     I make change in sipt module because I create ISUP part with
>>>     replaced \x00 by \x01 in 3 places.
>>>     I know where they are incorrect, so I can change them to 00
>>>     while changing number using sipt_destination()
>>     OK.
>>
>>     I haven't looked at the code to see how the config parser handles
>>     this case, could be what you said.
>>
>>     A solution might be to add a new function
>>     append_body_part_hex(...) where the parameter is given in
>>     hexadecimal without escaping and the conversion to binary is done
>>     inside the code of the function. Like:
>>
>>     append_body_part("01 90 00 20")
>>
>>     Spaces can be omitted or ignored.
>>
>>     Cheers,
>>     Daniel
>>
>>>
>>>
>>>     --
>>>     Best regards,
>>>     Sergey Basov                     e-mail:
>>>     sergey.v.basov at gmail.com <mailto:sergey.v.basov at gmail.com>
>>>
>>>     2018-04-05 8:20 GMT+03:00 Sergey Basov <sergey.v.basov at gmail.com
>>>     <mailto:sergey.v.basov at gmail.com>>:
>>>
>>>         Hi Daniel,
>>>
>>>         I think that kamailio while reading configuration think that
>>>         \x00 character is the end of string..
>>>
>>>         --
>>>         Best regards,
>>>         Sergey Basov                     e-mail:
>>>         sergey.v.basov at gmail.com <mailto:sergey.v.basov at gmail.com>
>>>
>>>         2018-04-04 19:47 GMT+03:00 Daniel-Constantin Mierla
>>>         <miconda at gmail.com <mailto:miconda at gmail.com>>:
>>>
>>>             Hello,
>>>
>>>             I haven't looked at the source code, but it looks like
>>>             it needs some options to make it work with zero characters.
>>>
>>>             Why you had to do changes inside sipt module and not
>>>             inside append_body_part()?
>>>
>>>             Are you doing msg_apply_changes before use of
>>>             sipt_destination()?
>>>
>>>             Cheers,
>>>             Daniel
>>>
>>>
>>>             On 04.04.18 16:19, Sergey Basov wrote:
>>>>             Hi All.
>>>>
>>>>             Does nobody have any idea how to avoid this?
>>>>
>>>>             Thank you.
>>>>
>>>>             --
>>>>             Best regards,
>>>>             Sergey Basov                     e-mail:
>>>>             sergey.v.basov at gmail.com <mailto:sergey.v.basov at gmail.com>
>>>>
>>>>             2018-04-03 17:07 GMT+03:00 Sergey Basov
>>>>             <sergey.v.basov at gmail.com
>>>>             <mailto:sergey.v.basov at gmail.com>>:
>>>>
>>>>                 Hi All!
>>>>
>>>>                 I have some troubles with encoding hex string to
>>>>                 use as ISUP part.
>>>>
>>>>                 I have next line:
>>>>
>>>>                 append_body_part("\x01\x10\x48*\x00*\x0a*\x00*\x02\x09\x07\x03\x90\x90\x13\x71\x32\x20\x0a\x04\x02\x13\x73\x12*\x00*","application/isup;version=itu-t92+","signal;handling=optional");
>>>>
>>>>                 Problem is in the *\x00 *kamailio reads this string
>>>>                 till first \x00
>>>>
>>>>                 May be there is some workaround?
>>>>
>>>>                 Currently I have added some C code into SIPT module
>>>>                 to change values in this pisitions first to 00 then
>>>>                 make other changes.
>>>>
>>>>                 My current input string is
>>>>                 append_body_part("\x01\x10\x48*\x01*\x0a*\x01*\x02\x09\x07\x03\x90\x90\x13\x71\x32\x20\x0a\x04\x02\x13\x73\x12*\x01*","application/isup;version=itu-t92+","signal;handling=optional");
>>>>
>>>>                 I first make replacement \x01 to \x00 while
>>>>                 executing sipt_destination
>>>>
>>>>                 May be there is better solution?
>>>>
>>>>                 Thank you.
>>>>                 --
>>>>                 Best regards,
>>>>                 Sergey Basov                     e-mail:
>>>>                 sergey.v.basov at gmail.com
>>>>                 <mailto:sergey.v.basov at gmail.com>
>>>>
>>>>
>>>>
>>>>
>>>>             _______________________________________________
>>>>             Kamailio (SER) - Users Mailing List
>>>>             sr-users at lists.kamailio.org
>>>>             <mailto:sr-users at lists.kamailio.org>
>>>>             https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>>             <https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users>
>>>
>>>             -- 
>>>             Daniel-Constantin Mierla
>>>             www.twitter.com/miconda <http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda
>>>             <http://www.linkedin.com/in/miconda>
>>>             Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com <http://www.asipto.com>
>>>             Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com <http://www.kamailioworld.com>
>>>
>>>
>>>
>>
>>     -- 
>>     Daniel-Constantin Mierla
>>     www.twitter.com/miconda <http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda>
>>     Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com <http://www.asipto.com>
>>     Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com <http://www.kamailioworld.com>
>
>     -- 
>     Daniel-Constantin Mierla
>     www.twitter.com/miconda <http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda>
>     Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com <http://www.asipto.com>
>     Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com <http://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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20180406/5febf057/attachment.html>


More information about the sr-users mailing list