[asterisk-commits] apps/dial: Add test for Q() option (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Oct 12 08:44:36 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: apps/dial:  Add test for Q() option
......................................................................


apps/dial:  Add test for Q() option

Add a test for the Q() dial option.  The test makes sure that the
reason code set in a CANCEL is set appropriately.

ASTERISK-26446

Change-Id: I6ecc48a9158d6638b1fbb0472812eb2e8f43b69b
---
A tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/configs/ast1/extensions.conf
A tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/configs/ast1/pjsip.conf
A tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/sipp/bob.xml
A tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/sipp/charlie.xml
A tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/test-config.yaml
M tests/apps/dial/dial_parallel/tests.yaml
6 files changed, 321 insertions(+), 0 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/configs/ast1/extensions.conf b/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/configs/ast1/extensions.conf
new file mode 100644
index 0000000..f8ce969
--- /dev/null
+++ b/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+exten => s,1,NoOp()
+	same => n,Dial(PJSIP/bob&PJSIP/charlie,,Q(FACILITY_REJECTED))
+	same => n,Hangup()
+
+exten => echo,1,Echo()
diff --git a/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/configs/ast1/pjsip.conf b/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..7fe3e18
--- /dev/null
+++ b/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/configs/ast1/pjsip.conf
@@ -0,0 +1,24 @@
+[udp]
+type = transport
+protocol = udp
+bind = 127.0.0.1
+
+[bob]
+type = endpoint
+aors = bob
+context = default
+allow = !all,ulaw
+
+[bob]
+type = aor
+contact = sip:bob at 127.0.0.1:5066
+
+[charlie]
+type = endpoint
+aors = charlie
+context = default
+allow = !all,ulaw
+
+[charlie]
+type = aor
+contact = sip:charlie at 127.0.0.1:5067
diff --git a/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/sipp/bob.xml b/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/sipp/bob.xml
new file mode 100644
index 0000000..9874415
--- /dev/null
+++ b/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/sipp/bob.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAS responder">
+	<recv request="INVITE" crlf="true">
+		<!-- Save the from tag. We'll need it when we send our response -->
+		<action>
+			<ereg regexp=".*(;tag=.*)" header="From:" search_in="hdr"
+				check_it="true" assign_to="remote_tag" />
+		</action>
+	</recv>
+
+	<send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [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>
+
+	<recv request="CANCEL" crlf="true">
+		<action>
+			<ereg regexp=".*;cause=29" header="Reason:" search_in="hdr"
+				check_it="true" assign_to="dummy" />
+		</action>
+	</recv>
+
+	<send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];[$remote_tag]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+	</send>
+
+
+	<send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 487 Request Terminated
+      [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>
+
+	<Reference variables="dummy" />
+
+</scenario>
+
diff --git a/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/sipp/charlie.xml b/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/sipp/charlie.xml
new file mode 100644
index 0000000..a0dedab
--- /dev/null
+++ b/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/sipp/charlie.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAS responder">
+	<Global variables="remote_tag" />
+	<recv request="INVITE" crlf="true">
+		<!-- Save the from tag. We'll need it when we send our BYE -->
+		<action>
+			<ereg regexp=".*(;tag=.*)" header="From:" search_in="hdr"
+				check_it="true" assign_to="dummy,remote_tag" />
+		</action>
+	</recv>
+
+	<send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [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>
+
+	<pause milliseconds="500" />
+
+	<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:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      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">
+	</recv>
+
+	<pause milliseconds="2000" />
+
+	<send>
+    <![CDATA[
+
+      BYE sip:charlie@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: charlie <sip:charlie@[local_ip]:[local_port]>;tag=[pid]SIPpTag01[call_number]
+      To: Asterisk <sip:charlie@[remote_ip]:[remote_port]>[$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: sip:charlie@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+	</send>
+
+	<recv response="200">
+	</recv>
+
+	<Reference variables="dummy" />
+
+</scenario>
+
diff --git a/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/test-config.yaml b/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/test-config.yaml
new file mode 100644
index 0000000..b64f5ed
--- /dev/null
+++ b/tests/apps/dial/dial_parallel/dial_parallel_answer_cancel_cause/test-config.yaml
@@ -0,0 +1,138 @@
+testinfo:
+    summary:     'Dial Parallel with an Answer/Cancel and a specific hangup cause'
+    description: |
+        'Dial two endpoints. One happens to Answer before the other replies back.
+        Verify that Asterisk cancels the other Dial request with a specific reason
+        when Dial is called with the Q() argument.'
+
+properties:
+    minversion: '13.12.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - app : 'sipp'
+        - asterisk : 'app_dial'
+        - asterisk : 'app_echo'
+        - asterisk : 'chan_pjsip'
+    tags:
+        - pjsip
+        - dial
+
+test-modules:
+    test-object:
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: ami-config
+            typename: 'ami.AMIEventModule'
+        -
+            config-section: originator-config
+            typename: 'pluggable_modules.Originator'
+
+ami-config:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'DialBegin'
+                DestChannel: 'PJSIP/bob-.*'
+        requirements:
+            match:
+                Channel: 'Local/s at default-.*'
+                Uniqueid: '.*'
+                Linkedid: '.*'
+                DestUniqueid: '.*'
+                DestLinkedid: '.*'
+                CallerIDNum: '<unknown>'
+                CallerIDName: '<unknown>'
+                ConnectedLineNum: '<unknown>'
+                ConnectedLineName: '<unknown>'
+                Dialstring: 'bob'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'DialBegin'
+                DestChannel: 'PJSIP/charlie-.*'
+        requirements:
+            match:
+                Channel: 'Local/s at default-.*'
+                Uniqueid: '.*'
+                Linkedid: '.*'
+                DestUniqueid: '.*'
+                DestLinkedid: '.*'
+                CallerIDNum: '<unknown>'
+                CallerIDName: '<unknown>'
+                ConnectedLineNum: '<unknown>'
+                ConnectedLineName: '<unknown>'
+                Dialstring: 'charlie'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'DialEnd'
+                DestChannel: 'PJSIP/bob-.*'
+        requirements:
+            match:
+                Channel: 'Local/s at default-.*'
+                Uniqueid: '.*'
+                Linkedid: '.*'
+                DestUniqueid: '.*'
+                DestLinkedid: '.*'
+                CallerIDNum: '<unknown>'
+                CallerIDName: '<unknown>'
+                ConnectedLineNum: 's'
+                ConnectedLineName: '<unknown>'
+                DialStatus: 'CANCEL'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'DialEnd'
+                DestChannel: 'PJSIP/charlie-.*'
+        requirements:
+            match:
+                Channel: 'Local/s at default-.*'
+                Uniqueid: '.*'
+                Linkedid: '.*'
+                DestUniqueid: '.*'
+                DestLinkedid: '.*'
+                CallerIDNum: '<unknown>'
+                CallerIDName: '<unknown>'
+                ConnectedLineNum: 's'
+                ConnectedLineName: '<unknown>'
+                DialStatus: 'ANSWER'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'Hangup'
+                Channel: 'PJSIP/bob-.*'
+        requirements:
+            match:
+                Cause: '29'
+        count: '1'
+
+originator-config:
+    trigger: 'scenario_start'
+    scenario-trigger-after: '2'
+    ignore-originate-failure: 'yes'
+    id: '0'
+    channel: 'Local/s at default'
+    context: 'default'
+    exten: 'echo'
+    priority: 1
+    async: True
+
+sipp-config:
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'bob.xml', '-p': '5066'} }
+                - { 'key-args': {'scenario': 'charlie.xml', '-p': '5067'} }
diff --git a/tests/apps/dial/dial_parallel/tests.yaml b/tests/apps/dial/dial_parallel/tests.yaml
index 675bbaf..1f38679 100644
--- a/tests/apps/dial/dial_parallel/tests.yaml
+++ b/tests/apps/dial/dial_parallel/tests.yaml
@@ -1,5 +1,6 @@
 tests:
     - test: 'dial_parallel_answer_cancel'
+    - test: 'dial_parallel_answer_cancel_cause'
     - test: 'dial_parallel_all_cancel'
     - test: 'dial_parallel_all_busy'
     - test: 'dial_parallel_all_congestion'

-- 
To view, visit https://gerrit.asterisk.org/4057
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6ecc48a9158d6638b1fbb0472812eb2e8f43b69b
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list