From d9b0701a5f39ec7013a9130530b98cd6539be52e Mon Sep 17 00:00:00 2001 From: Kirill Solomko Date: Tue, 25 Feb 2020 16:47:04 +0100 Subject: [PATCH] TT#76362 vmnotify subscriber lookup by uuid * vmnotify now requires a subscriber's UUID as the mandatory parameter. reason for that is to fetch the related subscriber as the alias number can be a short one and not matching the real subscriber alias. Change-Id: I86af2c22871ed3f0ff1b2d9426e2fb953556fb39 (cherry picked from commit 2a0d2c3c829e94efc1dbf63dfc27bde0d62d9870) --- vmnotify | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/vmnotify b/vmnotify index 15a912e..1b90c5b 100755 --- a/vmnotify +++ b/vmnotify @@ -34,6 +34,7 @@ Options: [basic] - voicemail context (default: "default") - mailbox number + - subscriber uuid - amount of new messages [old messages] - amount of old messages [urgent messages] - amount of urgent messages @@ -89,7 +90,7 @@ my $sth_etag = $dbh->prepare( "and event='message-summary' order by received_time desc limit 1" ) or die "Failed to prepare etag query: $DBI::errstr"; my $sth_userdom = $dbh->prepare( - "select username, domain from dbaliases where alias_username=?" + "select username, domain from subscriber where uuid=?" ) or die "Failed to prepare userdom query: $DBI::errstr"; #---------------------------------------------------------------------- @@ -153,7 +154,7 @@ sub send_mwi_notify { die "Empty MWI. Cannot send SIP MWI notification\n" unless $mwi; my $log_str = sprintf <{bodylen} = 2+length($macros->{body_mw})+2+length($macros->{body_vm})+2; @@ -273,7 +274,7 @@ sub main { die "Incorrect arguments list" if $#ARGV < 2; my $idx = 0; - foreach my $arg (qw(context mailbox new old urgent)) { + foreach my $arg (qw(context mailbox uuid new old urgent)) { $data{$arg} = $ARGV[$idx] // 0; $idx++; } @@ -285,7 +286,7 @@ sub main { } $data{callid} = gen_callid().'@voip.sipwise.local'; - ($data{user}, $data{domain}) = get_user_domain($data{mailbox}); + ($data{user}, $data{domain}) = get_user_domain($data{uuid}); my $etag = get_etag($data{user}, $data{domain}); my $sipifmatch = defined $etag ? "SIP-If-Match: $etag" : "STRIP"; my $mwiid = $data{msgnum} ge 0 ? "P-NGCP-MWI-Id: $data{msgnum}\n": "";