Re: [SR-Users] kamailio 4.4 - jansson_get_field parse error actions

2017-11-17 Thread Jonathan Hunter
Hi Guys,


Looks like return code = -1 does the trick for me?!


Sorry for noise please comment if there is a better way.


thanks


Jon



From: sr-users  on behalf of Jonathan 
Hunter 
Sent: 17 November 2017 14:56
To: Kamailio (SER) - Users Mailing List
Subject: [SR-Users] kamailio 4.4 - jansson_get_field parse error actions


Hi Guys,

I am looking to send calls to a default route should we have issues when 
connecting to our API which provides routing instructions.

On scenario is handling an invalid JSON response , which would result in a 
parse error.

Is it possible to capture when there is a failed to parse error when dealing 
with JSON responses to an http query in kamailio?

In particular when using the jansson_get_field, I am looking to default to a 
route should their be a parse error, so I am forcing an erro, I get this in the 
logs, but can I grab to act on it?

Nov 17 14:37:25 ip-172-31-34-165 /usr/local/kamailio-4.4/sbin/kamailio[9735]: 
ERROR: jansson [jansson_funcs.c:59]: janssonmod_get(): failed to parse: 200 OK
Nov 17 14:37:25 ip-172-31-34-165 /usr/local/kamailio-4.4/sbin/kamailio[9735]: 
ERROR: jansson [jansson_funcs.c:61]: janssonmod_get(): json error at line 1: 
'[' or '{' expected near '200'
Nov 17 14:37:25 ip-172-31-34-165 /usr/local/kamailio-4.4/sbin/kamailio[9735]: 
ERROR: jansson [jansson_funcs.c:59]: janssonmod_get(): failed to parse: 200 OK
Nov 17 14:37:25 ip-172-31-34-165 /usr/local/kamailio-4.4/sbin/kamailio[9735]: 
ERROR: jansson [jansson_funcs.c:61]: janssonmod_get(): json error at line 1: 
'[' or '{' expected near '200'


On receipt of this I would then like to hit a default route.


Many thanks


Jon
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] kamailio 4.4 - jansson_get_field parse error actions

2017-11-17 Thread Jonathan Hunter
Hi Guys,

I am looking to send calls to a default route should we have issues when 
connecting to our API which provides routing instructions.

On scenario is handling an invalid JSON response , which would result in a 
parse error.

Is it possible to capture when there is a failed to parse error when dealing 
with JSON responses to an http query in kamailio?

In particular when using the jansson_get_field, I am looking to default to a 
route should their be a parse error, so I am forcing an erro, I get this in the 
logs, but can I grab to act on it?

Nov 17 14:37:25 ip-172-31-34-165 /usr/local/kamailio-4.4/sbin/kamailio[9735]: 
ERROR: jansson [jansson_funcs.c:59]: janssonmod_get(): failed to parse: 200 OK
Nov 17 14:37:25 ip-172-31-34-165 /usr/local/kamailio-4.4/sbin/kamailio[9735]: 
ERROR: jansson [jansson_funcs.c:61]: janssonmod_get(): json error at line 1: 
'[' or '{' expected near '200'
Nov 17 14:37:25 ip-172-31-34-165 /usr/local/kamailio-4.4/sbin/kamailio[9735]: 
ERROR: jansson [jansson_funcs.c:59]: janssonmod_get(): failed to parse: 200 OK
Nov 17 14:37:25 ip-172-31-34-165 /usr/local/kamailio-4.4/sbin/kamailio[9735]: 
ERROR: jansson [jansson_funcs.c:61]: janssonmod_get(): json error at line 1: 
'[' or '{' expected near '200'


On receipt of this I would then like to hit a default route.


Many thanks


Jon
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users