[svn-commits] coreyfarrell: testsuite/asterisk/trunk r4681 - in /asterisk/trunk/tests/chann...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Feb 10 12:25:13 CST 2014


Author: coreyfarrell
Date: Mon Feb 10 12:25:08 2014
New Revision: 4681

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4681
Log:
Create a basic test for chan_sip Record-Record handling.

Test strict and loose routes, for inbound and outbound calls.  This
verifies expected method URL's, as well as Record-Route and Route headers.

(issue ASTERISK-22582)
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/3172/

Added:
    asterisk/trunk/tests/channels/SIP/route/
    asterisk/trunk/tests/channels/SIP/route/configs/
    asterisk/trunk/tests/channels/SIP/route/configs/ast1/
    asterisk/trunk/tests/channels/SIP/route/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/SIP/route/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/channels/SIP/route/sipp/
    asterisk/trunk/tests/channels/SIP/route/sipp/recv-invite.xml   (with props)
    asterisk/trunk/tests/channels/SIP/route/sipp/send-invite.xml   (with props)
    asterisk/trunk/tests/channels/SIP/route/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/channels/SIP/tests.yaml

Added: asterisk/trunk/tests/channels/SIP/route/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/route/configs/ast1/extensions.conf?view=auto&rev=4681
==============================================================================
--- asterisk/trunk/tests/channels/SIP/route/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/SIP/route/configs/ast1/extensions.conf Mon Feb 10 12:25:08 2014
@@ -1,0 +1,8 @@
+[default]
+exten => s,1,Answer()
+same => n,Dial(SIP/ua1,1)
+same => n,Hangup()
+
+exten => _XX,1,Ringing()
+same => n,Answer()
+same => n,Hangup()

Propchange: asterisk/trunk/tests/channels/SIP/route/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/route/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/route/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/route/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/route/configs/ast1/sip.conf?view=auto&rev=4681
==============================================================================
--- asterisk/trunk/tests/channels/SIP/route/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/channels/SIP/route/configs/ast1/sip.conf Mon Feb 10 12:25:08 2014
@@ -1,0 +1,7 @@
+[general]
+udpbindaddr=127.0.0.1
+
+[ua1]
+type=peer
+host=127.0.0.1
+port=5062

