Skip to content

Commit

Permalink
dialog: wrapper function to set a dlg var with unsigned integer param…
Browse files Browse the repository at this point in the history
…eter

- use it to set cseq diff value

(cherry picked from commit b7dc2ac)
  • Loading branch information
miconda committed Sep 14, 2022
1 parent 89fa867 commit 2427f19
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/modules/dialog/dlg_cseq.c
Expand Up @@ -173,8 +173,7 @@ int dlg_cseq_update(sip_msg_t *msg)
LM_DBG("nothing to increment\n");
goto done;
}
nval.s = int2str(vinc, &nval.len);
if(set_dlg_variable(dlg, &_dlg_cseq_diff_var_name, &nval) <0) {
if(set_dlg_variable_uintval(dlg, &_dlg_cseq_diff_var_name, vinc) <0) {
LM_ERR("failed to set the dlg cseq diff var\n");
goto done;
}
Expand Down
12 changes: 12 additions & 0 deletions src/modules/dialog/dlg_var.c
Expand Up @@ -378,6 +378,18 @@ int set_dlg_variable(struct dlg_cell *dlg, str *key, str *val)
return ret;
}

int set_dlg_variable_uintval(struct dlg_cell *dlg, str *key, unsigned int uval)
{
str sval = STR_NULL;

sval.s = int2str(uval, &sval.len);
if(sval.s==NULL) {
return -1;
}

return set_dlg_variable(dlg, key, &sval);
}

int pv_get_dlg_variable(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
{
dlg_cell_t *dlg;
Expand Down
1 change: 1 addition & 0 deletions src/modules/dialog/dlg_var.h
Expand Up @@ -63,6 +63,7 @@ str* get_dlg_variable(dlg_cell_t *dlg, str *key);
int set_dlg_variable(dlg_cell_t *dlg, str *key, str *val);

int get_dlg_variable_uintval(struct dlg_cell *dlg, str *key, unsigned int *uval);
int set_dlg_variable_uintval(struct dlg_cell *dlg, str *key, unsigned int uval);

int pv_parse_dialog_var_name(pv_spec_p sp, str *in);

Expand Down

0 comments on commit 2427f19

Please sign in to comment.