Asterisk 13.22.0
FreePBX 14.0.13.26
Avaya Definity v9.5si, IP enabled (but not SIP capable)
I am an old Avaya guy, and a newbie to Asterisk and Perl scripting. And I apologize profusely for the length of this post.
I am trying to set up FreePBX as a standalone voicemail server for an Avaya Definity PBX, v9.5si.
I have an ISDN PRI between the Definity and the FreePBX server. I am successfully sending calls over the PRI to the FreePBX server and am successfully leaving messages in mailboxes.
The issue is getting Message Waiting Indication from FreePBX to the Avaya. FreePBX is calling the Avaya, but is not sending any digits.
I have the PRI set up in two groups - channels 1 through 22, and channel 23 in it's own group (on both ends). Channel 24 for signalling. I use only channel 23 for MWI (dahdi/g1/).
I am using the following Perl script for MWI. I added the line numbers to this for clarity (they are not in the actual script).
On line 23 I set $DEBUG to "1", but the file "/tmp/asterisk.log" is not created.
The block from line 026 through 033 seems to work, as I see the caller ID name and number in the trace on the Avaya side. Asterisk shows the call completed successfully.
On line 104 I set the MWI On code to "106".
On line 141 I set the MWI Off code to "107".
I am expecting FreePBX to send 7 digits - MWI ON code + 4-digit extension.For Testing, on the Avaya side, I am checking for the number of incoming digits, then route the call to a vector that routes the calls to the string of digits received. Unfortunately, I am getting zero digits.
The only time I receive digits are when I manually add them to the end of line 026, such as
Then I get 7 digits. But that's not the way.
Any experts out there have any suggestions?
Thanks in advance -
- Duaneness
FreePBX 14.0.13.26
Avaya Definity v9.5si, IP enabled (but not SIP capable)
I am an old Avaya guy, and a newbie to Asterisk and Perl scripting. And I apologize profusely for the length of this post.
I am trying to set up FreePBX as a standalone voicemail server for an Avaya Definity PBX, v9.5si.
I have an ISDN PRI between the Definity and the FreePBX server. I am successfully sending calls over the PRI to the FreePBX server and am successfully leaving messages in mailboxes.
The issue is getting Message Waiting Indication from FreePBX to the Avaya. FreePBX is calling the Avaya, but is not sending any digits.
I have the PRI set up in two groups - channels 1 through 22, and channel 23 in it's own group (on both ends). Channel 24 for signalling. I use only channel 23 for MWI (dahdi/g1/).
I am using the following Perl script for MWI. I added the line numbers to this for clarity (they are not in the actual script).
Code:
001 #!/usr/bin/perl
002 #
003 # vmnotify.pl v0.1, Copyright (C) Mike Cathey
004 #
005 # ChangeLog
006 #
007 # Use this at your own risk!
008 #
009 # This program is free software; you can redistribute it and/or modify
010 # it under the terms of the GNU General Public License as published by
011 # the Free Software Foundation; either version 2 of the License, or
012 # (at your option) any later version.
013 #
014 # This program is distributed in the hope that it will be useful,
015 # but WITHOUT ANY WARRANTY; without even the implied warranty of
016 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
017 # GNU General Public License for more details.
018 #
019 # You should have received a copy of the GNU General Public License
020 # along with this program; if not, write to the Free Software
021 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
022 #
023 my $DEBUG = 1;
024 open(OUT, ">>","/tmp/asterisk.log");
025
026 my $callFile = "Channel: dahdi/g1/
027 MaxRetries: 6
028 RetryTime: 60
029 WaitTime: 5
030 Context: vmnotify
031 Extension: s
032 Callerid: VM Notify <(123) 555-1234>
033 Priority: 2";
034
035 my $notifyFileP = "Channel: dahdi/g1/9
036 MaxRetries: 0
037 RetryTime: 300
038 WaitTime:30
039 Context: default
040 Extension: s
041 Callerid: VM Notific <(123) 555-1234>
042 Priority: 2";
043
044 my $notifyFileM = "Channel: dahdi/g1/9
045 MaxRetries: 0
046 RetryTime: 300
047 WaitTime:30
048 Context: default
049 Application: VoicemailMain
050 Data: sEXTENSION
051 Callerid: VM Notifica <(123) 555-1234>
052 Priority: 2";
053
054
055 my $currentMessageDir = "/var/spool/asterisk/mwi/";
056 my $currentNotifyDir = "/var/spool/asterisk/notify/";
057 my $rand = $$;
058 my $callFileTEMP = "/var/tmp/asterisk.callfile." . $rand;
059 $rand2 = $rand + 1;
060 my $callFileTEMP2 = "/var/tmp/asterisk.callfile." . $rand2;
061
062
063 my $date = `date`;
064 print OUT $date;
065
066
067 if ($DEBUG > 0) {
068 print OUT "\$callFileTEMP = $callFileTEMP\n";
069 print OUT "\$callFileTEMP2 = $callFileTEMP2\n";
070 for my $arg (@ARGV) {
071 print OUT "\t$arg\n";
072 }
073 }
074
075 shift;
076 my $mailboxTEMP = shift;
077 my $messages = shift;
078 chomp $mailbox;
079 chomp $messages;
080
081 my ($mailbox,$context) = split(/\@/, $mailboxTEMP);
082
083 # testing
084 # $mailbox = 2235;
085 # $context = "default";
086 # $messages = 0;
087
088 $CMDPath = $currentMessageDir . $context . "/" . $mailbox;
089 my $currentMessages = 0;
090 if ( -e $CMDPath ) {
091 open(CURRENT, "<$CMDPath");
092 $currentMessages = <CURRENT>;
093 close CURRENT;
094 chomp $currentMessages;
095 print OUT "currentMessages = \"$currentMessages\"\n" if $DEBUG > 0;
096 } else {
097 $currentMessages = 0;
098 }
099
100 # create the call file
101 open(CF, ">$callFileTEMP");
102
103 if ( $messages > $currentMessages ) { # they have messages
104 $callFile =~ s/CALLTHISNUMBER/\106$mailbox/;
105 # print "Turning ON MWI for $mailbox\@$context\n" if $DEBUG > 0;
106 print OUT "Turning ON MWI for $mailbox\@$context\n";
107 print OUT $callFile if $DEBUG > 0;
108
109 open(CF2, ">$callFileTEMP2");
110 my $notifyNumber = getNotifyNumber($mailbox);
111 my $notifyMethod = $notifyNumber;
112 $notifyMethod = substr($notifyNumber,0,1);
113 $notifyNumber = substr($notifyNumber,1,7);
114 my $notifyFile = "";
115 my $qFile = "/var/spool/asterisk/outgoing/asterisk." . $rand2;
116 print OUT "\$qfile = $qFile\n" if $DEBUG > 0;
117 if ($notifyMethod eq 'm') {
118 $notifyFile = $notifyFileM;
119 } elsif ( $notifyMethod eq 'p' ) {
120 $notifyFile = $notifyFileP;
121 }
122
123 if ( $notifyNumber != 0 ) {
124 $notifyFile =~ s/CALLTHISNUMBER/$notifyNumber/;
125 if ($notifyMethod eq 'p' ) {
126 $notifyFile =~ s/EXTENSION/$mailbox/;
127 } else {
128 $notifyFile =~ s/EXTENSION/$mailbox\@$context/;
129 }
130 print CF2 $notifyFile;
131 if ($DEBUG > 0 ) {
132 print OUT "---\n";
133 print OUT $notifyFile;
134 print OUT "---\n";
135 }
136 close CF2;
137 rename($callFileTEMP2, $qFile) or print(OUT "ERROR: Can't rename callfile($callFileTEMP2): $!\n");
138 }
139
140 } else {
141 $callFile =~ s/CALLTHISNUMBER/\107$mailbox/;
142 #print "Turning OFF MWI for $mailbox\@$context\n" if $DEBUG > 0;
143 print OUT "Turning OFF MWI for $mailbox\@$context\n";
144 print OUT $callFile if $DEBUG > 0;
145 }
146 print CF $callFile;
147 close CF;
148
149 # put it in the outgoing queue
150 rename($callFileTEMP, "/var/spool/asterisk/outgoing/asterisk.$$") or print(OUT "ERROR: Can't rename callfile($callFileTEMP): $!\n");
151
152 # update the new message count
153 open(UPDATECMD, ">$CMDPath");
154 print UPDATECMD $messages;
155 close UPDATECMD;
156 print OUT "-"x80 . "\n";
157 close OUT;
158
159 sub getNotifyNumber {
160 my $NotifyPath = $currentNotifyDir . $context . "/" . $mailbox;
161 if ( -e $NotifyPath ) {
162 open(CURRENT, "<$NotifyPath");
163 $notifyNumber = <CURRENT>;
164 close CURRENT;
165 chomp $notifyNumber;
166 print OUT "notifyNumber = \"$notifyNumber\"\n" if $DEBUG > 0;
167 return $notifyNumber;
168 } else {
169 return 0;
170 }
171 }
On line 23 I set $DEBUG to "1", but the file "/tmp/asterisk.log" is not created.
The block from line 026 through 033 seems to work, as I see the caller ID name and number in the trace on the Avaya side. Asterisk shows the call completed successfully.
On line 104 I set the MWI On code to "106".
On line 141 I set the MWI Off code to "107".
I am expecting FreePBX to send 7 digits - MWI ON code + 4-digit extension.For Testing, on the Avaya side, I am checking for the number of incoming digits, then route the call to a vector that routes the calls to the string of digits received. Unfortunately, I am getting zero digits.
The only time I receive digits are when I manually add them to the end of line 026, such as
Code:
my $callFile = "Channel: dahdi/g1/1062234
Any experts out there have any suggestions?
Thanks in advance -
- Duaneness