I'm trying hard to get a handle on configuring ser but I think I need a few hints..
I thought I was doing the accounting right but the acc table never receives any information.. In my reading I thought by using setflag(x) where x was the same number as the db_flag number stateful accounting records would be automatic.. is this wrong..?
Can someone clue me in as to what I'm doing wrong as I just can't get this.
Here's my config if it helps at all:
# ----------- global configuration parameters ------------------------
debug=3 # debug level (cmd line: -dddddddddd) fork=yes
log_stderror=no # (cmd line: -E) 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=0666
alias="voip.domain.com"
# ------------------ module loading ----------------------------------
loadmodule "/usr/local/ser/lib/ser/modules/mysql.so" loadmodule "/usr/local/ser/lib/ser/modules/sl.so" loadmodule "/usr/local/ser/lib/ser/modules/tm.so" loadmodule "/usr/local/ser/lib/ser/modules/maxfwd.so" loadmodule "/usr/local/ser/lib/ser/modules/rr.so" loadmodule "/usr/local/ser/lib/ser/modules/textops.so" loadmodule "/usr/local/ser/lib/ser/modules/vm.so" loadmodule "/usr/local/ser/lib/ser/modules/usrloc.so" loadmodule "/usr/local/ser/lib/ser/modules/registrar.so" loadmodule "/usr/local/ser/lib/ser/modules/auth.so" loadmodule "/usr/local/ser/lib/ser/modules/auth_db.so" loadmodule "/usr/local/ser/lib/ser/modules/acc.so" loadmodule "/usr/local/ser/lib/ser/modules/group.so"
# ----------------- setting module-specific parameters ---------------
modparam("voicemail", "db_url","mysql://ser:heslo@localhost/ser") modparam("voicemail", "email_column", "email_address") modparam("voicemail", "subscriber_table", "subscriber") modparam("voicemail", "user_column", "username") modparam("usrloc", "db_mode", 2) modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password") modparam("rr", "enable_full_lr", 1) modparam("acc", "log_level", 1) modparam("acc", "log_flag", 1) modparam("acc", "log_missed_flag", 2) modparam("acc", "db_url", "mysql://ser:heslo@localhost/ser") modparam("acc", "db_flag", 1) modparam("acc", "db_missed_flag", 2) modparam("group", "db_url", "mysql://ser:heslo@localhost/ser") modparam("group", "table", "grp") modparam("group", "user_column", "username") modparam("group", "domain_column", "domain") modparam("group", "group_column", "grp") # If set to 1 then username@domain will be used for lookup, if # set to 0 then only username will be used. modparam("group", "use_domain", 0)
# ------------------------- request routing logic -------------------
# main routing logic
route {
# initial sanity checks -- messages with # max_forwards==0, or excessively long requests if (!mf_process_maxfwd_header("10")) { t_reply("483","Too Many Hops"); break; }; if ( msg:len > max_len ) { t_reply("513", "Message too big"); break; };
record_route(); if (loose_route()) { t_relay(); break; };
# label all transactions for accounting setflag(1);
# decide if callee has voicemail if (is_user_in("Request-URI", "voicemail")) { setflag(4); };
# decide if caller is allowed long distance if (is_user_in("From", "ld")) { setflag(5); };
# only process for our sip domain if (uri==myself) {
# authorize and save location if (method=="REGISTER") { if (!www_authorize("voip.domain.com", "subscriber")) { www_challenge("voip.domain.com", "1"); sl_send_reply("404", "Incorrect Authorization"); break; }; save("location"); break; };
# lookup and handle local users first if (lookup("location")) { t_relay(); break; } else { if ((method=="INVITE" || method=="ACK") && t_newtran() ) { # new call to offline user with voicemail flag if (isflagset(4)) { route(4); break; }; route(5); break; }; };
if (!t_relay()) { sl_reply_error(); break; };
} else { t_reply("404","UA Configuration error - Incorrect domain"); break; };
} # end main route
route[4] {
# Voicemail specific configuration - begin if(method=="ACK" || method=="INVITE" || method=="BYE" || method=="REFER"){ if(t_newtran()){ t_reply("100","Trying -- just wait a minute !"); if(method=="INVITE" || method=="REFER"){ log("**************** vm start - begin ******************\n"); if( uri =~ "conference" ){ if(!vm("/tmp/am_fifo","conference")){ log("could not contact conference server\n"); t_reply("500","could not contact conference server"); }; } else if( uri =~ "echo" ){ if(!vm("/tmp/am_fifo","echo")){ log("could not contact echo\n"); t_reply("500","could not contact echo"); }; } else { if(!vm("/tmp/am_fifo","voicemail")){ log("could not contact voicemail\n"); t_reply("500","could not contact voicemail"); }; }; log("**************** vm start - end ******************\n"); break; };
if(method=="BYE"){ log("**************** vm end/refer - begin ******************\n"); if(!vm("/tmp/am_fifo","bye")){ log("could not contact the media server\n"); t_reply("500","could not contact the media server"); }; log("**************** vm end/refer - end ********************\n"); break; }; } else { log("could not create new transaction\n"); t_reply("500","could not create new transaction"); }; }; # Voicemail specific configuration - end
}
route[5] {
# protect the pstn from having to bother with calls to our local blocks if (uri=~"^sip:555") { t_reply("404","no such user"); break; };
# dial plan routing - long distance or local lata/tandem transit if ((uri=~"^sip:1") && (isflagset(5))) { rewritehostport("172.16.0.7:5060"); t_relay(); break; };
if (uri=~"^sip:7") { rewritehostport("172.16.0.5:5060"); t_relay(); break; };
if (uri=~"^sip:3") { rewritehostport("172.16.0.5:5060"); t_relay(); break; };
t_reply("404","Not Found"); break;
}
Try to put setflag(1) before the record_route() statement. This is just to make sure that the flag is really set for all transactions.
If you still get no records, check out ser logs and try to find some error message.
Jan.
On 29-01 02:12, Live_Wire_Net_Matt_Hess wrote:
I'm trying hard to get a handle on configuring ser but I think I need a few hints..
I thought I was doing the accounting right but the acc table never receives any information.. In my reading I thought by using setflag(x) where x was the same number as the db_flag number stateful accounting records would be automatic.. is this wrong..?
Can someone clue me in as to what I'm doing wrong as I just can't get this.
Here's my config if it helps at all:
# ----------- global configuration parameters ------------------------
debug=3 # debug level (cmd line: -dddddddddd) fork=yes
log_stderror=no # (cmd line: -E) 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=0666
alias="voip.domain.com"
# ------------------ module loading ----------------------------------
loadmodule "/usr/local/ser/lib/ser/modules/mysql.so" loadmodule "/usr/local/ser/lib/ser/modules/sl.so" loadmodule "/usr/local/ser/lib/ser/modules/tm.so" loadmodule "/usr/local/ser/lib/ser/modules/maxfwd.so" loadmodule "/usr/local/ser/lib/ser/modules/rr.so" loadmodule "/usr/local/ser/lib/ser/modules/textops.so" loadmodule "/usr/local/ser/lib/ser/modules/vm.so" loadmodule "/usr/local/ser/lib/ser/modules/usrloc.so" loadmodule "/usr/local/ser/lib/ser/modules/registrar.so" loadmodule "/usr/local/ser/lib/ser/modules/auth.so" loadmodule "/usr/local/ser/lib/ser/modules/auth_db.so" loadmodule "/usr/local/ser/lib/ser/modules/acc.so" loadmodule "/usr/local/ser/lib/ser/modules/group.so"
# ----------------- setting module-specific parameters ---------------
modparam("voicemail", "db_url","mysql://ser:heslo@localhost/ser") modparam("voicemail", "email_column", "email_address") modparam("voicemail", "subscriber_table", "subscriber") modparam("voicemail", "user_column", "username") modparam("usrloc", "db_mode", 2) modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password") modparam("rr", "enable_full_lr", 1) modparam("acc", "log_level", 1) modparam("acc", "log_flag", 1) modparam("acc", "log_missed_flag", 2) modparam("acc", "db_url", "mysql://ser:heslo@localhost/ser") modparam("acc", "db_flag", 1) modparam("acc", "db_missed_flag", 2) modparam("group", "db_url", "mysql://ser:heslo@localhost/ser") modparam("group", "table", "grp") modparam("group", "user_column", "username") modparam("group", "domain_column", "domain") modparam("group", "group_column", "grp") # If set to 1 then username@domain will be used for lookup, if # set to 0 then only username will be used. modparam("group", "use_domain", 0)
# ------------------------- request routing logic -------------------
# main routing logic
route {
# initial sanity checks -- messages with # max_forwards==0, or excessively long requests if (!mf_process_maxfwd_header("10")) { t_reply("483","Too Many Hops"); break; }; if ( msg:len > max_len ) { t_reply("513", "Message too big"); break; };
record_route(); if (loose_route()) { t_relay(); break; };
# label all transactions for accounting setflag(1);
# decide if callee has voicemail if (is_user_in("Request-URI", "voicemail")) { setflag(4); };
# decide if caller is allowed long distance if (is_user_in("From", "ld")) { setflag(5); };
# only process for our sip domain if (uri==myself) {
# authorize and save location if (method=="REGISTER") { if (!www_authorize("voip.domain.com", "subscriber")) { www_challenge("voip.domain.com", "1"); sl_send_reply("404", "Incorrect Authorization"); break; }; save("location"); break; };
# lookup and handle local users first if (lookup("location")) { t_relay(); break; } else { if ((method=="INVITE" || method=="ACK") && t_newtran() ) { # new call to offline user with voicemail flag if (isflagset(4)) { route(4); break; }; route(5); break; }; };
if (!t_relay()) { sl_reply_error(); break; };
} else { t_reply("404","UA Configuration error - Incorrect domain"); break; };
} # end main route
route[4] {
# Voicemail specific configuration - begin if(method=="ACK" || method=="INVITE" || method=="BYE" || method=="REFER"){ if(t_newtran()){ t_reply("100","Trying -- just wait a minute !"); if(method=="INVITE" || method=="REFER"){ log("**************** vm start - begin ******************\n"); if( uri =~ "conference" ){ if(!vm("/tmp/am_fifo","conference")){ log("could not contact conference server\n"); t_reply("500","could not contact conference server"); }; } else if( uri =~ "echo" ){ if(!vm("/tmp/am_fifo","echo")){ log("could not contact echo\n"); t_reply("500","could not contact echo"); }; } else { if(!vm("/tmp/am_fifo","voicemail")){ log("could not contact voicemail\n"); t_reply("500","could not contact voicemail"); }; }; log("**************** vm start - end ******************\n"); break; };
if(method=="BYE"){ log("**************** vm end/refer - begin ******************\n"); if(!vm("/tmp/am_fifo","bye")){ log("could not contact the media server\n"); t_reply("500","could not contact the media server"); }; log("**************** vm end/refer - end ********************\n"); break; }; } else { log("could not create new transaction\n"); t_reply("500","could not create new transaction"); };
}; # Voicemail specific configuration - end
}
route[5] {
# protect the pstn from having to bother with calls to our local blocks if (uri=~"^sip:555") { t_reply("404","no such user"); break; };
# dial plan routing - long distance or local lata/tandem transit if ((uri=~"^sip:1") && (isflagset(5))) { rewritehostport("172.16.0.7:5060"); t_relay(); break; };
if (uri=~"^sip:7") { rewritehostport("172.16.0.5:5060"); t_relay(); break; };
if (uri=~"^sip:3") { rewritehostport("172.16.0.5:5060"); t_relay(); break; };
t_reply("404","Not Found"); break;
}
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
At 10:12 AM 1/29/2004, Live_Wire_Net_Matt_Hess wrote:
I'm trying hard to get a handle on configuring ser but I think I need a few hints..
I thought I was doing the accounting right but the acc table never receives any information.. In my reading I thought by using setflag(x) where x was the same number as the db_flag number stateful accounting records would be automatic.. is this wrong..?
That's the way it is supposed to work and I unfortunately don't see an obvious reason why it should not. The only thing is that setflag is before record-routing section, i.e., it will be processed only for initial requests (INVITE) but at least those should be appear in the acc table.
-jiri
Can someone clue me in as to what I'm doing wrong as I just can't get this.
Here's my config if it helps at all:
# ----------- global configuration parameters ------------------------ loadmodule "/usr/local/ser/lib/ser/modules/acc.so" modparam("acc", "db_url", "mysql://ser:heslo@localhost/ser")
record_route(); if (loose_route()) { t_relay(); break; };
# label all transactions for accounting setflag(1);
Ok here's another question:
off the same ser.cfg I sent earlier when dialing a number that would go to a pstn.. ie: route(5) and then rewritehostport("172.16.0.5:5060"); t_relay(); break; I get the following error messages:
Jan 29 06:06:31 tranquility /usr/local/ser/sbin/ser[22664]: ERROR: t_newtran: transaction already in process 0x7c1ad7f0 Jan 29 06:06:31 tranquility /usr/local/ser/sbin/ser[22664]: ERROR: t_newtran: transaction already in process 0x7c1ad7f0
I must have a hole in my logic somewhere..?
Oh and I did move the setflag to be before record_route(); and I do get invites in the database but don't receive any bye's.. I've got to be able to get both to do proper cdr and billing.. yes?
I also get when placing a call to another registered user:
Jan 29 06:11:43 tranquility /usr/local/ser/sbin/ser[5017]: WARNING: t_reply: ACKs are not replied Jan 29 06:11:45 tranquility /usr/local/ser/sbin/ser[14527]: WARNING: t_reply: ACKs are not replied Jan 29 06:11:48 tranquility /usr/local/ser/sbin/ser[25400]: WARNING: t_reply: ACKs are not replied Jan 29 06:11:48 tranquility /usr/local/ser/sbin/ser[14527]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established Jan 29 06:11:48 tranquility /usr/local/ser/sbin/ser[14527]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established Jan 29 06:11:50 tranquility /usr/local/ser/sbin/ser[6559]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established Jan 29 06:11:50 tranquility /usr/local/ser/sbin/ser[6559]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established Jan 29 06:11:53 tranquility /usr/local/ser/sbin/ser[5017]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established Jan 29 06:11:53 tranquility /usr/local/ser/sbin/ser[5017]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established
and the other user never sees me hang up..
Jiri Kuthan wrote:
At 10:12 AM 1/29/2004, Live_Wire_Net_Matt_Hess wrote:
I'm trying hard to get a handle on configuring ser but I think I need a few hints..
I thought I was doing the accounting right but the acc table never receives any information.. In my reading I thought by using setflag(x) where x was the same number as the db_flag number stateful accounting records would be automatic.. is this wrong..?
That's the way it is supposed to work and I unfortunately don't see an obvious reason why it should not. The only thing is that setflag is before record-routing section, i.e., it will be processed only for initial requests (INVITE) but at least those should be appear in the acc table.
-jiri
Can someone clue me in as to what I'm doing wrong as I just can't get this.
Here's my config if it helps at all:
# ----------- global configuration parameters ------------------------ loadmodule "/usr/local/ser/lib/ser/modules/acc.so" modparam("acc", "db_url", "mysql://ser:heslo@localhost/ser")
record_route(); if (loose_route()) { t_relay(); break; };
# label all transactions for accounting setflag(1);
At 09:20 PM 1/29/2004, Matt Hess wrote:
Ok here's another question:
off the same ser.cfg I sent earlier when dialing a number that would go to a pstn.. ie: route(5) and then rewritehostport("172.16.0.5:5060"); t_relay(); break; I get the following error messages:
Jan 29 06:06:31 tranquility /usr/local/ser/sbin/ser[22664]: ERROR: t_newtran: transaction already in process 0x7c1ad7f0 Jan 29 06:06:31 tranquility /usr/local/ser/sbin/ser[22664]: ERROR: t_newtran: transaction already in process 0x7c1ad7f0
You can't create a transaction for a message twice. You probably call some of t_newtran or t_relay_* in a row for a single request somewhere in your script.
I must have a hole in my logic somewhere..?
Oh and I did move the setflag to be before record_route(); and I do get invites in the database but don't receive any bye's.. I've got to be able to get both to do proper cdr and billing.. yes?
I also get when placing a call to another registered user:
Jan 29 06:11:43 tranquility /usr/local/ser/sbin/ser[5017]: WARNING: t_reply: ACKs are not replied Jan 29 06:11:45 tranquility /usr/local/ser/sbin/ser[14527]: WARNING: t_reply: ACKs are not replied Jan 29 06:11:48 tranquility /usr/local/ser/sbin/ser[25400]: WARNING: t_reply: ACKs are not replied Jan 29 06:11:48 tranquility /usr/local/ser/sbin/ser[14527]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established Jan 29 06:11:48 tranquility /usr/local/ser/sbin/ser[14527]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established Jan 29 06:11:50 tranquility /usr/local/ser/sbin/ser[6559]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established Jan 29 06:11:50 tranquility /usr/local/ser/sbin/ser[6559]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established Jan 29 06:11:53 tranquility /usr/local/ser/sbin/ser[5017]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established Jan 29 06:11:53 tranquility /usr/local/ser/sbin/ser[5017]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established
I suppose that the thing happened which the log tells you: you tried to generate a stateful reply (t_reply action) without having decided to process the transaction statefuly before (t_newtran action).
I suppose you did not have a specific reason to use stateful replying, in which case you will be better off with stateless replies. They take easier scripts and consume less memory, so they ought to be the default choice. Simply replace t_reply with sl_send_reply.
It is hard to tell details without seeing the complete script though.
-jiri
I sent the complete cfg file earlier and didn't want to duplicate it if it was unnecessary.. and as I've been reading.. statefull ransactions are required for acc .. yes?
Here is my config.. a work in progress now..
# ----------- global configuration parameters ------------------------
debug=4 # debug level (cmd line: -dddddddddd) fork=yes
log_stderror=no # (cmd line: -E) 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=0666
alias="voip.livewirenet.com"
# ------------------ module loading ----------------------------------
loadmodule "/usr/local/ser/lib/ser/modules/mysql.so" loadmodule "/usr/local/ser/lib/ser/modules/sl.so" loadmodule "/usr/local/ser/lib/ser/modules/tm.so" loadmodule "/usr/local/ser/lib/ser/modules/acc.so" loadmodule "/usr/local/ser/lib/ser/modules/maxfwd.so" loadmodule "/usr/local/ser/lib/ser/modules/rr.so" loadmodule "/usr/local/ser/lib/ser/modules/textops.so" loadmodule "/usr/local/ser/lib/ser/modules/vm.so" loadmodule "/usr/local/ser/lib/ser/modules/usrloc.so" loadmodule "/usr/local/ser/lib/ser/modules/registrar.so" loadmodule "/usr/local/ser/lib/ser/modules/auth.so" loadmodule "/usr/local/ser/lib/ser/modules/auth_db.so" loadmodule "/usr/local/ser/lib/ser/modules/group.so"
# ----------------- setting module-specific parameters ---------------
modparam("voicemail", "db_url","mysql://ser:heslo@localhost/ser") modparam("voicemail", "email_column", "email_address") modparam("voicemail", "subscriber_table", "subscriber") modparam("voicemail", "user_column", "username") modparam("usrloc", "db_mode", 2) modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password") modparam("rr", "enable_full_lr", 1) modparam("acc", "log_level", 1) modparam("acc", "log_flag", 1) modparam("acc", "log_missed_flag", 2) modparam("acc", "db_url", "mysql://ser:heslo@localhost/ser") modparam("acc", "db_flag", 11) modparam("acc", "db_missed_flag", 12) modparam("acc", "failed_transactions", 1) modparam("group", "db_url", "mysql://ser:heslo@localhost/ser") modparam("group", "table", "grp") modparam("group", "user_column", "username") modparam("group", "domain_column", "domain") modparam("group", "group_column", "grp") # If set to 1 then username@domain will be used for lookup, if # set to 0 then only username will be used. modparam("group", "use_domain", 0)
# ------------------------- request routing logic -------------------
# main routing logic
route {
# initial sanity checks -- messages with # max_forwards==0, or excessively long requests if (!mf_process_maxfwd_header("10")) { t_reply("483","Too Many Hops"); break; }; if ( msg:len > max_len ) { t_reply("513", "Message too big"); break; };
# label all transactions for accounting setflag(11); setflag(12);
record_route(); if (loose_route()) { t_relay(); break; };
# decide if callee has voicemail if (is_user_in("Request-URI", "voicemail")) { setflag(4); };
# decide if caller is allowed long distance if (is_user_in("From", "ld")) { setflag(5); };
# only process for our sip domain if (uri==myself) {
# authorize and save location if (method=="REGISTER") { if (!www_authorize("voip.livewirenet.com", "subscriber")) { www_challenge("voip.livewirenet.com", "1"); break; }; save("location"); break; };
if (lookup("location")) { t_relay(); break; } else { if ((method=="INVITE" || method=="ACK") && t_newtran() ) { # new call to offline user with voicemail flag if (isflagset(4)) { route(4); break; } else { route(5); break; }; }; sl_reply_error(); break; };
#if (!t_relay()) { # sl_reply_error(); # break; #};
} else { t_reply("404","UA Configuration error - Incorrect domain"); break; }; # end uri==myself
} # end main route
route[4] {
# Voicemail specific configuration - begin if(method=="ACK" || method=="INVITE" || method=="BYE" || method=="REFER"){ if(t_newtran()){ t_reply("100","Trying -- just wait a minute !"); if(method=="INVITE" || method=="REFER"){ log("**************** vm start - begin ******************\n"); if( uri =~ "conference" ){ if(!vm("/tmp/am_fifo","conference")){ log("could not contact conference server\n"); t_reply("500","could not contact conference server"); }; } else if( uri =~ "echo" ){ if(!vm("/tmp/am_fifo","echo")){ log("could not contact echo\n"); t_reply("500","could not contact echo"); }; } else { if(!vm("/tmp/am_fifo","voicemail")){ log("could not contact voicemail\n"); t_reply("500","could not contact voicemail"); }; }; log("**************** vm start - end ******************\n"); break; };
if(method=="BYE"){ log("**************** vm end/refer - begin ******************\n"); if(!vm("/tmp/am_fifo","bye")){ log("could not contact the media server\n"); t_reply("500","could not contact the media server"); }; log("**************** vm end/refer - end ********************\n"); break; }; } else { log("could not create new transaction\n"); t_reply("500","could not create new transaction"); }; }; # Voicemail specific configuration - end
}
route[5] {
# protect the pstn from having to bother with calls to out local blocks if (uri=~"^sip:303993") { t_reply("404", "no such user"); break; };
# dial plan routing - long distance or local lata/tandem transit if ((uri=~"^sip:1") && (isflagset(5))) { rewritehostport("172.16.0.7:5060"); t_relay(); break; };
if (uri=~"^sip:720") { rewritehostport("172.16.0.5:5060"); t_relay(); break; };
if (uri=~"^sip:303") { rewritehostport("172.16.0.5:5060"); t_relay(); break; };
t_reply("404","Not Found"); break;
}
failure_route[1] { t_relay(); }
Jiri Kuthan wrote:
At 09:20 PM 1/29/2004, Matt Hess wrote:
Ok here's another question:
off the same ser.cfg I sent earlier when dialing a number that would go to a pstn.. ie: route(5) and then rewritehostport("172.16.0.5:5060"); t_relay(); break; I get the following error messages:
Jan 29 06:06:31 tranquility /usr/local/ser/sbin/ser[22664]: ERROR: t_newtran: transaction already in process 0x7c1ad7f0 Jan 29 06:06:31 tranquility /usr/local/ser/sbin/ser[22664]: ERROR: t_newtran: transaction already in process 0x7c1ad7f0
You can't create a transaction for a message twice. You probably call some of t_newtran or t_relay_* in a row for a single request somewhere in your script.
I must have a hole in my logic somewhere..?
Oh and I did move the setflag to be before record_route(); and I do get invites in the database but don't receive any bye's.. I've got to be able to get both to do proper cdr and billing.. yes?
I also get when placing a call to another registered user:
Jan 29 06:11:43 tranquility /usr/local/ser/sbin/ser[5017]: WARNING: t_reply: ACKs are not replied Jan 29 06:11:45 tranquility /usr/local/ser/sbin/ser[14527]: WARNING: t_reply: ACKs are not replied Jan 29 06:11:48 tranquility /usr/local/ser/sbin/ser[25400]: WARNING: t_reply: ACKs are not replied Jan 29 06:11:48 tranquility /usr/local/ser/sbin/ser[14527]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established Jan 29 06:11:48 tranquility /usr/local/ser/sbin/ser[14527]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established Jan 29 06:11:50 tranquility /usr/local/ser/sbin/ser[6559]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established Jan 29 06:11:50 tranquility /usr/local/ser/sbin/ser[6559]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established Jan 29 06:11:53 tranquility /usr/local/ser/sbin/ser[5017]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established Jan 29 06:11:53 tranquility /usr/local/ser/sbin/ser[5017]: ERROR: t_reply: cannot send a t_reply to a message for which no T-state has been established
I suppose that the thing happened which the log tells you: you tried to generate a stateful reply (t_reply action) without having decided to process the transaction statefuly before (t_newtran action).
I suppose you did not have a specific reason to use stateful replying, in which case you will be better off with stateless replies. They take easier scripts and consume less memory, so they ought to be the default choice. Simply replace t_reply with sl_send_reply.
It is hard to tell details without seeing the complete script though.
-jiri
At 12:08 AM 1/30/2004, Matt Hess wrote:
I sent the complete cfg file earlier and didn't want to duplicate it if it was unnecessary..
ignore my previous request to resent the config file -- I didn't realize it is the same one. Anyhow, my previous email should have answered your questions.
and as I've been reading.. statefull ransactions are required for acc .. yes?
It depends on what you want to do. Typically, you wish to account on result of proxied transactions -- that's why you need state: you keep original requests in memory, correlate them with replies and generate a report eventually which uses information from both stored request and received replies.
In your script however, you generate local replies if some undesirable conditions occur (Incorrect domain, etc.) It does not seem reasonable to flood accoutning with reports on all localy denied request. I better suggest generating all local negative replies statelessly -- that scales a way better.
-jiri
Below is the latest config of mine solving all the t_* errors.. and thanks to the ser list for the help so far.. But one problem still remains. When a person hangs up there is no end of call logged and the phone takes a little while to disconnect and the other phone never hangs up.. nothing is in the error logs about the disconnect either.
# ----------- global configuration parameters ------------------------
debug=7 # debug level (cmd line: -dddddddddd) fork=yes
log_stderror=no # (cmd line: -E) 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=0666
alias="voip.livewirenet.com"
# ------------------ module loading ----------------------------------
loadmodule "/usr/local/ser/lib/ser/modules/mysql.so" loadmodule "/usr/local/ser/lib/ser/modules/sl.so" loadmodule "/usr/local/ser/lib/ser/modules/tm.so" loadmodule "/usr/local/ser/lib/ser/modules/acc.so" loadmodule "/usr/local/ser/lib/ser/modules/maxfwd.so" loadmodule "/usr/local/ser/lib/ser/modules/rr.so" loadmodule "/usr/local/ser/lib/ser/modules/textops.so" loadmodule "/usr/local/ser/lib/ser/modules/vm.so" loadmodule "/usr/local/ser/lib/ser/modules/usrloc.so" loadmodule "/usr/local/ser/lib/ser/modules/registrar.so" loadmodule "/usr/local/ser/lib/ser/modules/auth.so" loadmodule "/usr/local/ser/lib/ser/modules/auth_db.so" loadmodule "/usr/local/ser/lib/ser/modules/group.so"
# ----------------- setting module-specific parameters ---------------
modparam("voicemail", "db_url","mysql://ser:heslo@localhost/ser") modparam("voicemail", "email_column", "email_address") modparam("voicemail", "subscriber_table", "subscriber") modparam("voicemail", "user_column", "username") modparam("usrloc", "db_mode", 1) modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password") modparam("rr", "enable_full_lr", 1) modparam("acc", "log_level", 1) modparam("acc", "log_flag", 1) modparam("acc", "log_missed_flag", 2) modparam("acc", "db_url", "mysql://ser:heslo@localhost/ser") modparam("acc", "db_flag", 11) modparam("acc", "db_missed_flag", 12) modparam("acc", "failed_transactions", 1) modparam("group", "db_url", "mysql://ser:heslo@localhost/ser") modparam("group", "table", "grp") modparam("group", "user_column", "username") modparam("group", "domain_column", "domain") modparam("group", "group_column", "grp") # If set to 1 then username@domain will be used for lookup, if # set to 0 then only username will be used. modparam("group", "use_domain", 0)
# ------------------------- request routing logic -------------------
# main routing logic
route {
# initial sanity checks -- messages with # max_forwards==0, or excessively long requests if (!mf_process_maxfwd_header("10")) { t_reply("483","Too Many Hops"); break; }; if ( msg:len > max_len ) { t_reply("513", "Message too big"); break; };
# label all transactions for accounting setflag(11); setflag(12);
record_route(); if (loose_route()) { t_relay(); break; };
if (!search("(f|From): .*@voip.livewirenet.com")) { sl_send_reply("404","Not Found"); break; };
# decide if callee has voicemail if (is_user_in("Request-URI", "voicemail")) { setflag(4); };
# decide if caller is allowed long distance if (is_user_in("From", "ld")) { setflag(5); };
# only process for our sip domain if (uri==myself) {
# authorize and save location if (method=="REGISTER") { if (!www_authorize("voip.livewirenet.com", "subscriber")) { www_challenge("voip.livewirenet.com", "1"); break; }; save("location"); break; };
if (!lookup("location")) { # if we can't lookup the location and the callee has voicemail # we need not worry about any call routing and should dump # the call directly to voicemail if (isflagset(4)) { route(4); break; };
# We have made sure that voicemail for a local user isn't an # issue.. now process like a normal call route(5); break;
} else { # found in userloc t_relay(); break; };
}; # end uri==myself
} # end main route
route[4] {
# Voicemail specific configuration - begin if(method=="ACK" || method=="INVITE" || method=="BYE" || method=="REFER"){ if(t_newtran()){ t_reply("100","Trying -- just wait a minute !"); if(method=="INVITE" || method=="REFER"){ log("**************** vm start - begin ******************\n"); if( uri =~ "conference" ){ if(!vm("/tmp/am_fifo","conference")){ log("could not contact conference server\n"); t_reply("500","could not contact conference server"); }; } else if( uri =~ "echo" ){ if(!vm("/tmp/am_fifo","echo")){ log("could not contact echo\n"); t_reply("500","could not contact echo"); }; } else { if(!vm("/tmp/am_fifo","voicemail")){ log("could not contact voicemail\n"); t_reply("500","could not contact voicemail"); }; }; log("**************** vm start - end ******************\n"); break; };
if(method=="BYE"){ log("**************** vm end/refer - begin ******************\n"); if(!vm("/tmp/am_fifo","bye")){ log("could not contact the media server\n"); t_reply("500","could not contact the media server"); }; log("**************** vm end/refer - end ********************\n"); break; }; } else { log("could not create new transaction\n"); t_reply("500","could not create new transaction"); }; }; # Voicemail specific configuration - end
}
route[5] {
# protect the pstn from having to bother with calls to out local blocks if (uri=~"^sip:303993") { sl_send_reply("404", "no such user"); break; };
# dial plan routing - long distance or local lata/tandem transit if (uri=~"^sip:1") { if (isflagset(5)) { rewritehostport("172.16.0.7:5060"); t_relay(); break; } else { sl_send_reply("500","Not allowed to call long distance"); break; }; };
if (uri=~"^sip:720") { rewritehostport("172.16.0.5:5060"); t_relay(); break; };
if (uri=~"^sip:303") { rewritehostport("172.16.0.5:5060"); t_relay(); break; };
# should not have gotten here sl_reply_error(); break;
}
Jiri Kuthan wrote:
At 12:08 AM 1/30/2004, Matt Hess wrote:
I sent the complete cfg file earlier and didn't want to duplicate it if it was unnecessary..
ignore my previous request to resent the config file -- I didn't realize it is the same one. Anyhow, my previous email should have answered your questions.
and as I've been reading.. statefull ransactions are required for acc .. yes?
It depends on what you want to do. Typically, you wish to account on result of proxied transactions -- that's why you need state: you keep original requests in memory, correlate them with replies and generate a report eventually which uses information from both stored request and received replies.
In your script however, you generate local replies if some undesirable conditions occur (Incorrect domain, etc.) It does not seem reasonable to flood accoutning with reports on all localy denied request. I better suggest generating all local negative replies statelessly -- that scales a way better.
-jiri
Make sure that BYE really passes through ser. If not then the phones are broken because you have record-routing enabled. Anyway, SIP message dumps would help to diagnose the problem.
Jan.
On 30-01 14:30, Matt Hess wrote:
Below is the latest config of mine solving all the t_* errors.. and thanks to the ser list for the help so far.. But one problem still remains. When a person hangs up there is no end of call logged and the phone takes a little while to disconnect and the other phone never hangs up.. nothing is in the error logs about the disconnect either.
# ----------- global configuration parameters ------------------------
debug=7 # debug level (cmd line: -dddddddddd) fork=yes
log_stderror=no # (cmd line: -E) 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=0666
alias="voip.livewirenet.com"
# ------------------ module loading ----------------------------------
loadmodule "/usr/local/ser/lib/ser/modules/mysql.so" loadmodule "/usr/local/ser/lib/ser/modules/sl.so" loadmodule "/usr/local/ser/lib/ser/modules/tm.so" loadmodule "/usr/local/ser/lib/ser/modules/acc.so" loadmodule "/usr/local/ser/lib/ser/modules/maxfwd.so" loadmodule "/usr/local/ser/lib/ser/modules/rr.so" loadmodule "/usr/local/ser/lib/ser/modules/textops.so" loadmodule "/usr/local/ser/lib/ser/modules/vm.so" loadmodule "/usr/local/ser/lib/ser/modules/usrloc.so" loadmodule "/usr/local/ser/lib/ser/modules/registrar.so" loadmodule "/usr/local/ser/lib/ser/modules/auth.so" loadmodule "/usr/local/ser/lib/ser/modules/auth_db.so" loadmodule "/usr/local/ser/lib/ser/modules/group.so"
# ----------------- setting module-specific parameters ---------------
modparam("voicemail", "db_url","mysql://ser:heslo@localhost/ser") modparam("voicemail", "email_column", "email_address") modparam("voicemail", "subscriber_table", "subscriber") modparam("voicemail", "user_column", "username") modparam("usrloc", "db_mode", 1) modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password") modparam("rr", "enable_full_lr", 1) modparam("acc", "log_level", 1) modparam("acc", "log_flag", 1) modparam("acc", "log_missed_flag", 2) modparam("acc", "db_url", "mysql://ser:heslo@localhost/ser") modparam("acc", "db_flag", 11) modparam("acc", "db_missed_flag", 12) modparam("acc", "failed_transactions", 1) modparam("group", "db_url", "mysql://ser:heslo@localhost/ser") modparam("group", "table", "grp") modparam("group", "user_column", "username") modparam("group", "domain_column", "domain") modparam("group", "group_column", "grp") # If set to 1 then username@domain will be used for lookup, if # set to 0 then only username will be used. modparam("group", "use_domain", 0)
# ------------------------- request routing logic -------------------
# main routing logic
route {
# initial sanity checks -- messages with # max_forwards==0, or excessively long requests if (!mf_process_maxfwd_header("10")) { t_reply("483","Too Many Hops"); break; }; if ( msg:len > max_len ) { t_reply("513", "Message too big"); break; };
# label all transactions for accounting setflag(11); setflag(12);
record_route(); if (loose_route()) { t_relay(); break; };
if (!search("(f|From): .*@voip.livewirenet.com")) { sl_send_reply("404","Not Found"); break; };
# decide if callee has voicemail if (is_user_in("Request-URI", "voicemail")) { setflag(4); };
# decide if caller is allowed long distance if (is_user_in("From", "ld")) { setflag(5); };
# only process for our sip domain if (uri==myself) {
# authorize and save location if (method=="REGISTER") { if (!www_authorize("voip.livewirenet.com", "subscriber")) { www_challenge("voip.livewirenet.com", "1"); break; }; save("location"); break; };
if (!lookup("location")) { # if we can't lookup the location and the callee has voicemail # we need not worry about any call routing and should dump # the call directly to voicemail if (isflagset(4)) { route(4); break; };
# We have made sure that voicemail for a local user isn't an # issue.. now process like a normal call route(5); break;
} else { # found in userloc t_relay(); break; };
}; # end uri==myself
} # end main route
route[4] {
# Voicemail specific configuration - begin if(method=="ACK" || method=="INVITE" || method=="BYE" || method=="REFER"){ if(t_newtran()){ t_reply("100","Trying -- just wait a minute !"); if(method=="INVITE" || method=="REFER"){ log("**************** vm start - begin ******************\n"); if( uri =~ "conference" ){ if(!vm("/tmp/am_fifo","conference")){ log("could not contact conference server\n"); t_reply("500","could not contact conference server"); }; } else if( uri =~ "echo" ){ if(!vm("/tmp/am_fifo","echo")){ log("could not contact echo\n"); t_reply("500","could not contact echo"); }; } else { if(!vm("/tmp/am_fifo","voicemail")){ log("could not contact voicemail\n"); t_reply("500","could not contact voicemail"); }; }; log("**************** vm start - end ******************\n"); break; };
if(method=="BYE"){ log("**************** vm end/refer - begin
******************\n"); if(!vm("/tmp/am_fifo","bye")){ log("could not contact the media server\n"); t_reply("500","could not contact the media server"); }; log("**************** vm end/refer - end ********************\n"); break; }; } else { log("could not create new transaction\n"); t_reply("500","could not create new transaction"); }; }; # Voicemail specific configuration - end
}
route[5] {
# protect the pstn from having to bother with calls to out local blocks if (uri=~"^sip:303993") { sl_send_reply("404", "no such user"); break; };
# dial plan routing - long distance or local lata/tandem transit if (uri=~"^sip:1") { if (isflagset(5)) { rewritehostport("172.16.0.7:5060"); t_relay(); break; } else { sl_send_reply("500","Not allowed to call long distance"); break; }; };
if (uri=~"^sip:720") { rewritehostport("172.16.0.5:5060"); t_relay(); break; };
if (uri=~"^sip:303") { rewritehostport("172.16.0.5:5060"); t_relay(); break; };
# should not have gotten here sl_reply_error(); break;
}
Jiri Kuthan wrote:
At 12:08 AM 1/30/2004, Matt Hess wrote:
I sent the complete cfg file earlier and didn't want to duplicate it if it was unnecessary..
ignore my previous request to resent the config file -- I didn't realize it is the same one. Anyhow, my previous email should have answered your questions.
and as I've been reading.. statefull ransactions are required for acc .. yes?
It depends on what you want to do. Typically, you wish to account on result of proxied transactions -- that's why you need state: you keep original requests in memory, correlate them with replies and generate a report eventually which uses information from both stored request and received replies.
In your script however, you generate local replies if some undesirable conditions occur (Incorrect domain, etc.) It does not seem reasonable to flood accoutning with reports on all localy denied request. I better suggest generating all local negative replies statelessly -- that scales a way better.
-jiri
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
In doing the dumps the bye messages were being sent to ser from the client but they were not passing through ser.. this was using 2 x-lite free clients.. in using a cisco ata and x-lite if the cisco hung up first the x-lite would hang up no problem but if the x-lite hung up first the cisco wouldnt see the termination.. I knew it was my config because with the default ser sample config the clients behaved normally.
So I re-did my config yet again with a bit more logic and a good night's rest and everything works now.. this has been one heck of a thing to configure as the docs are so spread out and out of date as to functionality and module usages.. but I should shutup since I haven't volunteered my time to fix them yet.
Below is my complete (seemingly working) config so others in the future may benefit from my strugle and hopefully not ask for other examples on here thus saving mailing list traffic and repeat questions
Jan Janak wrote:
Make sure that BYE really passes through ser. If not then the phones are broken because you have record-routing enabled. Anyway, SIP message dumps would help to diagnose the problem.
Jan.
# ----------- global configuration parameters ------------------------
debug=3 # debug level (cmd line: -dddddddddd) fork=yes
log_stderror=no # (cmd line: -E) check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 children=10 fifo="/tmp/ser_fifo" fifo_mode=0666
alias="voip.livewirenet.com"
# ------------------ module loading ----------------------------------
loadmodule "/usr/local/ser/lib/ser/modules/mysql.so" loadmodule "/usr/local/ser/lib/ser/modules/sl.so" loadmodule "/usr/local/ser/lib/ser/modules/tm.so" loadmodule "/usr/local/ser/lib/ser/modules/acc.so" loadmodule "/usr/local/ser/lib/ser/modules/maxfwd.so" loadmodule "/usr/local/ser/lib/ser/modules/rr.so" loadmodule "/usr/local/ser/lib/ser/modules/textops.so" loadmodule "/usr/local/ser/lib/ser/modules/vm.so" loadmodule "/usr/local/ser/lib/ser/modules/usrloc.so" loadmodule "/usr/local/ser/lib/ser/modules/registrar.so" loadmodule "/usr/local/ser/lib/ser/modules/auth.so" loadmodule "/usr/local/ser/lib/ser/modules/auth_db.so" loadmodule "/usr/local/ser/lib/ser/modules/group.so" loadmodule "/usr/local/ser/lib/ser/modules/uri.so"
# ----------------- setting module-specific parameters ---------------
modparam("voicemail", "db_url","mysql://ser:heslo@localhost/ser") modparam("voicemail", "email_column", "email_address") modparam("voicemail", "subscriber_table", "subscriber") modparam("voicemail", "user_column", "username") modparam("usrloc", "db_mode", 1) modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password") modparam("rr", "enable_full_lr", 1) modparam("rr", "append_fromtag", 1) modparam("acc", "log_level", 1) modparam("acc", "log_flag", 1) modparam("acc", "log_missed_flag", 2) modparam("acc", "db_url", "mysql://ser:heslo@localhost/ser") modparam("acc", "db_flag", 3) modparam("acc", "db_missed_flag", 4) modparam("acc", "failed_transactions", 1) modparam("group", "db_url", "mysql://ser:heslo@localhost/ser") modparam("group", "table", "grp") modparam("group", "user_column", "username") modparam("group", "domain_column", "domain") modparam("group", "group_column", "grp") # If set to 1 then username@domain will be used for lookup, if # set to 0 then only username will be used. modparam("group", "use_domain", 0)
# ------------------------- request routing logic -------------------
# main routing logic
route {
# initial sanity checks -- messages with # max_forwards==0, or excessively long requests if (!mf_process_maxfwd_header("10")) { t_reply("483","Too Many Hops"); break; }; if ( msg:len > max_len ) { t_reply("513", "Message too big"); break; };
# label all transactions for accounting setflag(3); setflag(4);
record_route(); if (loose_route()) { t_relay(); break; };
if (!search("(f|From): .*@voip.livewirenet.com")) { sl_send_reply("603","Transaction Declined"); break; };
# callee should be on this system if (does_uri_exist()) { setflag(5); };
# decide if caller is allowed local calls if (is_user_in("From", "local")) { setflag(6); };
# decide if callee has voicemail if (is_user_in("Request-URI", "voicemail")) { setflag(7); };
# decide if caller is allowed long distance if (is_user_in("From", "ld")) { setflag(8); };
# only process for our sip domain if (uri==myself) {
# authorize and save location if (method=="REGISTER") { if (!www_authorize("voip.livewirenet.com", "subscriber")) { www_challenge("voip.livewirenet.com", "1"); break; }; save("location"); break; };
# handle for users on our system first as all users should be in database if (isflagset(5)) { if (!lookup("location")) { # if we can't lookup the location and the callee has voicemail if (isflagset(7)) { route(7); break; } else { sl_send_reply("404", "subscriber not online"); break; }; }; # end localuser handling } else { # protect the pstn from having to bother with calls to local blocks if (uri=~"^sip:303993") { sl_send_reply("404", "no such user"); break; } else { # must have local perms to dial local or ld if (isflagset(6)) { route(6); } else { sl_send_reply("403","Not allowed to call out"); break; }; };
}; # end local or pstn logic
}; # end uri==myself
if (!t_relay()) { sl_reply_error(); };
} # end main route
route[7] {
# Voicemail specific configuration - begin if(method=="ACK" || method=="INVITE" || method=="BYE" || method=="REFER"){ if(t_newtran()){ t_reply("100","Trying -- just wait a minute !"); if(method=="INVITE" || method=="REFER"){ log("**************** vm start - begin ******************\n"); if( uri =~ "conference" ){ if(!vm("/tmp/am_fifo","conference")){ log("could not contact conference server\n"); t_reply("500","could not contact conference server"); }; } else if( uri =~ "echo" ){ if(!vm("/tmp/am_fifo","echo")){ log("could not contact echo\n"); t_reply("500","could not contact echo"); }; } else { if(!vm("/tmp/am_fifo","voicemail")){ log("could not contact voicemail\n"); t_reply("500","could not contact voicemail"); }; }; log("**************** vm start - end ******************\n"); break; };
if(method=="BYE"){ log("**************** vm end/refer - begin ******************\n"); if(!vm("/tmp/am_fifo","bye")){ log("could not contact the media server\n"); t_reply("500","could not contact the media server"); }; log("**************** vm end/refer - end ********************\n"); break; }; } else { log("could not create new transaction\n"); t_reply("500","could not create new transaction"); }; }; # Voicemail specific configuration - end
}
route[6] {
# dial plan routing - long distance or local lata/tandem transit if (uri=~"^sip:1") { if (isflagset(8)) { rewritehostport("172.16.0.7:5060"); } else { sl_send_reply("403","Not allowed to call long distance"); break; }; };
if (uri=~"^sip:720") { rewritehostport("172.16.0.5:5060"); };
if (uri=~"^sip:303") { rewritehostport("172.16.0.5:5060"); };
} # end pstn routing