Hello all
Testing dialog timeout event callback for kemi lua setup on kamailio 5.4.0-dev3 (x86_64/linux) d74157-dirty, i had some problems to perform the dlg timeroute behaviour the same as we could on native version.
If i used KSR.dialog.var_sets to set $dlg_ctx(timeout_route), I saw that on a dialog timeout, the dlg_ontimeout event route was not triggered, and only the dialog callback was executed with evname dialog:end. (only executing event_route -1 on state 5)
So i'm guessing that the kemi dialog var_sets is for $dlg_var only (¿?)
Anycase, If i used KSR.pv.sets, i saw the kamailio was crashing
.....
16(5579) DEBUG: dialog [dlg_hash.c:1013]: dlg_ref_helper(): ref dlg 0x7f9a961f5f90 with 1 -> 3
16(5579) DEBUG: dialog [dlg_handlers.c:1589]: dlg_ontimeout(): executing route -1 on timeout
22(5645) CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 8
22(5645) DEBUG: <core> [core/tcp_main.c:3762]: handle_ser_child(): dead child 16, pid 5579 (shutting down?)
....
Adding some debug, i could see that the call was not attempting the kemi function of line 1598 of dlg_handlers.c, and was trying the code i think was for native on line 1593.
We think the issue is that the toroute is defined as unsigned
dlg_hash.h: unsigned int toroute; /*!< index of route that is executed on timeout */
but after that when setting $dlg_ctx(timeout_route) with pv module, it tries to compare an integer being unsigned, so it's always true and never uses kemi
with this change we made it work
+ if ((int)(dlg->toroute) > 0) {
+ /*if(dlg->toroute>0) {*/
but i don't know maybe there is a better way to do it.
best regards
david