Stephen,
Just when I thought I knew everything :-)
Thank you!
---greg
Greg,
You can set a timer when the phone rings and isn't answered.
modparam("tm", "fr_inv_timer", 20 )
20 is the time before the failure. You can change this.
Stephen -----Original Message----- From: Greg Fausak [mailto:greg@august.net]=20 Sent: Friday, September 26, 2003 11:56 AM To: 'Jiri Kuthan'; 'Gavin Bensom'; serusers@lists.iptel.org Subject: RE: [Serusers] voicemail question - dial plan example - pstngatewayexample
Jiri,
I believe this is what you and I talked about at VON. I am very interested in an easy way to do serial forking. For instance, if I have 3 sip endpoints like :
1000@myproxy.com 1010@myproxy.com 1020@myproxy.com
And finally, a voice mail reference:
1000@myvoicemailmediaserver.com
I currently am doing a serial forking like this:
First, create a table called 'forward' that works exactly like 'aliases'. Then, put all 'forward' instructions in the table. This includes forwarding to voicemail server.
{ ... if(lookup("forward")) { xlog("L_WARN", "HUNTGROUP: %Ts call-id:%ci cseq:%ci\n"); t_on_failure("1"); }
if(!t_relay()) { sl_reply_error(); break; } ... }
# here is the 'failure_route' for number forwarding failure_route[1] { if(lookup("forward")) { xlog("L_WARN", "CONTINUE HUNT: %Ts call-id:%ci cseq:%ci messageid:%mi\n"); t_on_failure("1"); append_branch(); t_relay(); break; };
xlog("L_WARN", "NO CONTINUE HUNT: %Ts call-id:%ci cseq:%ci
messageid:%mi\n");
#sl_reply_error(); t_reply("486","Busy puppy."); break;
}
This setup sort of works, but, it seems that I get many t_relay() events that just hang and eventually time out, which I don't understand how is happening.
Also, it would be nice if I could set a timer, say for 15 seconds, that causes a failure to occur in the event a phone rings but isn't answered.
---greg
=20 There is other problem though -- the failure_route logic for=20 VM should be different from that in route block -- you can't create transaction=20 state two times (first time with t_relay, second time with t_newtran). SER=20 will certainly complain with some error message in your logs. =20 I will introduce some new command which hides details of=20 transaction processing from script writers and can be used from both route[] and=20 failure_route[]. (I didn't think of it before since I used voicemail on some=20 other machine than proxy server.) =20 -jiri =20
=20 Thanks, G.
Do you Yahoo!? <http://shopping.yahoo.com/?__yltc=3Ds%3A150000443%2Cd%3A227082
28%2Cslk%3Atext%2Csec%3Amail>The New Yahoo! Shopping - with=20 improved product search=20
# # $Id: ser.cfg,v 1.20 2003/05/31 21:12:19 jiri Exp $ # # simple quick-start config script #
# ----------- global configuration parameters=20
debug=3D3 # debug level (cmd line: -dddddddddd) fork=3Dyes log_stderror=3Dno # (cmd line: -E)
/* Uncomment these lines to enter debugging mode=20 debug=3D8 fork=3Dno log_stderror=3Dyes */
check_via=3Dno # (cmd. line: -v) dns=3Dno # (cmd. line: -r) rev_dns=3Dno # (cmd. line: -R) port=3D5060 children=3D4 fifo=3D"/tmp/ser_fifo" sip_warning=3Dno # # ------------------ module loading=20
# # 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/vm.so" loadmodule "/usr/local/lib/ser/modules/pa.so" loadmodule "/usr/local/lib/ser/modules/msilo.so" loadmodule "/usr/local/lib/ser/modules/acc.so" loadmodule "/usr/local/lib/ser/modules/textops.so" # #loadmodule "/usr/local/lib/ser/modules/nathelper.so" #loadmodule "/usr/local/lib/ser/modules/uri.so" #loadmodule "/usr/local/lib/ser/modules/group.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" # # ----------------- setting module-specific parameters=20
# # -- usrloc params -- # #modparam("usrloc", "db_mode", 0) # # Uncomment this if you want to use SQL database=20 # for persistent storage and comment the previous line modparam("usrloc", "db_mode", 2) # # -- 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=20
this config),=20
# uncomment also the following parameter) # modparam("auth_db", "password_column", "password") # # modparam("acc", "log_level", 1) modparam("acc", "log_flag", 2) modparam("acc", "log_missed_flag", 2) modparam("acc", "log_fmt", "fimos") # #modparam("tm", "fr_inv_timer", 35) #INVITE timeout #modparam("tm", "fr_timer", 30) #negative INVITE replay or no=20 #final reply for a request for ACK # modparam("voicemail", "db_url", "sql://ser:heslo@localhost/ser") # #modparam("acc", "db_url", "sql://ser:heslo@localhost/ser") #modparam("acc", "db_flag", 2) #modparam("acc", "db_missed_flag", 2) # # ------------------------- request routing logic=20
# # main routing logic # alias=3D10.10.10.49 #sip server IP address alias=3Djiffypop #sip server name alias=3Dmydomain.com #sip domain/realm =20 alias=3Djiffypop.mydomain.com #sip server FQDN # route{ log(1,"entering main route"); #prevent strangers from claiming to belong to our domain; #if sender claims to be in our domain in From header field, #better authenticate him # code not inserted yet :)
# initial sanity checks -- messages with # max_forwards=3D=3D0, or excessively long requests if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); break; }; if (len_gt( max_len )) { sl_send_reply("513", "Message too big"); break; }; # we record-route all messages -- to make sure that # subsequent messages will go through our proxy; that's # particularly good if upstream and downstream entities # use different transport protocol record_route();=20 # loose-route processing if (loose_route()) { t_relay(); break; }; =20 setflag(2); #set flag for accounting =20 # 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=3D=3Dmyself) { if (method=3D=3D"REGISTER") { # digest authentication log(1,"request for registration"); if (!www_authorize("mydomain.com",=20
"subscriber")) {
www_challenge("mydomain.com", "0"); break; }; save("location"); break; };
/* ********** Dial out to PSTN logic ************* */ =20
#forward numerical 7 digit requests to gateway =20
if(uri=3D~"^sip:[0-9]{7}@(mydomain.com|10.10.10.49)"){
# =20
append_hf("Remote-Party-ID:sip:6508466600@mydomain.com;party =3Dcalling;id-type=3Dsubscriber;privacy=3Doff;screen=3Dno;\r\n");
rewritehostport("10.10.10.5:5060"); log(1,"7 digit expression match"); =20 route(2); break; =20 }; # strip 650 and forward to GW is user dials=20
650 before phone no.
=20
if(uri=3D~"^sip:650[0-9]{7}@(mydomain.com|10.10.10.49)"){
strip(3); rewritehostport("10.10.10.5:5060"); log(1,"650 area code dialed, 650 stripped"); route(2); break; =20 }; #forward numerical 10 digit requests to=20
gateway, append a 1 first
=20
if(uri=3D~"^sip:[0-9]{10}@(mydomain.com|10.10.10.49)"){
prefix("1"); rewritehostport("10.10.10.5:5060"); =20 log(1,"10 digit expression match, prefix 1"); route(2); break; }; #forward numerical 11 digit requests that=20
start with a 1 to GW
=20
if(uri=3D~"^sip:1[0-9]{10}@(mydomain.com|10.10.10.49)"){
rewritehostport("10.10.10.5:5060"); log(1,"10 digit exp match w/leading 1"); route(2); break; }; #forward international N digit requests to gateway =20
if(uri=3D~"^sip:011[0-9]+@(mydomain.com|10.10.10.49)"){
rewritehostport("10.10.10.5:5060"); =20 log(1,"international expression match"); route(2); break; };
/* ********** VOICEMAIL logic ************* */
if (uri=3D~"^sip:voicemail\+@"){ t_newtran(); t_reply("100", "Trying -- just a second"); if(!vm("/tmp/am_fifo","announcement")){ t_reply("500", "SEMS error"); }; log(1,"sip:voicemail uri match"); break; };
/* ****** Find Aliases and Locations of users ********* */
# It is very important to lookup "aliases" before looking up=20
"locations"
if(!lookup("aliases")){ log(1,"Couldn't find any matching alias"); sl_send_reply("404", "User does not exist"); break; }; if(!lookup("location")) { log(1,"unable to locate user"); route(3); break; }; }; # forward to current uri now; use stateful forwarding; that # works reliably even if we forward from TCP to UDP t_on_failure("1"); if (!t_relay()) { sl_reply_error(); }; log(1,"eof");
}
route[2]{ =20 log(1,"route[2]:SIP-to-PSTN call routed"); if(!t_relay()){ sl_reply_error(); }; }
route[3]{ log(1,"route[3]: voicemail processing"); if(method=3D=3D"INVITE" || method=3D=3D"ACK"){ log(1,"1st if entered in route[3] *vm*"); t_newtran(); t_reply("100","Trying -- just a second"); if(!vm("/tmp/am_fifo","voicemail")){ #=20
"announcement" was replaced with "voicemail"
log(1,"vm module called and failed"); t_reply("500", "SEMS error"); }; =20 break; }; log(1,"end of route[3], 1st if check not entered");
}
failure_route[1]{ log(1,"failure_route[1]:jump to vm processing"); route(3); # break; }
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
=20
Jiri Kuthan http://iptel.org/~jiri/=20 =20 _______________________________________________ Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers =20
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers