### Description
In a setup with 2 kamailios in active/passive with a virtual IP that failovers between them:
sbc01 (active) is handling calls. sbc02 (passive) is started, and does an initial dialog sync via DMQ
``` root@sbc01:~# kamctl rpc stats.get_statistics all | grep dialog "dialog:active_dialogs = 39", "dialog:early_dialogs = 2", "dialog:expired_dialogs = 0", "dialog:failed_dialogs = 583", "dialog:processed_dialogs = 2527", root@sbc01:~# ```
``` root@sbc02:/etc/kamailio# kamctl rpc stats.get_statistics all | grep dialog "dialog:active_dialogs = 39", "dialog:early_dialogs = 0", "dialog:expired_dialogs = 0", "dialog:failed_dialogs = 0", "dialog:processed_dialogs = 0", root@sbc02:/etc/kamailio# ```
From that point onwards, as long as sbc01 stays as active, sbc02 stays as passive, and no restarts occur anywhere, the values for `dialog` metrics in sbc02 will not change and remain as they are, in the previous example, active_dialogs would remain as 39.
### Troubleshooting
This was discovered during some tests from #1591
#### Reproduction
Setup 2 kamailio instances that replicate dialogs via DMQ.
1- On Kamailio1 put some traffic to have some active dialogs (must call `dlg_manage()` in routing script for these test calls) 2- Start Kamailio2 3- Compare output of: `kamcmd stats.get_statistics dialog:` on both nodes. 4- Alter the amount of active dialogs on Kamailio1 (either end some or create new ones). 5- Repeat step 3.
Kamailio1 --> Step5 will have different values from Step3. Kamailio2 --> Step5 will have exactly the same values from Step3.
### Possible Solutions
`dialog:active_dialogs` should remain as 0 on Kamailio2, as technically there are no dialogs being handled by that server, it only has information of replicated dialogs and those stats are available in the `dlg.stats_active` metric.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` # kamailio -V version: kamailio 5.2.0-pre1 (x86_64/linux) 2ecf60-dirty flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: 2ecf60 -dirty compiled with gcc 6.3.0 ```
* **Operating System**:
<!-- Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...; Kernel details (output of `uname -a`) -->
``` root@sbc02:~# lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.5 (stretch) Release: 9.5 Codename: stretch root@sbc02:~# uname -a Linux sbc02 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u6 (2018-10-08) x86_64 GNU/Linux root@sbc02:~# ```
A dedicated command was added to fetch the values by scanning the internal hash table, so I am closing this one. If someone wants a different implementation, just make a PR.
Closed #1692.