[Asterisk-Users] Asterisk voicemail

Yan Yu Lim yanyu.lim at gmail.com
Wed Jul 6 08:23:31 MST 2005


Hi guys,

I'm new to Asterisk, so I'm hoping someone can guide me :-)

Currently, I am having the configuration as follows :

PSTN -> Cisco router -> Sip Express Router -> Asterisk Voicemail

I'm able to get the part from PSTN to Sip Express Router working, but
I can't integrate Asterisk with Sip Express Router (SER).

Basically, SER does all the registering and forwarding of calls. I
need to implement the voicemail in Asterisk, whereby a user calls a
certain IP Phone, and if the user does not pick up the call in time,
the call is diverted to Asterisk's voicemail.

However, I am unable to get Asterisk to activate the voicemail upon
missed calls. Please kindly advise.

Regards,
YY


My current settings are as follows :

-------------
------------
SER
------------
-------------

1. ser.cfg (SER's config file)
-----------------------------------------


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

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

# Uncomment these lines to enter debugging mode 
debug=3
fork=yes
listen=202.122.25.106
log_stderror=yes

check_via=no	# (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
fifo="/tmp/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/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/exec.so"

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

# -- usrloc params --
# store user location in memory, not using database
modparam("usrloc", "db_mode", 0)
modparam("rr", "enable_full_lr", 1)

# -- tm params --
# set time for which ser will be waiting for a final response;
# fr_inv_timer sets value for INVITE transactions,
# fr_timer for all others
modparam("tm","fr_inv_timer",15)

# -------------------------  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;
	};
	
	setflag(1);

	# 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

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

	# loose-route processing
	if (loose_route()) {
		route(1);
		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){
		route(1);
		break;
	};

	if (uri==myself) {

		if (method=="REGISTER") {

			route(2);
			break;
		};
      
      		setflag(4);

		# attempt handoff to PSTN
    		if (uri=~"^sip:9[0-9]*@test.net") {  	##  This assumes that the caller is
        		log(1, "Forwarding to PSTN");      		##  registered in our realm
        		forward(10.10.10.3, 5060);			##  Our Cisco router
			break;
    		};

		# native SIP destinations are handled using our USRLOC DB
		if (!lookup("location")) {
			sl_send_reply("404", "Not Found");
			#acc_rad_request("404");
			break;
		};
		
		# timeout occurred ... now to forward to Asterisk's voicemail service
		if(method == "INVITE" && isflagset(4)) {
			t_on_failure("1");
		};
	};
	route(1);
}

	# -------------------------------
	#	Route Processing
	# -------------------------------

	route[1]{
		  if(!t_relay()){
			sl_reply_error();
		  };
	}
	
	route[2]{
		  if(!save("location")){
			sl_reply_error();
		  }
	}
	
# voicemail activation!!
#
	failure_route[1] {
		log(1,"Activating voicemail!!\n");
		forward(202.122.25.106, 5061);
	}

---------------------------


--------
--------
ASTERISK
--------
--------



voicemail.conf
---------------

[default]
1012 => 1234, YY, ylim at test.net

sip.conf
-----------

port=5061			; UDP Port to bind to (SIP standard port is 5060)
bindaddr=0.0.0.0		; IP address to bind to (0.0.0.0 binds to all)
srvlookup=yes			; Enable DNS SRV lookups on outbound calls

[1012]
type=friend 
username=1012
insecure=yes
canreinvite=no
context=test
mailbox=1012
host=202.122.25.106
nat=no

extensions.conf
----------------

[test]
;leave voice messages
exten => 1012, 1, Wait(1)
exten => 1012, 2, VoiceMail(u1012)
exten => 1012, 3, Hangup
;play voice messages
exten => 2012, 1, Wait(1)
exten => 2012, 2, VoiceMailMain()
exten => 2012, 3, Hangup

------------------------------



More information about the asterisk-users mailing list