[Asterisk-code-review] blind transfers: Notify with sip frag 100 now arrives later (testsuite[master])

Anonymous Coward asteriskteam at digium.com
Tue Mar 15 08:47:18 CDT 2016


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

Change subject: blind transfers: Notify with sip frag 100 now arrives later
......................................................................


blind transfers: Notify with sip frag 100 now arrives later

Some phones send a hang up immediately after receiving the first sip notify
during a transfer. Because of this asterisk was modified to delay sending the
initial notify that contains a sip frag 100 to a bit later.

A couple of pjsip transfer tests, blind_transfer/callee_direct_media and
blind_transfer/caller_direct_media, have been changed to account for the
late arrival of the notify.

ASTERISK-25771

Change-Id: I8a0be41a3a19015c6b69e20e38f2853e2defd8dd
---
M lib/python/asterisk/test_runner.py
M tests/channels/pjsip/transfers/blind_transfer/callee_direct_media/sipp/bob_v13_8_0.xml
M tests/channels/pjsip/transfers/blind_transfer/callee_direct_media/test-config.yaml
M tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/alice_v13_8_0.xml
M tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/test-config.yaml
5 files changed, 130 insertions(+), 45 deletions(-)

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



diff --git a/lib/python/asterisk/test_runner.py b/lib/python/asterisk/test_runner.py
index c156316..a097d02 100755
--- a/lib/python/asterisk/test_runner.py
+++ b/lib/python/asterisk/test_runner.py
@@ -21,6 +21,7 @@
 from twisted.internet import reactor
 
 LOGGER = logging.getLogger('test_runner')
+logging.basicConfig()
 
 sys.path.append('lib/python')
 
@@ -185,7 +186,7 @@
     return module
 
 
-def create_test_object(test_path, test_config):
+def create_test_object(test_path, test_config, ast_version):
     """Create the specified test object from the test configuration
 
     Parameters:
@@ -199,6 +200,13 @@
         - evaluate_results() - True if the test passed, False otherwise
     Or None if the object couldn't be created.
     """
+    def get_test_object():
+        objs = test_config['test-modules']['test-object']
+        if not isinstance(objs, list):
+            objs = [objs]
+        return next((obj for obj in objs if check_module_version(
+            obj, ast_version)), None)
+
     if not 'test-modules' in test_config:
         LOGGER.error("No test-modules block in configuration")
         return None
@@ -206,7 +214,10 @@
         LOGGER.error("No test-object specified for this test")
         return None
 
-    test_object_spec = test_config['test-modules']['test-object']
+    test_object_spec = get_test_object()
+    if not test_object_spec:
+        LOGGER.error("No test-object found for version range(s)")
+        return None
 
     module_obj = load_and_parse_module(test_object_spec['typename'])
     if module_obj is None:
@@ -319,7 +330,7 @@
 
     read_module_paths(test_config, test_directory)
 
-    test_object = create_test_object(test_directory, test_config)
+    test_object = create_test_object(test_directory, test_config, ast_version)
     if test_object is None:
         return 1
 
diff --git a/tests/channels/pjsip/transfers/blind_transfer/callee_direct_media/sipp/bob_v13_8_0.xml b/tests/channels/pjsip/transfers/blind_transfer/callee_direct_media/sipp/bob_v13_8_0.xml
index 35cf649..fc3716a 100644
--- a/tests/channels/pjsip/transfers/blind_transfer/callee_direct_media/sipp/bob_v13_8_0.xml
+++ b/tests/channels/pjsip/transfers/blind_transfer/callee_direct_media/sipp/bob_v13_8_0.xml
@@ -123,25 +123,6 @@
   <recv response="202" rtd="true">
   </recv>
 
