Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

janssonrpc-c does not return results if no route option specified #256

Closed
debackel opened this issue Jul 20, 2015 · 1 comment
Closed

janssonrpc-c does not return results if no route option specified #256

debackel opened this issue Jul 20, 2015 · 1 comment

Comments

@debackel
Copy link

Experimenting janssonrpc-c, I noticed that I can't get anythin in the result variable, if no "route" option is specified.
1/ With "route" option, everything is OK:
janssonrpc_request("local", "bar.PIC1", '{"cli": "$avp(cli)","en": "$avp(cld)"}', "route=RPC_Init_Resp,retry=1");
route[RPC_Init_Resp] {
xlog("JANSSON result: $var(result)\n");

The "xlog" returns the json formatted results as expected:
JANSSON result: {"result":{"NetScenario":"PreCall","cli":"123456789","en":"9876543210Destination":"sip:xxx@xx.x.xx.xxx:xxxx","NextRPC":"bar.PIC2"}}

2/ The exact same request, without the route option does not return anything:
janssonrpc_request("local", "bar.PIC1", '{"cli": "$avp(cli)","en": "$avp(cld)"}');
xlog("JANSSON result: $var(result)\n");

The "xlog" returns 0 this time:
JANSSON result: 0

A tshark trace indicates the same response is returned by the jsonrpc server, excluding a potential issue on this side.

I am available for futher information
Best regards,

Laurent.

@miconda
Copy link
Member

miconda commented Jul 21, 2015

The function is asynchronous, meaning that while waiting for response, other sip packets are handled, current one being suspended. Also, the response comes in other process. If you want to handle the rpc response, then you have to provide the name of the route block where to resume the processing of the suspended request.

In the docs of the function is written:

If no route is specified, then any errors are logged and successes are ignored.

Therefore it is no bug, but how the function was designed to work.

@miconda miconda closed this as completed Jul 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants