[Asterisk-code-review] core/dial: Add test to check a new channel variable FORWARDE... (testsuite[master])

Alexei Gradinari asteriskteam at digium.com
Wed Jun 1 14:28:46 CDT 2016


Alexei Gradinari has uploaded a new change for review.

  https://gerrit.asterisk.org/2929

Change subject: core/dial: Add test to check a new channel variable FORWARDERNAME
......................................................................

core/dial: Add test to check a new channel variable FORWARDERNAME

This test checks if the channel variable FORWARDERNAME exists after
forwarding requests received on dial attempt using applications:
Dial, Queue and Originate.

ASTERISK-26059

Change-Id: Ibdc345bb9962628dad9e58466701abac2a4c2bfe
---
A tests/redirecting/forwardername/configs/ast1/extensions.conf
A tests/redirecting/forwardername/configs/ast1/queues.conf
A tests/redirecting/forwardername/configs/ast1/sip.conf
A tests/redirecting/forwardername/sipp/uac-no-hangup.xml
A tests/redirecting/forwardername/sipp/uas-redirect.xml
A tests/redirecting/forwardername/test-config.yaml
M tests/redirecting/tests.yaml
7 files changed, 222 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/29/2929/1

diff --git a/tests/redirecting/forwardername/configs/ast1/extensions.conf b/tests/redirecting/forwardername/configs/ast1/extensions.conf
new file mode 100644
index 0000000..2d7607e
--- /dev/null
+++ b/tests/redirecting/forwardername/configs/ast1/extensions.conf
@@ -0,0 +1,19 @@
+[default]
+
+exten => forwarder,1,NoOp(Dial SIP/forwarder)
+same => n,Dial(SIP/forwarder)
+same => n,Hangup
+
+exten => queue,1,NoOp(Queue SIP/forwarder)
+same => n,Queue(queue,Rtc)
+same => n,Hangup
+
+exten => originate,1,NoOp(Originate SIP/forwarder)
+same => n,Answer
+same => n,Originate(SIP/forwarder,app,Playback,hello-world)
+same => n,Hangup
+
+exten => test_forwardername,1,Answer
+same => n,NoOp(FORWARDERNAME is '${FORWARDERNAME}')
+same => n,UserEvent(ForwarderName, Result: ${IF($["${CUT(FORWARDERNAME,-,1-$[${FIELDQTY(FORWARDERNAME,-)} - 1])}" = "SIP/forwarder"]?Success:Failure)})
+same => n,Hangup()
diff --git a/tests/redirecting/forwardername/configs/ast1/queues.conf b/tests/redirecting/forwardername/configs/ast1/queues.conf
new file mode 100644
index 0000000..0890117
--- /dev/null
+++ b/tests/redirecting/forwardername/configs/ast1/queues.conf
@@ -0,0 +1,4 @@
+[general]
+
+[queue]
+member => SIP/forwarder
diff --git a/tests/redirecting/forwardername/configs/ast1/sip.conf b/tests/redirecting/forwardername/configs/ast1/sip.conf
new file mode 100644
index 0000000..528824f
--- /dev/null
+++ b/tests/redirecting/forwardername/configs/ast1/sip.conf
@@ -0,0 +1,13 @@
+[general]
+
+udpbindaddr = 127.0.0.1:5060
+
+[caller]
+type=peer
+host=127.0.0.1
+port=5061
+
+[forwarder]
+type=peer
+host=127.0.0.1
+port=5062
diff --git a/tests/redirecting/forwardername/sipp/uac-no-hangup.xml b/tests/redirecting/forwardername/sipp/uac-no-hangup.xml
new file mode 100644
index 0000000..a458a67
--- /dev/null
+++ b/tests/redirecting/forwardername/sipp/uac-no-hangup.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic Sipstone UAC">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      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 response="100"
+        optional="true">
+  </recv>
+
+  <recv response="181"
+        optional="true">
+  </recv>
+
+  <recv response="180" optional="true">
+  </recv>
+
+  <recv response="183" optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="BYE">
+  </recv>
+
+  <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>
+
+  <timewait milliseconds="4000"/>
+
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/tests/redirecting/forwardername/sipp/uas-redirect.xml b/tests/redirecting/forwardername/sipp/uas-redirect.xml
new file mode 100644
index 0000000..cf1c9da
--- /dev/null
+++ b/tests/redirecting/forwardername/sipp/uas-redirect.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAS responder">
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 302 Temporarily Moved
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Diversion: <sip:[local_ip]:[local_port]>;reason="unconditional"
+      Contact: <sip:[redir_target]@[remote_ip]:[remote_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/tests/redirecting/forwardername/test-config.yaml b/tests/redirecting/forwardername/test-config.yaml
new file mode 100644
index 0000000..b4d1595
--- /dev/null
+++ b/tests/redirecting/forwardername/test-config.yaml
@@ -0,0 +1,61 @@
+testinfo:
+    summary: 'Test that channel variable FORWARDERNAME is set'
+    description: |
+        'This test places an outgoing call to a UAS that responds with a 302.
+         We check in the dialplan that channel variable FORWARDERNAME has been set
+         to forwarder name'
+
+test-modules:
+    test-object:
+        config-section: 'calls'
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: 'ami-config'
+            typename: 'ami.AMIEventModule'
+
+calls:
+    fail-on-any: False
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': { 'scenario': 'uas-redirect.xml', '-p': '5062'},
+                    'ordered-args': ['-key', 'redir_target', 'test_forwardername']}
+                - { 'key-args': { 'scenario': 'uac-no-hangup.xml', '-d': '2000', '-s': 'forwarder', '-p': '5061'} }
+        -
+            scenarios:
+                - { 'key-args': { 'scenario': 'uas-redirect.xml', '-p': '5062'},
+                    'ordered-args': ['-key', 'redir_target', 'test_forwardername']}
+                - { 'key-args': { 'scenario': 'uac-no-hangup.xml', '-d': '2000', '-s': 'queue', '-p': '5061'} }
+        -
+            scenarios:
+                - { 'key-args': { 'scenario': 'uas-redirect.xml', '-p': '5062'},
+                    'ordered-args': ['-key', 'redir_target', 'test_forwardername']}
+                - { 'key-args': { 'scenario': 'uac-no-hangup.xml', '-d': '2000', '-s': 'originate', '-p': '5061'} }
+
+ami-config:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'ForwarderName'
+        requirements:
+            match:
+                Result: 'Success'
+        count: '3'
+
+properties:
+    minversion: '13.10.0'
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - sipp:
+            version: 'v3.1'
+        - asterisk: 'app_dial'
+        - asterisk: 'app_queue'
+        - asterisk: 'app_originate'
+        - asterisk: 'app_userevent'
+        - asterisk: 'chan_sip'
+    tags:
+        - bridge
diff --git a/tests/redirecting/tests.yaml b/tests/redirecting/tests.yaml
index 3da1d12..bf4b498 100644
--- a/tests/redirecting/tests.yaml
+++ b/tests/redirecting/tests.yaml
@@ -1,5 +1,6 @@
 # Enter tests here in the order they should be considered for execution:
 tests:
+    - test: 'forwardername'
     - test: 'macro'
     - test: 'subroutine'
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibdc345bb9962628dad9e58466701abac2a4c2bfe
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>



More information about the asterisk-code-review mailing list