4 digit dialing from Digital PBX to Asterisk PBX over Private VPN
Hi,
I am trying to setup 4 digit calling from my Digital PBX to the asterisk server over a private vpn. At the moment
I can do this from the Digital PBX to a Cisco CME system. We forward the calls from the PBX to a third party device which in turn forwards all the calls to the CME.
Would any one know the best way to do this with the asterisk PBX

output...
below are some examples... I never got qsig to completely work, I'm using a loop start channel to toggle MWI on/off(voicemail.conf/externotify=vmnotify.pl) see below . These examples are from a box thats been in production for about 2 years now.
However, notice that switchtype is set to qsig... On the Avaya side/hunt group form/ the message center is set to qsig-mwi.
Zapata.conf
[trunkgroups]
trunkgroup => 1,24
spanmap => 1,1
[channels]
language = en
context = local
switchtype = qsig ;dms100 4ess 5ess ni1 qsig
signalling = pri_cpe
;nsf = none ;'none', 'sdn', 'megacom', 'accunet'
pridialplan = local ; unknown private local national international
prilocaldialplan = national ; same
resetinterval = 3600
overlapdial = yes
priindication = outofband ; inband outofband
priexclusive = yes
; pritimer => t200,1000
; pritimer => t313,4000
; facilityenable = yes
group = 1
echocancel = yes
echocancelwhenbridged = yes
echotraining = yes
echotraining = 800
jitterbuffers = 20
rxgain = 0.0
txgain = 0.0
channel => 25-47
;
signalling = fxs_ls ; i use first channel to toggle MWI
group = 2
channel => 1-24
extensions.conf this box is purely asterisk, so for trixbox, modify in extensions_custom.conf
2699 was the DNIS for the front of the VM application...so to check your vm, you'd dial 2699, etc.. You'll also notice we have 4 and 5 digit extensions hence _xxxx and _xxxxx.
61505 was used for the operator to dump a caller directly into a users vm box.
[general]
static=yes
writeprotect=no
autofallthrough=no
;clearglobalvars=no
priorityjumping=no
;
[globals]
TRUNK=Zap/g1
DIALTRUNK=Zap/g2
;
[macro-vmplatform]
;This is used to map ANI
;to the customers voicemail box
; ${ARG1} - MailBox To Dial
; ${ARG2} - Trunk to use
exten => s,1,NoOp(ANI Recieved ${CALLERID(ani)})
exten => s,2,NoOp(Voicemail Box to Dial ${ARG1})
exten => s,3,Dial(${ARG2}/${ARG1})
exten => s,4,Hangup()
;
[macro-stdexten]
; Standard extension macro:
; ${ARG1} - extension
; ${ARG2} - Device(s) to ring
exten => s,1,NoOp(Call Forwarded from ${ARG1})
exten => s,2,NoOp(CallerID is ${CALLERID(ani)})
exten => s,3,GotoIF($["${CALLERID(rdnis)}" = ""]?emptyrdnis|1)
exten => s,4,Voicemail(u${ARG2})
exten => s,5,Hangup()
exten => a,1,VoiceMailMain(${ARG1})
exten => a,2,Hangup()
exten => emptyrdnis,1,Directory(default|noRDNIS)
exten => emptyrdnis,2,Hangup()
exten => o,1,Dial(Zap/g2/0)
exten => o,2,Hangup()
;
[macro-vmexten]
;this is used by operator to send
;callers directly to users vm box
; ${ARG1} - extension
; ${ARG2} - Device(s) to ring
exten => s,1,NoOp(Operator Dialed ${ARG1})
exten => s,2,NoOp(CallerID is Operator)
exten => s,3,Voicemail(u${ARG2})
exten => s,4,Hangup()
exten => a,1,VoiceMailMain(${ARG1})
exten => a,2,Hangup()
exten => o,1,Dial(Zap/g2/0)
exten => o,2,Hangup()
;
[vmnotify]
exten => s,1,Wait(5)
exten => s,2,Hangup
;
[default]
include => local
;
[local]
;
exten => _XXXX,1,Macro(stdexten,${CALLERID(rdnis)},${CALLERID(rdnis)})
exten => _XXXXX,1,Macro(stdexten,${CALLERID(rdnis)},${CALLERID(rdnis)})
exten => _2699,1,VoiceMailMain()
exten => _2699,2,NoOp(${Mailbox})
exten => _2699,3,Hangup()
exten => o,1,Dial(Zap/g2/0)
exten => o,2,Hangup()
exten => _61505,1,Goto(opvm,61505,1)
;
[opvm]
exten => _61505,1,Answer()
exten => _61505,2,Playback(vm-extension)
exten => _61505,3,WaitExten(10)
exten => _XXXX,1,Macro(vmexten,${EXTEN},${EXTEN})
exten => _XXXXX,1,Macro(vmexten,${EXTEN},${EXTEN})
;
[noRDNIS]
;
exten => _XXXX,1,VoiceMail(u${EXTEN})
exten => _XXXX,2,Hangup()
exten => _XXXXX,1,VoiceMail(u${EXTEN})
exten => _XXXXX,2,Hangup()
exten => o,1,Dial(Zap/g2/0)
exten => o,2,Hangup()
;
vmnotify.pl
Where *1 and #1 represent the code to toggle mwi on and off. ex... dialing *1 1000 will turn the light on and #1 1000 will turn it off... Avaya's only hang up, only the extension that turned it on can turn it off.
#!/usr/bin/perl
my $DEBUG = 0;
open(OUT, ">>/tmp/asterisk.log");
###############################################################################
# Configuration Variables
###############################################################################
# If you have a remote PBX ( hanging off of your non asterisk pbx;
# ie. asterisk -> definity -> nortel)
# ... remoteExtensions would be the mode code for the nortel
# remoteExtensions is the list of extensions hanging of the "nortel"
my $remoteExtensions = "1280|1203";
my $remoteMWIOn = "#53";
my $remoteMWIOff = "#*53";
#
# Mode codes for the definity
my $mwiOn = "*1";
my $mwiOff = "#1";
#
my $vmNumber = "555-867-5309";
###############################################################################
my $callFile = "Channel: Zap/25/CALLTHISNUMBER
MaxRetries: 15
RetryTime: 60
WaitTime: 10
Context: vmnotify
Extension: s
Callerid: VM Notification <$vmNumber>
Priority: 2";
my $notifyFileP = "Channel: Zap/g1/9CALLTHISNUMBER,,,,EXTENSION#
MaxRetries: 0
RetryTime: 300
WaitTime:30
Context: default
Extension: s
Callerid: VM Notification <$vmNumber>
Priority: 2";
my $notifyFileM = "Channel: Zap/g1/9CALLTHISNUMBER
MaxRetries: 0
RetryTime: 300
WaitTime:30
Context: default
Application: VoicemailMain
Data: sEXTENSION
Callerid: VM Notification <$vmNumber>
Priority: 2";
my $currentMessageDir = "/var/spool/asterisk/mwi/";
my $currentNotifyDir = "/var/spool/asterisk/notify/";
my $rand = $$;
my $callFileTEMP = "/var/tmp/asterisk.callfile." . $rand;
$rand2 = $rand + 1;
my $callFileTEMP2 = "/var/tmp/asterisk.callfile." . $rand2;
my $date = `date`;
print OUT $date;
if ($DEBUG > 0) {
print OUT "\$callFileTEMP = $callFileTEMP\n";
print OUT "\$callFileTEMP2 = $callFileTEMP2\n";
for my $arg (@ARGV) {
print OUT "\t$arg\n";
}
}
shift;
my $mailboxTEMP = shift;
my $messages = shift;
chomp $mailbox;
chomp $messages;
my ($mailbox,$context) = split(/\@/, $mailboxTEMP);
if ( $mailbox =~ /$remoteExtensions/ ){
$mwiOn = $remoteMWIOn;
$mwiOff = $remoteMWIOff;
}
$CMDPath = $currentMessageDir . $context . "/" . $mailbox;;
my $currentMessages = 0;
if ( -e $CMDPath ) {
open(CURRENT, "<$CMDPath");
$currentMessages =
close CURRENT;
chomp $currentMessages;
print OUT "currentMessages = \"$currentMessages\"\n" if $DEBUG > 0;
} else {
$currentMessages = 0;
}
# create the call file
open(CF, ">$callFileTEMP");
if ( $messages > $currentMessages ) { # they have messages
$callFile =~ s/CALLTHISNUMBER/$mwiOn$mailbox/;
# print "Turning ON MWI for $mailbox\@$context\n" if $DEBUG > 0;
print OUT "Turning ON MWI for $mailbox\@$context\n";
print OUT $callFile if $DEBUG > 0;
open(CF2, ">$callFileTEMP2");
my $notifyNumber = getNotifyNumber($mailbox);
my $notifyMethod = $notifyNumber;
$notifyMethod = substr($notifyNumber,0,1);
$notifyNumber = substr($notifyNumber,1,10);
my $notifyFile = "";
my $qFile = "/var/spool/asterisk/outgoing/asterisk." . $rand2;
print OUT "\$qfile = $qFile\n" if $DEBUG > 0;
if ($notifyMethod eq 'm') {
$notifyFile = $notifyFileM;
} elsif ( $notifyMethod eq 'p' ) {
$notifyFile = $notifyFileP;
}
if ( $notifyNumber != 0 ) {
$notifyFile =~ s/CALLTHISNUMBER/$notifyNumber/;
if ($notifyMethod eq 'p' ) {
$notifyFile =~ s/EXTENSION/$mailbox/;
} else {
$notifyFile =~ s/EXTENSION/$mailbox\@$context/;
}
print CF2 $notifyFile;
if ($DEBUG > 0 ) {
print OUT "---\n";
print OUT $notifyFile;
print OUT "---\n";
}
close CF2;
rename($callFileTEMP2, $qFile) or print(OUT "ERROR: Can't rename callfile($callFileTEMP2): $!\n");
}
} else {
$callFile =~ s/CALLTHISNUMBER/$mwiOff$mailbox/;
#print "Turning OFF MWI for $mailbox\@$context\n" if $DEBUG > 0;
print OUT "Turning OFF MWI for $mailbox\@$context\n";
print OUT $callFile if $DEBUG > 0;
}
print CF $callFile;
close CF;
# put it in the outgoing queue
rename($callFileTEMP, "/var/spool/asterisk/outgoing/asterisk.$$") or print(OUT "ERROR: Can't rename callfile($callFileTEMP): $!\n");
# update the new message count
open(UPDATECMD, ">$CMDPath");
print UPDATECMD $messages;
close UPDATECMD;
print OUT "-"x80 . "\n";
close OUT;
sub getNotifyNumber {;
my $NotifyPath = $currentNotifyDir . $context . "/" . $mailbox;
if ( -e $NotifyPath ) {
open(CURRENT, "<$NotifyPath");
$notifyNumber =
close CURRENT;
chomp $notifyNumber;
print OUT "notifyNumber = \"$notifyNumber\"\n" if $DEBUG > 0;
return $notifyNumber;
} else {
return 0;
}
}
If you want conf files via email...just write me... matt@tycal.com
- Matt