|
@@ -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
|