[asterisk-dev] Change in testsuite[master]: PJSIP: Added test to ensure retransmissions are not handled.

Mark Michelson (Code Review) asteriskteam at digium.com
Thu Mar 26 22:46:54 CDT 2015


Mark Michelson has uploaded a new change for review.

  https://gerrit.asterisk.org/14

Change subject: PJSIP: Added test to ensure retransmissions are not handled.
......................................................................

PJSIP: Added test to ensure retransmissions are not handled.

In this test, a SIPp scenario sends the exact same MESSAGE request
to Asterisk twice. The test ensures that the dialplan is only called
into a single time.

Without the patch from https://reviewboard.asterisk.org/r/4532/ , this
test fails because the UserEvent in the dialplan is sent twice. With
that patch, this test succeeds.

Change-Id: I524a3eb1cde4489d0ff9866913ae1be318c72115
---
A tests/channels/pjsip/message/message_retrans/configs/ast1/extensions.conf
A tests/channels/pjsip/message/message_retrans/configs/ast1/pjsip.conf
A tests/channels/pjsip/message/message_retrans/sipp/message_retrans.xml
A tests/channels/pjsip/message/message_retrans/test-config.yaml
M tests/channels/pjsip/message/tests.yaml
5 files changed, 94 insertions(+), 0 deletions(-)


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

diff --git a/tests/channels/pjsip/message/message_retrans/configs/ast1/extensions.conf b/tests/channels/pjsip/message/message_retrans/configs/ast1/extensions.conf
new file mode 100644
index 0000000..b5b6eec
--- /dev/null
+++ b/tests/channels/pjsip/message/message_retrans/configs/ast1/extensions.conf
@@ -0,0 +1,3 @@
+[default]
+exten => test,1,NoOp()
+same => n,UserEvent(MessageHandled)
diff --git a/tests/channels/pjsip/message/message_retrans/configs/ast1/pjsip.conf b/tests/channels/pjsip/message/message_retrans/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..5f335b2
--- /dev/null
+++ b/tests/channels/pjsip/message/message_retrans/configs/ast1/pjsip.conf
@@ -0,0 +1,8 @@
+[main-transport]
+type = transport
+bind = 127.0.0.1:5060
+protocol = udp
+
+[sipp]
+type = endpoint
+context = default
diff --git a/tests/channels/pjsip/message/message_retrans/sipp/message_retrans.xml b/tests/channels/pjsip/message/message_retrans/sipp/message_retrans.xml
new file mode 100644
index 0000000..af12f97
--- /dev/null
+++ b/tests/channels/pjsip/message/message_retrans/sipp/message_retrans.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="Basic MESSAGE send and receive">
+  <send>
+    <![CDATA[
+
+      MESSAGE sip:test@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=z9hG4bK-24096-1-0
+      From: user <sip:sipp@[local_ip]:[local_port]>;tag=1
+      To: <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: 1234567890
+      CSeq: 1 MESSAGE
+      Max-Forwards: 70
+      Expires: 3600
+      Content-Type: text/plain
+      Content-Length: 18
+
+      Watson, come here.
+
+    ]]>
+  </send>
+
+  <send>
+    <![CDATA[
+
+      MESSAGE sip:test@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=z9hG4bK-24096-1-0
+      From: user <sip:sipp@[local_ip]:[local_port]>;tag=1
+      To: <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: 1234567890
+      CSeq: 1 MESSAGE
+      Max-Forwards: 70
+      Expires: 3600
+      Content-Type: text/plain
+      Content-Length: 18
+
+      Watson, come here.
+
+    ]]>
+  </send>
+
+</scenario>
diff --git a/tests/channels/pjsip/message/message_retrans/test-config.yaml b/tests/channels/pjsip/message/message_retrans/test-config.yaml
new file mode 100644
index 0000000..1f63fca
--- /dev/null
+++ b/tests/channels/pjsip/message/message_retrans/test-config.yaml
@@ -0,0 +1,40 @@
+testinfo:
+    summary: 'Test that Asterisk does not handle MESSAGE retransmissions'
+    description: |
+        'A SIPp scenario sends the same SIP MESSAGE request twice. The test ensures that
+        Asterisk only attempts to handle one of them. If both MESSAGEs reach the dialplan,
+        the test fails.'
+
+properties:
+    minversion: '13.4.0'
+    dependencies:
+        - app: 'sipp'
+        - asterisk: 'res_pjsip'
+        - asterisk: 'res_pjsip_messaging'
+    tags:
+        - pjsip
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: 'ami-config'
+            typename: 'ami.AMIEventModule'
+
+
+test-object-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': { 'scenario': 'message_retrans.xml', '-p': '5061' } }
+
+ami-config:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'MessageHandled'
+        count: '1'
diff --git a/tests/channels/pjsip/message/tests.yaml b/tests/channels/pjsip/message/tests.yaml
index de6741a..faf4e86 100644
--- a/tests/channels/pjsip/message/tests.yaml
+++ b/tests/channels/pjsip/message/tests.yaml
@@ -7,3 +7,4 @@
     - test: 'message_cust_hdr'
     - test: 'message_in_dialog'
     - test: 'message_send_ami'
+    - test: 'message_retrans'

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I524a3eb1cde4489d0ff9866913ae1be318c72115
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-dev mailing list