[Asterisk-code-review] blind transfer: Add allow_transfer=no test (...testsuite[16])

Friendly Automation asteriskteam at digium.com
Mon Jul 22 08:35:35 CDT 2019


Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/testsuite/+/11570 )

Change subject: blind transfer: Add allow_transfer=no test
......................................................................

blind transfer: Add allow_transfer=no test

Add a test, pjsip/transfers/blind_transfer/disallow, that ensures a blind
transfer gets declined when allow_transfer=no

Change-Id: I14fca19c65c54895c69eca1daf084919c17cb0db
---
A tests/channels/pjsip/transfers/blind_transfer/disallow/configs/ast1/extensions.conf
A tests/channels/pjsip/transfers/blind_transfer/disallow/configs/ast1/pjsip.conf
A tests/channels/pjsip/transfers/blind_transfer/disallow/sipp/alice.xml
A tests/channels/pjsip/transfers/blind_transfer/disallow/sipp/bob.xml
A tests/channels/pjsip/transfers/blind_transfer/disallow/test-config.yaml
M tests/channels/pjsip/transfers/blind_transfer/tests.yaml
6 files changed, 252 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/tests/channels/pjsip/transfers/blind_transfer/disallow/configs/ast1/extensions.conf b/tests/channels/pjsip/transfers/blind_transfer/disallow/configs/ast1/extensions.conf
new file mode 100644
index 0000000..eab3dba
--- /dev/null
+++ b/tests/channels/pjsip/transfers/blind_transfer/disallow/configs/ast1/extensions.conf
@@ -0,0 +1,3 @@
+[default]
+exten => bob,1,Dial(PJSIP/bob)
+exten => charlie,1,Dial(PJSIP/charlie)
diff --git a/tests/channels/pjsip/transfers/blind_transfer/disallow/configs/ast1/pjsip.conf b/tests/channels/pjsip/transfers/blind_transfer/disallow/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..75ceb51
--- /dev/null
+++ b/tests/channels/pjsip/transfers/blind_transfer/disallow/configs/ast1/pjsip.conf
@@ -0,0 +1,37 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+context=default
+direct_media=false
+allow=!all,ulaw
+
+[alice](aor-template)
+contact=sip:alice at 127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
+
+[bob](aor-template)
+contact=sip:bob at 127.0.0.1:5062
+
+[bob](endpoint-template)
+aors=bob
+allow_transfer=no
+
+[charlie](aor-template)
+contact=sip:charlie at 127.0.0.1:5063
+
+[charlie](endpoint-template)
+aors=charlie
diff --git a/tests/channels/pjsip/transfers/blind_transfer/disallow/sipp/alice.xml b/tests/channels/pjsip/transfers/blind_transfer/disallow/sipp/alice.xml
new file mode 100644
index 0000000..e082c04
--- /dev/null
+++ b/tests/channels/pjsip/transfers/blind_transfer/disallow/sipp/alice.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="Send Call">
+
+    <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: <sip:alice@[local_ip]:[local_port]>;tag=[call_number]
+        To: <sip:[service]@[remote_ip]:[remote_port]>
+        Call-ID: [call_id]
+        CSeq: [cseq] INVITE
+        Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+        Max-Forwards: 70
+        Content-Type: application/sdp
+        Content-Length: [len]
+
+        v=0
+        o=- 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 response="180" optional="true" />
+    <recv response="183" optional="true" />
+    <recv response="200" rtd="true" />
+
+    <send>
+        <![CDATA[
+
+        ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+        Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+        From: <sip:alice@[local_ip]:[local_port]>;tag=[call_number]
+        To: <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+        Call-ID: [call_id]
+        CSeq: [cseq] ACK
+        Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+        Max-Forwards: 70
+        Content-Length: 0
+
+        ]]>
+    </send>
+
+    <recv request="BYE" />
+
+    <send>
+        <![CDATA[
+
+        SIP/2.0 200 OK
+        [last_Via:]
+        [last_From:]
+        [last_To:]
+        [last_Call-ID:]
+        [last_CSeq:]
+        Content-Length: 0
+
+        ]]>
+    </send>
+
+</scenario>
diff --git a/tests/channels/pjsip/transfers/blind_transfer/disallow/sipp/bob.xml b/tests/channels/pjsip/transfers/blind_transfer/disallow/sipp/bob.xml
new file mode 100644
index 0000000..280552b
--- /dev/null
+++ b/tests/channels/pjsip/transfers/blind_transfer/disallow/sipp/bob.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="Receive call then attempt blind transfer">
+
+    <!-- save tag to use when sending REFER and BYE -->
+    <recv request="INVITE" crlf="true">
+        <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:bob@[local_ip]:[local_port];transport=[transport]>
+        Content-Length: 0
+
+        ]]>
+    </send>
+    <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:bob@[local_ip]:[local_port];transport=[transport]>
+        Content-Length: [len]
+        Content-Type: application/sdp
+
+        v=0
+        o=- 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" optional="false" />
+
+    <pause milliseconds="1000" />
+
+    <send retrans="500">
+        <![CDATA[
+
+        REFER sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+        Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+        From: <sip:bob@[local_ip]:[local_port]>;tag=[pid]SIPpTag01[call_number]
+        To: <sip:[service]@[remote_ip]:[remote_port]>[$remote_tag]
+        Call-ID: [call_id]
+        CSeq: [cseq] REFER
+        Contact: <sip:bob@[local_ip]:[local_port];transport=[transport]>
+        Max-Forwards: 70
+        Content-Length: 0
+        Refer-To: <sip:charlie@[remote_ip]:[remote_port]>
+        Referred-By: <sip:bob@[local_ip]:[local_port]>
+
+        ]]>
+    </send>
+
+    <recv response="603" />
+
+    <send>
+      <![CDATA[
+
+        ACK sip:call_a@[remote_ip]:[remote_port] SIP/2.0
+        Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
+        [last_From:]
+        [last_To]
+        Call-ID: [call_id]
+        CSeq: [cseq] ACK
+        Contact: sip:bob@[local_ip]:[local_port]
+        Max-Forwards: 70
+        Content-Length: 0
+
+      ]]>
+    </send>
+
+    <pause milliseconds="1000" />
+
+    <send retrans="500">
+        <![CDATA[
+
+        BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+        Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+        From: <sip:bob@[local_ip]:[local_port]>;tag=[pid]SIPpTag01[call_number]
+        To: <sip:[service]@[remote_ip]:[remote_port]>[$remote_tag]
+        Call-ID: [call_id]
+        CSeq: [cseq] BYE
+        Max-Forwards: 70
+        Content-Length: 0
+
+        ]]>
+    </send>
+
+    <recv response="200" />
+
+</scenario>
diff --git a/tests/channels/pjsip/transfers/blind_transfer/disallow/test-config.yaml b/tests/channels/pjsip/transfers/blind_transfer/disallow/test-config.yaml
new file mode 100644
index 0000000..c5a4c27
--- /dev/null
+++ b/tests/channels/pjsip/transfers/blind_transfer/disallow/test-config.yaml
@@ -0,0 +1,31 @@
+testinfo:
+    summary: 'Ensure setting allow_transfer=no prevents a blind transfer'
+    description: |
+        'With the allow_transfer option disabled Alice calls Bob. Bob then
+        tries to transfer Alice to Charlie. Bob then should receive a 603
+        decline since transfers have been blocked.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    test-iterations:
+        -
+            scenarios:
+                # Bob receives the call and then attempts to blind transfer Alice to Charlie
+                - { 'key-args': {'scenario': 'bob.xml', '-p': '5062', '-i': '127.0.0.1', '-s': 'alice' } }
+                # Alice calls Bob
+                - { 'key-args': {'scenario': 'alice.xml', '-p': '5061', '-i': '127.0.0.1', '-s': 'bob' } }
+
+properties:
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
+        - transfer
+
diff --git a/tests/channels/pjsip/transfers/blind_transfer/tests.yaml b/tests/channels/pjsip/transfers/blind_transfer/tests.yaml
index c7cbd32..2c24a89 100644
--- a/tests/channels/pjsip/transfers/blind_transfer/tests.yaml
+++ b/tests/channels/pjsip/transfers/blind_transfer/tests.yaml
@@ -8,6 +8,7 @@
     - test: 'caller_refer_only'
     - test: 'caller_with_hold'
     - test: 'caller_with_hold_drop_options'
+    - test: 'disallow'
     - test: 'goto_on_blindxfr'
     - test: 'no_target_in_refer'
     - test: 'immediate_ok_notify'

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/11570
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: I14fca19c65c54895c69eca1daf084919c17cb0db
Gerrit-Change-Number: 11570
Gerrit-PatchSet: 2
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190722/8d315b29/attachment-0001.html>


More information about the asterisk-code-review mailing list