[Serusers] Voicemail implementation

Jan Janak jan at iptel.org
Thu Jul 24 23:32:16 CEST 2003


Hello, comments inline.

On 24-07 16:45, Juan J. Sierralta P. wrote:
> On Thu, 2003-07-24 at 16:17, Jan Janak wrote:
> 
> > > 	First of all thanks to SER developers for the great work.
> > > 	I'm new to SIP and SER, I been playing with it a week ago and I was
> > > able to setup a 0.8.11pre, and now I want to try the voicemail service.
> > > It seems that I need to run another SER instance for voicemail and
> > > redirect the requests to that instance.
> > 
> >   No, you can run it on the same server.
> > 
> > > 	It is posible to process the voicemail request on the same instance I
> > > use to forward/register users ?
> > 
> >    Yes.
> > 
> > > 	Or I need a second SER running. In case of 2 SER servers, it is posible
> > > to run them in the same box using diferent ports and diferent databases
> > > ?
> > 
> >   Yes, if the servers listen on different ports and use different
> >   databases.
> 
> 	The problem I see with two instances is maintaing the users table
> syncronized to get the email address.

    You can use the same table as for the "routing" SIP server.
    subscriber table (the table which contains usernames and
    correspondings e-mails) is not modified by the proxy or voicemail,
    so there is no need to synchronize it.

    I mean the routing proxy will query the table to get credentials and
    voicemail will query it to get email addresses.

> 	So is there an example out there how to implement voicemail in the same
> instance used for forwarding/register.

   A sample config file for a voicemail running within another ser
   instance is attached. Note that you can also put the snippets of the
   config into the main proxy config, you need no separate instance.

> 	Correct me if I'm wrong:
> 	- I receive an INVITE for an offline user.
> 	- I detect the offline status and must rewrite the uri in some 	way to
> signal echo,conference or voicemail.
> 
> 	The problem I see if I rewrite the URI the VM will no be able to locate
> the user's email address.

   It uses To header field to get URI of the callee, To header
   field URI never changes.

    Jan.

PS: Please always CC the list.

-------------- next part --------------
#
# $Id: ser.cfg,v 1.10 2003/04/27 12:10:14 rco Exp $
#
# iptel's voicemail config script
#

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

#debug=7		        # debug level (cmd line: -dddddddddd)
#fork=no
#log_stderror=yes 	# (cmd line: -E)

debug=3		        # debug level (cmd line: -dddddddddd)
fork=yes

log_stderror=no 	# (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/dbtext/dbtext.so"
loadmodule "/usr/local/lib/ser/modules/sl/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm/tm.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/mysql/mysql.so"
loadmodule "/usr/local/lib/ser/modules/rr/rr.so"
loadmodule "/usr/local/lib/ser/modules/textops/textops.so"
loadmodule "/usr/local/lib/ser/modules/vm/vm.so"
	    
# ----------------- setting module-specific parameters ---------------

modparam("voicemail", "db_url","sql://ser:heslo@dbhost/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;
	};

	# 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
	loose_route();

	# Make MSN Messenger happy... 
	if (method=="REGISTER") {
		sl_send_reply("200","ok");
		break;
	};

	if (uri =~ "HOSTNAME.OF.YOUR.SERVER.HERE") {

		# Voicemail specific configuration - begin

		if(method=="ACK" || method=="INVITE" || method=="BYE"){

			if(t_newtran()){

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

				if(method=="INVITE"){
					log("**************** vm start - begin ******************\n");
					if(!vm("/tmp/am_fifo","voicemail")){
						log("could not contact the answer machine\n");
						t_reply("500","could not contact the answer machine");
					};
					log("**************** vm start - end ******************\n");
					break;
				};

				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 machine");
					};
					log("**************** vm end - end ******************\n");
					break;
				};
			}
			else {
			     log("could not create new transaction\n");
			     sl_send_reply("500","could not create new transaction");
			};
		};

		# Voicemail specific configuration - end
	};
}


More information about the sr-users mailing list