[Serusers] sems+ivr(python)+ser

voip technocrat tech_voip at yahoo.co.in
Mon Dec 13 05:17:11 CET 2004


Hello list,

i have successfully completed my trails with voice
mail

now my aim is to do the ivr enableing with sems.

iam useing the ser-0.8.12 of stable version and sems

of stable and latest cvs version.


i have compiled my ivr plugin with the python and i
got  the binary file ivr.so

so my doubts are 

1) does i need to load this binary file into ser.cfg

2)if so  how do i need to load the module into the my
ser.cfg

3) the following is my configuration files of ser.cfg
and sems.conf 

4) my expectations with the current configurtions is 
that when i invite any other user agent it has to 
go to the ivr but instead of this it gives the error 
as follows

out put while running sems in debug mode
------------------------------------------

[root at server1 answer_machine]# ./sems -D 3 -E
(1281) ERROR: reportConfigError
(SemsConfiguration.cpp:274):
/usr/local/etc/sems/sems.conf:197  configuration:
inline module definitions may not be nested



sems.conf
******************************************************
[root at server1 sems]# cat sems.conf
# $Id: sems.conf.sample,v 1.20 2004/08/30 11:03:26 rco
Exp $
#
# sems.conf.sample
#
# Sip Express Media Server (sems)
#
# sample configuration file
#
#
# whitespaces (spaces and tabs) are ignored
# comments start with a "#" and may be used inline
#
# example: option=value1, value2  # i like this option
#

##################################
# global parameters              #
##################################

# optional parameter: fork={yes|no}
#
# - specifies if sems should run in daemon mode
(background)
#   (fork=no is the same as -E)
fork=yes

# optional parameter: stderr={yes|no}
#
# - debug mode: do not fork and log to stderr
#   (stderr=yes is the same as -E)
stderr=no

# optional parameter: loglevel={0|1|2|3}
#
# - sets log level (error=0, warning=1, info=2,
debug=3)
#   (same as -D)
loglevel=1

# optional parameter: fifo_name=<filename>
#
# - path and file name of our fifo file (same as -i)
fifo_name=/tmp/am_fifo

# optional parameter: ser_fifo_name=<filename>
#
# - path and file name of Ser's fifo file (same as -o)
ser_fifo_name=/tmp/ser_fifo

# optional parameter: socket_name=<filename>
#
# - path and file name of our unix socket
socket_name=/tmp/am_sock

# optional parameter: ser_socket_name=<filename>
#
# - path and file name of Ser's unix socket
ser_socket_name=/tmp/ser_sock

# optional parameter: send_method=<filename>
#
# - sets which method will be used to contact Ser:
#   FIFO or unix socket server.
# - values: fifo (default), unix_socket
#
# - PLEASE NOTE THAT: if you use 'fifo', make sure
that
#   fifo_name and ser_fifo_name have been set. if you
use 'unix_socket',
#   make sure that socket_name and ser_socket_name
have been set.
#
send_method=unix_socket

# optional parameter: plugin_path=<path>
#
# - sets the path to the plug-ins
# - may be absolute or relative to CWD
plugin_path=/usr/local/lib/sems/plug-in/

# optional parameter: smtp_server=<hostname>
#
# - sets address of smtp server
smtp_server=localhost

# optional parameter: smtp_port=<port>
#
# - sets port of smtp server
smtp_port=25

# optional parameter: rtp_low_port=<port>
#
# - sets port of rtp lowest server
#rtp_low_port=1024

# optional parameter: rtp_high_port=<port>
#
# - sets port of rtp highest server
#rtp_high_port=65535

##################################
# module specific parameters     #
##################################

# sample voicemail configuration (inline)
config.voicemail=inline

# optional parameter: rec_file_extension=<ext>
#
# - sets the file extension which will be used
#   to record messages.
# - example 1: wav
# - example 2: mp3
#
# WARNING: you must compile the mp3 plug-in
#          in order to use 'mp3' as default
#          extension. You will need the lame
#          encoder for that.
#          See plug-in/mp3/ReadmeMP3.txt for
#          more information.
#
rec_file_extension=wav

# optional parameter: announce_path=<path>
#
# - sets the path where announce files are searched
for
# - the file to be played is determined the following
way:
#   <announce_path>/<domainname>/<username>.wav
#   if this file is not available
<announce_path>/<default_anounce> is used
announce_path=/usr/local/lib/sems/audio/