Propchange: asterisk/trunk/tests/channels/SIP/route/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/route/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/route/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/route/sipp/recv-invite.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/route/sipp/recv-invite.xml?view=auto&rev=4681
==============================================================================
--- asterisk/trunk/tests/channels/SIP/route/sipp/recv-invite.xml (added)
+++ asterisk/trunk/tests/channels/SIP/route/sipp/recv-invite.xml Mon Feb 10 12:25:08 2014
@@ -1,0 +1,146 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- This program is free software; you can redistribute it and/or      -->
+<!-- modify it under the terms of the GNU General Public License as     -->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.                    -->
+<!--                                                                    -->
+<!-- This program is distributed in the hope that it will be useful,    -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of     -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      -->
+<!-- GNU General Public License for more details.                       -->
+<!--                                                                    -->
+<!-- You should have received a copy of the GNU General Public License  -->
+<!-- along with this program; if not, write to the                      -->
+<!-- Free Software Foundation, Inc.,                                    -->
+<!-- 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA             -->
+
+<scenario name="recv-invite">
+	<nop hide="true">
+		<action>
+			<assignstr assign_to="1" value="[call_number]" />
+			<strcmp assign_to="rr_type" variable="1" value="1" />
+		</action>
+	</nop>
+
+	<nop hide="true" next="4" test="rr_type">
+		<action>
+			<assignstr assign_to="rr_out" value="<test1-subsystem1@[local_ip]:[local_port]>,<test1-subsystem2@[local_ip]:[local_port]>" />
+			<assignstr assign_to="rr_uri" value="test1-subsystem2@[local_ip]:[local_port]" />
+			<assignstr assign_to="rr_rcv" value="<test1-subsystem1@[local_ip]:[local_port]>,<sip:[local_ip]:[local_port]>" />
+		</action>
+	</nop>
+
+	<nop hide="true">
+		<action>
+			<assignstr assign_to="rr_out" value="<test1-subsystem1@[local_ip]:[local_port];lr>,<test1-subsystem2@[local_ip]:[local_port];lr>" />
+			<assignstr assign_to="rr_uri" value="sip:[local_ip]:[local_port]" />
+			<assignstr assign_to="rr_rcv" value="<test1-subsystem2@[local_ip]:[local_port];lr>,<test1-subsystem1@[local_ip]:[local_port];lr>" />
+		</action>
+	</nop>
+
+	<label id="4"/>
+
+	<recv request="INVITE" crlf="true" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 180 Ringing
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[pid]SIPpTag01[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Record-Route: [$rr_out]
+			Contact: <sip:[local_ip]:[local_port]>
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<send retrans="500">
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[pid]SIPpTag01[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Record-Route: [$rr_out]
+			Contact: <sip:[local_ip]:[local_port]>
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=audio [media_port] RTP/AVP 0
+			a=rtpmap:0 PCMU/8000
+
+		]]>
+	</send>
+
+	<recv request="ACK" rtd="true" crlf="true">
+		<action>
+			<ereg regexp="ACK\s*([^ ]*) SIP/2.0" search_in="msg" assign_to="1,uri_got"/>
+			<strcmp assign_to="1" variable="uri_got" variable2="rr_uri" />
+			<test assign_to="url_wrong" variable="1" compare="not_equal" value="" />
+
+			<ereg regexp="\s*(.*)\s*" search_in="hdr" header="Route:" assign_to="1,r_got"/>
+			<strcmp assign_to="1" variable="r_got" variable2="rr_rcv" />
+			<test assign_to="r_wrong" variable="1" compare="not_equal" value="" />
+		</action>
+	</recv>
+
+	<nop condexec="url_wrong">
+		<action>
+			<error message="ACK URI expected '[$rr_uri]' but got '[$uri_got]'" />
+		</action>
+	</nop>
+	<nop condexec="r_wrong">
+		<action>
+			<error message="ACK Route expected '[$rr_rcv]' but got '[$r_got]'" />
+		</action>
+	</nop>
+
+	<recv request="BYE">
+		<action>
+			<ereg regexp="BYE\s*([^ ]*) SIP/2.0" search_in="msg" assign_to="1,uri_got"/>
+			<strcmp assign_to="1" variable="uri_got" variable2="rr_uri" />
+			<test assign_to="url_wrong" variable="1" compare="not_equal" value="" />
+
+			<ereg regexp="\s*(.*)\s*" search_in="hdr" header="Route:" assign_to="1,r_got"/>
+			<strcmp assign_to="1" variable="r_got" variable2="rr_rcv" />
+			<test assign_to="r_wrong" variable="1" compare="not_equal" value="" />
+		</action>
+	</recv>
+
+	<nop condexec="url_wrong">
+		<action>
+			<error message="BYE URI expected '[$rr_uri]' but got '[$uri_got]'" />
+		</action>
+	</nop>
+	<nop condexec="r_wrong">
+		<action>
+			<error message="BYE Route expected '[$rr_rcv]' but got '[$r_got]'" />
+		</action>
+	</nop>
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[pid]SIPpTag01[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+
+		]]>
+	</send>
+
+</scenario>

