Module: kamailio
Branch: master
Commit: 81feae1940c299455804ddb211252766d50114d8
URL:
https://github.com/kamailio/kamailio/commit/81feae1940c299455804ddb21125276…
Author: jaybeepee <jason.penton(a)gmail.com>
Committer: jaybeepee <jason.penton(a)gmail.com>
Date: 2015-10-08T09:50:23+02:00
modules/dialog_ng: set init ts for dialog_in
---
Modified: modules/dialog_ng/dlg_handlers.c
Modified: modules/dialog_ng/dlg_hash.c
Modified: modules/dialog_ng/dlg_hash.h
---
Diff:
https://github.com/kamailio/kamailio/commit/81feae1940c299455804ddb21125276…
Patch:
https://github.com/kamailio/kamailio/commit/81feae1940c299455804ddb21125276…
---
diff --git a/modules/dialog_ng/dlg_handlers.c b/modules/dialog_ng/dlg_handlers.c
index e94be20..323b7c9 100644
--- a/modules/dialog_ng/dlg_handlers.c
+++ b/modules/dialog_ng/dlg_handlers.c
@@ -44,6 +44,7 @@ int spiral_detected = -1;
extern struct rr_binds d_rrb; /*!< binding to record-routing module */
extern struct tm_binds d_tmb;
extern struct dialog_ng_counters_h dialog_ng_cnts_h;
+time_t act_time;
extern pv_elem_t *ruri_param_model; /*!< pv-string to get r-uri */
@@ -1671,7 +1672,7 @@ int dlg_set_tm_callbacks(tm_cell_t *t, sip_msg_t *req, dlg_cell_t
*dlg,
goto error;
}
if (d_tmb.register_tmcb(req, t,
- TMCB_RESPONSE_IN | TMCB_RESPONSE_READY | TMCB_RESPONSE_FWDED |
TMCB_ON_FAILURE | TMCB_E2ECANCEL_IN | TMCB_REQUEST_OUT,
+ TMCB_DESTROY | TMCB_RESPONSE_IN | TMCB_RESPONSE_READY |
TMCB_RESPONSE_FWDED | TMCB_ON_FAILURE | TMCB_E2ECANCEL_IN | TMCB_REQUEST_OUT,
dlg_onreply, (void*) iuid, dlg_iuid_sfree) < 0) {
LM_ERR("failed to register TMCB\n");
goto error;
@@ -1826,6 +1827,7 @@ void internal_print_all_dlg(struct dlg_cell *dlg) {
LM_DBG("----------------------------");
LM_DBG("Dialog h_entry:h_id = [%u : %u]\n", dlg->h_entry,
dlg->h_id);
+ LM_DBG("Dialog age: %ld\n", act_time - dlg->init_ts);
LM_DBG("Dialog call-id: %.*s\n", dlg->callid.len, dlg->callid.s);
LM_DBG("Dialog state: %d\n", dlg->state);
LM_DBG("Dialog ref counter: %d\n", dlg->ref);
@@ -1876,6 +1878,7 @@ void print_all_dlgs() {
struct dlg_cell *dlg;
unsigned int i;
+ act_time = time(0);
LM_DBG("********************");
LM_DBG("printing %i dialogs\n", d_table->size);
diff --git a/modules/dialog_ng/dlg_hash.c b/modules/dialog_ng/dlg_hash.c
index 725114c..4de3b32 100644
--- a/modules/dialog_ng/dlg_hash.c
+++ b/modules/dialog_ng/dlg_hash.c
@@ -336,6 +336,7 @@ struct dlg_cell* build_new_dlg(str *callid, str *from_uri, str
*from_tag, str *r
}
dlg->state = DLG_STATE_UNCONFIRMED;
+ dlg->init_ts = (unsigned int)time(NULL);
dlg->h_entry = core_hash(callid, 0, d_table->size);
LM_DBG("new dialog on hash %u\n", dlg->h_entry);
@@ -1240,6 +1241,7 @@ void next_state_dlg(struct dlg_cell *dlg, int event,
case DLG_EVENT_REQBYE:
switch (dlg->state) {
case DLG_STATE_CONFIRMED:
+ case DLG_STATE_CONFIRMED_NA: /* we weight towards tearing the dialog down if we get a
bye - perhaps bye can beat ack*/
dlg->dflags |= DLG_FLAG_HASBYE;
dlg->state = DLG_STATE_DELETED;
*unref = 1;
diff --git a/modules/dialog_ng/dlg_hash.h b/modules/dialog_ng/dlg_hash.h
index 8d78a51..0988c5a 100644
--- a/modules/dialog_ng/dlg_hash.h
+++ b/modules/dialog_ng/dlg_hash.h
@@ -125,6 +125,7 @@ typedef struct dlg_cell {
str caller_route_set; /*!< route set of caller*/
struct socket_info * caller_bind_addr; /*! binded address of caller*/
unsigned int state; /*!< dialog state */
+ unsigned int init_ts;/*!< init (creation) time (absolute UNIX ts)*/
unsigned int start_ts; /*!< start time (absolute UNIX ts)*/
unsigned int lifetime; /*!< dialog lifetime */
unsigned int toroute; /*!< index of route that is executed on timeout */