Hello;

i am trying to limit call duration with dialog module. So i use timeout_avp  for limiting it. there is no problem to close calls but when it happens i got some errors and kamailio can not write Bye result in DB. There is code sample and result in below.

2. question : is there a big difference between dialog_ng and dialog? Which one is more stable?

3. question : After restarting kamailio , Dialog hash vanish so timeout isn't working. Can DB mode solve this problem?

PS:  event_route[dialog:end] isn't working in Kamailio V 4.1.4. I got some error like t_w_relay.

Thanks for helps.


#---------------- dialog params -------------
#!ifdef WITH_DIALOG
modparam("dialog", "enable_stats", 1)
modparam("dialog", "hash_size", 8192)
modparam("dialog", "rr_param", "did")
modparam("dialog", "dlg_flag",4)
modparam("dialog", "timeout_avp", "$avp(i:10)")
modparam("dialog", "dlg_match_mode", 1)
modparam("dialog", "default_timeout", 3600)
modparam("dialog", "detect_spirals", 1)
modparam("dialog", "profiles_with_value", "userid ; opkodu")
modparam("dialog", "dlg_extra_hdrs", "Hint: Hell Yeah\r\n")
modparam("dialog", "send_bye", 1)
#endif


route[SW]{
xlog("L_INFO","Dialog:h_id:$dlg(h_id):h_entry:$dlg(h_entry):timeout:$dlg_ctx(timeout_route):bye:$dlg_ctx(timeout_bye):$avp(i:10)");
                $dlg_ctx(timeout_bye)=1;
                $avp(i:10)=15;
                $dlg_ctx(timeout_route)=33;

                 dlg_manage();
                 set_dlg_profile("userid","$avp(userid)");
                if(get_profile_size("userid","$avp(s_userid)")){
                        xlog("L_INFO","Userid_Size:$avp(s_userid)");
                }
xlog("L_INFO","Dialog:h_id:$dlg(h_id):h_entry:$dlg(h_entry):timeout:$dlg_ctx(timeout_route):bye:$dlg_ctx(timeout_bye):$avp(i:10)");
        if(!t_relay()) {
                 send_reply("408", "Servis Disi");
        }else{
                 exit;
        }
        return;
}
event_route[dialog:start]{
        xlog("L_ALERT","START:ci:$ci:method:$rm:start");
}
event_route[dialog:end]{
        xlog("L_ALERT","END");
        xlog("L_ALERT","END:$fU:$fd:$si:$rU:$rd:$avp(poparty):$avp(networkdatetime):$avp(ptparty):$avp(pprovider):$avp(maliyet_id):$avp(tibtip)");
        xlog("L_ALERT","END:$rm:$rr:$rs:");
}
event_route[dialog:failed]{

        xlog("L_INFO","FAILED:ci:$ci:method:$rm:end");
}
route[33]{
        xlog("L_INFO","route:33:$fU:$fd:$si:$rU:$rd:$avp(poparty):$avp(networkdatetime):$avp(ptparty):$avp(pprovider):$avp(maliyet_id):$avp(tibtip)");
        xlog("L_INFO","route:33:$rm:$rr:$rs:");
}
# Handle requests within SIP dialogs
route[WITHINDLG] {
        if (has_totag()) {
                # sequential request withing a dialog should
                # take the path determined by record-routing
                if (loose_route()) {
                        route(DLGURI);
                        if (is_method("BYE")) {
                                setflag(FLT_ACC); # do accounting ...
                                setflag(FLT_ACCFAILED); # ... even if the transaction fails
                        }
                        else if ( is_method("ACK") ) {
                                # ACK is forwarded statelessy
                                route(NATMANAGE);
                        }
                        else if ( is_method("NOTIFY") ) {
                                # Add Record-Route for in-dialog NOTIFY as per RFC 6665.
                                record_route();
                        }
                        route(RELAY);
                } else {
                        if (is_method("SUBSCRIBE") && uri == myself) {
                                # in-dialog subscribe requests
                                route(PRESENCE);
                                exit;
                        }
                        if ( is_method("ACK") ) {
                                if ( t_check_trans() ) {
                                        # no loose-route, but stateful ACK;
                                        # must be an ACK after a 487
                                        # or e.g. 404 from upstream server
                                        route(RELAY);
                                        exit;
                                } else {
                                        # ACK without matching transaction ... ignore and discard
                                        exit;
                                }
                        }
         sl_send_reply("404","Not here");
                }
                exit;
        }
}


