Module: kamailio
Branch: master
Commit: 6c557efc1b9cb8c880a05235c94780bbaf305073
URL:
https://github.com/kamailio/kamailio/commit/6c557efc1b9cb8c880a05235c94780b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-02-13T17:01:49+01:00
dialog: keep route block index as signed int
- otherwise it can be broken value when route block doesn't exit and
kemi callback should be executed
- reported by David Escartin
---
Modified: src/modules/dialog/dlg_hash.h
Modified: src/modules/dialog/dlg_var.c
---
Diff:
https://github.com/kamailio/kamailio/commit/6c557efc1b9cb8c880a05235c94780b…
Patch:
https://github.com/kamailio/kamailio/commit/6c557efc1b9cb8c880a05235c94780b…
---
diff --git a/src/modules/dialog/dlg_hash.h b/src/modules/dialog/dlg_hash.h
index 33b36a7ce8..5ecf13f871 100644
--- a/src/modules/dialog/dlg_hash.h
+++ b/src/modules/dialog/dlg_hash.h
@@ -114,7 +114,7 @@ typedef struct dlg_cell
unsigned int dflags; /*!< internal dialog memory flags */
unsigned int iflags; /*!< internal dialog persistent flags */
unsigned int sflags; /*!< script dialog persistent flags */
- unsigned int toroute; /*!< index of route that is executed on timeout */
+ int toroute; /*!< index of route that is executed on timeout */
str toroute_name; /*!< name of route that is executed on timeout */
unsigned int from_rr_nb; /*!< information from record routing */
struct dlg_tl tl; /*!< dialog timer list */
diff --git a/src/modules/dialog/dlg_var.c b/src/modules/dialog/dlg_var.c
index 0a9ef65246..fa9eae9d1f 100644
--- a/src/modules/dialog/dlg_var.c
+++ b/src/modules/dialog/dlg_var.c
@@ -478,8 +478,8 @@ int pv_get_dlg_ctx(struct sip_msg *msg, pv_param_t *param,
return pv_get_uintval(msg, param, res,
(unsigned int)_dlg_ctx.dir);
case 7:
- return pv_get_uintval(msg, param, res,
- (unsigned int)_dlg_ctx.to_route);
+ return pv_get_sintval(msg, param, res,
+ _dlg_ctx.to_route);
default:
return pv_get_uintval(msg, param, res,
(unsigned int)_dlg_ctx.on);
@@ -601,6 +601,7 @@ int pv_get_dlg(struct sip_msg *msg, pv_param_t *param,
int res_type = 0;
str sv = { 0 };
unsigned int ui = 0;
+ int si = 0;
if(param==NULL)
return -1;
@@ -683,8 +684,8 @@ int pv_get_dlg(struct sip_msg *msg, pv_param_t *param,
sv.s[sv.len] = '\0';
break;
case 9:
- res_type = 1;
- ui = (unsigned int)dlg->toroute;
+ res_type = 3;
+ si = dlg->toroute;
break;
case 10:
if(dlg->cseq[DLG_CALLEE_LEG].s==NULL
@@ -817,6 +818,8 @@ int pv_get_dlg(struct sip_msg *msg, pv_param_t *param,
return pv_get_uintval(msg, param, res, ui);
case 2:
return pv_get_strval(msg, param, res, &sv);
+ case 3:
+ return pv_get_sintval(msg, param, res, si);
default:
return pv_get_null(msg, param, res);
}