Skip to content

Commit

Permalink
mi_script: fix value of parameters provided through AVP
Browse files Browse the repository at this point in the history
(cherry picked from commit d6e9145)
  • Loading branch information
razvancrainea committed Sep 16, 2022
1 parent c32349f commit cf353bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/mi_script/mi_script.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static mi_request_t *mi_script_parse_request(str *method, str *params,
mi_request_t *req = NULL;
struct usr_avp *v_avp = NULL;
struct usr_avp *a_avp = NULL;
int_str avp_val;
int_str avp_val, avp_val_v;
unsigned int tmp;
cJSON *val;
char *p;
Expand Down Expand Up @@ -239,15 +239,15 @@ static mi_request_t *mi_script_parse_request(str *method, str *params,
/* check attribute */
if (vals) {
v_avp = search_first_avp(vals->pvp.pvn.u.isname.type,
vals->pvp.pvn.u.isname.name.n, &avp_val, v_avp);
vals->pvp.pvn.u.isname.name.n, &avp_val_v, v_avp);
if (!v_avp) {
LM_ERR("missing attribute\n");
goto error;
}
if (a_avp->flags & AVP_VAL_STR)
val = cJSON_CreateStr(avp_val.s.s, avp_val.s.len);
val = cJSON_CreateStr(avp_val_v.s.s, avp_val_v.s.len);
else
val = cJSON_CreateNumber(avp_val.n);
val = cJSON_CreateNumber(avp_val_v.n);
/* avp is always null terminated */
cJSON_AddItemToObject(req->params, avp_val.s.s, val);
} else {
Expand Down

0 comments on commit cf353bf

Please sign in to comment.