Propchange: asterisk/trunk/tests/channels/SIP/route/sipp/recv-invite.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/route/sipp/recv-invite.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/route/sipp/recv-invite.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/route/sipp/send-invite.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/route/sipp/send-invite.xml?view=auto&rev=4681
==============================================================================
--- asterisk/trunk/tests/channels/SIP/route/sipp/send-invite.xml (added)
+++ asterisk/trunk/tests/channels/SIP/route/sipp/send-invite.xml Mon Feb 10 12:25:08 2014
@@ -1,0 +1,176 @@
+<?xml version="1.0" encoding="iso-8859-2" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- This program is free software; you can redistribute it and/or      -->
+<!-- modify it under the terms of the GNU General Public License as     -->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.                    -->
+<!--                                                                    -->
+<!-- This program is distributed in the hope that it will be useful,    -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of     -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      -->
+<!-- GNU General Public License for more details.                       -->
+<!--                                                                    -->
+<!-- You should have received a copy of the GNU General Public License  -->
+<!-- along with this program; if not, write to the                      -->
+<!-- Free Software Foundation, Inc.,                                    -->
+<!-- 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA             -->
+
+<scenario name="send-invite">
+	<nop hide="true">
+		<action>
+			<assignstr assign_to="1" value="[call_number]" />
+			<strcmp assign_to="rr_type" variable="1" value="1" />
+		</action>
+	</nop>
+
+	<nop hide="true" next="4" test="rr_type">
+		<action>
+			<assignstr assign_to="rr_out" value="<strict1@[local_ip]:[local_port]>,<strict2@[local_ip]:[local_port]>" />
+			<assignstr assign_to="rr_rcv" value="[$rr_out]" />
+			<assignstr assign_to="bye_uri" value="strict1@[local_ip]:[local_port]" />
+			<assignstr assign_to="rr_bye" value="<strict2@[local_ip]:[local_port]>,<sip:51@[local_ip]:[local_port]>" />
+		</action>
+	</nop>
+
+	<nop hide="true">
+		<action>
+			<assignstr assign_to="rr_out" value="<loose1@[local_ip]:[local_port];lr>,<loose2@[local_ip]:[local_port];lr>" />
+			<assignstr assign_to="rr_rcv" value="[$rr_out]" />
+			<assignstr assign_to="bye_uri" value="sip:51@[local_ip]:[local_port]" />
+			<assignstr assign_to="rr_bye" value="<loose1@[local_ip]:[local_port];lr>,<loose2@[local_ip]:[local_port];lr>" />
+		</action>
+	</nop>
+
+	<label id="4"/>
+
+	<send retrans="500">
+		<![CDATA[
+			INVITE sip:52@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: sipp <sip:51@[local_ip]:[local_port]>;tag=[call_number]
+			To: <sip:52@[remote_ip]:[remote_port]>
+			Call-ID: [call_id]
+			CSeq: [cseq] INVITE
+			Contact: sip:51@[local_ip]:[local_port]
+			Record-Route: [$rr_out]
+			Max-Forwards: 100
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=audio [media_port] RTP/AVP 8
+			a=rtpmap:8 PCMA/8000
+
+		]]>
+	</send>
+
+	<recv response="100">
+		<action>
+			<ereg regexp="\s*(.*)\s*" search_in="hdr" header="Record-Route:" assign_to="1,rr_got"/>
+			<strcmp assign_to="1" variable="rr_got" variable2="rr_rcv" />
+			<test assign_to="r_wrong" variable="1" compare="not_equal" value="" />
+		</action>
+	</recv>
+
+	<nop condexec="r_wrong">
+		<action>
+			<error message="100 RR expected '[$rr_rcv]' but got '[$rr_got]'" />
+		</action>
+	</nop>
+
+	<recv response="180">
+		<action>
+			<ereg regexp="\s*(.*)\s*" search_in="hdr" header="Record-Route:" assign_to="1,rr_got"/>
+			<strcmp assign_to="1" variable="rr_got" variable2="rr_rcv" />
+			<test assign_to="r_wrong" variable="1" compare="not_equal" value="" />
+		</action>
+	</recv>
+
+	<nop condexec="r_wrong">
+		<action>
+			<error message="180 RR expected '[$rr_rcv]' but got '[$rr_got]'" />
+		</action>
+	</nop>
+
+	<recv response="183" optional="true">
+		<action>
+			<ereg regexp="\s*(.*)\s*" search_in="hdr" header="Record-Route:" assign_to="1,rr_got"/>
+			<strcmp assign_to="1" variable="rr_got" variable2="rr_rcv" />
+			<test assign_to="r_wrong" variable="1" compare="not_equal" value="" check_it="true" />
+		</action>
+	</recv>
+
+	<recv response="200" rrs="true">
+		<action>
+			<ereg regexp="\s*(.*)\s*" search_in="hdr" header="Record-Route:" assign_to="1,rr_got"/>
+			<strcmp assign_to="1" variable="rr_got" variable2="rr_rcv" />
+			<test assign_to="r_wrong" variable="1" compare="not_equal" value="" />
+		</action>
+	</recv>
+
+	<nop condexec="r_wrong">
+		<action>
+			<error message="200 RR expected '[$rr_rcv]' but got '[$rr_got]'" />
+		</action>
+	</nop>
+
+	<send>
+		<![CDATA[
+			ACK [next_url] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: <sip:51@[local_ip]:[local_port]>;tag=[call_number]
+			[last_To:]
+			[routes]
+			Call-ID: [call_id]
+			CSeq: [cseq] ACK
+			Contact: sip:51@[local_ip]:[local_port]
+			Max-Forwards: 100
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<recv request="BYE">
+		<action>
+			<ereg regexp="BYE\s*([^ ]*) SIP/2.0" search_in="msg" assign_to="1,bye_got"/>
+			<strcmp assign_to="1" variable="bye_got" variable2="bye_uri" />
+			<test assign_to="url_wrong" variable="1" compare="not_equal" value="" />
+
+			<ereg regexp="\s*(.*)\s*" search_in="hdr" header="Route:" assign_to="1,rr_got"/>
+			<strcmp assign_to="1" variable="rr_got" variable2="rr_bye" />
+			<test assign_to="r_wrong" variable="1" compare="not_equal" value="" />
+		</action>
+	</recv>
+
+	<nop condexec="url_wrong">
+		<action>
+			<error message="BYE URI expected '[$bye_uri]' but got '[$bye_got]'" />
+		</action>
+	</nop>
+	<nop condexec="r_wrong">
+		<action>
+			<error message="BYE Route expected '[$rr_bye]' but got '[$rr_got]'" />
+		</action>
+	</nop>
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+
+		]]>
+	</send>
+
+</scenario>
+

