[Serusers] voicemail config

Srbislav Cvetkovic srbislav at city-net.com
Thu Jan 15 17:58:40 CET 2004


Hi Arnd,

I have searched the archieves and I have found examples that I have 
implemented. I am running two instances of ser server with ser -f 
/ser.cfg and ser -f /voicemail.cfg. The respected conf fiiles are 
below. Now, when I call and after so many seconds my call is being 
redirected i get Call Failed: 404 Not Found and no voicemail turned on. 
Then i added that user to the grp table with serctl command like this 
serctl acl grant username voicemail. After I do that i get Hung up 
after i try to call that user. It rings for 20 seconds and then it 
justs hangs up. Any Ideas?

#
# $Id: ser.cfg,v 1.21.2.1 2003/07/30 16:46:18 andrei Exp $
#
# simple quick-start config script
#

# ----------- global configuration parameters ------------------------

#debug=3         # debug level (cmd line: -dddddddddd)
#fork=yes
#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"

# ------------------ 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/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 ---------------

# -- 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)

# -- 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")

# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

modparam("group", "db_url", "mysql://ser:heslo@localhost/ser")

# time to give up on ringing -- global timer, applies to
#    all transactions
modparam("tm", "fr_inv_timer", 30)

# -------------------------  request routing logic -------------------

# main routing logic
route {

         if (!mf_process_maxfwd_header("10")) {
                 log("LOG: Too many hops\n");
                 sl_send_reply("483", "Alas Too Many Hops");
                 break;
         };

         if (!(method=="REGISTER")) record_route();
         if (loose_route()) {
                 t_relay();
                 break;
         };

         if (!uri==myself) {
                 t_relay();
                 break;
         };

         if (method == "REGISTER") {
                 if (!save("location")) {
                         sl_reply_error();
                 };
                 break;
         };

         # does the user wish redirection on no availability? (i.e., is 
he
         # in the voicemail group?) -- determine it now and store it in
         # flag 4, before we rewrite the flag using UsrLoc
         if (is_user_in("Request-URI", "voicemail")) {
                 setflag(4);
         };

         # native SIP destinations are handled using our USRLOC DB
         if (!lookup("location")) {
                 # handle user which was not found
                 route(4);
                 break;
         };

         # if user is on-line and is in voicemail group, enable 
redirection
         if (method == "INVITE" && isflagset(4)) {
                 t_on_failure("1");
         };
         t_relay();
}

# ------------- handling of unavailable user ------------------
route[4] {

         # non-Voip -- just send "off-line"
         if (!(method == "INVITE" || method == "ACK" || method == 
"CANCEL")) {
                 sl_send_reply("404", "Not Found");
                 break;
         };

         # not voicemail subscriber
         if (!isflagset(4)) {
                 sl_send_reply("404", "Not Found and no voicemail turned 
on");
                 break;
         };

         # forward to voicemail now
         rewritehostport("vm_host:5090");
         t_relay_to_udp("vm_host", "5090");
}

# if forwarding downstream did not succeed, try voicemail running
# at vm_host:5090

failure_route[1] {
         revert_uri();
         rewritehostport("vm_host:5090");
         append_branch();
         t_relay_to_udp("vm_host", "5090");
}



////////////////////////////////////////////////
#
# $Id: voicemail.cfg,v 1.2 2003/10/10 06:27:18 jiri Exp $
#
# this script is configured for use as voicemail UAS; it processes
# INVITEs and BYEs and asks SEMS to record media via "vm"; 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=                 # debug level (cmd line: -dddddddddd)
#fork=no
#log_stderror=yes       # (cmd line: -E)


check_via=no            # (cmd. line: -v)
dns=no                  # (cmd. line: -r)
rev_dns=no              # (cmd. line: -R)
port=5090
children=4
fifo="/tmp/vm_ser_fifo"

# ------------------ module loading ----------------------------------

loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/mysql.so"
loadmodule "/usr/local/lib/ser/modules/vm.so"

# ----------------- setting module-specific parameters ---------------

modparam("voicemail", "db_url","mysql://ser:heslo@localhost/ser")

# -------------------------  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");
                 break;
         };
         if (len_gt( max_len )) {
                 sl_send_reply("513", "Message too big");
                 break;
         };

         if (!uri==myself) {
                 sl_send_reply("404", "not reponsible for host in 
r-uri");
                 break;
         };


         # 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");
                         break;
                 };

                 t_reply("100","Trying -- just wait a minute !");
                 if(method=="INVITE"){
                         log("**************** vm start - begin 
*****************
*\n");
                         if (uri=~"sip:1000 at .*" || uri=~"sip:1001 at .*") {
                                 if (!vm("/tmp/am_fifo", 
"announcement")) {
                                         log("couldn't contact 
announcement serve
r\n");
                                         t_reply("500", "couldn not 
contact annou
ncement server");
                                 };
                         } else {
                                 if(!vm("/tmp/am_fifo","voicemail")){
                                         log("could not contact the 
answer machin
e\n");
                                         t_reply("500","could not 
contact the ans
wer machine");
                                 };
                         };
                         log("**************** vm start - end 
******************\
n");
                 } else if(method=="BYE"){
                         log("**************** vm end - begin 
******************\
n");
                         if(!vm("/tmp/am_fifo","bye")){
                                 log("could not contact the answer 
machine\n");
                                 t_reply("500","could not contact the 
answer mach
ine");
                         };
                         log("**************** vm end - end 
******************\n"
);
                 };
                 break;
         };
         if (method=="CANCEL") {
                 sl_send_reply("200", "cancels are junked here");
                 break;
         };
         sl_send_reply("501", "method not understood here");
}


On Monday, January 12, 2004, at 03:34  PM, Arnd Vehling wrote:

> Hi,
>
> you need to setup 2 ser servers if u want to use voicemail.
>
> One Server as "regular" sip proxy and one ser-server as dedicated
> voicemail server (on a different port if on the same machine).
>
> Then you route the calls from the "regular" ser server to the
> dedicated voicemail server if the call isnt answered after a
> certain amount of time.
>
> You cant define the timeout in means of "rings" because the ser
> server doesnt know how often an UAC will ring.
>
> If you search the mail archive you will find several example configs
> for this setup.
>
> best regards,
>
>   Arnd
> -- 
> NetHead                                 Network Design and Security
> Arnd Vehling                            av at nethead.De
> Gummersbacherstr. 27                    Phone: +49 221 8809210
> 50679 Köln                              Fax  : +49 221 8809212
>

  Srbo Cvetkovic                  | CityNet, Inc.		
  srbo at city-net.com            | Pittsburgh, PA	
  voice: 412.481.5406         | fax: 412.431.1315





More information about the sr-users mailing list