diff --git a/functions b/functions index 45b6deb..6b68a44 100755 --- a/functions +++ b/functions @@ -84,6 +84,10 @@ then BOB_TIMEOUT=90 TEST_SET="${TEST_SET},11,12,13,14,reinv_brkn1,reinv_brkn2,reinv_bad_ack" fi +if [ "${MM_TYPE}" = "b2bua" ] +then + TEST_SET="${TEST_SET},inv_brkn1" +fi #if [ "${MM_TYPE}" != "opensips" -o "${MM_BRANCH}" = "1.11" ] #then diff --git a/lib/alice_testcore.py b/lib/alice_testcore.py index a6a125b..2913ad0 100644 --- a/lib/alice_testcore.py +++ b/lib/alice_testcore.py @@ -55,13 +55,14 @@ from ..test_cases.reinv_adelay import a_test_reinv_adelay from ..test_cases.reinv_frombob import a_test_reinv_frombob from ..test_cases.reinv_bad_ack import a_test_reinv_bad_ack +from ..test_cases.inv_brkn1 import a_test_inv_brkn1 ALL_TESTS = (a_test1, a_test2, a_test3, a_test4, a_test5, a_test6, a_test7, \ a_test8, a_test9, a_test10, a_test11, a_test12, a_test13, a_test14, \ a_test_early_cancel, a_test_early_cancel_lost100, a_test_reinvite, \ a_test_reinv_fail, a_test_reinv_brkn1, a_test_reinv_brkn2, \ a_test_reinv_onhold, a_test_reinv_adelay, a_test_reinv_frombob, \ - a_test_reinv_bad_ack) + a_test_reinv_bad_ack, a_test_inv_brkn1) class a_cfg(object): test_class = None diff --git a/lib/bob_testcore.py b/lib/bob_testcore.py index 4dd5d24..5b07ff2 100644 --- a/lib/bob_testcore.py +++ b/lib/bob_testcore.py @@ -57,13 +57,14 @@ from ..test_cases.reinv_adelay import b_test_reinv_adelay from ..test_cases.reinv_frombob import b_test_reinv_frombob from ..test_cases.reinv_bad_ack import b_test_reinv_bad_ack +from ..test_cases.inv_brkn1 import b_test_inv_brkn1 ALL_TESTS = (b_test1, b_test2, b_test3, b_test4, b_test5, b_test6, b_test7, \ b_test8, b_test9, b_test10, b_test11, b_test12, b_test13, b_test14, \ b_test_early_cancel, b_test_early_cancel_lost100, b_test_reinvite, \ b_test_reinv_fail, b_test_reinv_brkn1, b_test_reinv_brkn2, \ b_test_reinv_onhold, b_test_reinv_adelay, b_test_reinv_frombob, \ - b_test_reinv_bad_ack) + b_test_reinv_bad_ack, b_test_inv_brkn1) class STMHooks(object): lossemul = 0 diff --git a/rtpproxy.b2bua.output b/rtpproxy.b2bua.output index 2b71627..20b084e 100644 --- a/rtpproxy.b2bua.output +++ b/rtpproxy.b2bua.output @@ -1,5 +1,5 @@ -nsess_created=46 nsess_destroyed=42 nsess_timeout=4 nsess_complete=30 nsess_nortp=26 nsess_owrtp=0 nsess_nortcp=26 nsess_owrtcp=0 -ncmds_rcvd=167 ncmds_succd=162 ncmds_errs=4 ncmds_repld=166 -nsess_created=46 nsess_destroyed=46 nsess_timeout=8 nsess_complete=30 nsess_nortp=30 nsess_owrtp=0 nsess_nortcp=30 nsess_owrtcp=0 -ncmds_rcvd=173 ncmds_succd=164 ncmds_errs=8 ncmds_repld=172 +nsess_created=48 nsess_destroyed=44 nsess_timeout=4 nsess_complete=30 nsess_nortp=26 nsess_owrtp=0 nsess_nortcp=26 nsess_owrtcp=0 +ncmds_rcvd=171 ncmds_succd=166 ncmds_errs=4 ncmds_repld=170 +nsess_created=48 nsess_destroyed=48 nsess_timeout=8 nsess_complete=30 nsess_nortp=30 nsess_owrtp=0 nsess_nortcp=30 nsess_owrtcp=0 +ncmds_rcvd=177 ncmds_succd=168 ncmds_errs=8 ncmds_repld=176 MEMDEB(rtpproxy): all clear diff --git a/test_cases/inv_brkn1.py b/test_cases/inv_brkn1.py new file mode 100644 index 0000000..30a9cdf --- /dev/null +++ b/test_cases/inv_brkn1.py @@ -0,0 +1,75 @@ +# Copyright (c) 2016 Sippy Software, Inc. All rights reserved. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +from .t2 import a_test2 as a_test_inv, b_test2 as b_test_inv + +from sippy.CCEvents import CCEventTry, CCEventRing, CCEventFail, CCEventDisconnect + +def cripple_body(self, sdp_body): + sdp_body = sdp_body.getCopy() + for sect in sdp_body.content.sections: + if sect.m_header.transport.lower() not in ('udp', 'udptl', 'rtp/avp'): + continue + sect.c_header = None + if sect.m_header.port + self.p_incr <= 0: + self.p_incr = -self.p_incr + sect.m_header.port += self.p_incr + self.p_incr = -self.p_incr + sdp_body.content.o_header.version += 1 + return sdp_body + +class a_test_inv_brkn1(a_test_inv): + cld = 'bob_inv_brkn1' + cli = 'alice_inv_brkn1' + + def alldone(self, ua): + if self.disconnect_done and self.nerrs == 0: + self.rval = 0 + self.tccfg.done_cb(self) + + def recvEvent(self, event, ua): + if isinstance(event, CCEventTry): + return (super().recvEvent(event, ua)) + if isinstance(event, CCEventRing) and event.getData()[0] == 100: + return (super().recvEvent(event, ua)) + if self.connect_done or not isinstance(event, (CCEventFail, CCEventDisconnect)): + self.nerrs += 1 + raise ValueError(f'{self.failed_msg()}: INVITE has NOT failed with {event}') + return (super().recvEvent(event, ua)) + +class b_test_inv_brkn1(b_test_inv): + cli = 'bob_inv_brkn1' + p_incr = -10 + + def ring(self, ua): + if self.connect_done or self.disconnect_done: + return + self.body = cripple_body(self, self.body) + super().ring(ua) + + def alldone(self, ua): + if self.ring_done and not self.connect_done and self.disconnect_done and self.nerrs == 0: + self.rval = 0 + self.tccfg.done_cb(self)