[asterisk-commits] pjsip/transfer: Test "From" anonymization (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 10 05:48:22 CST 2016


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

Change subject: pjsip/transfer:  Test "From" anonymization
......................................................................


pjsip/transfer:  Test "From" anonymization

Because of the multiple call legs, a transfer test is ideal for testing the
anonymization of the From header when callerid presentation is prohibited.

Change-Id: If9ebc98bd60d9ae7d5c90ddc57ae1a3f5b4f8f90
---
A tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/configs/ast1/extensions.conf
A tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/configs/ast1/pjsip.conf
A tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/referee.xml
A tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/referer_uas.xml
A tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/uac-no-hangup.xml
A tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/uas.xml
A tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/test-config.yaml
M tests/channels/pjsip/transfers/attended_transfer/nominal/tests.yaml
8 files changed, 813 insertions(+), 0 deletions(-)

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



diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/configs/ast1/extensions.conf b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/configs/ast1/extensions.conf
new file mode 100644
index 0000000..a299118
--- /dev/null
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/configs/ast1/extensions.conf
@@ -0,0 +1,9 @@
+
+[default]
+exten => call_c,1,NoOp()
+	same => n,Dial(PJSIP/charlie)
+	same => n,Hangup()
+
+exten => alice,1,NoOp()
+	same => n,Dial(PJSIP/bob)
+	same => n,Hangup()
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/configs/ast1/pjsip.conf b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..d7e4874
--- /dev/null
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/configs/ast1/pjsip.conf
@@ -0,0 +1,38 @@
+[local]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint](!)
+type=endpoint
+context=default
+disallow=all
+allow=ulaw
+direct_media=no
+send_pai=yes
+send_rpid=yes
+trust_id_outbound=yes
+trust_id_inbound=yes
+callerid_privacy=prohib
+
+[alice](endpoint)
+callerid=Alice <alice>
+
+[bob](endpoint)
+aors=bob
+callerid=Bob <bob>
+
+[bob]
+type=aor
+contact=sip:bob at 127.0.0.1:5066
+
+[charlie](endpoint)
+aors=charlie
+callerid=Charlie <charlie>
+
+[charlie]
+type=aor
+contact=sip:charlie at 127.0.0.1:5067
+
+[david](endpoint)
+callerid=David <david>
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/referee.xml b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/referee.xml
new file mode 100644
index 0000000..f4166e1
--- /dev/null
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/referee.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- This program is free software; you can redistribute it and/or      -->
+<!-- modify it under the terms of the GNU General Public License as     -->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.                    -->
+<!--                                                                    -->
+<!-- This program is distributed in the hope that it will be useful,    -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of     -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      -->
+<!-- GNU General Public License for more details.                       -->
+<!--                                                                    -->
+<!-- You should have received a copy of the GNU General Public License  -->
+<!-- along with this program; if not, write to the                      -->
+<!-- Free Software Foundation, Inc.,                                    -->
+<!-- 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA             -->
+<!--                                                                    -->
+
+<scenario name="Referee Leg">
+
+  <recvCmd>
+    <action>
+      <ereg regexp="REMOTE(.*)"
+        search_in="hdr"
+        header="Call-ID:"
+        check_it="true"
+        assign_to="1,original_callid" />
+    </action>
+  </recvCmd>
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:call_c@[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=[call_number]
+      To: <sip:transfer@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: [cseq] INVITE
+      Contact: <sip:bob@[local_ip]:[local_port]>
+      Max-Forwards: 70
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=- 1324901698 1324901698 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 101
+      a=sendrecv
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:101 telephone-event/8000
+
+    ]]>
+  </send>
+
+  <recv response="100" optional="true" />
+  <recv response="101" optional="true" />
+  <recv response="180" optional="true" />
+  <recv response="200" rtd="true" crlf="true">
+    <action>
+      <ereg regexp="tag=([[:alnum:].\-]*)"
+        search_in="hdr"
+        header="To:"
+        check_it="true"
+        assign_to="2,to_tag" />
+      <ereg regexp="tag=([[:alnum:].\-]*)"
+        search_in="hdr"
+        header="From:"
+        check_it="true"
+        assign_to="3,from_tag" />
+    </action>
+  </recv>
+  <Reference variables="1,2,3" />
+
+  <send>
+    <![CDATA[
+
+      ACK sip:call_c@[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" />
+  <sendCmd>
+    <![CDATA[
+      Call-ID: [$original_callid]
+      Remote-To-Tag: [$to_tag]
+      Remote-From-Tag: [$from_tag]
+      Remote-URI: sip:call_c@[remote_ip]:[remote_port]
+    ]]>
+  </sendCmd>
+
+  <recv request="BYE">
+    <action>
+        <ereg regexp="<sip:transfer at 127.0.0.1>"
+         header="From"
+         search_in="hdr"
+         check_it="true"
+         assign_to="from"/>
+	</action>
+  </recv>
+  <Reference variables="from" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:bob@[local_ip]:[local_port]>
+      Content-Length:0
+
+    ]]>
+  </send>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/referer_uas.xml b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/referer_uas.xml
new file mode 100644
index 0000000..950cc54
--- /dev/null
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/referer_uas.xml
@@ -0,0 +1,252 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- This program is free software; you can redistribute it and/or      -->
+<!-- modify it under the terms of the GNU General Public License as     -->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.                    -->
+<!--                                                                    -->
+<!-- This program is distributed in the hope that it will be useful,    -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of     -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      -->
+<!-- GNU General Public License for more details.                       -->
+<!--                                                                    -->
+<!-- You should have received a copy of the GNU General Public License  -->
+<!-- along with this program; if not, write to the                      -->
+<!-- Free Software Foundation, Inc.,                                    -->
+<!-- 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA             -->
+<!--                                                                    -->
+
+<scenario name="Referer Leg">
+  <recv request="INVITE" crlf="true">
+    <action>
+		<ereg regexp="\"Anonymous\" <sip:anonymous at anonymous.invalid>"
+              header="From"
+              search_in="hdr"
+              check_it="true"
+              assign_to="from"/>
+    </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[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">
+    <action>
+      <ereg regexp="\"Anonymous\" <sip:anonymous at anonymous.invalid>"
+         header="From"
+         search_in="hdr"
+         check_it="true"
+         assign_to="from"/>
+      <ereg regexp=" (.+)"
+        search_in="hdr"
+        header="From:"
+        check_it="true"
+        assign_to="1,outbound_to_header" />
+      <ereg regexp=" (.+)"
+        search_in="hdr"
+        header="To:"
+        check_it="true"
+        assign_to="1,outbound_from_header" />
+    </action>
+  </recv>
+
+  <!-- Put this leg on hold -->
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/UDP [local_ip]:[local_port];rport;received=127.0.0.1;branch=[branch]
+      From: [$outbound_from_header]
+      To: [$outbound_to_header]
+      Call-ID: [call_id]
+      CSeq: [cseq] INVITE
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Max-Forwards: 70
+      Content-Length: [len]
+
+      v=0
+      o=- 1324901698 1324901698 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 101
+      a=sendonly
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:101 telephone-event/8000
+
+    ]]>
+  </send>
+
+  <recv response="100" optional="true" />
+  <recv response="101" optional="true" />
+  <recv response="180" optional="true" />
+  <recv response="200" rtd="true" crlf="true" />
+
+  <send>
+    <![CDATA[
+
+      ACK sip:[local_ip]:[local_port] SIP/2.0
+      [last_Via]
+      [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>
+
+  <sendCmd>
+    <![CDATA[
+      Call-ID: REMOTE[call_id]
+      Start the Echo Leg
+    ]]>
+  </sendCmd>
+
+  <recvCmd>
+    <action>
+      <ereg regexp=" (.+)"
+        search_in="hdr"
+        header="Remote-URI:"
+        check_it="true"
+        assign_to="1,remote_contact" />
+      <ereg regexp=" (.+)"
+        search_in="hdr"
+        header="Remote-To-Tag:"
+        check_it="true"
+        assign_to="2,remote_to_tag" />
+      <ereg regexp=" (.+)"
+        search_in="hdr"
+        header="Remote-From-Tag:"
+        check_it="true"
+        assign_to="3,remote_from_tag" />
+     </action>
+  </recvCmd>
+  <Reference variables="1,2,3" />
+
+  <send>
+    <![CDATA[
+
+      REFER sip:call_c@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      [last_From:]
+      [last_To]
+      [last_Call-ID:]
+      CSeq: [cseq] REFER
+      Contact: <sip:bob@[local_ip]:[local_port]>
+      Max-Forwards: 70
+      Refer-to: <[$remote_contact]?Replaces=REMOTE[call_id]%3Bto-tag%3D[$remote_to_tag]%3Bfrom-tag%3D[$remote_from_tag]>
+      Referred-By: sip:bob@[local_ip]
+      Content-Length: 0
+
+    ]]>
+  </send>
+  <recv response="202" rtd="true" crlf="true" />
+
+  <!-- In a nominal attended transfer Asterisk should always
+       be sending two notifies (SIP frags of 100 and 200) -->
+  <recv request="NOTIFY" >
+    <action>
+        <ereg regexp="\"Anonymous\" <sip:anonymous at anonymous.invalid>"
+         header="From"
+         search_in="hdr"
+         check_it="true"
+         assign_to="from"/>
+    </action>
+  </recv>
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:bob@[local_ip]:[local_port]>
+      Content-Length:0
+
+    ]]>
+  </send>
+
+  <recv request="NOTIFY">
+    <action>
+        <ereg regexp="\"Anonymous\" <sip:anonymous at anonymous.invalid>"
+         header="From"
+         search_in="hdr"
+         check_it="true"
+         assign_to="from"/>
+    </action>
+  </recv>
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:bob@[local_ip]:[local_port]>
+      Content-Length:0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:call_c@[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=[call_number]
+      To: <sip:transfer@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: [cseq] BYE
+      Contact: sip:bob@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200"/>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+  <Reference variables="from" />
+
+</scenario>
+
+
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/uac-no-hangup.xml b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/uac-no-hangup.xml
new file mode 100644
index 0000000..321e53f
--- /dev/null
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/uac-no-hangup.xml
@@ -0,0 +1,141 @@
+<?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:alice@[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:alice@[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:alice@[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:alice@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="INVITE">
+      <action>
+          <ereg regexp="\"Anonymous\" <sip:anonymous at anonymous.invalid>"
+              header="From"
+              search_in="hdr"
+              check_it="true"
+              assign_to="from"/>
+          <ereg regexp="\"Charlie\" <sip:charlie at 127.0.0.1>"
+              header="P-Asserted-Identity"
+              search_in="hdr"
+              check_it="true"
+              assign_to="asserted_identity"/>
+          <ereg regexp="\"Charlie\" <sip:charlie at 127.0.0.1>"
+              header="Remote-Party-ID"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_party_id"/>
+      </action>
+  </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-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">
+  </recv>
+
+  <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"/>
+
+  <Reference variables="asserted_identity" />
+  <Reference variables="remote_party_id" />
+  <Reference variables="from" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/uas.xml b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/uas.xml
new file mode 100644
index 0000000..69c014d
--- /dev/null
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/sipp/uas.xml
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- This program is free software; you can redistribute it and/or      -->
+<!-- modify it under the terms of the GNU General Public License as     -->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.                    -->
+<!--                                                                    -->
+<!-- This program is distributed in the hope that it will be useful,    -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of     -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      -->
+<!-- GNU General Public License for more details.                       -->
+<!--                                                                    -->
+<!-- You should have received a copy of the GNU General Public License  -->
+<!-- along with this program; if not, write to the                      -->
+<!-- Free Software Foundation, Inc.,                                    -->
+<!-- 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA             -->
+<!--                                                                    -->
+<!--                 Sipp default 'uas' scenario.                       -->
+<!--                                                                    -->
+
+<scenario name="Basic UAS responder">
+  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
+  <!-- are saved and used for following messages sent. Useful to test   -->
+  <!-- against stateful SIP proxies/B2BUAs.                             -->
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <!-- The '[last_*]' keyword is replaced automatically by the          -->
+  <!-- specified header if it was present in the last message received  -->
+  <!-- (except if it was a retransmission). If the header was not       -->
+  <!-- present or if no message has been received, the '[last_*]'       -->
+  <!-- keyword is discarded, and all bytes until the end of the line    -->
+  <!-- are also discarded.                                              -->
+  <!--                                                                  -->
+  <!-- If the specified header was present several times in the         -->
+  <!-- message, all occurences are concatenated (CRLF seperated)        -->
+  <!-- to be used in place of the '[last_*]' keyword.                   -->
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[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=[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"
+        optional="true"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <recv request="INVITE">
+      <action>
+          <ereg regexp="\"Anonymous\" <sip:anonymous at anonymous.invalid>"
+              header="From"
+              search_in="hdr"
+              check_it="true"
+              assign_to="from"/>
+          <ereg regexp="\"Alice\" <sip:alice at 127.0.0.1>"
+              header="P-Asserted-Identity"
+              search_in="hdr"
+              check_it="true"
+              assign_to="asserted_identity"/>
+          <ereg regexp="\"Alice\" <sip:alice at 127.0.0.1>"
+              header="Remote-Party-ID"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_party_id"/>
+      </action>
+  </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-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">
+  </recv>
+
+  <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>
+
+  <!-- Keep the call open for a while in case the 200 is lost to be     -->
+  <!-- able to retransmit it if we receive the BYE again.               -->
+  <pause milliseconds="4000"/>
+
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+  <Reference variables="asserted_identity" />
+  <Reference variables="remote_party_id" />
+  <Reference variables="from" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/test-config.yaml b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/test-config.yaml
new file mode 100644
index 0000000..642336b
--- /dev/null
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_anonymous/test-config.yaml
@@ -0,0 +1,69 @@
+testinfo:
+    summary: Test anonymized From headers while performing a callee-initiated attended transfer.
+    description: |
+        "Start four SIPp scenarios that do the following:
+        SIPp #1 (uac-no-hangup.xml) calls through Asterisk to SIPp #2 (referer_uas.xml)
+        SIPp #2 kicks off SIPp #3 (referee.xml) which calls SIPp #4 (uas.xml).
+        SIPp #3 passes call information back to SIPp #2.
+        SIPp #2 initiates an attended transfer via REFER with Replaces information from SIPp #3.
+        SIPp #1 and SIPp #4 are bridged.
+        SIPp #1 and SIPp #4 receive connected line updates and the values are checked.
+        SIPp #2 and SIPp #3 are hung up.
+        SIPp #1 and SIPp #4 are hung up."
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: sipp.SIPpTestCase
+    modules:
+        -
+            config-section: ami-config
+            typename: 'pluggable_modules.EventActionModule'
+
+test-object-config:
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'coordinated-sender': {'key-args': {'scenario':'referer_uas.xml', '-p':'5066', '-sleep': '2'} },
+                    'coordinated-receiver': { 'key-args': {'scenario':'referee.xml', '-p':'5065'} } }
+                - { 'key-args': {'scenario':'uas.xml', '-p':'5067', '-sleep': '2'} }
+                - { 'key-args': {'scenario':'uac-no-hangup.xml', '-p':'5068', '-s':'alice', '-sleep': '2'} }
+
+ami-config:
+    -
+        ami-events:
+            type: 'headermatch'
+            conditions:
+                match:
+                    Event: 'AttendedTransfer'
+                    Result: 'Success'
+            count: 1
+    # Ensure COLP updates occur for alice and charlie before hanging up.
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'NewConnectedLine'
+                    Channel: 'PJSIP/charlie-.*|PJSIP/alice-.*'
+                    ChannelStateDesc: 'Up'
+                    ConnectedLineNum: 'alice|charlie'
+                    ConnectedLineName: 'Alice|Charlie'
+            count: '>2'
+            trigger-on-count: True
+        ami-actions:
+            action:
+                action: 'Hangup'
+                channel: '/^PJSIP/charlie-.*$/'
+
+properties:
+    minversion: '13.8.0'
+    dependencies:
+        - python : twisted
+        - python : starpy
+        - asterisk : app_dial
+        - asterisk : chan_pjsip
+        - asterisk : res_pjsip_caller_id
+        - asterisk : res_pjsip_session
+    tags:
+        - PJSIP
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/tests.yaml b/tests/channels/pjsip/transfers/attended_transfer/nominal/tests.yaml
index b56c877..9056fa9 100644
--- a/tests/channels/pjsip/transfers/attended_transfer/nominal/tests.yaml
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/tests.yaml
@@ -3,6 +3,7 @@
     - test: 'caller_local'
     - test: 'caller_local_blonde'
     - test: 'callee_local'
+    - test: 'callee_local_anonymous'
     - test: 'callee_local_blonde'
     - test: 'caller_remote'
     - test: 'callee_remote'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If9ebc98bd60d9ae7d5c90ddc57ae1a3f5b4f8f90
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: George Joseph <george.joseph at fairview5.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-commits mailing list