-  <!-- We should receive a NOTIFY from Asterisk with a 100 trying sipfrag -->
-  <recv request="NOTIFY" crlf="true">
-  </recv>
-
-  <send>
-    <![CDATA[
-
-      SIP/2.0 200 OK
-      [last_Via:]
-      [last_From:]
-      [last_To:]
-      [last_Call-ID:]
-      [last_CSeq:]
-      [last_Event:]
-      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
-      Content-Length: 0
-    ]]>
-  </send>
-
   <!--
        Wait for re-invite for tearing down direct media between alice and bob
        due to transfering alice to charlie.
@@ -182,6 +163,25 @@
 
   <label id="12" />
 
+  <!-- We should receive a NOTIFY from Asterisk with a 100 trying sipfrag -->
+  <recv request="NOTIFY" crlf="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      [last_Event:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+    ]]>
+  </send>
+
   <!-- We should receive a NOTIFY from Asterisk with a '200 OK' sipfrag -->
   <recv request="NOTIFY" crlf="true" next="13">
     <!-- Check if 'SIP/2.0 200 OK' is in the body -->
diff --git a/tests/channels/pjsip/transfers/blind_transfer/callee_direct_media/test-config.yaml b/tests/channels/pjsip/transfers/blind_transfer/callee_direct_media/test-config.yaml
index 62c6aa8..b5c0e9f 100644
--- a/tests/channels/pjsip/transfers/blind_transfer/callee_direct_media/test-config.yaml
+++ b/tests/channels/pjsip/transfers/blind_transfer/callee_direct_media/test-config.yaml
@@ -29,8 +29,15 @@
 test-modules:
     add-test-to-search-path: 'True'
     test-object:
-        config-section: test-case-config
-        typename: 'sipp.SIPpTestCase'
+        -
+            maxversion: '13.8.0'
+            config-section: test-case-config
+            typename: 'sipp.SIPpTestCase'
+        -
+            # The Notify with a SIP frag of 100 are now sent later
+            minversion: '13.8.0'
+            config-section: test-case-config-v13.8.0
+            typename: 'sipp.SIPpTestCase'
     modules:
         -
             config-section: 'ami-config'
