Revision: 6020
http://openser.svn.sourceforge.net/openser/?rev=6020&view=rev
Author: timoreimann
Date: 2010-07-13 18:31:40 +0000 (Tue, 13 Jul 2010)
Log Message:
-----------
modules_k/dialog: Delay dialog deletion to absorb late in-dialog
requests
- When a dialog's state transitions to DLG_STATE_DELETED, register a tm
callback for TMCB_TRANS_DELETED to absorb late in-dialog requests (no
more "unable to find dialog for <REQUEST TYPE>" log messages).
- On callback, unreference and, in consequence, destroy the dialog.
Modified Paths:
--------------
branches/1.5/modules/dialog/dlg_handlers.c
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Module: sip-router
Branch: kamailio_3.0
Commit: 24877089b48cdbf9389981c0e9285e6a3a1ce6c8
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2487708…
Author: Timo Reimann <timo.reimann(a)1und1.de>
Committer: Timo Reimann <timo.reimann(a)1und1.de>
Date: Mon Jun 28 10:50:05 2010 +0200
modules_k/dialog: Delay dialog deletion to absorb late in-dialog
requests
- When a dialog's state transitions to DLG_STATE_DELETED, register
a tm callback for TMCB_DESTROY to absorb late in-dialog requests
(no more "unable to find dialog for <REQUEST TYPE>" log
messages).
- On callback, unreference and, in consequence, destroy the
dialog.
(cherry picked from commit 3537c2d8c27617023cb9f9a569435483748fef1f)
---
modules_k/dialog/dlg_handlers.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/modules_k/dialog/dlg_handlers.c b/modules_k/dialog/dlg_handlers.c
index ad892b6..19b53e9 100644
--- a/modules_k/dialog/dlg_handlers.c
+++ b/modules_k/dialog/dlg_handlers.c
@@ -764,6 +764,20 @@ static void unreference_dialog(void *dialog)
/*!
+ * \brief Unreference a dialog from tm callback (another wrapper)
+ * \param t transaction, unused
+ * \param type type of the entered callback
+ * \param param saved dialog structure in the callback
+ */
+static void unref_dlg_from_cb(struct cell* t, int type, struct tmcb_params *param)
+{
+ struct dlg_cell *dlg = (struct dlg_cell *)(*param->param);
+
+ unref_dlg(dlg, 1);
+}
+
+
+/*!
* \brief Function that is registered as RR callback for dialog tracking
*
* Function that is registered as RR callback for dialog tracking. It
@@ -886,6 +900,17 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)
set_current_dialog( req, dlg);
_dlg_ctx.dlg = dlg;
+ /* delay deletion of dialog until transaction has died off in order
+ * to absorb in-air messages */
+ if (new_state==DLG_STATE_DELETED && old_state!=DLG_STATE_DELETED) {
+ if ( d_tmb.register_tmcb(req, NULL, TMCB_DESTROY,
+ unref_dlg_from_cb, (void*)dlg, NULL)<0 ) {
+ LM_ERR("failed to register deletion delay function\n");
+ } else {
+ ref_dlg(dlg, 1);
+ }
+ }
+
/* run actions for the transition */
if (event==DLG_EVENT_REQBYE && new_state==DLG_STATE_DELETED &&
old_state!=DLG_STATE_DELETED) {
Module: sip-router
Branch: master
Commit: 3537c2d8c27617023cb9f9a569435483748fef1f
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3537c2d…
Author: Timo Reimann <timo.reimann(a)1und1.de>
Committer: Timo Reimann <timo.reimann(a)1und1.de>
Date: Mon Jun 28 10:50:05 2010 +0200
modules_k/dialog: Delay dialog deletion to absorb late in-dialog
requests
- When a dialog's state transitions to DLG_STATE_DELETED, register
a tm callback for TMCB_DESTROY to absorb late in-dialog requests
(no more "unable to find dialog for <REQUEST TYPE>" log
messages).
- On callback, unreference and, in consequence, destroy the
dialog.
---
modules_k/dialog/dlg_handlers.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/modules_k/dialog/dlg_handlers.c b/modules_k/dialog/dlg_handlers.c
index ad892b6..19b53e9 100644
--- a/modules_k/dialog/dlg_handlers.c
+++ b/modules_k/dialog/dlg_handlers.c
@@ -764,6 +764,20 @@ static void unreference_dialog(void *dialog)
/*!
+ * \brief Unreference a dialog from tm callback (another wrapper)
+ * \param t transaction, unused
+ * \param type type of the entered callback
+ * \param param saved dialog structure in the callback
+ */
+static void unref_dlg_from_cb(struct cell* t, int type, struct tmcb_params *param)
+{
+ struct dlg_cell *dlg = (struct dlg_cell *)(*param->param);
+
+ unref_dlg(dlg, 1);
+}
+
+
+/*!
* \brief Function that is registered as RR callback for dialog tracking
*
* Function that is registered as RR callback for dialog tracking. It
@@ -886,6 +900,17 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)
set_current_dialog( req, dlg);
_dlg_ctx.dlg = dlg;
+ /* delay deletion of dialog until transaction has died off in order
+ * to absorb in-air messages */
+ if (new_state==DLG_STATE_DELETED && old_state!=DLG_STATE_DELETED) {
+ if ( d_tmb.register_tmcb(req, NULL, TMCB_DESTROY,
+ unref_dlg_from_cb, (void*)dlg, NULL)<0 ) {
+ LM_ERR("failed to register deletion delay function\n");
+ } else {
+ ref_dlg(dlg, 1);
+ }
+ }
+
/* run actions for the transition */
if (event==DLG_EVENT_REQBYE && new_state==DLG_STATE_DELETED &&
old_state!=DLG_STATE_DELETED) {
Hi, Kamailio 1.5.4, let's suppose this case:
1) A dialog in eary state (state 2):
~# kamctl fifo profile_list_dlgs out
dialog:: hash=1055:330534072
state:: 2
2) Now try to terminate it:
~# kamctl fifo dlg_end_dlg 1055 330534072
3) It produces an error because in the early dialog there is no
Contact for the called:
ERROR:dialog:build_dlg_t: no contact available
ERROR:dialog:send_bye: failed to create dlg_t
CRITICAL:dialog:log_next_state_dlg: bogus event 7 in state 2 for dlg
0x7f25f0cde718 [3168:435552476] with clid 'hqpprxbyrutiytu@ibc-torre'
and tags 'ysldc' ''
4) The dialog remains in state 2 (as the MI command shows), and later
it's cancelled by the UAC.
5) MI profile_list_dlgs out will show the dialog in state 5 *forever*,
it's never deleted from memory! (perhaps it's after expiration time,
haven't checked it).
NOTE: I do know that dlg_end_dlg is not ready for early dialogs, as it
should trigger a transaction cancel (CANCEL to all the branches and
408 to the UAC) rather than sending a BYE, but this feature is not
implemented.
However the current code could leak.
--
Iñaki Baz Castillo
<ibc(a)aliax.net>
Hi,
what's the dialog module's "failed_dlgs" counter variable (defined in
modules_k/dialog.c) supposed to indicate?
My understanding would be that it shows the number of dialogs that could
not reach the "confirmed" call state, i.e., calls for which the caller
received a non-2xx final response after the initial INVITE during
routing. However, the variable is increased in situations for which a
dialog could not be set up in the very first place due to either
- malformed SIP headers in the INVITE request,
- lack of shared memory, and
- unsuccessful callback registrations to the rr or tm module
which are all checked in dlg_handler.c's dlg_new_dialog() function prior
to any further response processing.
What I'd prefer to do to the least is additionally update the counter
variable every time a non-2xx final response has been received to
indicate call failure in the SIP sense. Going one step further, I'd
remove the update code from its current place because I do not see much
meaning in running statistics on hard errors as given above. The cases
are already covered by ERROR-level log messages so they will be reported
anyway.
To sum up my goal: If no one objects, I will change the code such that
hard errors are not covered by failed_dlgs anymore but failure to
establish SIP sessions are.
Cheers,
--Timo
Revision: 6019
http://openser.svn.sourceforge.net/openser/?rev=6019&view=rev
Author: timoreimann
Date: 2010-07-13 16:55:11 +0000 (Tue, 13 Jul 2010)
Log Message:
-----------
Increase failed_dlgs when a non-2xx final response has been received
only.
Modified Paths:
--------------
branches/1.5/modules/dialog/dlg_handlers.c
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6018
http://openser.svn.sourceforge.net/openser/?rev=6018&view=rev
Author: timoreimann
Date: 2010-07-13 12:59:25 +0000 (Tue, 13 Jul 2010)
Log Message:
-----------
Fix minor typo
Modified Paths:
--------------
branches/1.5/modules/dialog/dlg_hash.c
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.