Skip to content

Commit

Permalink
rtjson: updated to use xavp long value field
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Nov 22, 2022
1 parent 9e7e367 commit 2dd4a59
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/modules/rtjson/rtjson_routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ int rtjson_init_routes(sip_msg_t *msg, str *rdoc)
srjson_DestroyDoc(&tdoc);

memset(&xval, 0, sizeof(sr_xval_t));
xval.type = SR_XTYPE_INT;
xval.v.i = 0;
xval.type = SR_XTYPE_LONG;
xval.v.l = 0;
xname.s = "idx";
xname.len = 3;
if(xavp_add_value(&xname, &xval, &xavp)==NULL) {
Expand Down Expand Up @@ -271,7 +271,7 @@ int rtjson_push_routes(sip_msg_t *msg)
return -1;
}

LM_DBG("routes index: %d\n", iavp->val.v.i);
LM_DBG("routes index: %ld\n", iavp->val.v.l);

srjson_InitDoc(&tdoc, NULL);

Expand Down Expand Up @@ -395,7 +395,7 @@ int rtjson_init_serial(sip_msg_t *msg, srjson_doc_t *jdoc, sr_xavp_t *iavp)
setbflagsval(0, old_bflags|bflags);
}

iavp->val.v.i++;
iavp->val.v.l++;

return 0;

Expand Down Expand Up @@ -585,7 +585,7 @@ int rtjson_init_parallel(sip_msg_t *msg, srjson_doc_t *jdoc, sr_xavp_t *iavp)
while(nj) {
rtjson_append_branch(msg, jdoc, nj);

iavp->val.v.i++;
iavp->val.v.l++;
nj = nj->next;
}

Expand Down Expand Up @@ -625,7 +625,7 @@ int rtjson_next_route(sip_msg_t *msg)
return -1;
}

LM_DBG("routes index: %d\n", iavp->val.v.i);
LM_DBG("routes index: %ld\n", iavp->val.v.l);

srjson_InitDoc(&tdoc, NULL);

Expand Down Expand Up @@ -657,18 +657,18 @@ int rtjson_next_route(sip_msg_t *msg)
nj = tj->child;

i = 0;
while(nj && i<iavp->val.v.i) {
while(nj && i<iavp->val.v.l) {
nj = nj->next;
i++;
}
if(nj==NULL) {
LM_DBG("no route at index: %d\n", iavp->val.v.i);
LM_DBG("no route at index: %ld\n", iavp->val.v.l);
goto error;
}

iavp->val.v.i++;
iavp->val.v.l++;
if(rtjson_append_branch(msg, &tdoc, nj)<0) {
LM_DBG("route index %d not appended\n", iavp->val.v.i);
LM_DBG("route index %ld not appended\n", iavp->val.v.l);
goto error;
}

Expand Down Expand Up @@ -709,7 +709,7 @@ int rtjson_update_branch(sip_msg_t *msg)
LM_WARN("no idx for routing\n");
return -1;
}
if(iavp->val.v.i<=0) {
if(iavp->val.v.l<=0) {
LM_WARN("invalid branch idx for routing\n");
return -1;
}
Expand Down Expand Up @@ -745,7 +745,7 @@ int rtjson_update_branch(sip_msg_t *msg)

i = 0;
/* stop at number of branches - 1 */
while(nj && i<iavp->val.v.i-1) {
while(nj && i<iavp->val.v.l-1) {
nj = nj->next;
i++;
}
Expand Down

0 comments on commit 2dd4a59

Please sign in to comment.