@@ -66,6 +73,36 @@
                 - { 'key-args': {'scenario': 'alice.xml', '-p': '5060', '-i': '127.0.0.2', '-s': 'bob_two', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.2'},
                     'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
 
+test-case-config-v13.8.0:
+    reactor-timeout: 45
+    connect-ami: 'True'
+    fail-on-any: False
+    test-iterations:
+        # First iteration
+        -
+            scenarios:
+                # Charlie receives transfered call and sends audio to Alice.
+                - { 'key-args': {'scenario': 'charlie.xml', '-p': '5060', '-i': '127.0.0.4', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.4'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+                # Bob receives call from Alice and sends audio. Bob then attemps to blind transfer Alice to Charlie.
+                - { 'key-args': {'scenario': 'bob_v13_8_0.xml', '-p': '5060', '-i': '127.0.0.3', '-s': 'alice', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.3'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+                # Alice calls Bob and sends audio.
+                - { 'key-args': {'scenario': 'alice.xml', '-p': '5060', '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.2'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+        # Second iteration
+        -
+            scenarios:
+                # Charlie receives transfered call and sends audio to Alice.
+                - { 'key-args': {'scenario': 'charlie.xml', '-p': '5060', '-i': '127.0.0.4', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.4'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+                # Bob receives call from Alice and sends audio. Bob then attempts to blind transfer Alice to Charlie.
+                - { 'key-args': {'scenario': 'bob_v13_8_0.xml', '-p': '5060', '-i': '127.0.0.3', '-s': 'alice', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.3'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+                # Alice calls Bob and sends audio.
+                - { 'key-args': {'scenario': 'alice.xml', '-p': '5060', '-i': '127.0.0.2', '-s': 'bob_two', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.2'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+
 ami-config:
         -
             type: 'headermatch'
diff --git a/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/alice_v13_8_0.xml b/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/alice_v13_8_0.xml
index bca2c85..f9867f9 100644
--- a/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/alice_v13_8_0.xml
+++ b/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/sipp/alice_v13_8_0.xml
@@ -123,25 +123,6 @@
   <recv response="202" rtd="true">
   </recv>
 
-  <!-- We should receive a NOTIFY from Asterisk with a 100 trying sipfrag -->
-  <recv request="NOTIFY" crlf="true">
-  </recv>
-
-  <send>
-    <![CDATA[
-
-      SIP/2.0 200 OK
-      [last_Via:]
-      [last_From:]
-      [last_To:]
-      [last_Call-ID:]
-      [last_CSeq:]
-      [last_Event:]
-      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
-      Content-Length: 0
-    ]]>
-  </send>
-
   <!--
        Wait for re-invite for tearing down direct media between alice and bob
        due to transfering bob to charlie.
@@ -177,6 +158,25 @@
     crlf="true">
   </recv>
 
+  <!-- We should receive a NOTIFY from Asterisk with a 100 trying sipfrag -->
+  <recv request="NOTIFY" crlf="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      [last_Event:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+    ]]>
+  </send>
+
   <!-- We should receive a NOTIFY from Asterisk with a '200 OK' sipfrag -->
   <recv request="NOTIFY" crlf="true">
     <!-- Check if 'SIP/2.0 200 OK' is in the body -->
diff --git a/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/test-config.yaml b/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/test-config.yaml
index 425a9f3..ed19b93 100644
--- a/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/test-config.yaml
+++ b/tests/channels/pjsip/transfers/blind_transfer/caller_direct_media/test-config.yaml
@@ -29,8 +29,15 @@
 test-modules:
     add-test-to-search-path: 'True'
     test-object:
-        config-section: test-case-config
-        typename: 'sipp.SIPpTestCase'
+        -
+            maxversion: '13.8.0'
+            config-section: test-case-config
+            typename: 'sipp.SIPpTestCase'
+        -
+            # The Notify with a SIP frag of 100 are now sent later
+            minversion: '13.8.0'
+            config-section: test-case-config-v13.8.0
+            typename: 'sipp.SIPpTestCase'
     modules:
         -
             config-section: 'ami-config'
@@ -66,6 +73,36 @@
                 - { 'key-args': {'scenario': 'alice.xml', '-p': '5060', '-i': '127.0.0.2', '-s': 'bob_two', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.2'},
                     'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
 
+test-case-config-v13.8.0:
+    reactor-timeout: 45
+    connect-ami: 'True'
+    fail-on-any: False
+    test-iterations:
+        # First iteration
+        -
+            scenarios:
+                # Charlie receives transfered call and sends audio to Bob.
+                - { 'key-args': {'scenario': 'charlie.xml', '-p': '5060', '-i': '127.0.0.4', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.4'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+                # Bob receives call from Alice and sends audio.
+                - { 'key-args': {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3', '-s': 'alice', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.3'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+                # Alice calls Bob and sends audio. Alice then attempts to blind transfer Bob to Charlie.
+                - { 'key-args': {'scenario': 'alice_v13_8_0.xml', '-p': '5060', '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.2'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+        # Second iteration
+        -
+            scenarios:
+                # Charlie receives transfered call and sends audio to Bob.
+                - { 'key-args': {'scenario': 'charlie.xml', '-p': '5060', '-i': '127.0.0.4', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.4'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+                # Bob receives call from Alice and sends audio.
+                - { 'key-args': {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3', '-s': 'alice', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.3'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+                # Alice calls Bob and sends audio. Alice then attempts to blind transfer Bob to Charlie.
+                - { 'key-args': {'scenario': 'alice_v13_8_0.xml', '-p': '5060', '-i': '127.0.0.2', '-s': 'bob_two', '-timeout': '20s', '-min_rtp_port': '6004', '-max_rtp_port': '6008', '-mi': '127.0.0.2'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+
 ami-config:
         -
             type: 'headermatch'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8a0be41a3a19015c6b69e20e38f2853e2defd8dd
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list