Module: kamailio
Branch: master
Commit: 07310c634d322f137cff0103f776f0e397f963bb
URL:
https://github.com/kamailio/kamailio/commit/07310c634d322f137cff0103f776f0e…
Author: Juha Heinanen <jh(a)tutpro.com>
Committer: Juha Heinanen <jh(a)tutpro.com>
Date: 2016-12-12T11:28:11+02:00
modules/pua_rpc: return result as struct
---
Modified: src/modules/pua_rpc/pua_rpc.c
---
Diff:
https://github.com/kamailio/kamailio/commit/07310c634d322f137cff0103f776f0e…
Patch:
https://github.com/kamailio/kamailio/commit/07310c634d322f137cff0103f776f0e…
---
diff --git a/src/modules/pua_rpc/pua_rpc.c b/src/modules/pua_rpc/pua_rpc.c
index 0663caa..1ceb419 100644
--- a/src/modules/pua_rpc/pua_rpc.c
+++ b/src/modules/pua_rpc/pua_rpc.c
@@ -63,6 +63,7 @@ static int publish_callback(ua_pres_t* hentity, struct sip_msg* reply)
{
rpc_delayed_ctx_t* dctx;
void* c;
+ void* st;
rpc_t* rpc;
struct hdr_field* hdr= NULL;
int statuscode;
@@ -95,7 +96,13 @@ static int publish_callback(ua_pres_t* hentity, struct sip_msg* reply)
statuscode = reply->first_line.u.reply.statuscode;
reason = reply->first_line.u.reply.reason;
}
- rpc->add(c, "dS", statuscode, &reason);
+ if (rpc->add(c, "{", &st) < 0) {
+ LM_ERR("rpc->add failed on '{'\n");
+ rpc->delayed_ctx_close(dctx);
+ return -1;
+ }
+ rpc->struct_add(st, "d", "statusCode", statuscode);
+ rpc->struct_add(st, "S", "reasonPhrase", &reason);
if (statuscode == 200) {
expires = ((exp_body_t*)reply->expires->parsed)->val;
@@ -116,7 +123,8 @@ static int publish_callback(ua_pres_t* hentity, struct sip_msg*
reply)
}
etag = hdr->body;
LM_DBG("SIP-Etag = %.*s\n", etag.len, etag.s);
- rpc->add(c, "Sd", &etag, expires);
+ rpc->struct_add(st, "S", "SIP-Etag", &etag);
+ rpc->struct_add(st, "d", "Expires", expires);
}
rpc->delayed_ctx_close(dctx);
@@ -279,7 +287,7 @@ static void publish(rpc_t* rpc, void* c)
rpc_export_t pua_rpc[] = {
- {"pua.publish", publish, publish_doc, 0},
+ {"pua.publish", publish, publish_doc, 0},
{0, 0, 0, 0}
};