Module: kamailio
Branch: 5.3
Commit: 54520cee9f6f088ddcfad0e7e6f312c04322bf76
URL: 
https://github.com/kamailio/kamailio/commit/54520cee9f6f088ddcfad0e7e6f312c04322bf76

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2020-04-06T13:18:59+02: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

(cherry picked from commit 6c557efc1b9cb8c880a05235c94780bbaf305073)

---

Modified: src/modules/dialog/dlg_hash.h
Modified: src/modules/dialog/dlg_var.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/54520cee9f6f088ddcfad0e7e6f312c04322bf76.diff
Patch: 
https://github.com/kamailio/kamailio/commit/54520cee9f6f088ddcfad0e7e6f312c04322bf76.patch

---

diff --git a/src/modules/dialog/dlg_hash.h b/src/modules/dialog/dlg_hash.h
index a2f4fa7f97..ed5cd7bef0 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);
        }


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to