Module: kamailio
Branch: master
Commit: e0bcdcddcb30f6221a92bd08221f2b50831c8b6b
URL:
https://github.com/kamailio/kamailio/commit/e0bcdcddcb30f6221a92bd08221f2b5…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-09-27T08:55:52+02:00
usrloc: rpc responses use array for contact records
---
Modified: modules/usrloc/ul_rpc.c
---
Diff:
https://github.com/kamailio/kamailio/commit/e0bcdcddcb30f6221a92bd08221f2b5…
Patch:
https://github.com/kamailio/kamailio/commit/e0bcdcddcb30f6221a92bd08221f2b5…
---
diff --git a/modules/usrloc/ul_rpc.c b/modules/usrloc/ul_rpc.c
index e547c21..505f75a 100644
--- a/modules/usrloc/ul_rpc.c
+++ b/modules/usrloc/ul_rpc.c
@@ -203,6 +203,7 @@ static void ul_rpc_dump(rpc_t* rpc, void* ctx)
ucontact_t* c;
void* th;
void* ah;
+ void* bh;
void* ih;
void* sh;
int max, n, i;
@@ -219,7 +220,7 @@ static void ul_rpc_dump(rpc_t* rpc, void* ctx)
rpc->fault(ctx, 500, "Internal error creating top rpc");
return;
}
- if(rpc->struct_add(th, "Sd{",
+ if(rpc->struct_add(th, "Sd[",
"Domain", &dl->name,
"Size", (int)dom->size,
"AoRs", &ah)<0)
@@ -242,7 +243,14 @@ static void ul_rpc_dump(rpc_t* rpc, void* ctx)
return;
}
} else {
- if(rpc->struct_add(ah, "Sd{",
+ if(rpc->struct_add(ah, "{",
+ "Info", &bh)<0)
+ {
+ unlock_ulslot( dom, i);
+ rpc->fault(ctx, 500, "Internal error creating aor struct");
+ return;
+ }
+ if(rpc->struct_add(bh, "Sd[",
"AoR", &r->aor,
"HashID", r->aorhash,
"Contacts", &ih)<0)
@@ -340,6 +348,7 @@ static void ul_rpc_lookup(rpc_t* rpc, void* ctx)
str table = {0, 0};
str aor = {0, 0};
void* th;
+ void* ih;
urecord_t *rec;
ucontact_t* con;
int ret;
@@ -381,15 +390,24 @@ static void ul_rpc_lookup(rpc_t* rpc, void* ctx)
if (rpc->add(ctx, "{", &th) < 0)
{
+ unlock_udomain(dom, &aor);
rpc->fault(ctx, 500, "Internal error creating outer rpc");
return;
}
+ if(rpc->struct_add(th, "S[",
+ "AoR", &aor,
+ "Contacts", &ih)<0)
+ {
+ unlock_udomain(dom, &aor);
+ rpc->fault(ctx, 500, "Internal error creating aor struct");
+ return;
+ }
/* We have contacts, list them */
for( con=rec->contacts ; con ; con=con->next) {
if (VALID_CONTACT( con, act_time)) {
rpl_tree++;
- if (rpc_dump_contact(rpc, ctx, th, con) == -1) {
+ if (rpc_dump_contact(rpc, ctx, ih, con) == -1) {
unlock_udomain(dom, &aor);
return;
}