[Asterisk-code-review] res pjsip: Call Transfer with Empty Extension (testsuite[master])

Anonymous Coward asteriskteam at digium.com
Mon Mar 20 13:47:52 CDT 2017


Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/5152 )

Change subject: res_pjsip:  Call Transfer with Empty Extension
......................................................................


res_pjsip:  Call Transfer with Empty Extension

When performing a call transfer to a sip uri w/o a username part
make sure that the 's' extension of the dialplan is invoked

ASTERISK-26869

Change-Id: Iba651ccc278ebd18ba854b4d85b986ccb7c0e6ba
---
A tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/configs/ast1/extensions.conf
A tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/configs/ast1/pjsip.conf
A tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/sipp/transferer.xml
A tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/test-config.yaml
M tests/channels/pjsip/transfers/blind_transfer/tests.yaml
5 files changed, 180 insertions(+), 1 deletion(-)

Approvals:
  Kevin Harwell: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/configs/ast1/extensions.conf b/tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/configs/ast1/extensions.conf
new file mode 100644
index 0000000..a6d7535
--- /dev/null
+++ b/tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/configs/ast1/extensions.conf
@@ -0,0 +1,12 @@
+[default]
+
+exten => echo,1,Answer()
+same => n,Echo()
+same => n,Hangup()
+
+exten => call-sipp,1,Dial(PJSIP/sipp)
+same => n,Hangup()
+
+exten => s,1,Answer()
+same => n,UserEvent(Transferred)
+same => n,Hangup()
diff --git a/tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/configs/ast1/pjsip.conf b/tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..7132032
--- /dev/null
+++ b/tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/configs/ast1/pjsip.conf
@@ -0,0 +1,14 @@
+[main-transport]
+type = transport
+protocol = udp
+bind = 127.0.0.1
+
+[sipp]
+type = endpoint
+context = default
+allow = ulaw
+aors = sipp
+
+[sipp]
+type = aor
+contact = sip:sipp at 127.0.0.1:5061
diff --git a/tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/sipp/transferer.xml b/tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/sipp/transferer.xml
new file mode 100644
index 0000000..1737d1e
--- /dev/null
+++ b/tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/sipp/transferer.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+<scenario name="transferer">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <!-- Save the from tag. We'll need it when we send our REFER -->
+      <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>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag00[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" />
+
+  <!-- Blind transfer this sucker to, well, nowhere which should be s -->
+  <send retrans="500">
+    <![CDATA[
+
+      REFER sip:sipp@[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]>[$remote_tag]
+      Call-ID: [call_id]
+      CSeq: [cseq] REFER
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Refer-To: sip:[remote_ip]:[remote_port];user=phone
+      Referred-By: sip:sipp@[local_ip]:[local_port]
+      Content-Length: 0
+
+    ]]>
+
+  </send>
+
+  <recv response="202" rtd="true">
+  </recv>
+
+  <recv request="NOTIFY" crlf="true">
+  </recv>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/test-config.yaml b/tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/test-config.yaml
new file mode 100644
index 0000000..61bc622
--- /dev/null
+++ b/tests/channels/pjsip/transfers/blind_transfer/no_target_in_refer/test-config.yaml
@@ -0,0 +1,63 @@
+testinfo:
+    summary: "Ensure that when a REFER without a user is received we transfer to s extension"
+    description: |
+        'Asterisk originates a call to a Local channel that runs Echo. The other half of
+        the local channel is placed into the dialplan and calls a SIPp scenario. The SIPp
+        scenario answers the call and then performs a blind transfer without specifying
+        an extension in the REFER. The blind transfer should go to the s extension and be
+        considered successful. An event which is emitted by the dialplan is used to determine
+        if the s extension was executed and to end the test.
+
+test-modules:
+    test-object:
+        config-section: sipp-config
+        typename: sipp.SIPpTestCase
+    modules:
+        -
+            config-section: originator-config
+            typename: pluggable_modules.Originator
+        -
+            config-section: pluggable-config
+            typename: 'pluggable_modules.EventActionModule'
+
+sipp-config:
+    stop-after-scenarios: false
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'transferer.xml', '-i': '127.0.0.1', '-p': '5061' }}
+
+originator-config:
+    channel: 'Local/echo at default'
+    context: 'default'
+    exten: 'call-sipp'
+    priority: '1'
+    trigger: 'scenario_start'
+    scenario-name: 'transferer.xml'
+
+pluggable-config:
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    UserEvent: 'Transferred'
+            count: 1
+        stop_test:
+
+properties:
+    minversion: '13.15.0'
+    dependencies:
+        - sipp:
+            version: 'v3.0'
+        - asterisk: 'res_pjsip'
+        - asterisk: 'res_pjsip_session'
+        - asterisk: 'res_pjsip_refer'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'app_dial'
+        - asterisk: 'app_echo'
+    tags:
+        - pjsip
+    testconditions:
+        -
+            name: 'channels'
diff --git a/tests/channels/pjsip/transfers/blind_transfer/tests.yaml b/tests/channels/pjsip/transfers/blind_transfer/tests.yaml
index a529add..6688906 100644
--- a/tests/channels/pjsip/transfers/blind_transfer/tests.yaml
+++ b/tests/channels/pjsip/transfers/blind_transfer/tests.yaml
@@ -9,4 +9,4 @@
     - test: 'caller_with_hold'
     - test: 'caller_with_hold_drop_options'
     - test: 'goto_on_blindxfr'
-
+    - test: 'no_target_in_refer'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iba651ccc278ebd18ba854b4d85b986ccb7c0e6ba
Gerrit-PatchSet: 4
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Torrey Searle <tsearle at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-code-review mailing list