Propchange: asterisk/trunk/tests/channels/SIP/route/sipp/send-invite.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/route/sipp/send-invite.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/route/sipp/send-invite.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/route/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/route/test-config.yaml?view=auto&rev=4681
==============================================================================
--- asterisk/trunk/tests/channels/SIP/route/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/SIP/route/test-config.yaml Mon Feb 10 12:25:08 2014
@@ -1,0 +1,41 @@
+testinfo:
+    summary:     'SIP Record-Route Support'
+    description: |
+        'This test verifies SIP Record-Route handling.
+        Test includes loose and strict routes.'
+
+properties:
+    minversion: '1.8.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - app : 'sipp'
+        - asterisk : 'chan_sip'
+    tags:
+        - SIP
+
+test-modules:
+    test-object:
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        # Need to originate exactly 2 channels for recv-invite.
+        -
+            config-section: originator-recv-invite
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: originator-recv-invite
+            typename: 'pluggable_modules.Originator'
+
+originator-recv-invite:
+    application: 'Wait'
+    data: '1'
+    trigger: 'ami_connect'
+
+sipp-config:
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'send-invite.xml', '-p': '5061', '-m': '2', },}
+                - { 'key-args': {'scenario': 'recv-invite.xml', '-p': '5062', '-m': '2', },}

Propchange: asterisk/trunk/tests/channels/SIP/route/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/route/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/route/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=4681&r1=4680&r2=4681
==============================================================================
--- asterisk/trunk/tests/channels/SIP/tests.yaml (original)
+++ asterisk/trunk/tests/channels/SIP/tests.yaml Mon Feb 10 12:25:08 2014
@@ -60,6 +60,7 @@
     - dir: 'session_timers'
     - test: 'path'
     - test: 'alwaysauthreject'
+    - test: 'route'
     - dir: 'register_forbidden_retry'
     - test: 'outbound_register_from'
     - test: 'outbound_reregister_from'




More information about the svn-commits mailing list