[OpenSIPS-Devel] AVP variable string lenght

Bogdan-Andrei Iancu bogdan at opensips.org
Fri Dec 5 15:53:20 CET 2014


Hi Nikita,

You use the str_init() macro in a wrong way - it is intended to take as 
param a static string (ie. str_init("test string") ) and not a pointer, 
as you do.
str_init() macro does a sizeof, and for you it will be 8 (size of a 
pointer on 64bit) -> with one null termination -> 7 left :).

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 05.12.2014 10:40, Nikita Tarasov wrote:
> We are creating module for opensips working similar to call_control. 
> This module exchanges with our software via unix socket. I developed 
> mostly the all functionality that we want nevertheless I got very 
> strange result in setting AVP variable via module. This variable with 
> string is cutting after 7th symbol.
> How can I increase AVP string variable length?
> code example
> pv_value_t spec_value;
> pch = strtok (NULL, "\r\n:");
> str text = str_init(pch);
> spec_value.rs = text;
> spec_value.flags = PV_VAL_STR;
> if (pv_set_value(msg,&(mediagateway_avp_spec),0,&spec_value) != 0){
>     LM_ERR("Failed to set the output variable\n");
> }
> Nikita
>
>
> _______________________________________________
> Devel mailing list
> Devel at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20141205/08cab4ac/attachment.htm>


More information about the Devel mailing list