Module: sip-router
Branch: master
Commit: a4c2f8086781f27648b6796ed10a93b91103f6e9
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a4c2f80…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu May 28 12:26:13 2009 +0300
dialog (k): lookup the index of timeout route
- sr can have str name for routes, therefore K mode is no longer valid
---
modules_k/dialog/dlg_handlers.c | 2 +-
modules_k/dialog/dlg_var.c | 16 +++++++++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/modules_k/dialog/dlg_handlers.c b/modules_k/dialog/dlg_handlers.c
index 2b3d53d..0ebb4b1 100644
--- a/modules_k/dialog/dlg_handlers.c
+++ b/modules_k/dialog/dlg_handlers.c
@@ -964,7 +964,7 @@ void dlg_ontimeout( struct dlg_tl *tl)
dlg = ((struct dlg_cell*)((char *)(tl) -
(unsigned long)(&((struct dlg_cell*)0)->tl)));
- if(dlg->toroute>0 && dlg->toroute<RT_NO)
+ if(dlg->toroute>0 && main_rt.rlist[dlg->toroute]!=NULL)
{
dlg_set_ctx_dialog(dlg);
fmsg = faked_msg_next();
diff --git a/modules_k/dialog/dlg_var.c b/modules_k/dialog/dlg_var.c
index 588e231..48710e5 100644
--- a/modules_k/dialog/dlg_var.c
+++ b/modules_k/dialog/dlg_var.c
@@ -20,6 +20,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "../../route.h"
+
#include "dlg_var.h"
dlg_ctx_t _dlg_ctx;
@@ -68,6 +70,8 @@ int pv_set_dlg_ctx(struct sip_msg* msg, pv_param_t *param,
int op, pv_value_t *val)
{
int n;
+ char *rtp;
+
if(param==NULL)
return -1;
@@ -88,7 +92,17 @@ int pv_set_dlg_ctx(struct sip_msg* msg, pv_param_t *param,
_dlg_ctx.to_bye = n;
break;
case 4:
- _dlg_ctx.to_route = n;
+ if(val->flags&PV_VAL_STR) {
+ if(val->rs.s[val->rs.len]=='\0')
+ _dlg_ctx.to_route = route_lookup(&main_rt, val->rs.s);
+ else _dlg_ctx.to_route = 0;
+ } else {
+ if(n!=0) {
+ rtp = int2str(n, NULL);
+ _dlg_ctx.to_route = route_lookup(&main_rt, rtp);
+ } else _dlg_ctx.to_route = 0;
+ }
+ if(_dlg_ctx.to_route <0) _dlg_ctx.to_route = 0;
break;
default:
_dlg_ctx.on = n;