[sr-dev] git:master: kamailio.cfg: route subscribe for event message-summary to voicemail server

Daniel-Constantin Mierla miconda at gmail.com
Sat Jun 15 18:24:59 CEST 2013


Module: sip-router
Branch: master
Commit: e7da9f72beb1c97b79a516ecdd19db8971dea508
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e7da9f72beb1c97b79a516ecdd19db8971dea508

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Sat Jun 15 18:23:48 2013 +0200

kamailio.cfg: route subscribe for event message-summary to voicemail server

---

 etc/kamailio.cfg |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/etc/kamailio.cfg b/etc/kamailio.cfg
index 911b7d6..c8ac439 100644
--- a/etc/kamailio.cfg
+++ b/etc/kamailio.cfg
@@ -680,21 +680,25 @@ route[PRESENCE] {
 	if(!is_method("PUBLISH|SUBSCRIBE"))
 		return;
 
+	if(is_method("SUBSCRIBE") && $hdr(Event)=="message-summary") {
+		route(TOVOICEMAIL);
+		# returns here if no voicemail server is configured
+		sl_send_reply("404", "No voicemail service");
+		exit;
+	}
+
 #!ifdef WITH_PRESENCE
 	if (!t_newtran())
 	{
 		sl_reply_error();
 		exit;
-	};
+	}
 
 	if(is_method("PUBLISH"))
 	{
 		handle_publish();
 		t_release();
-	}
-	else
-	if( is_method("SUBSCRIBE"))
-	{
+	} else if(is_method("SUBSCRIBE")) {
 		handle_subscribe();
 		t_release();
 	}
@@ -868,7 +872,7 @@ route[XMLRPC] {
 # route to voicemail server
 route[TOVOICEMAIL] {
 #!ifdef WITH_VOICEMAIL
-	if(!is_method("INVITE"))
+	if(!is_method("INVITE|SUBSCRIBE"))
 		return;
 
 	# check if VoiceMail server IP is defined
@@ -876,11 +880,17 @@ route[TOVOICEMAIL] {
 		xlog("SCRIPT: VoiceMail rotuing enabled but IP not defined\n");
 		return;
 	}
-	if($avp(oexten)==$null)
-		return;
-
-	$ru = "sip:" + $avp(oexten) + "@" + $sel(cfg_get.voicemail.srv_ip)
+	if(is_method("INVITE")) {
+		if($avp(oexten)==$null)
+			return;
+		$ru = "sip:" + $avp(oexten) + "@" + $sel(cfg_get.voicemail.srv_ip)
 				+ ":" + $sel(cfg_get.voicemail.srv_port);
+	} else {
+		if($rU==$null)
+			return;
+		$ru = "sip:" + $rU + "@" + $sel(cfg_get.voicemail.srv_ip)
+				+ ":" + $sel(cfg_get.voicemail.srv_port);
+	}
 	route(RELAY);
 	exit;
 #!endif




More information about the sr-dev mailing list