Aug  1 16:51:52 host-91-93-189-136 /usr/local/sbin/kamailio[6111]: ALERT: <script>: USERID:456123
Aug  1 16:51:52 host-91-93-189-136 /usr/local/sbin/kamailio[6111]: ALERT: <script>: arayan:XXXX:aranan:XXXXX
Aug  1 16:51:52 host-91-93-189-136 /usr/local/sbin/kamailio[6111]: INFO: carrierroute [cr_func.c:710]: cr_do_route(): uri XXXX was rewritten to sip:YYYYYYYYYYYYYYY@XXXXXXX5:5060, carrier 3, domain 1
Aug  1 16:51:52 host-91-93-189-136 /usr/local/sbin/kamailio[6111]: INFO: <script>: vardesc: 40
Aug  1 16:51:52 host-91-93-189-136 /usr/local/sbin/kamailio[6111]: INFO: <script>: Dialog:h_id:<null>:h_entry:<null>:timeout:0:bye:0:<null>
Aug  1 16:51:52 host-91-93-189-136 /usr/local/sbin/kamailio[6111]: INFO: <script>: Userid_Size:1
Aug  1 16:51:52 host-91-93-189-136 /usr/local/sbin/kamailio[6111]: INFO: <script>: Dialog:h_id:3953:h_entry:3170:timeout:14:bye:1:15
Aug  1 16:51:55 host-91-93-189-136 /usr/local/sbin/kamailio[6114]: ALERT: <script>: START:ci:2c5695c1644fa2b135f57ea72c590cc7@XXXXXXX:5060:method:INVITE:start
Aug  1 16:52:11 host-91-93-189-136 /usr/local/sbin/kamailio[6145]: ERROR: <core> [parser/parse_from.c:113]: parse_from_uri(): failed to parse From uri
Aug  1 16:52:11 host-91-93-189-136 /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI
Aug  1 16:52:11 host-91-93-189-136 /usr/local/sbin/kamailio[6145]: ERROR: <core> [parser/parse_from.c:113]: parse_from_uri(): failed to parse From uri
Aug  1 16:52:11 host-91-93-189-136 /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI
Aug  1 16:52:11 host-91-93-189-136 /usr/local/sbin/kamailio[6145]: INFO: <script>: route:33:<null>:<null>:1.0.0.127:you:kamailio.org:<null>:<null>:<null>:<null>:<null>:<null>
Aug  1 16:52:11 host-91-93-189-136 /usr/local/sbin/kamailio[6145]: INFO: <script>: route:33:OPTIONS:<null>:<null>:
Aug  1 16:52:11 host-91-93-189-136 /usr/local/sbin/kamailio[6145]: ALERT: <script>: END
Aug  1 16:52:11 host-91-93-189-136 /usr/local/sbin/kamailio[6145]: ERROR: <core> [parser/parse_from.c:113]: parse_from_uri(): failed to parse From uri
Aug  1 16:52:11 host-91-93-189-136 /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI
Aug  1 16:52:11 host-91-93-189-136 /usr/local/sbin/kamailio[6145]: ERROR: <core> [parser/parse_from.c:113]: parse_from_uri(): failed to parse From uri
Aug  1 16:52:11 host-91-93-189-136 /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI
Aug  1 16:52:11 host-91-93-189-136 /usr/local/sbin/kamailio[6145]: ALERT: <script>: END:<null>:<null>:1.0.0.127:you:kamailio.org:<null>:<null>:<null>:<null>:<null>:<null>
Aug  1 16:52:11 host-91-93-189-136 /usr/local/sbin/kamailio[6145]: ALERT: <script>: END:OPTIONS:<null>:<null>:
Aug  1 16:52:11 host-91-93-189-136 /usr/local/sbin/kamailio[6121]: WARNING: dialog [dlg_req_within.c:212]: bye_reply_cb(): inconsitent dlg timer data on dlg 0x7feb2115d918 [3170:3953] with clid '2c5695c1644fa2b135f57ea72c590cc7@95.0.154.92:5060' and tags 'as3c7c5aa4' 'as0b640624'
Aug  1 16:52:11 host-91-93-189-136 /usr/local/sbin/kamailio[6121]: ERROR: acc [acc_cdr.c:574]: cdr_on_end(): invalid values#012!