[SR-Users] jansson_get_filed with variables
Sergio Serrano
sergio.serrano at avanzada7.com
Wed Sep 21 11:38:20 CEST 2016
Hi all,
I will try to do an special condfiguration to manage calls. We
ask to Webservice and I obtain a json structure with and array inside.
{allow=true, number=sip:205, ip=127.26.101.12, port=5080, headers=[X-
header1, X-header2, X-header3], X-header1=2, X-header2=1, X-
header3=yes}
This is made like that to add any header and process in an INVITE to
add headers. My problems is when I try to process array. I have next
code:
jansson_get_field("$avp(respINV)", "Allow", "$var(allow)");
jansson_get_field("$avp(respINV)", "Number", "$var(number)");
jansson_get_field("$avp(respINV)", "Ip", "$var(ip)");
jansson_get_field("$avp(respINV)", "port", "$var(port)");
jansson_get_field("$avp(respINV)", "headers", "$var(headers)");
$var(indice)=0;
$var(cabeceras)="{\"cabeceras\":$var(headers)}";
jansson_array_size("cabeceras", $var(cabeceras), "$var(size)");
xlog("L_INFO", "Tamaño: $var(size)----\n");
while($var(indice) < $var(size))
{
jansson_get("cabeceras[$var(indice)]",$var(cabeceras),
"$var(tmp)");
xlog("L_INFO", "Cabecera cabeceras[$var(indice)]: --$var(tmp)
--\n");
$var(indice) = $var(indice) + 1;
jannson_get_field("$avp(respINV)", $var(tmp),
"$var(valorCabecera)");
xlog("L_INFO", "Cabecera: $var(tmp) - Valor:
$var(valorCabecera) \n");
}The problem is in the line:
jannson_get_field("$avp(respINV)", $var(tmp), "$var(valorCabecera)");
It's appears that I can't use variable in second parameter
ERROR: <core> [cfg.y:3228]: yyparse(): cfg. parser: failed to find
command jannson_get_field (params
3)
Sep 21 11:36:58 kam01 kamailio: : <core> [cfg.y:3368]: yyerror_at():
parse error in config file /usr/local/etc/kamailio/kamailio.cfg, line
617, column 69: unknown command, missing loadmodule?
Any one can confirm that I can't use var as parameters in
jannson_get_filed function?
Best regards,
Sergio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160921/43fdeb4a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160921/43fdeb4a/attachment.sig>
More information about the sr-users
mailing list