Discussion:
[SR-Users] missing BYE record on acc table when using timeout_avp
b***@public.gmane.org
2014-08-04 13:19:40 UTC
Permalink
Hi to all,
I want to limit call duration according to the credit of the user.To accomplish this I use timeout_avp .When the limit is reached call ends but no record associated with BYE method is inserted to the acc table and that makes impossible to bill that call.What can I do to solve this problem or is there an alternative way to limit call duration?My configuration and logs are as follows.
BEST REGARDS.
#---------------- 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 kamailio /usr/local/sbin/kamailio[6111]: ALERT: <script>: USERID:456123
Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: ALERT: <script>: arayan:XXXX:aranan:XXXXX
Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: INFO: carrierroute [cr_func.c:710]: cr_do_route(): uri XXXX was rewritten to sip:***@XXXXXXX5:5060, carrier 3, domain 1
Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: INFO: <script>: vardesc: 40
Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: INFO: <script>: Dialog:h_id:<null>:h_entry:<null>:timeout:0:bye:0:<null>
Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: INFO: <script>: Userid_Size:1
Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: INFO: <script>: Dialog:h_id:3953:h_entry:3170:timeout:14:bye:1:15
Aug 1 16:51:55 kamailio /usr/local/sbin/kamailio[6114]: ALERT: <script>: START:ci:***@XXXXXXX:5060:method:INVITE:start
Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI
Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI
Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: INFO: <script>: route:33:OPTIONS:<null>:<null>:
Aug 1 16:52:11 kamailio /usr/local/sbin/kamailio[6145]: ALERT: <script>: END
Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI
Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI
Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ALERT: <script>: END:OPTIONS:<null>:<null>:
Aug 1 16:52:11 kamailio /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-ZDF/***@public.gmane.org:5060' and tags 'as3c7c5aa4' 'as0b640624'
Aug 1 16:52:11 kamailio /usr/local/sbin/kamailio[6121]: ERROR: acc [acc_cdr.c:574]: cdr_on_end(): invalid values#012!
Daniel-Constantin Mierla
2014-08-04 14:28:52 UTC
Permalink
Hello,

with latest version you can get the cdrs at once via dialog+acc module.

If you want to use the classic acc, then add either
event_route[dialog:end] or event_route[tm:local-request]. There you can
get actions when the dialog is ended (including the time out), and for
the second you get the BYE sent out. Perhaps SQLOPS with sql_query() or
acc_db_requests() should be used to record the event in db table.

Cheers,
Daniel
Post by b***@public.gmane.org
Hi to all,
I want to limit call duration according to the credit of the user.To
accomplish this I use timeout_avp .When the limit is reached call ends
but no record associated with BYE method is inserted to the acc table
and that makes impossible to bill that call.What can I do to solve
this problem or is there an alternative way to limit call duration?My
configuration and logs are as follows. BEST REGARDS. #----------------
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; } }
--------------------------------------------------------------------------------
<script>: USERID:456123 Aug 1 16:51:52 kamailio
arayan:XXXX:aranan:XXXXX Aug 1 16:51:52 kamailio
cr_do_route(): uri XXXX was rewritten to
kamailio /usr/local/sbin/kamailio[6111]: INFO: <script>: vardesc: 40
<script>: Dialog:h_id:<null>:h_entry:<null>:timeout:0:bye:0:<null> Aug
INFO: <script>: Dialog:h_id:3953:h_entry:3170:timeout:14:bye:1:15 Aug
Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv
[pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1
16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv
[pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1
route:33:<null>:<null>:1.0.0.127:you:kamailio.org:<null>:<null>:<null>:<null>:<null>:<null>
<script>: route:33:OPTIONS:<null>:<null>: Aug 1 16:52:11 kamailio
/usr/local/sbin/kamailio[6145]: ALERT: <script>: END Aug 1 16:52:11
kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv
[pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1
16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv
[pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1
END:<null>:<null>:1.0.0.127:you:kamailio.org:<null>:<null>:<null>:<null>:<null>:<null>
<script>: END:OPTIONS:<null>:<null>: Aug 1 16:52:11 kamailio
/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
'as3c7c5aa4' 'as0b640624' Aug 1 16:52:11 kamailio
cdr_on_end(): invalid values#012! BTLCRT
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
b***@public.gmane.org
2014-08-04 15:34:31 UTC
Permalink
Hi,
In ‘event_route[dialog:end]’I can not get any variable they are all empty but using acc_db_requests() worked for me.
Thanks for your help.
BEST REGARDS
From: Daniel-Constantin Mierla
Sent: Monday, August 04, 2014 5:28 PM
To: Kamailio (SER) - Users Mailing List
Subject: Re: [SR-Users] missing BYE record on acc table when usingtimeout_avp
Hello,

with latest version you can get the cdrs at once via dialog+acc module.

If you want to use the classic acc, then add either event_route[dialog:end] or event_route[tm:local-request]. There you can get actions when the dialog is ended (including the time out), and for the second you get the BYE sent out. Perhaps SQLOPS with sql_query() or acc_db_requests() should be used to record the event in db table.

Cheers,
Daniel

On 04/08/14 15:19, betul.cerit-B7uwCZGgQyS/***@public.gmane.org wrote:

Hi to all,
I want to limit call duration according to the credit of the user.To accomplish this I use timeout_avp .When the limit is reached call ends but no record associated with BYE method is inserted to the acc table and that makes impossible to bill that call.What can I do to solve this problem or is there an alternative way to limit call duration?My configuration and logs are as follows. BEST REGARDS. #---------------- 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 kamailio /usr/local/sbin/kamailio[6111]: ALERT: <script>: USERID:456123 Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: ALERT: <script>: arayan:XXXX:aranan:XXXXX Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: INFO: carrierroute [cr_func.c:710]: cr_do_route(): uri XXXX was rewritten to sip:***@XXXXXXX5:5060, carrier 3, domain 1 Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: INFO: <script>: vardesc: 40 Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: INFO: <script>: Dialog:h_id:<null>:h_entry:<null>:timeout:0:bye:0:<null> Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: INFO: <script>: Userid_Size:1 Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: INFO: <script>: Dialog:h_id:3953:h_entry:3170:timeout:14:bye:1:15 Aug 1 16:51:55 kamailio /usr/local/sbin/kamailio[6114]: ALERT: <script>: START:ci:***@XXXXXXX:5060:method:INVITE:start Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: INFO: <script>: route:33:OPTIONS:<null>:<null>: Aug 1 16:52:11 kamailio /usr/local/sbin/kamailio[6145]: ALERT: <script>: END Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ALERT: <script>: END:OPTIONS:<null>:<null>: Aug 1 16:52:11 kamailio /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-ZDF/***@public.gmane.org:5060' and tags 'as3c7c5aa4' 'as0b640624' Aug 1 16:52:11 kamailio /usr/local/sbin/kamailio[6121]: ERROR: acc [acc_cdr.c:574]: cdr_on_end(): invalid values#012!


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda

--------------------------------------------------------------------------------
b***@public.gmane.org
2014-08-05 07:00:03 UTC
Permalink
Hi,
In ‘event_route[dialog:end]’I can not get any variable they are all empty but using acc_db_requests() worked for me.
Thanks for your help.
BEST REGARDS
From: Daniel-Constantin Mierla
Sent: Monday, August 04, 2014 5:28 PM
To: Kamailio (SER) - Users Mailing List
Subject: Re: [SR-Users] missing BYE record on acc table when usingtimeout_avp
Hello,

with latest version you can get the cdrs at once via dialog+acc module.

If you want to use the classic acc, then add either event_route[dialog:end] or event_route[tm:local-request]. There you can get actions when the dialog is ended (including the time out), and for the second you get the BYE sent out. Perhaps SQLOPS with sql_query() or acc_db_requests() should be used to record the event in db table.

Cheers,
Daniel

On 04/08/14 15:19, betul.cerit-B7uwCZGgQyS/***@public.gmane.org wrote:

Hi to all,
I want to limit call duration according to the credit of the user.To accomplish this I use timeout_avp .When the limit is reached call ends but no record associated with BYE method is inserted to the acc table and that makes impossible to bill that call.What can I do to solve this problem or is there an alternative way to limit call duration?My configuration and logs are as follows. BEST REGARDS. #---------------- 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 kamailio /usr/local/sbin/kamailio[6111]: ALERT: <script>: USERID:456123 Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: ALERT: <script>: arayan:XXXX:aranan:XXXXX Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: INFO: carrierroute [cr_func.c:710]: cr_do_route(): uri XXXX was rewritten to sip:***@XXXXXXX5:5060, carrier 3, domain 1 Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: INFO: <script>: vardesc: 40 Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: INFO: <script>: Dialog:h_id:<null>:h_entry:<null>:timeout:0:bye:0:<null> Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: INFO: <script>: Userid_Size:1 Aug 1 16:51:52 kamailio /usr/local/sbin/kamailio[6111]: INFO: <script>: Dialog:h_id:3953:h_entry:3170:timeout:14:bye:1:15 Aug 1 16:51:55 kamailio /usr/local/sbin/kamailio[6114]: ALERT: <script>: START:ci:***@XXXXXXX:5060:method:INVITE:start Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: INFO: <script>: route:33:OPTIONS:<null>:<null>: Aug 1 16:52:11 kamailio /usr/local/sbin/kamailio[6145]: ALERT: <script>: END Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv [pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ALERT: <script>: END:OPTIONS:<null>:<null>: Aug 1 16:52:11 kamailio /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-ZDF/***@public.gmane.org:5060' and tags 'as3c7c5aa4' 'as0b640624' Aug 1 16:52:11 kamailio /usr/local/sbin/kamailio[6121]: ERROR: acc [acc_cdr.c:574]: cdr_on_end(): invalid values#012!


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda

--------------------------------------------------------------------------------
Daniel-Constantin Mierla
2014-08-05 08:41:52 UTC
Permalink
The dialog event route should have the $dlg(...) variable available that
you should use as input in an sql_query():

-
http://www.kamailio.org/wiki/cookbooks/4.1.x/pseudovariables#dialog_module_pseudo-variables

At timeout there is no request there. It is the event that triggers tm
to build and send a bye, to be available in tm:local-request

Cheers,
Daniel
Hi, In ‘event_route[dialog:end]’I can not get any variable they are
all empty but using acc_db_requests() worked for me. Thanks for your
help. BEST REGARDS *From:* Daniel-Constantin Mierla
*To:* Kamailio (SER) - Users Mailing List
missing BYE record on acc table when usingtimeout_avp Hello,
with latest version you can get the cdrs at once via dialog+acc module.
If you want to use the classic acc, then add either
event_route[dialog:end] or event_route[tm:local-request]. There you
can get actions when the dialog is ended (including the time out), and
for the second you get the BYE sent out. Perhaps SQLOPS with
sql_query() or acc_db_requests() should be used to record the event in
db table.
Cheers,
Daniel
Hi to all, I want to limit call duration according to the credit of
the user.To accomplish this I use timeout_avp .When the limit is
reached call ends but no record associated with BYE method is
inserted to the acc table and that makes impossible to bill that
call.What can I do to solve this problem or is there an alternative
way to limit call duration?My configuration and logs are as follows.
BEST REGARDS. #---------------- 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; } }
--------------------------------------------------------------------------------
<script>: USERID:456123 Aug 1 16:51:52 kamailio
arayan:XXXX:aranan:XXXXX Aug 1 16:51:52 kamailio
cr_do_route(): uri XXXX was rewritten to
Dialog:h_id:<null>:h_entry:<null>:timeout:0:bye:0:<null> Aug 1
INFO: <script>: Dialog:h_id:3953:h_entry:3170:timeout:14:bye:1:15 Aug
Aug 1 16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv
[pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1
16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv
[pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1
route:33:<null>:<null>:1.0.0.127:you:kamailio.org:<null>:<null>:<null>:<null>:<null>:<null>
<script>: route:33:OPTIONS:<null>:<null>: Aug 1 16:52:11 kamailio
/usr/local/sbin/kamailio[6145]: ALERT: <script>: END Aug 1 16:52:11
kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv
[pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1
16:52:11 kamailio /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 kamailio /usr/local/sbin/kamailio[6145]: ERROR: pv
[pv_core.c:397]: pv_get_xto_attr(): cannot parse From URI Aug 1
END:<null>:<null>:1.0.0.127:you:kamailio.org:<null>:<null>:<null>:<null>:<null>:<null>
<script>: END:OPTIONS:<null>:<null>: Aug 1 16:52:11 kamailio
/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
'as3c7c5aa4' 'as0b640624' Aug 1 16:52:11 kamailio
cdr_on_end(): invalid values#012! BTLCRT
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla -http://www.asipto.com
http://twitter.com/#!/miconda -http://www.linkedin.com/in/miconda
------------------------------------------------------------------------
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Loading...