Group,
Is there a downside to casting responses from a rest response into a json
object rather than a generic $var? Here is my function it works but I want
to be aware if this will cost a considerable amount of resources.
if (!rest_get("http://myauthurl.com/authme/$fU/$rU",
"$json(authresponse)", "$var(ct)", "$var(rcode)")) {
xlog("Error code $var(rcode) in HTTP GET!\n");
xlog("on account of admittance error we are sending the call to the AS
server for processing");
route(4);
}
xlog("got this body response from authority on invite
$json(authresponse) with response code $var(rcode)");
xlog("response now casting to json $json(authresponse) ");
$json(authbody) := "{}";
$json(authbody) := $json(authresponse);
xlog(" accessing the message $json(authbody/message)");
$json(accept) := $json(authbody/message);
xlog(" casted message $json(accept)");
if($json(accept/AcceptCall) == "false"){
xlog("response equal false");
route(3);
}else{
Notice how the response is casted from $json(authresponse) to $json(authbody)
after it is initialized. I came to realize that I had to initialize a
variable because I couldn't access keys in $json(authresponse).
Thanks,
Tito
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users