Module: kamailio Branch: master Commit: aae99e8e6d9cf959719b09360ff0cfc37386d722 URL: https://github.com/kamailio/kamailio/commit/aae99e8e6d9cf959719b09360ff0cfc37386d722
Author: Daniel-Constantin Mierla <mico...@gmail.com> Committer: Daniel-Constantin Mierla <mico...@gmail.com> Date: 2024-12-13T19:50:44+01:00 dialog: update fields on dlg_set_state() changes --- Modified: src/modules/dialog/dlg_handlers.c --- Diff: https://github.com/kamailio/kamailio/commit/aae99e8e6d9cf959719b09360ff0cfc37386d722.diff Patch: https://github.com/kamailio/kamailio/commit/aae99e8e6d9cf959719b09360ff0cfc37386d722.patch --- diff --git a/src/modules/dialog/dlg_handlers.c b/src/modules/dialog/dlg_handlers.c index 167e4602b88..0aeff6c02fd 100644 --- a/src/modules/dialog/dlg_handlers.c +++ b/src/modules/dialog/dlg_handlers.c @@ -1888,7 +1888,7 @@ int dlg_set_state(sip_msg_t *msg, int istate) str st = STR_NULL; dlg_cell_t *dlg = NULL; unsigned int dir = 0; - int oldstate = 0; + int ostate = 0; if(msg->callid == NULL && ((parse_headers(msg, HDR_CALLID_F, 0) == -1) @@ -1918,16 +1918,24 @@ int dlg_set_state(sip_msg_t *msg, int istate) LM_DBG("dialog not found\n"); return -1; } - oldstate = dlg->state; + ostate = dlg->state; dlg->state = istate; + /* updates for terminated dialogs */ + if(ostate == DLG_STATE_CONFIRMED && istate == DLG_STATE_DELETED) { + /* updating timestamps, flags, dialog stats */ + dlg->init_ts = (unsigned int)(time(0)); + dlg->end_ts = (unsigned int)(time(0)); + } + dlg->dflags |= DLG_FLAG_CHANGED; if(msg->first_line.type == SIP_REQUEST) { - LM_DBG("handling request - oldstate: %d newstate: %d\n", oldstate, + LM_DBG("handling request - oldstate: %d newstate: %d\n", ostate, istate); } else { - LM_DBG("handling response - oldstate: %d newstate: %d\n", oldstate, + LM_DBG("handling response - oldstate: %d newstate: %d\n", ostate, istate); } dlg_release(dlg); + return 0; } _______________________________________________ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!