Module: kamailio
Branch: master
Commit: a2d9a2f95e2212a9f5538ac25ac241206eff06a0
URL:
https://github.com/kamailio/kamailio/commit/a2d9a2f95e2212a9f5538ac25ac2412…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-09-23T14:07:41+02:00
pua_dialoginfo: use dlg api function get_dlg_varval()
---
Modified: src/modules/pua_dialoginfo/pua_dialoginfo.c
---
Diff:
https://github.com/kamailio/kamailio/commit/a2d9a2f95e2212a9f5538ac25ac2412…
Patch:
https://github.com/kamailio/kamailio/commit/a2d9a2f95e2212a9f5538ac25ac2412…
---
diff --git a/src/modules/pua_dialoginfo/pua_dialoginfo.c
b/src/modules/pua_dialoginfo/pua_dialoginfo.c
index 10aa5b467d..50a1029289 100644
--- a/src/modules/pua_dialoginfo/pua_dialoginfo.c
+++ b/src/modules/pua_dialoginfo/pua_dialoginfo.c
@@ -315,11 +315,13 @@ void refresh_pubruri_avps(struct dlginfo_cell *dlginfo, str *uri)
}
void refresh_local_identity(struct dlg_cell *dlg, str *uri) {
- str *s = dlg_api.get_dlg_var(dlg, &local_identity_dlg_var);
+ str s = {0};
- if(s != NULL) {
- uri->s = s->s;
- uri->len = s->len;
+ dlg_api.get_dlg_varval(dlg, &local_identity_dlg_var, &s);
+
+ if(s.s != NULL) {
+ uri->s = s.s;
+ uri->len = s.len;
LM_DBG("Found local_identity in dialog '%.*s'\n",
uri->len, uri->s);
}
@@ -576,7 +578,7 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type,
int disable
{
struct dlginfo_cell *dlginfo;
int len;
- str* s=NULL;
+ str dval = {0};
// generate new random uuid
if(sruid_next_safe(&_puadi_sruid) < 0) {
@@ -652,9 +654,10 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type,
int disable
} else {
if(caller_dlg_var.len>0
- && (s = dlg_api.get_dlg_var(dlg, &caller_dlg_var))!=0) {
+ && (dlg_api.get_dlg_varval(dlg, &caller_dlg_var, &dval)==0)
+ && dval.s!=NULL) {
dlginfo->pubruris_caller =
- (struct str_list*)shm_malloc(sizeof(struct str_list) + s->len + 1);
+ (struct str_list*)shm_malloc(sizeof(struct str_list) + dval.len + 1);
if (dlginfo->pubruris_caller==0) {
SHM_MEM_ERROR;
free_dlginfo_cell(dlginfo);
@@ -663,17 +666,18 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type,
int disable
memset(dlginfo->pubruris_caller, 0, sizeof(struct str_list));
dlginfo->pubruris_caller->s.s = (char*)dlginfo->pubruris_caller
+ sizeof(sizeof(struct str_list));
- memcpy(dlginfo->pubruris_caller->s.s, s->s, s->len);
- dlginfo->pubruris_caller->s.s[s->len] = '\0';
- dlginfo->pubruris_caller->s.len = s->len;
+ memcpy(dlginfo->pubruris_caller->s.s, dval.s, dval.len);
+ dlginfo->pubruris_caller->s.s[dval.len] = '\0';
+ dlginfo->pubruris_caller->s.len = dval.len;
LM_DBG("Found pubruris_caller in dialog '%.*s'\n",
dlginfo->pubruris_caller->s.len, dlginfo->pubruris_caller->s.s);
}
if(callee_dlg_var.len>0
- && (s = dlg_api.get_dlg_var(dlg, &callee_dlg_var))!=0) {
+ && (dlg_api.get_dlg_varval(dlg, &callee_dlg_var, &dval)==0)
+ && dval.s!=NULL) {
dlginfo->pubruris_callee =
- (struct str_list*)shm_malloc(sizeof(struct str_list) + s->len + 1);
+ (struct str_list*)shm_malloc(sizeof(struct str_list) + dval.len + 1);
if (dlginfo->pubruris_callee==0) {
SHM_MEM_ERROR;
free_dlginfo_cell(dlginfo);
@@ -682,9 +686,9 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type,
int disable
memset(dlginfo->pubruris_callee, 0, sizeof(struct str_list));
dlginfo->pubruris_callee->s.s = (char*)dlginfo->pubruris_callee
+ sizeof(sizeof(struct str_list));
- memcpy(dlginfo->pubruris_callee->s.s, s->s, s->len);
- dlginfo->pubruris_callee->s.s[s->len] = '\0';
- dlginfo->pubruris_callee->s.len = s->len;
+ memcpy(dlginfo->pubruris_callee->s.s, dval.s, dval.len);
+ dlginfo->pubruris_callee->s.s[dval.len] = '\0';
+ dlginfo->pubruris_callee->s.len = dval.len;
LM_DBG("Found pubruris_callee in dialog '%.*s'\n",
dlginfo->pubruris_callee->s.len, dlginfo->pubruris_callee->s.s);
}