[asterisk-commits] jrose: testsuite/asterisk/trunk r4801 - in /asterisk/trunk/tests/channels: SI...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Mar 7 09:58:14 CST 2014
Author: jrose
Date: Fri Mar 7 09:58:12 2014
New Revision: 4801
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4801
Log:
Testsuite: SIP hold tests with ICE for chan_sip and chan_pjsip
(closes issue ASTERISK-23213)
Reported by: Andrea Suisani
(closes issue ASTERISK-22911)
Reported by: Vytis Valentinavičius
Review: https://reviewboard.asterisk.org/r/3255/
Review: https://reviewboard.asterisk.org/r/3286/
Added:
asterisk/trunk/tests/channels/SIP/sip_hold_ice/
asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/
asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/
asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/extensions.conf (with props)
asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/rtp.conf (with props)
asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/sip.conf (with props)
asterisk/trunk/tests/channels/SIP/sip_hold_ice/run-test (with props)
asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/
asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/inject_bridge.csv (with props)
asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_A.xml (with props)
asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_B.xml (with props)
asterisk/trunk/tests/channels/SIP/sip_hold_ice/test-config.yaml (with props)
asterisk/trunk/tests/channels/pjsip/hold_ice/
asterisk/trunk/tests/channels/pjsip/hold_ice/configs/
asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/
asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/extensions.conf (with props)
asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/pjsip.conf (with props)
asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/rtp.conf (with props)
asterisk/trunk/tests/channels/pjsip/hold_ice/run-test (with props)
asterisk/trunk/tests/channels/pjsip/hold_ice/sipp/
asterisk/trunk/tests/channels/pjsip/hold_ice/sipp/inject.csv (with props)
asterisk/trunk/tests/channels/pjsip/hold_ice/sipp/phone_A.xml (with props)
asterisk/trunk/tests/channels/pjsip/hold_ice/sipp/phone_B.xml (with props)
asterisk/trunk/tests/channels/pjsip/hold_ice/test-config.yaml (with props)
Modified:
asterisk/trunk/tests/channels/SIP/tests.yaml
asterisk/trunk/tests/channels/pjsip/tests.yaml
Added: asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/extensions.conf?view=auto&rev=4801
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/extensions.conf Fri Mar 7 09:58:12 2014
@@ -1,0 +1,7 @@
+[general]
+PHONE_TO_DIAL=SIP/phone_B
+
+[default]
+exten => basicdial,1,NoOp()
+ same => n,Dial(SIP/phone_B)
+ same => n,Hangup()
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/rtp.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/rtp.conf?view=auto&rev=4801
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/rtp.conf (added)
+++ asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/rtp.conf Fri Mar 7 09:58:12 2014
@@ -1,0 +1,5 @@
+[general]
+rtpstart=10000
+rtpend=20000
+icesupport=yes
+stunaddr=stun.l.google.com:19302
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/rtp.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/rtp.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/rtp.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/sip.conf?view=auto&rev=4801
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/sip.conf Fri Mar 7 09:58:12 2014
@@ -1,0 +1,29 @@
+[general]
+allowguest=no
+bindaddr=0.0.0.0
+sipdebug=yes
+directmedia=no
+
+[phone_A]
+type=friend
+context=default
+disallow=all
+allow=ulaw
+qualify=no
+insecure=invite
+host=127.0.0.2
+port=6080
+icesupport=yes
+avpf=yes
+
+[phone_B]
+type=friend
+context=default
+disallow=all
+allow=ulaw
+qualify=no
+insecure=invite
+host=127.0.0.3
+port=6081
+nat=no
+
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/sip_hold_ice/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_hold_ice/run-test?view=auto&rev=4801
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_hold_ice/run-test (added)
+++ asterisk/trunk/tests/channels/SIP/sip_hold_ice/run-test Fri Mar 7 09:58:12 2014
@@ -1,0 +1,180 @@
+#!/usr/bin/env python
+"""
+Copyright (C) 2014, Digium, Inc.
+Jonathan Rose <jrose at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+"""
+
+import sys
+import logging
+
+sys.path.append("lib/python")
+
+from asterisk.test_case import TestCase
+from asterisk.sipp import SIPpScenario
+from twisted.internet import reactor
+from asterisk.version import AsteriskVersion
+
+LOGGER = logging.getLogger(__name__)
+INJECT_FILE_BRIDGE = "inject_bridge.csv"
+
+
+class SIPHold(TestCase):
+ """TestCase to execute and evaluate SIP hold/unhold with ICE scenario """
+
+ def __init__(self):
+ """ Constructor """
+ TestCase.__init__(self)
+ self.create_asterisk()
+
+ running_version = AsteriskVersion()
+
+ if (running_version < AsteriskVersion("12.0.0")):
+ #Pre-12
+ self.asterisk12Events = False
+ else:
+ self.asterisk12Events = True
+
+ self.sipp_phone_a_scenario = {'scenario': 'phone_A.xml',
+ '-i': '127.0.0.2',
+ '-p': ' 6080',
+ '-inf': INJECT_FILE_BRIDGE}
+ self.sipp_phone_b_scenario = {'scenario': 'phone_B.xml',
+ '-i': '127.0.0.3',
+ '-p': '6081',
+ '-inf': INJECT_FILE_BRIDGE}
+
+ self.moh_start_event = False
+ self.moh_stop_event = False
+ self.check_list_success_events = 0
+
+ def ami_connect(self, ami):
+ """ Reaction to new AMI connection
+
+ :param ami: AMI connection that was established
+ """
+ TestCase.ami_connect(self, ami)
+
+ ami.registerEvent('TestEvent', self.test_event_handler)
+
+ if self.asterisk12Events:
+ ami.registerEvent('MusicOnHoldStart', self.moh_start_event_handler)
+ ami.registerEvent('MusicOnHoldStop', self.moh_stop_event_handler)
+ else:
+ ami.registerEvent('MusicOnHold', self.moh_event_handler)
+
+ LOGGER.info("Starting SIP scenario")
+ self.execute_scenario()
+
+ def execute_scenario(self):
+ """Execute sipp scenarios and check results for a single test phase
+ """
+ sipp_a = SIPpScenario(self.test_name, self.sipp_phone_a_scenario)
+ sipp_b = SIPpScenario(self.test_name, self.sipp_phone_b_scenario)
+
+ # Start up the listener first - Phone A calls Phone B
+ sipp_b.run(self)
+ sipp_a.run(self)
+
+ def handle_checklist_create(self, ami, event):
+ """ Reacts to ICECHECKLISTCREATE user events
+
+ :param ami AMI connection the event was received from
+ :param event Event that was received
+ """
+ if event.get('result') == 'SUCCESS':
+ self.check_list_success_events += 1
+ LOGGER.debug("Received create check list success")
+ if self.check_list_success_events == 2 and \
+ self.moh_stop_event:
+ self.evaluate_success()
+ self.stop_reactor()
+ else:
+ LOGGER.error("Failed to create check list - test failed")
+ self.set_passed(False)
+ self.stop_reactor()
+
+ def test_event_handler(self, ami, event):
+ """ Reacts to User Events and routes them based on their State Value
+
+ :param ami AMI connection the event was received from
+ :param event Event that was received
+ """
+ if event.get('state') == 'ICECHECKLISTCREATE':
+ self.handle_checklist_create(ami, event)
+
+ def moh_start_event_handler(self, ami, event):
+ """ Reacts to music on hold start events and tallies them.
+
+ :param ami: AMI connection the event was received from
+ :param event: Event that was received
+ """
+ LOGGER.debug("Received MOH start event")
+ self.moh_start_event = True
+
+ def moh_stop_event_handler(self, ami, event):
+ """ Reacts to music on hold stop events and tallies them.
+
+ :param ami: AMI connection the event was received from
+ :param event: Event that was received
+ """
+ LOGGER.debug("Received MOH stop event")
+ self.moh_stop_event = True
+ if self.check_list_success_events == 2:
+ self.evaluate_success()
+ self.stop_reactor()
+
+ def moh_event_handler(self, ami, event):
+ """ Reacts to MusicOnHold events (legacy events from Asterisk <= 11)
+
+ :param ami: AMI connection the event was received from
+ :param event: Event that was received
+ """
+ if event.get('state') == "Start":
+ LOGGER.debug("Received MOH start event")
+ self.moh_start_event = True
+ elif event.get('state') == "Stop":
+ LOGGER.debug("Received MOH stop event")
+ self.moh_stop_event = True
+ if self.check_list_success_events == 2:
+ self.evaluate_success()
+ self.stop_reactor()
+
+ def run(self):
+ """ Run the test and create an AMI connection """
+ TestCase.run(self)
+ self.create_ami_factory()
+
+ def evaluate_success(self):
+ """ Determine whether all of the conditions for passing the test
+ have been met and raise passed flag accordingly.
+ """
+ if not self.moh_start_event:
+ LOGGER.error("Failed to receive MOH start event")
+ self.set_passed(False)
+ if not self.moh_stop_event:
+ LOGGER.error("Failed to receive MOH stop event")
+ self.set_passed(False)
+ if not self.check_list_success_events == 2:
+ LOGGER.error("Expected 2 check list creation events. Got %d\n" %
+ self.check_list_success_events)
+ self.set_passed(False)
+
+ self.set_passed(True)
+
+
+def main():
+ test = SIPHold()
+ reactor.run()
+ if test.passed:
+ return 0
+ return 1
+
+
+if __name__ == "__main__":
+ sys.exit(main())
+
+
+# vim:sw=4:ts=4:expandtab:textwidth=79
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/run-test
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/inject_bridge.csv
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/inject_bridge.csv?view=auto&rev=4801
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/inject_bridge.csv (added)
+++ asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/inject_bridge.csv Fri Mar 7 09:58:12 2014
@@ -1,0 +1,2 @@
+SEQUENTIAL
+phone_A;phone_B;basicdial
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/inject_bridge.csv
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/inject_bridge.csv
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/inject_bridge.csv
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_A.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_A.xml?view=auto&rev=4801
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_A.xml (added)
+++ asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_A.xml Fri Mar 7 09:58:12 2014
@@ -1,0 +1,222 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Phone A Hold with IP and Media Restrictions">
+
+ <send retrans="500">
+ <![CDATA[
+ INVITE sip:[field2]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: [field0] <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
+ To: <sip:[field2]@[remote_ip]:[remote_port];user=phone>
+ CSeq: 1 INVITE
+ Call-ID: [call_id]
+ Contact: <sip:[field0]@[local_ip]:[local_port]>
+ Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER
+ User-Agent: PolycomSoundPointIP-SPIP_430-UA/3.2.3.1734
+ Accept-Language: en
+ Allow-Events: talk,hold,conference
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 1324901698 1324901698 IN IP4 [local_ip]
+ s=Polycom IP Phone
+ c=IN IP4 [local_ip]
+ t=0 0
+ a=sendrecv
+ m=audio 2226 RTP/AVP 0 101
+ a=sendrecv
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:101 telephone-event/8000
+ a=candidate:474352566 1 udp 2113937151 10.24.16.82 58057 typ host generation 0
+ a=candidate:474352566 2 udp 2113937151 10.24.16.82 58057 typ host generation 0
+ a=candidate:3038348387 1 udp 1845501695 216.207.245.1 58057 typ srflx raddr 10.24.16.82 rport 58057 generation 0
+ a=candidate:3038348387 2 udp 1845501695 216.207.245.1 58057 typ srflx raddr 10.24.16.82 rport 58057 generation 0
+ a=candidate:1388705606 1 tcp 1509957375 10.24.16.82 0 typ host generation 0
+ a=candidate:1388705606 2 tcp 1509957375 10.24.16.82 0 typ host generation 0
+ a=ice-ufrag:/c7ZXBQs6LexKQPT
+ a=ice-pwd:pWzGkNwkFPRpcmVo7In+1Tnn
+ a=ice-options:google-ice
+ ]]>
+ </send>
+
+ <recv response="100" optional="true" />
+
+ <recv response="180" optional="true" />
+
+ <recv response="183" optional="true" />
+
+ <recv response="200" />
+
+ <send>
+ <![CDATA[
+ ACK sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: [field0] <sip:[field0]@[remote_ip]>;tag=[call_number]
+ To: <sip:[field1]@[remote_ip];user=phone>[peer_tag_param]
+ CSeq: 1 ACK
+ Call-ID: [call_id]
+ Contact: <sip:[field0]@[local_ip]:[local_port]>
+ Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER
+ User-Agent: PolycomSoundPointIP-SPIP_430-UA/3.2.3.1734
+ Accept-Language: en
+ Max-Forwards: 70
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <!-- Wait some period of time -->
+ <pause milliseconds="3000"/>
+
+ <!-- Modify RTP session to be send only -->
+ <send retrans="500">
+ <![CDATA[
+ INVITE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: [field0] <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
+ To: [field1] <sip:[field0]@[remote_ip]>
+ CSeq: [cseq] INVITE
+ Call-ID: [call_id]
+ Contact: <sip:[field0]@[local_ip]:[local_port]>
+ Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER
+ User-Agent: PolycomSoundPointIP-SPIP_430-UA/3.2.3.1734
+ Accept-Language: en
+ Supported: 100rel,replaces
+ Allow-Events: talk,hold,conference
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 1325003603 1325003604 IN IP4 [local_ip]
+ s=Polycom IP Phone
+ c=IN IP4 [local_ip]
+ t=0 0
+ a=sendonly
+ m=audio 2226 RTP/AVP 0 101
+ a=sendonly
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:101 telephone-event/8000
+ a=candidate:474352566 1 udp 2113937151 10.24.16.82 58057 typ host generation 0
+ a=candidate:474352566 2 udp 2113937151 10.24.16.82 58057 typ host generation 0
+ a=candidate:3038348387 1 udp 1845501695 216.207.245.1 58057 typ srflx raddr 10.24.16.82 rport 58057 generation 0
+ a=candidate:3038348387 2 udp 1845501695 216.207.245.1 58057 typ srflx raddr 10.24.16.82 rport 58057 generation 0
+ a=candidate:1388705606 1 tcp 1509957375 10.24.16.82 0 typ host generation 0
+ a=candidate:1388705606 2 tcp 1509957375 10.24.16.82 0 typ host generation 0
+ a=ice-ufrag:/c7ZXBQs6LexKQPT
+ a=ice-pwd:pWzGkNwkFPRpcmVo7In+1Tnn
+ a=ice-options:google-ice
+ ]]>
+ </send>
+
+ <recv response="100" optional="true" />
+
+ <recv response="200" />
+ <send>
+ <![CDATA[
+ ACK sip:[field2]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: [field0] <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
+ To: <sip:[field2]@[remote_ip]>[peer_tag_param]
+ CSeq: [cseq] ACK
+ Call-ID: [call_id]
+ Contact: <sip:[field0]@[local_ip]:[local_port]>
+ Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER
+ User-Agent: PolycomSoundPointIP-SPIP_430-UA/3.2.3.1734
+ Accept-Language: en
+ Max-Forwards: 70
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <!-- Wait some period of time -->
+ <pause milliseconds="3000"/>
+
+ <!-- Unhold -->
+ <!-- Modify RTP session to be send/recv -->
+ <send retrans="500">
+ <![CDATA[
+ INVITE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: [field0] <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
+ To: [field1] <sip:[field0]@[remote_ip]>
+ CSeq: [cseq] INVITE
+ Call-ID: [call_id]
+ Contact: <sip:[field0]@[local_ip]:[local_port]>
+ Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER
+ User-Agent: PolycomSoundPointIP-SPIP_430-UA/3.2.3.1734
+ Accept-Language: en
+ Supported: 100rel,replaces
+ Allow-Events: talk,hold,conference
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 1325003603 1325003605 IN IP4 [local_ip]
+ s=Polycom IP Phone
+ c=IN IP4 [local_ip]
+ t=0 0
+ a=sendrecv
+ m=audio 2226 RTP/AVP 0 101
+ a=sendrecv
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:101 telephone-event/8000
+ a=candidate:474352566 1 udp 2113937151 10.24.16.82 43995 typ host generation 0
+ a=candidate:474352566 2 udp 2113937151 10.24.16.82 43995 typ host generation 0
+ a=candidate:3038348387 1 udp 1845501695 216.207.245.1 43995 typ srflx raddr 10.24.16.82 rport 43995 generation 0
+ a=candidate:3038348387 2 udp 1845501695 216.207.245.1 43995 typ srflx raddr 10.24.16.82 rport 43995 generation 0
+ a=candidate:1388705606 1 tcp 1509957375 10.24.16.82 0 typ host generation 0
+ a=candidate:1388705606 2 tcp 1509957375 10.24.16.82 0 typ host generation 0
+ a=ice-ufrag:ZBrSbiG7KWV6Oxfs
+ a=ice-pwd:fPY7kNj+q4x2sn6zACkKURp+
+ a=ice-options:google-ice
+ ]]>
+ </send>
+
+ <recv response="100" optional="true" />
+
+ <recv response="200" />
+
+ <send>
+ <![CDATA[
+ ACK sip:[field2]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: [field0] <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
+ To: <sip:[field2]@[remote_ip]>[peer_tag_param]
+ CSeq: [cseq] ACK
+ Call-ID: [call_id]
+ Contact: <sip:[field0]@[local_ip]:[local_port]>
+ Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER
+ User-Agent: PolycomSoundPointIP-SPIP_430-UA/3.2.3.1734
+ Accept-Language: en
+ Max-Forwards: 70
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <!-- Wait some period of time -->
+ <pause milliseconds="1000"/>
+
+ <send>
+ <![CDATA[
+ BYE sip:[field0]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/UDP [local_ip]:[local_port];branch=[branch]
+ From: [field0] <sip:[field1]@[local_ip]:[local_port]>;tag=[call_number]
+ To: [field1] <sip:[field1]@[remote_ip]>[peer_tag_param]
+ CSeq: [cseq] BYE
+ Call-ID: [call_id]
+ Contact: <sip:[field1]@[local_ip]:[local_port]>
+ User-Agent: PolycomSoundPointIP-SPIP_430-UA/3.2.3.1734
+ Accept-Language: en
+ Max-Forwards: 70
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv response="200" />
+
+
+</scenario>
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_A.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_A.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_A.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_B.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_B.xml?view=auto&rev=4801
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_B.xml (added)
+++ asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_B.xml Fri Mar 7 09:58:12 2014
@@ -1,0 +1,105 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Phone B Hold with Media Restrictions">
+
+ <recv request="INVITE" crlf="true" />
+
+ <send>
+ <![CDATA[
+ SIP/2.0 100 Trying
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[field1]@[local_ip]:[local_port];transport=[transport]>
+ User-Agent: PolycomSoundPointIP-SPIP_430-UA/3.2.3.1734
+ Accept-Language: en
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <send>
+ <![CDATA[
+ SIP/2.0 180 Ringing
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[field1]@[local_ip]:[local_port];transport=[transport]>
+ User-Agent: PolycomSoundPointIP-SPIP_430-UA/3.2.3.1734
+ Allow-Events: talk,hold,conference
+ Accept-Language: en
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <pause milliseconds="200"/>
+
+ <send retrans="500">
+ <![CDATA[
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[field1]@[local_ip]:[local_port];transport=[transport]>
+ Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER
+ Supported: 100rel,replaces
+ User-Agent: PolycomSoundPointIP-SPIP_430-UA/3.2.3.1734
+ Accept-Language: en
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 1325003603 1325003604 IN IP4 [local_ip]
+ s=Polycom IP Phone
+ c=IN IP4 [local_ip]
+ t=0 0
+ a=sendrecv
+ m=audio 2226 RTP/AVP 0 101
+ a=sendrecv
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:101 telephone-event/8000
+ ]]>
+ </send>
+
+ <!-- RECV ACK -->
+ <recv request="ACK"/>
+
+ <recv request="BYE"/>
+
+ <send retrans="500">
+ <![CDATA[
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[field1]@[local_ip]:[local_port];transport=[transport]>
+ Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER
+ Supported: 100rel,replaces
+ User-Agent: PolycomSoundPointIP-SPIP_430-UA/3.2.3.1734
+ Accept-Language: en
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 1324901698 1324901698 IN IP4 [local_ip]
+ s=Polycom IP Phone
+ c=IN IP4 [local_ip]
+ t=0 0
+ a=sendrecv
+ m=audio 2226 RTP/AVP 0 101
+ a=sendrecv
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:101 telephone-event/8000
+ ]]>
+ </send>
+
+
+</scenario>
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_B.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_B.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/sipp/phone_B.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/sip_hold_ice/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_hold_ice/test-config.yaml?view=auto&rev=4801
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_hold_ice/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/SIP/sip_hold_ice/test-config.yaml Fri Mar 7 09:58:12 2014
@@ -1,0 +1,22 @@
+testinfo:
+ summary: 'Test SIP Hold with ICE'
+ description: |
+ This tests a PJSIP assertion crash in 11.7 detailed somewhat in
+ https://issues.asterisk.org/jira/browse/ASTERISK-23213 - A call
+ is started with ICE enabled. A call is started from A to B with
+ some ICE candidates listed that are known to cause a crash in
+ 11.7. The call is then put on hold hold (which is the trigger
+ for the crash) and taken off hold. If both the hold and unhold
+ events are received and Asterisk doesn't crash, the test is
+ considered successful. Note that the direction of media is not
+ considered in this test.
+
+properties:
+ minversion: '11.8.0'
+ dependencies:
+ - sipp :
+ version : 'v3.0'
+ - asterisk : 'chan_sip'
+ tags:
+ - SIP
+ - ICE
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/sip_hold_ice/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/trunk/tests/channels/SIP/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/tests.yaml?view=diff&rev=4801&r1=4800&r2=4801
==============================================================================
--- asterisk/trunk/tests/channels/SIP/tests.yaml (original)
+++ asterisk/trunk/tests/channels/SIP/tests.yaml Fri Mar 7 09:58:12 2014
@@ -43,6 +43,7 @@
- test: 'sip_hold'
- test: 'sip_hold_direct_media'
- test: 'sip_hold_no_moh'
+ - test: 'sip_hold_ice'
- test: 'header_parsing'
- test: 'use_contact_from_200'
- test: 'generic_ccss'
Added: asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/extensions.conf?view=auto&rev=4801
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/extensions.conf Fri Mar 7 09:58:12 2014
@@ -1,0 +1,10 @@
+[general]
+PHONE_TO_DIAL=PJSIP/phone_B
+
+[default]
+; Dial with no options; use bridge set up based on peer definitions
+exten => devicehint,hint,PJSIP/phone_A
+
+exten => basicdial,1,NoOp()
+ same => n,Dial(PJSIP/phone_B,,g)
+ same => n,Hangup()
Propchange: asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/pjsip.conf?view=auto&rev=4801
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/pjsip.conf Fri Mar 7 09:58:12 2014
@@ -1,0 +1,30 @@
+[local]
+type=transport
+protocol=udp
+bind=0.0.0.0
+
+[phone_A]
+type=aor
+contact=sip:phone_A at 127.0.0.2:6080
+
+[phone_A]
+type=endpoint
+aors=phone_A
+context=default
+disallow=all
+allow=ulaw
+direct_media=no
+ice_support=yes
+
+[phone_B]
+type=aor
+contact=sip:phone_B at 127.0.0.3:6081
+
+[phone_B]
+type=endpoint
+aors=phone_B
+context=default
+disallow=all
+allow=ulaw
+direct_media=no
+ice_support=yes
Propchange: asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/rtp.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/rtp.conf?view=auto&rev=4801
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/rtp.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/rtp.conf Fri Mar 7 09:58:12 2014
@@ -1,0 +1,5 @@
+[general]
+rtpstart=10000
+rtpend=20000
+icesupport=yes
+stunaddr=stun.l.google.com:19302
Propchange: asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/rtp.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/rtp.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/hold_ice/configs/ast1/rtp.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/hold_ice/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/hold_ice/run-test?view=auto&rev=4801
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/hold_ice/run-test (added)
+++ asterisk/trunk/tests/channels/pjsip/hold_ice/run-test Fri Mar 7 09:58:12 2014
@@ -1,0 +1,154 @@
+#!/usr/bin/env python
+"""
+Copyright (C) 2014, Digium, Inc.
+Jonathan Rose <jrose at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+"""
+
+import sys
+import logging
+
+sys.path.append("lib/python")
+
+from asterisk.test_case import TestCase
+from asterisk.sipp import SIPpScenario
+from twisted.internet import reactor
+
+LOGGER = logging.getLogger(__name__)
+INJECT_FILE = "inject.csv"
+
+
+class SIPHold(TestCase):
+ """TestCase to execute and evaluate PJSIP hold/unhold with ICE scenario """
+
+ def __init__(self):
+ """ Constructor """
+ super(SIPHold, self).__init__()
+ self.create_asterisk()
+
+ self.sipp_phone_a_scenario = {'scenario': 'phone_A.xml',
+ '-i': '127.0.0.2',
+ '-p': ' 6080',
+ '-inf': INJECT_FILE}
+ self.sipp_phone_b_scenario = {'scenario': 'phone_B.xml',
+ '-i': '127.0.0.3',
+ '-p': '6081',
+ '-inf': INJECT_FILE}
+
+ self.moh_start_event = False
+ self.moh_stop_event = False
+ self.check_list_success_events = 0
+
+ def ami_connect(self, ami):
+ """ Reaction to new AMI connection
+
+ :param ami: AMI connection that was established
+ """
+ super(SIPHold, self).ami_connect(ami)
+
+ ami.registerEvent('TestEvent', self.test_event_handler)
+
+ ami.registerEvent('MusicOnHoldStart', self.moh_start_event_handler)
+ ami.registerEvent('MusicOnHoldStop', self.moh_stop_event_handler)
+
+ LOGGER.info("Starting SIP scenario")
+ self.execute_scenario()
+
+ def execute_scenario(self):
+ """Execute sipp scenarios and check results for a single test phase
+ """
+ sipp_a = SIPpScenario(self.test_name, self.sipp_phone_a_scenario)
+ sipp_b = SIPpScenario(self.test_name, self.sipp_phone_b_scenario)
+
+ # Start up the listener first - Phone A calls Phone B
+ sipp_b.run(self)
+ sipp_a.run(self)
+
+ def handle_checklist_create(self, ami, event):
+ """ Reacts to ICECHECKLISTCREATE user events
+
+ :param ami AMI connection the event was received from
+ :param event Event that was received
+ """
+ if event.get('result') == 'SUCCESS':
+ self.check_list_success_events += 1
+ LOGGER.debug("Received create check list success")
+ if self.check_list_success_events == 2 and \
+ self.moh_stop_event:
+ self.evaluate_success()
+ self.stop_reactor()
+ else:
+ LOGGER.error("Failed to create check list - test failed")
+ self.set_passed(False)
+ self.stop_reactor()
+
+ def test_event_handler(self, ami, event):
+ """ Reacts to User Events and routes them based on their State Value
+
+ :param ami AMI connection the event was received from
+ :param event Event that was received
+ """
+ if event.get('state') == 'ICECHECKLISTCREATE':
+ self.handle_checklist_create(ami, event)
+
+ def moh_start_event_handler(self, ami, event):
+ """ Reacts to music on hold start events and tallies them.
+
+ :param ami: AMI connection the event was received from
+ :param event: Event that was received
+ """
+ LOGGER.debug("Received MOH start event")
+ self.moh_start_event = True
+
+ def moh_stop_event_handler(self, ami, event):
+ """ Reacts to music on hold stop events and tallies them.
+
+ :param ami: AMI connection the event was received from
+ :param event: Event that was received
+ """
+
+ LOGGER.debug("Received MOH stop event")
+ self.moh_stop_event = True
+ if (self.check_list_success_events == 2):
+ self.evaluate_success()
+ self.stop_reactor()
+
+ def run(self):
+ """ Run the test and create an AMI connection """
+
+ super(SIPHold, self).run()
+ self.create_ami_factory()
+
+ def evaluate_success(self):
+ """ Determine whether all of the conditions for passing the test
+ have been met and raise passed flag accordingly.
+ """
+ if not self.moh_start_event:
+ LOGGER.error("Failed to receive MOH start event")
+ self.set_passed(False)
+ if not self.moh_stop_event:
+ LOGGER.error("Failed to receive MOH stop event")
+ self.set_passed(False)
+ if not self.check_list_success_events == 2:
+ LOGGER.error("Expected 2 check list creation events. Got %d\n" %
+ self.check_list_success_events)
+ self.set_passed(False)
+
+ self.set_passed(True)
+
+
+def main():
+ test = SIPHold()
+ reactor.run()
+ if test.passed:
+ return 0
+ return 1
+
+
+if __name__ == "__main__":
+ sys.exit(main())
+
+
+# vim:sw=4:ts=4:expandtab:textwidth=79
Propchange: asterisk/trunk/tests/channels/pjsip/hold_ice/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/hold_ice/run-test
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/trunk/tests/channels/pjsip/hold_ice/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
[... 447 lines stripped ...]
More information about the asterisk-commits
mailing list