[Serusers] accounting when forward to a gw

Roddy G. Posada Santos rposada at ecnet.ec
Mon Apr 5 17:36:28 CEST 2004


this is my config i can forward call to a gateway, but the accounting is not
working for the forwarded calls, when the callee hangs up the accounting
works, but when I hang up using a softphone like x-lite, i receive this:

-------------------------------------------
SEND >> 157.100.19.26:5060
BYE sip:2815 at 157.100.19.26:5060 SIP/2.0
Via: SIP/2.0/UDP
157.100.19.33:5060;rport;branch=z9hG4bK821BACD7B6D345B9B91ABF0415936C95
From: Roddy <sip:2815 at linora.ecua.net.ec>;tag=1603393349
To: <sip:0059399719212 at linora.ecua.net.ec>;tag=3290163180-508188
Contact: <sip:2815 at 157.100.19.33:5060>
Route:
<sip:0059399719212 at 69.20.61.218:5070;maddr=69.20.61.218>,<sip:0059399719212@
69.20.44.9:5060;maddr=69.20.44.9>,<sip:T-Telio-218 at 69.20.44.9:5070>
Call-ID: A65E0428-B4EC-4B0C-B7A8-5BE1B18C7849 at 157.100.19.33
CSeq: 27811 BYE
Max-Forwards: 70
User-Agent: X-PRO build 1101
Content-Length: 0


SEND >> 157.100.19.26:5060
BYE sip:2815 at 157.100.19.26:5060 SIP/2.0
Via: SIP/2.0/UDP
157.100.19.33:5060;rport;branch=z9hG4bK821BACD7B6D345B9B91ABF0415936C95
From: Roddy <sip:2815 at linora.ecua.net.ec>;tag=1603393349
To: <sip:0059399719212 at linora.ecua.net.ec>;tag=3290163180-508188
Contact: <sip:2815 at 157.100.19.33:5060>
Route:
<sip:0059399719212 at 69.20.61.218:5070;maddr=69.20.61.218>,<sip:0059399719212@
69.20.44.9:5060;maddr=69.20.44.9>,<sip:T-Telio-218 at 69.20.44.9:5070>
Call-ID: A65E0428-B4EC-4B0C-B7A8-5BE1B18C7849 at 157.100.19.33
CSeq: 27811 BYE
Max-Forwards: 70
User-Agent: X-PRO build 1101
Content-Length: 0


RECEIVE << 157.100.19.26:5060
SIP/2.0 408 Request Timeout
Via: SIP/2.0/UDP
157.100.19.33:5060;rport=5060;branch=z9hG4bK821BACD7B6D345B9B91ABF0415936C95
From: Roddy <sip:2815 at linora.ecua.net.ec>;tag=1603393349
To: <sip:0059399719212 at linora.ecua.net.ec>;tag=3290163180-508188
Call-ID: A65E0428-B4EC-4B0C-B7A8-5BE1B18C7849 at 157.100.19.33
CSeq: 27811 BYE
Server: Sip EXpress router (0.8.12 (i386/linux))
Content-Length: 0
Warning: 392 157.100.19.26:5060 "Noisy feedback tells:  pid=2654
req_src_ip=157.100.19.33 req_src_port=5060
in_uri=sip:2815 at 157.100.19.26:5060
out_uri=sip:0059399719212 at 69.20.61.218:5070;maddr=69.20.61.218 via_cnt==0"

--------------------------------------

the calls end but there is no accounting to my server.

thanks
roddy


#
# $Id: ser.cfg,v 1.21 2003/06/04 13:47:36 jiri Exp $
#
# simple quick-start config script
#
# ----------- global configuration parameters ------------------------
#debug=3 # debug level (cmd line: -dddddddddd)
#fork=no
#log_stderror=no # (cmd line: -E)

