Hello,

I'm trying for long hours to put voicemail working in my network. I'm using SEMS version from CVS and SER 0.8.12
I read many past emails from the serusers list and I follow the examples in FAQ by Jiri.
I create a group in ser's database named "voicemail" with serctl acl grante <username> <group> and put there all my usernames registered in SER's database.

I'm having always 2 problems;
        - is_user_in("Request-URI", "voicemail") always return false even if the user is in the group of voicemail in tables grp from SER'c database;

        - if I force setflag(4) to be true I always get the error "could not contact announcement server" or "could not contact voicemail server"


Does anyone have some idea what is happening?

Thank you.


João


Here are my config files:

#
# $Id: ser.cfg,v 1.21.4.1 2003/11/10 15:35:15 andrei Exp $
#
# simple quick-start config script
#

## vm_proxy 2004/01/26 Joao Sampaio


# ----------- 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 ----------------------------------
#
# $Id: vm_proxy.cfg,v 1.1 2003/10/30 14:52:41 jiri Exp $
#
# simple proxy script for forwarding to voicemail server
# for unavailable users
#

loadmodule "/usr/lib/ser/modules/sl.so"
loadmodule "/usr/lib/ser/modules/tm.so"
loadmodule "/usr/lib/ser/modules/rr.so"
loadmodule "/usr/lib/ser/modules/maxfwd.so"
loadmodule "/usr/lib/ser/modules/mysql.so"
loadmodule "/usr/lib/ser/modules/group.so"
loadmodule "/usr/lib/ser/modules/usrloc.so"
loadmodule "/usr/lib/ser/modules/registrar.so"

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

# database with user group membership
modparam("group", "db_url", "mysql://ser:heslo@localhost/ser")


# ---------------------  request 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 (1){  #is_user_in("Request-URI", "voicemail")) {   ###Force setflag(4) to be true###
                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("10.112.64.121:5090");
        t_relay_to_udp("10.112.64.121", "5090");       
}

# if forwarding downstream did not succeed, try voicemail running
# at bat.iptel.org:5090

failure_route[1] {
        revert_uri();
        rewritehostport("10.112.64.121:5090");
        append_branch();
        t_relay_to_udp("10.112.64.121", "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)

debug=4
#fork=no
log_stderror=yes
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/lib/ser/modules/sl.so"
loadmodule "/usr/lib/ser/modules/tm.so"
loadmodule "/usr/lib/ser/modules/maxfwd.so"
loadmodule "/usr/lib/ser/modules/mysql.so"
loadmodule "/usr/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 (msg:len > max_len){                  #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(1,"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(1,"**************** vm start - begin ******************\n");
                        if (uri=~"9999@10.112.64.121"){   #"sip:as_welcome@.*" || uri=~"sip:as_nomoney@.*") {
                                if (!vm("/tmp/am_fifo", "announcement")) {
                                log(1,"couldn't contact announcement server\n");
                                        t_reply("500", "couldn not contact announcement server");
                                };
                        } else {
                                if(!vm("/tmp/am_fifo","voicemail")){
                                        log(1,"could not contact the answer machine\n");
                                        t_reply("500","could not contact the answer machine");
                                };
                        };
                        log(1,"**************** vm start - end ******************\n");
                } else if(method=="BYE"){
                        log(1,"**************** vm end - begin ******************\n");
                        if(!vm("/tmp/am_fifo","bye")){
                                log(1,"could not contact the answer machine\n");
                                t_reply("500","could not contact the answer machine");
                        };
                        log(1,"**************** 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");
}






________________________
João Sampaio

PT Inovação, SA

SRM - Serviços e Redes Móveis

email: est-j-sampaio@ptinovacao.pt
Tlf:  +351 234511160-1907 / +351 234403421