From ccc7184fddc11a8dfab83ff0e6cd841e9c9402b4 Mon Sep 17 00:00:00 2001
From: Timo Reimann <timo.reimann@1und1.de>
Date: Sat, 22 Oct 2011 10:55:08 +0200
Subject: [PATCH] dialog(k): Set dialog parameters (timeout, etc.) before create callback
 is executed to provide these parameters to registered functions.

---
 modules_k/dialog/dlg_handlers.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/modules_k/dialog/dlg_handlers.c b/modules_k/dialog/dlg_handlers.c
index 89fb0b3..bc79f7b 100644
--- a/modules_k/dialog/dlg_handlers.c
+++ b/modules_k/dialog/dlg_handlers.c
@@ -730,6 +730,15 @@ int dlg_new_dialog(struct sip_msg *msg, struct cell *t)
 
 	link_dlg(dlg,0);
 
+	dlg->lifetime = get_dlg_timeout(msg);
+	s.s   = _dlg_ctx.to_route_name;
+	s.len = strlen(s.s);
+	dlg_set_toroute(dlg, &s);
+	dlg->sflags |= _dlg_ctx.flags;
+
+	if (_dlg_ctx.to_bye!=0)
+		dlg->dflags |= DLG_FLAG_TOBYE;
+
 	run_create_callbacks(dlg, msg);
 
 	/* first INVITE seen (dialog created, unconfirmed) */
@@ -748,15 +757,6 @@ int dlg_new_dialog(struct sip_msg *msg, struct cell *t)
 	// increase reference counter because of registered callback
 	ref_dlg(dlg, 1);
 
-	dlg->lifetime = get_dlg_timeout(msg);
-	s.s   = _dlg_ctx.to_route_name;
-	s.len = strlen(s.s);
-	dlg_set_toroute(dlg, &s);
-	dlg->sflags |= _dlg_ctx.flags;
-
-	if (_dlg_ctx.to_bye!=0)
-		dlg->dflags |= DLG_FLAG_TOBYE;
-
 	if_update_stat( dlg_enable_stats, processed_dlgs, 1);
 
 finish:
-- 
1.7.3.2

