[sr-dev] How to cast int val from db and cast to str?

Mino Haluz mino.haluz at gmail.com
Tue Jan 29 22:01:51 CET 2013


Because when I set  7 in

{"cr_route",         (cmd_function)cr_route,              7,
cr_route_fixup,             0, REQUEST_ROUTE | FAILURE_ROUTE }

It gives me Too many arguments when calling cr_route with 7 arguments, but
when I call it with 6 it gives Unknown command.

When I set param_no to 6, and I call it with exactly 6 arguments, it is ok
..

Maximum arguments count of 7 is only possible reason for this for me :/



On Tue, Jan 29, 2013 at 9:50 PM, Konstantin M. <evilzluk at gmail.com> wrote:

> By the way, I have the same question.
>
> 2013/1/29 Mino Haluz <mino.haluz at gmail.com>
>
>> Is there any limit for arguments count ? I have 7.
>>
>>
>> On Tue, Jan 29, 2013 at 9:05 PM, Mino Haluz <mino.haluz at gmail.com> wrote:
>>
>>> Thanks, that works. Now kamailio starts, but when I add another avp for
>>> cr_route command, it gives me Too many arguments. I'm sure that I added
>>> everything in every file of the module.. Is there any other directory,
>>> where kamailio stores params count for each call? or should it be really in
>>> module directory?
>>>
>>>
>>> On Tue, Jan 29, 2013 at 8:53 PM, Andrew Mortensen <
>>> admorten at isc.upenn.edu> wrote:
>>>
>>>>
>>>> On Jan 29, 2013, at 1:54 PM, Mino Haluz <mino.haluz at gmail.com> wrote:
>>>>
>>>> > Hi,
>>>> >
>>>> > I'm changing carrierroute module so that it could set into another
>>>> avp the ID of the rule that was chosen. I have already adjusted all
>>>> functions but I have still one problem when kamailio starts.
>>>> >
>>>> > tmp_id.s=(char *)row->values[COL_ID].val.string_val;
>>>> >
>>>> > It gives Segfault at this line. The question is, how can I convert
>>>> the row value that is int(10) to char (tmp_id is const str *, it is the
>>>> same as comment). Thanks,
>>>>
>>>> Use int2str from ut.h:
>>>>
>>>>         tmp_id.s = int2str(row->values[COL_ID].val.int_val, &tmp_id.len)
>>>>
>>>> Note that int2str uses an internal static buffer that's overwritten on
>>>> each call.
>>>>
>>>> andrew
>>>>
>>>> _______________________________________________
>>>> sr-dev mailing list
>>>> sr-dev at lists.sip-router.org
>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>>>>
>>>
>>>
>>
>> _______________________________________________
>> sr-dev mailing list
>> sr-dev at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>>
>>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20130129/270eb510/attachment.htm>


More information about the sr-dev mailing list