# Uncomment these lines to enter debugging mode
/*
debug=7
fork=no
log_stderror=yes
*/
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
port=5060
children=4
fifo="/tmp/ser_fifo"
fifo_mode=438
alias=linora.ecua.net.ec
# ------------------ module loading ----------------------------------
# Uncomment this if you want to use SQL database
loadmodule "/usr/local/lib/ser/modules/mysql.so"
loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
#loadmodule "/usr/local/lib/ser/modules/msilo.so"
#loadmodule "/usr/local/lib/ser/modules/print.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"
# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
#radius
#loadmodule "/usr/local/lib/ser/modules/auth_radius.so"
# load the voicemail module
#loadmodule "/usr/local/lib/ser/modules/vm.so"
# load the enum module
loadmodule "/usr/local/lib/ser/modules/enum.so"
# load the group module, to verify if a user forwards to voicemail
loadmodule "/usr/local/lib/ser/modules/group.so"
# load the nathelper module
loadmodule "/usr/local/lib/ser/modules/nathelper.so"
# ----------------- setting module-specific parameters ---------------
# -- registrar parameter
# special NAT flag indicates that a registered client is behind NAT
#modparam("registrar", "nat_flag", 6)
# -- acc params --
modparam("acc", "db_url", "sql://ser:xxxxxx@localhost/ser")
modparam("acc", "log_level", 1)
modparam("acc", "radius_flag", 1)
modparam("acc", "db_flag", 1)
modparam("acc", "db_missed_flag", 1)
modparam("acc",
"radius_config","/usr/local/etc/radiusclient/radiusclient.conf")
modparam("acc", "radius_missed_flag", 2)
modparam("acc", "service_type", 15)
modparam("acc", "log_flag", 1)
# -- usrloc params --
#modparam("usrloc", "db_mode", 0)
# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "db_url", "mysql://ser:xxxxxx@localhost/ser")
# -- auth params --
# Uncomment if you are using auth module
#
modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this config),
# uncomment also the following parameter)
#
modparam("auth_db", "password_column", "password")
modparam("auth_db", "db_url", "mysql://ser:xxxxxx@localhost/ser")
# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)
# -- voicemail params --
#modparam("voicemail", "db_url","mysql://ser:xxxxxx@localhost/ser")
# -- voicemail params --
modparam("group", "db_url","mysql://ser:xxxxxx@localhost/ser")
# -- nathelper params --
modparam("nathelper", "natping_interval", 60)
#modparam("nathelper", "ping_nated_only", 1)
# -- tm params --
#modparam("tm", "fr_inv_timer", 30 )
#modparam("tm", "fr_inv_timer", 18 )
#modparam("tm", "fr_timer", 10 )
modparam("tm", "fr_inv_timer", 15 )
#modparam("tm", "wt_timer", 10 )
# -- msilo params --
#modparam("msilo","db_url","mysql://user:xxxxxx@127.0.0.1/msilo")
#modparam("msilo","registrar","sip:registrar at mydomain.com")
# ------------------------- request routing logic -------------------
# main routing logic
route{
#setflag(1);
log(1, "-------------------------------------------\n");
log(1, "entering main loop\n");
if (method=="INVITE"){
record_route();
};
if (method=="INVITE" || method=="BYE" || method=="CANCEL"){
record_route();
setflag(1);
};

/*
if (method=="REGISTER")
log(1, "REGISTER message received\n");
if (method=="INVITE")
log(1, "INVITE message received\n");
if (method=="ACK")
log(1, "ACK message received\n");
if (method=="BYE")
log(1, "BYE message received\n");
if (method=="CANCEL")
log(1, "CANCEL message received\n");
if (method=="SUBSCRIBE")
log(1, "SUBSCRIBE message received\n");
if (method=="NOTIFY")
log(1, "NOTIFY message received\n");
if (method=="OPTIONS")
log(1, "OPTIONS message received\n");
if (method=="INFO")
log(1, "INFO message received\n");
if (method=="MESSAGE")
log(1, "MESSAGE message received\n");
if (method=="REFER")
log(1, "REFER message received\n");
*/
# initial sanity checks -- messages with
# max_forwards==0, or excessively long requests
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
break;
};
if (msg:len > max_len) {
#if (len_gt( max_len )) {
sl_send_reply("513", "Message too big");
break;
};
# loose-route processing
if (loose_route()) {
log(1, "loose_route processing\n");
t_relay();
break;
};
# if the request is for other domain use UsrLoc
# (in case, it does not work, use the following command
# with proper names and addresses in it)
if (uri=~"linora.ecua.net.ec") {
if (method=="REGISTER") {
log(1, "analyzing REGISTER request\n");
record_route();
# Uncomment this if you want to use digest authentication
if (!www_authorize("linora.ecua.net.ec", "subscriber")) {
www_challenge("linora.ecua.net.ec", "0");
break;
};
if (!save("location")) {
log(1, "save location error\n");
sl_reply_error();
};
break;
};
lookup("aliases");
# check if number beginns with 00, then convert it into a +
if (uri=~"^sip:00[0-9]*@") {
log(1, "00 International number detected\n");
# strip booth leading "0"
if (is_user_in("From", "ld")){
strip(2);
log(1, "ruta 5");
route(5);
break;
};
sl_send_reply("403","No tiene autorizacion LD");
break;
};
#mark transaction for voicemail
if (is_user_in("Request-URI", "voicemail\n")) {
log(1, "requested user is in voicemail group");
setflag(4);
};
# native SIP destinations are handled using our USRLOC DB
if (!lookup("location")) {
# handle user which was not found
log(1, "requested user not found\n");
route(4);
break;
};
};
#add failure route which should be performed if response code >=300
if (method=="INVITE" && isflagset(4)) {
log(1, "invite for voicemail user->initiate failureroute[1]\n");
t_on_failure("1");
};
# forward to current uri now; use stateful forwarding; that
# works reliably even if we forward from TCP to UDP
if (!t_relay()) {
log(1, "t_relay error occured\n");
sl_reply_error();
};
}

# all incoming replies for t_onrepli-ed transactions enter here
route[4]{
log(1, "-------------------------------------------\n");
log(1, "entering route[4] = requested user not online\n");
# non-Voip -- just send "off-line"
if (!(method == "INVITE" || method == "ACK" || method == "CANCEL" || method
== "REFER" || method == "BYE")) {
log(1, "no invite,ack,cancel,refer->return 404\n");
sl_send_reply("404", "Not Found");
break;
};
# not voicemail subscriber and no echo/conference call
if ( isflagset(4)) {
log(1, "flag(4) active\n");
};
if (uri =~ "conference") {
log(1, "conference call\n");
};
if (uri =~ "echo") {
log(1, "echo call\n");
};
if ( !( isflagset(4) || (uri =~ "conference") || (uri =~ "echo") ) ) {
log(1, "no voicemail subscriber->return 404");
sl_send_reply("404", "Not Found and no voicemail turned on");
break;
};
# forward to voicemail now
#rewritehostport("linora.ecua.net.ec:5090");
log(1, "forward to voicemail\n");
t_relay_to_udp("linora.ecua.net.ec", "5090");

}

failure_route[1] {
/* XX: note: unsafe if preloaded routes without username used */
log(1, "-------------------------------------------\n");
log(1, "failureroute[1] entered\");
revert_uri();
rewritehostport("linora.ecua.net.ec:5090");
append_branch();
t_relay_to_udp("linora.ecua.net.ec", "5090");
}
route[5] {
log(1, "forward hacia host internacional");
rewritehostport("xxx.xxx.xxx.xxx:5060"); # this is our trusted server
consume_credentials();
if (!t_relay()) {
sl_reply_error();
break;
};

}




More information about the sr-users mailing list