Browse code

dialog: update event route statistics

If dialog was deleted while running the event route, update statistics
for early and active dialogs.

Stefan Mititelu authored on 10/03/2020 09:46:49 • Stefan Mititelu committed on 11/03/2020 08:01:27
Showing 1 changed files
... ...
@@ -1810,6 +1810,16 @@ int dlg_run_event_route(dlg_cell_t *dlg, sip_msg_t *msg, int ostate, int nstate)
1810 1810
 		if (dlg0==0) {
1811 1811
 			LM_ALERT("after event route - dialog not found [%u:%u] (%d/%d) (%p) (%.*s)\n",
1812 1812
 					h_entry, h_id, ostate, nstate, dlg, evname.len, evname.s);
1813
+			if (nstate == DLG_STATE_DELETED) {
1814
+				if (ostate == DLG_STATE_UNCONFIRMED) {
1815
+					if_update_stat(dlg_enable_stats, failed_dlgs, 1);
1816
+				} else if (ostate == DLG_STATE_EARLY) {
1817
+					if_update_stat(dlg_enable_stats, early_dlgs, -1);
1818
+					if_update_stat(dlg_enable_stats, failed_dlgs, 1);
1819
+				} else if (ostate != DLG_STATE_DELETED) {
1820
+					if_update_stat(dlg_enable_stats, active_dlgs, -1);
1821
+				}
1822
+			}
1813 1823
 			return -1;
1814 1824
 		} else {
1815 1825
 			dlg_release(dlg0);