[OpenSIPS-Users] REST API Challenge

Dinesh Krishnamurthy krishdinesh at yahoo.com
Sun Jan 24 17:20:35 EST 2021


Hello,
I am trying to test a REST API call using the example code provided in the documentation. I am experiencing the following error and opensips would not start. I am running opensips 3.1.1 (x86_64/linux) on Debian 10. Any help would be appreciated. Curl is also installed and i am able to query a URL successfully Thank you
...# Example of querying a REST service to get the credit of an account$var(rc) = rest_get("https://getcredit.org/?account=$fU",                    $var(credit),                    $var(ct),                    $var(rcode));if ($var(rc) < 0) { xlog("rest_get() failed with $var(rc), acc=$fU\n"); send_reply(500, "Server Internal Error"); exit;}
if ($var(rcode) != 200) { xlog("L_INFO", "rest_get() rcode=$var(rcode), acc=$fU\n"); send_reply(403, "Forbidden"); exit;}


Jan 24 22:20:48 OpenSIPS /usr/sbin/opensips[739]: INFO:rest_client:mod_init: Module initialized!Jan 24 22:20:48 OpenSIPS /usr/sbin/opensips[739]: INFO:auth:mod_init: initializing...Jan 24 22:20:48 OpenSIPS /usr/sbin/opensips[739]: ERROR:core:fix_cmd: Param [2] expected to be a variableJan 24 22:20:48 OpenSIPS /usr/sbin/opensips[739]: ERROR:core:fix_actions: Failed to fix command <rest_get>Jan 24 22:20:48 OpenSIPS /usr/sbin/opensips[739]: ERROR:core:fix_actions: fixing failed (code=-6) at /etc/opensips/opensips.cfg:232Jan 24 22:20:48 OpenSIPS /usr/sbin/opensips[739]: CRITICAL:core:fix_expr: fix_actions errorJan 24 22:20:48 OpenSIPS /usr/sbin/opensips[739]: ERROR:core:main: failed to fix configuration with err code -6
Thank you,Dinesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20210124/e4ce999a/attachment.html>


More information about the Users mailing list