mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-26 04:27:25 +00:00
FS-9595 [avmd] Extend avmd show api
Add number of sessions currently running to output of avmd show api.
This commit is contained in:
parent
de223ea2c6
commit
b24c2ac945
@ -943,6 +943,7 @@ static void avmd_show(switch_stream_handle_t *stream, switch_mutex_t *mutex) {
|
|||||||
stream->write_function(stream, "inbound channel \t%u\n", avmd_globals.settings.inbound_channnel);
|
stream->write_function(stream, "inbound channel \t%u\n", avmd_globals.settings.inbound_channnel);
|
||||||
stream->write_function(stream, "outbound channel \t%u\n", avmd_globals.settings.outbound_channnel);
|
stream->write_function(stream, "outbound channel \t%u\n", avmd_globals.settings.outbound_channnel);
|
||||||
stream->write_function(stream, "detection mode \t%u\n", avmd_globals.settings.mode);
|
stream->write_function(stream, "detection mode \t%u\n", avmd_globals.settings.mode);
|
||||||
|
stream->write_function(stream, "sessions \t%"PRId64"\n", avmd_globals.session_n);
|
||||||
stream->write_function(stream, "\n\n");
|
stream->write_function(stream, "\n\n");
|
||||||
|
|
||||||
if (mutex != NULL) {
|
if (mutex != NULL) {
|
||||||
|
@ -16,7 +16,7 @@ use Time::HiRes;
|
|||||||
my $host = "127.0.0.1";
|
my $host = "127.0.0.1";
|
||||||
my $port = "8021";
|
my $port = "8021";
|
||||||
my $pass = "ClueCon";
|
my $pass = "ClueCon";
|
||||||
my $extension_base = "sofia/internal/1000\@192.168.1.60";
|
my $extension_base = "sofia/internal/1000\@192.168.1.1";
|
||||||
|
|
||||||
my $playback = 'local_stream://moh';
|
my $playback = 'local_stream://moh';
|
||||||
my $context = 'default';
|
my $context = 'default';
|
||||||
|
@ -0,0 +1,78 @@
|
|||||||
|
#!/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.1";
|
||||||
|
|
||||||
|
my $playback = 'local_stream://moh';
|
||||||
|
my $context = 'default';
|
||||||
|
my $gateway;
|
||||||
|
my $dest;
|
||||||
|
my $callerid;
|
||||||
|
my $thread_n;
|
||||||
|
my $idx = 0;
|
||||||
|
|
||||||
|
|
||||||
|
if ($#ARGV + 1 eq 3) {
|
||||||
|
$dest = $ARGV[0];
|
||||||
|
$callerid = $ARGV[1];
|
||||||
|
$thread_n = $ARGV[2];
|
||||||
|
print "Dialing [" .$thread_n ."] calls simultaneously to [loopback][" .$dest ."] as [" .$callerid ."]\n";
|
||||||
|
} else {
|
||||||
|
die "Please specify 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.11); # 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 . '}';
|
||||||
|
|
||||||
|
$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));
|
||||||
|
$con->api('uuid_setvar ' . $uuid .' execute_on_answer avmd_start');
|
||||||
|
}
|
@ -169,7 +169,7 @@ $con->events("plain", "CHANNEL_HANGUP");
|
|||||||
print "OK.\n\n";
|
print "OK.\n\n";
|
||||||
printf("\nRunning [" .keys(%numbers) ."] tests.\n\n");
|
printf("\nRunning [" .keys(%numbers) ."] tests.\n\n");
|
||||||
|
|
||||||
printf("outbound uuid | destination number | timestamp | expectation | test result | freq | f-variance | amplitude | a-variance\n\n");
|
printf("outbound uuid | destination number | timestamp | expectation | test result | freq | f-variance | amplitude | a-variance | resolution | offset | idx\n\n");
|
||||||
foreach $dest (sort keys %numbers) {
|
foreach $dest (sort keys %numbers) {
|
||||||
if (!$con->connected()) {
|
if (!$con->connected()) {
|
||||||
last;
|
last;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user