From af788f159a023b034e07262aef6c1eb60500a2b1 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 18 Mar 2016 12:35:08 -0400 Subject: [PATCH] additioanl tests and flags Change-Id: I61a94139261e94aae04ce9af6f883e75d177e2f4 --- perl/Rtpengine/Test.pm | 7 +++++-- utils/test-unidirectional.pl | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 utils/test-unidirectional.pl diff --git a/perl/Rtpengine/Test.pm b/perl/Rtpengine/Test.pm index 0613ec5f1..372a58c48 100644 --- a/perl/Rtpengine/Test.pm +++ b/perl/Rtpengine/Test.pm @@ -19,7 +19,7 @@ use RTP; use Rtpengine; sub new { - my ($class) = @_; + my ($class, %args) = @_; my $self = {}; bless $self, $class; @@ -53,7 +53,7 @@ sub new { $self->{timers} = []; $self->{clients} = []; - $self->{control} = Rtpengine->new('localhost', 2223); + $self->{control} = Rtpengine->new($args{host} // 'localhost', $args{port} // 2223); $self->{callid} = rand(); return $self; @@ -262,6 +262,9 @@ sub _default_req_args { for my $cp (qw(sdp from-tag to-tag ICE transport-protocol address-family)) { $args{$cp} and $req->{$cp} = $args{$cp}; } + for my $cp (@{$args{flags}}) { + push(@{$req->{flags}}, $cp); + } return $req; } diff --git a/utils/test-unidirectional.pl b/utils/test-unidirectional.pl new file mode 100644 index 000000000..7eda11e57 --- /dev/null +++ b/utils/test-unidirectional.pl @@ -0,0 +1,22 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use Rtpengine::Test; +use IO::Socket; + +my $r = Rtpengine::Test->new(host => '192.168.1.128'); +my ($a, $b) = $r->client_pair( + {sockdomain => &Socket::AF_INET}, + {sockdomain => &Socket::AF_INET} +); + +$r->timer_once(3, sub { $b->answer($a, ICE => 'remove', flags => ['unidirectional']); }); +$r->timer_once(10, sub { $r->stop(); }); + +$a->offer($b, ICE => 'remove', flags => ['unidirectional']); +$b->start_rtp(); + +$r->run(); + +$a->delete();