代码拉取完成,页面将自动刷新
#!/usr/bin/perl
use strict;
use warnings;
use NGCP::Rtpengine::Test;
use IO::Socket;
my $iterations = 10;
my @interfaces = qw(int ext);
my @domains = (&Socket::AF_INET);
my $r = NGCP::Rtpengine::Test->new(media_port => 50000);
for my $a_domain (@domains) {
for my $b_domain (@domains) {
if (!@interfaces) {
for (1 .. $iterations) {
run_test([], $a_domain, $b_domain);
}
}
else {
for my $a_interface (@interfaces) {
for my $b_interface (@interfaces) {
for (1 .. $iterations) {
run_test([$a_interface, $b_interface], $a_domain, $b_domain);
}
}
}
}
}
}
sub run_test {
my ($directions, $a_domain, $b_domain) = @_;
print("Testing directions @{$directions} between $a_domain and $b_domain\n");
my ($a, $b) = $r->client_pair(
{sockdomain => $a_domain},
{sockdomain => $b_domain}
);
print("Offering with address: " . $a->{sockets}->[0]->[0]->sockhost . "\n");
my %dir_arg = ();
$dir_arg{direction} = $directions if @{$directions};
$a->offer($b, ICE => 'remove', label => "caller", %dir_arg);
print("Offer out with address: " . $b->{remote_media}->connection->{address} . "\n");
print("Answering with address: " . $b->{sockets}->[0]->[0]->sockhost . "\n");
$b->answer($a, ICE => 'remove', label => "callee");
print("Answer out with address: " . $a->{remote_media}->connection->{address} . "\n");
$a->teardown();
print("\n");
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。