mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
FS-9564 [avmd]: add lagged detectors
Addition of detectors which skip first few frames of audio before they start to process it helps to properly handle some Verizon voicemails. The result of avmd test using this commit is OK. All PASS [100] Thi scommit also resolves: FS-9588 Add script for outbound avmdy FS-9589 Add resolution info to events
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
|
||||
#brief Call single voicemail available in default dialplan
|
||||
# and print detection result to the console.
|
||||
#brief Call single voicemail and print detection result to the console.
|
||||
#author Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
#date 15 Sept 2016 02:44 PM
|
||||
|
||||
@@ -74,7 +73,7 @@ sub test_once {
|
||||
|
||||
my $uuid = $con->api('create_uuid')->getBody();
|
||||
my ($time_epoch, $time_hires) = Time::HiRes::gettimeofday();
|
||||
printf("Calling with uuid [%s] [%s]...\n", $uuid, POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime($time_epoch)), $time_hires);
|
||||
printf("Calling with uuid [%s] [%s]...\n", $uuid, POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime($time_epoch)));
|
||||
|
||||
$con->bgapi(sprintf($originate_string, $uuid));
|
||||
|
||||
|
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
|
||||
#brief Call (possibly) multiple voicemails
|
||||
# and print detection result to the console.
|
||||
#author Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
#date 15 Sept 2016 02:44 PM
|
||||
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
require ESL;
|
||||
use POSIX;
|
||||
use Time::HiRes;
|
||||
|
||||
my $host = "127.0.0.1";
|
||||
my $port = "8021";
|
||||
my $pass = "ClueCon";
|
||||
my $extension_base = "sofia/internal/1000\@192.168.1.60";
|
||||
|
||||
my $playback = 'local_stream://moh';
|
||||
my $context = 'default';
|
||||
#Example:
|
||||
#my $endpoint = "originate {originator_codec=PCMA,origination_uuid=%s}sofia/gateway/box_b/840534002 \&park()";
|
||||
my $endpoint = "originate {originator_codec=PCMA,origination_uuid=%s}sofia/gateway/%s/%s \&park()";
|
||||
my $gateway;
|
||||
my $dest;
|
||||
my $callerid;
|
||||
my $thread_n;
|
||||
my $idx = 0;
|
||||
|
||||
|
||||
if ($#ARGV + 1 eq 4) {
|
||||
$gateway = $ARGV[0];
|
||||
$dest = $ARGV[1];
|
||||
$callerid = $ARGV[2];
|
||||
$thread_n = $ARGV[3];
|
||||
print "Dialing [" .$thread_n ."] calls simultaneously to [" .$gateway ."][" .$dest ."] as [" .$callerid ."]\n";
|
||||
} else {
|
||||
die "Please specify gateway, destination number, caller id and number of calls to make\n";
|
||||
}
|
||||
|
||||
my $con = new ESL::ESLconnection($host, $port, $pass);
|
||||
if (!$con) {
|
||||
die "Unable to establish connection to $host:$port\n";
|
||||
}
|
||||
if ($con->connected()) {
|
||||
print "OK, Connected.\n";
|
||||
} else {
|
||||
die "Connection failure.\n";
|
||||
}
|
||||
|
||||
while($con->connected() && ($idx < $thread_n)) {
|
||||
call_once($dest, $callerid, $idx);
|
||||
$idx++;
|
||||
Time::HiRes::sleep(0.15); # avoid switch_core_session.c:2265 Throttle Error! 33, switch_time.c:1227 Over Session Rate of 30!
|
||||
}
|
||||
|
||||
print "Disconnected.\n\n";
|
||||
|
||||
sub call_once {
|
||||
my ($dest, $callerid, $idx) = @_;
|
||||
my $uuid =
|
||||
my $originate_string =
|
||||
'originate ' .
|
||||
'{ignore_early_media=true,' .
|
||||
'originator_codec=PCMA,' .
|
||||
'origination_uuid=%s,' .
|
||||
'originate_timeout=60,' .
|
||||
'origination_caller_id_number=' . $callerid . ',' .
|
||||
'origination_caller_id_name=' . $callerid . '}';
|
||||
|
||||
if(defined($endpoint)) {
|
||||
$originate_string = '';
|
||||
$originate_string .= $endpoint;
|
||||
} else {
|
||||
$originate_string .= 'loopback/' . $dest . '/' . $context;
|
||||
$originate_string .= ' ' . '&playback(' . $playback . ')';
|
||||
}
|
||||
|
||||
my $uuid = $con->api('create_uuid')->getBody();
|
||||
my ($time_epoch, $time_hires) = Time::HiRes::gettimeofday();
|
||||
printf("[%s]\tCalling with uuid [%s] [%s]... [%s]\n", $idx + 1, $uuid, POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime($time_epoch)), $originate_string);
|
||||
|
||||
$con->bgapi(sprintf($originate_string, $uuid, $gateway, $dest));
|
||||
$con->api('uuid_setvar ' . $uuid .' execute_on_answer avmd_start');
|
||||
}
|
@@ -1,13 +1,13 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
|
||||
#brief Test module avmd by calling all voicemails available
|
||||
# in avmd test suite and print detection results to the console.
|
||||
#brief Test module avmd by calling voicemails from avmd test suite
|
||||
# and print detection results to the console.
|
||||
#author Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
#details If you are testing serving voicemails from dialplan then avmd
|
||||
# must be set to inbound mode, either globally (by avmd set inbound
|
||||
# in fs_cli) or in dialplan settings (<action application="avmd_start"
|
||||
# data="inbound_channel=1,outbound_channel=0").
|
||||
# data="inbound_channel=1,outbound_channel=0") or dynamically per call.
|
||||
#date 15 Sept 2016 03:00 PM
|
||||
|
||||
|
||||
@@ -114,6 +114,13 @@ my %numbers = (
|
||||
840531212 => "DETECTED",
|
||||
840531213 => "DETECTED",
|
||||
840531214 => "DETECTED",
|
||||
840531400 => "DETECTED", # obscure voicemails ATT pack
|
||||
840531401 => "DETECTED",
|
||||
840531402 => "DETECTED",
|
||||
840531403 => "DETECTED",
|
||||
840531404 => "DETECTED",
|
||||
840531405 => "DETECTED",
|
||||
840531051 => "NOTDETECTED", # fragment of "Save tonight" by Eagle-Eye Cherry covered by D-Lete-Funk-K
|
||||
);
|
||||
|
||||
my $host = "127.0.0.1";
|
||||
@@ -122,7 +129,7 @@ my $pass = "ClueCon";
|
||||
my $extension_base = "sofia/internal/1000\@192.168.1.60";
|
||||
|
||||
my $playback = 'local_stream://moh';
|
||||
my $context = 'default';
|
||||
my $context = 'default';
|
||||
my $endpoint;
|
||||
my $dest;
|
||||
my $expectation;
|
||||
@@ -162,7 +169,7 @@ $con->events("plain", "CHANNEL_HANGUP");
|
||||
print "OK.\n\n";
|
||||
printf("\nRunning [" .keys(%numbers) ."] tests.\n\n");
|
||||
|
||||
printf("outbound uuid | destination number | timestamp | expectation | test result\n\n");
|
||||
printf("outbound uuid | destination number | timestamp | expectation | test result | freq | f-variance | amplitude | a-variance\n\n");
|
||||
foreach $dest (sort keys %numbers) {
|
||||
if (!$con->connected()) {
|
||||
last;
|
||||
@@ -182,7 +189,7 @@ sub test_once {
|
||||
my $originate_string =
|
||||
'originate ' .
|
||||
'{ignore_early_media=true,' .
|
||||
'origination_uuid=%s,' .
|
||||
'origination_uuid=%s,' .
|
||||
'originate_timeout=60,' .
|
||||
'origination_caller_id_number=' . $callerid . ',' .
|
||||
'origination_caller_id_name=' . $callerid . '}';
|
||||
@@ -192,6 +199,11 @@ sub test_once {
|
||||
my $uuid_in = "";
|
||||
my $freq = "N/A";
|
||||
my $freq_var = "N/A";
|
||||
my $amp = "N/A";
|
||||
my $amp_var = "N/A";
|
||||
my $resolution = "N/A";
|
||||
my $offset = "N/A";
|
||||
my $idx = "N/A";
|
||||
|
||||
if(defined($endpoint)) {
|
||||
$originate_string .= $endpoint;
|
||||
@@ -220,6 +232,11 @@ sub test_once {
|
||||
if ($avmd_event_type eq 'avmd::beep') {
|
||||
$freq = $e->getHeader("Frequency");
|
||||
$freq_var = $e->getHeader("Frequency-variance");
|
||||
$amp = $e->getHeader("Amplitude");
|
||||
$amp_var = $e->getHeader("Amplitude-variance");
|
||||
$resolution = $e->getHeader("Detector-resolution");
|
||||
$offset = $e->getHeader("Detector-offset");
|
||||
$idx = $e->getHeader("Detector-index");
|
||||
}
|
||||
$outcome = $e->getHeader("Beep-Status");
|
||||
if ($outcome eq $expectation) {
|
||||
@@ -243,6 +260,6 @@ sub test_once {
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\t[%s]\t[%s]\t\t[%s]\t[%s]HZ\t[%s]\n", POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime($time_epoch)), $expectation, $result, $freq, $freq_var);
|
||||
printf("\t[%s]\t[%s]\t\t[%s]\t[%s]HZ\t[%s]\t[%s]\t[%s]\t[%s][%s][%s]\n", POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime($time_epoch)), $expectation, $result, $freq, $freq_var, $amp, $amp_var, $resolution, $offset, $idx);
|
||||
Time::HiRes::sleep(0.5); # avoid switch_core_session.c:2265 Throttle Error! 33, switch_time.c:1227 Over Session Rate of 30!
|
||||
}
|
||||
|
Reference in New Issue
Block a user