# # $Id: voicemail.cfg,v 1.5 2004/01/14 18:23:50 rco Exp $ # # this script is configured for use as voicemail UAS; it processes # INVITEs and BYEs and asks SEMS to record media via "t_write_req"; in this # script, all record-routing and other constructs known from proxy # scripts are not present -- it is a simple UAS # # ----------- global configuration parameters ------------------------ debug=9 # debug level (cmd line: -dddddddddd) fork=no log_stderror=yes # (cmd line: -E) #listen=212.103.160.198 check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5090 children=4 fifo="/tmp/t_write_req_ser_fifo" # ------------------ module loading ---------------------------------- loadmodule "modules/sl/sl.so" loadmodule "modules/tm/tm.so" loadmodule "modules/maxfwd/maxfwd.so" # ------------------------- request routing logic ------------------- # main routing logic route{ # initial sanity checks -- messages with # max_forwars==0, or excessively long requests if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; }; if (msg:len >= max_len) { sl_send_reply("513", "Message too big"); exit; }; if (!uri==myself) { sl_send_reply("404", "not reponsible for host in r-uri"); exit; }; # Voicemail specific configuration - begin if(method=="ACK" || method=="INVITE" || method=="BYE"){ if (!t_newtran()) { log("could not create new transaction\n"); sl_send_reply("500","could not create new transaction"); exit; }; t_reply("100","Trying -- just wait a minute !"); if(method=="INVITE"){ if (uri=~"sip:999[0-9]@.*") { if (!t_write_req("/tmp/am_fifo", "announcement")) { log(1,"couldn't contact announcement server\n"); t_reply("500", "couldn not contact announcement server"); }; log("!!!!!!!!!!!!!!!!!!!!!ANNOUNCEMENT!!!!!!!!!!!!!!!!!!!!!!\n"); } else if(uri=~"sip:1234567890@.*") { if (!t_write_req("/tmp/am_fifo", "number_reader")) { log("could not contact the number reader server\n"); t_reply("500","could not contact ivr server"); }; log ("!!!!!!!!!!!!!!!!!!!!!!!!!IVR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); } else if (uri=~"sip:55[0-9][0-9][0-9]@.*") { if (!t_write_req("/tmp/am_fifo", "conference")) { log("Could not contact conference server\n"); t_reply("500","Could not contact conference server"); }; log ("!!!!!!!!!!!!!!!!!!!!!CONFERENCE!!!!!!!!!!!!!!!!!!!!!!!!!\n"); } else { if(!t_write_req("/tmp/am_fifo","voicemail")) #if(!t_write_req("/tmp/am_fifo","ivr")) { log(1,"could not contact the answer machine\n"); t_reply("500","could not contact the answer machine"); }; log("!!!!!!!!!!!!!!!!!!!!!!VOICEMAIL!!!!!!!!!!!!!!!!!!!!!!!!!\n"); }; # # log("**************** t_write_req start - begin ******************\n"); # if(!t_write_req("/tmp/am_fifo","voicemail")){ # log("could not contact the answer machine\n"); # t_reply("500","could not contact the answer machine"); # }; # log("**************** t_write_req start - end ******************\n"); } else if(method=="BYE"){ log("**************** t_write_req end - begin ******************\n"); if(!t_write_req("/tmp/am_fifo","bye")){ log("could not contact the answer machine\n"); t_reply("500","could not contact the answer machine"); }; log("**************** t_write_req end - end ******************\n"); }; exit; }; if (method=="CANCEL") { sl_send_reply("200", "cancels are junked here"); exit; }; sl_send_reply("501", "method not understood here"); }