# parameter: default_announce=<filename>
#
# - sets the name of the default announce WAV file
default_announce=default_en.wav

# parameter: max_record_time=<seconds>
#
# - maximum record time
max_record_time=30

# parameter: accept_delay=<x>
#
# - delays accepting of the call for x seconds
# - default value is 0
accept_delay=0

# parameter: email_template_path=<filename>
#
# - email templates path
#
# See the README file in <sems-src>/plug-in/voicemail
# for more information on the syntax used.
#
email_template_path=/usr/local/etc/sems/

# end of configuration section for voicemail module
config.voicemail=end


# sample announcement configuration (inline)
config.announcement=inline

# optional parameter: announce_path=<path>
#
# - sets the path where announce files are searched
for
announce_path=/usr/local/lib/sems/audio/

# parameter: default_announce=<filename>
#
# - sets the name of the default announce WAV file
default_announce=default_en.wav

# end of configuration section for announcement module
config.announcement=end


# sample isdngw module configuration (external file)
# config.isdngw=/etc/isdngw.conf

# sample ivr module configuration (inline)
config.ivr=inline
#
#
# The IVR checks for a script with the named of the
callee
# (<local part in r-uri>.py for python, <local part in
r-uri>.pl for perl)
# in the directory <ivr_script_path><domain>, then for
# <ivr_script_path><domain><ivr_script_file>. If this
is  not found,
# <ivr_script_path>/<local part in r-uri>.py if
searched,
# and if this is not found,
<ivr_script_path>/<ivr_script_file> is used.












config.ivr=inline


python_scrit_path=/root/answer_machine/plugin/ivr/

python_script_file=ivr.py

config.ivr=end

  #parameter: ivr_script_path:
  # path to ivr scripts.
  #
  ivr_script_path=/etc/ivr/
  # default script file: this will be executed if
<user>.py does not exist.
  #
  ivr_script_file=ivr.py

  # parameter : tts_caching
  #     y or n
  #       text will be read from waves already
synthesized and
  #     cached in cache_path
  tts_caching=y

  # parameter : tts_cache_path
  #     path to cache waves
  #     path must exist!
  tts_cache_path=/tmp/wavs
# end of configuration section for ivr module

******************************************************



ser.cfg
*******************************************************

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

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

# ------------------ 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/vm.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")
modparam("usrloc","db_url","mysql://ser:heslo@localhost:3306/ser")

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

modparam("voicemail","db_url","mysql://ser:heslo@localhost:3306/ser")
modparam("voicemail","subscriber_table","subscriber")
modparam("voicemail","email_column","email_address")
# -------------------------  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")) {
                sl_send_reply("483","Too Many Hops");
                break;
        };
        if ( msg:len > 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();
        # loose-route processing
        if (loose_route()) {
                t_relay();
                break;
        };

        # 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==myself) {

                if (method=="REGISTER") {

# Uncomment this if you want to use digest
authentication
#                       if
(!www_authorize("iptel.org", "subscriber")) {
#                              
www_challenge("iptel.org", "0");
#                               break;
#                       };

                        save("location");
                        break;
                };

if ( method=="ACK" || method=="INVITE" ||
method=="BYE" || method=="CANCEL" )
        {
                    if (!t_newtran())
                                        {
                                        
sl_send_reply("500","could not create transaction");
                                         break;
                                        };

                    t_reply("100","Trying - just wait
a minute !");


                    if (method=="INVITE")
                                        {
                                               
log("in to the invite");
                                               
if(!vm("/tmp/am_fifo","ivr"))
                                                {
                                               
log("could not contact announcement server");
                                               
t_reply("500","error contacting sems");
                                                 };
                                                
break;

                                            }
                    else if (method=="BYE" ||
method=="CANCEL")
                                            {
                                             
if(!vm("/tmp/am_fifo","bye"))
                                                     {
                                 t_reply("500","error
contacting sems");
                                                      
  };
                                                      
 break;
                                            };
       };

                # native SIP destinations are handled
using our USRLOC DB
                if (!lookup("location")) {
                        sl_send_reply("404", "Not
Found");
                        break;
                };
        };
        # forward to current uri now; use stateful
forwarding; that
        # works reliably even if we forward from TCP
to UDP
        if (!t_relay()) {
                sl_reply_error();
        };

}


*******************************************************


your help will be highly appreciated

with regards
serdiehard







		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250




More information about the sr-users mailing list