Daniel-Constantin Mierla writes:
It seems you change the value of c inside publish:
if (dctx->reply_ctx != 0) { /* callback was not executed or its execution failed */ rpc = &dctx->rpc; c = dctx->reply_ctx; } else { return; }
So it is no longer pointing to the same structure as in dispatch_rpc().
it is pointing to the same structure as in publish_callback and if the callback is executed, everything works fine:
Dec 5 07:57:02 rautu /usr/bin/sip-proxy[32714]: INFO: pua_rpc [pua_rpc.c:222]: publish(): pua_send_publish returned 0 Dec 5 07:57:02 rautu /usr/bin/sip-proxy[32714]: INFO: xmlrpc [xmlrpc.c:2441]: dispatch_rpc(): reply was not sent # T 2014/12/05 07:57:02.516438 127.0.0.1:6060 -> 127.0.0.1:54971 [AP] HTTP/1.1 200 OK. Via: SIP/2.0/TCP 127.0.0.1:54971. Server: OpenXg SIP Proxy (4.3.0-0 (i386/linux)). Content-Length: 202. . <?xml version="1.0"?> <methodResponse> <params> <param> <value><int>200</int> <string>OK</string> <string>a.1417566804.11407.5.2</string> <int>7776001</int> </value> </param> </params> </methodResponse>
the same assignments are done in tm/rpc_uac.c, which i have used as an example.
i have tried also without the assignments (see below) and also then xmlrpc debug tells that reply was not sent:
T 2014/12/05 07:45:50.696091 127.0.0.1:6060 -> 127.0.0.1:54963 [AP] HTTP/1.1 200 OK. Via: SIP/2.0/TCP 127.0.0.1:54963. Server: OpenXg SIP Proxy (4.3.0-0 (i386/linux)). Content-Length: 108. . <?xml version="1.0"?> <methodResponse> <params> <param> <value></value> </param> </params> </methodResponse> ####Dec 5 07:45:50 rautu /usr/bin/sip-proxy[32709]: INFO: pua_rpc [pua_rpc.c:222]: publish(): pua_send_publish returned 418 Dec 5 07:45:50 rautu /usr/bin/sip-proxy[32709]: INFO: xmlrpc [xmlrpc.c:2441]: dispatch_rpc(): reply was not sent
-- juha
static void publish(rpc_t* rpc, void* c) { ... dctx = rpc->delayed_ctx_new(c); if (dctx == 0) { LM_ERR("internal error: failed to create context\n"); rpc->fault(c, 500, "internal error: failed to create context"); return; }
publ.cb_param = dctx; publ.source_flag = MI_ASYN_PUBLISH;
ret = pua_send_publish(&publ); LM_INFO("pua_send_publish returned %d\n", ret);
if (dctx->reply_ctx == 0) /* callback was successfully executed */ return; ...
if (ret == 418) { rpc->fault(c, 500, "Wrong ETag"); rpc->delayed_ctx_close(dctx); }
return; }