[Asterisk-code-review] pjsip: new endpoint's options to control Connected Line updates (testsuite[master])

Jenkins2 asteriskteam at digium.com
Thu Nov 1 06:48:45 CDT 2018


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/10545 )

Change subject: pjsip: new endpoint's options to control Connected Line updates
......................................................................

pjsip: new endpoint's options to control Connected Line updates

Change-Id: I032b2a7cd92defbcac4e3fd1c75039a29776459c
---
A tests/channels/pjsip/connected_line/connected_line_allow/configs/ast1/extensions.conf
A tests/channels/pjsip/connected_line/connected_line_allow/configs/ast1/pjsip.conf
A tests/channels/pjsip/connected_line/connected_line_allow/sipp/alice.xml
A tests/channels/pjsip/connected_line/connected_line_allow/sipp/bob.xml
A tests/channels/pjsip/connected_line/connected_line_allow/test-config.yaml
A tests/channels/pjsip/connected_line/connected_line_no_send/configs/ast1/extensions.conf
A tests/channels/pjsip/connected_line/connected_line_no_send/configs/ast1/pjsip.conf
A tests/channels/pjsip/connected_line/connected_line_no_send/sipp/alice.xml
A tests/channels/pjsip/connected_line/connected_line_no_send/sipp/bob.xml
A tests/channels/pjsip/connected_line/connected_line_no_send/test-config.yaml
A tests/channels/pjsip/connected_line/connected_line_no_trust/configs/ast1/extensions.conf
A tests/channels/pjsip/connected_line/connected_line_no_trust/configs/ast1/pjsip.conf
A tests/channels/pjsip/connected_line/connected_line_no_trust/sipp/alice.xml
A tests/channels/pjsip/connected_line/connected_line_no_trust/sipp/bob.xml
A tests/channels/pjsip/connected_line/connected_line_no_trust/test-config.yaml
A tests/channels/pjsip/connected_line/tests.yaml
M tests/channels/pjsip/tests.yaml
17 files changed, 980 insertions(+), 0 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/tests/channels/pjsip/connected_line/connected_line_allow/configs/ast1/extensions.conf b/tests/channels/pjsip/connected_line/connected_line_allow/configs/ast1/extensions.conf
new file mode 100644
index 0000000..bc9969a
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/connected_line_allow/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+
+[default]
+exten => bob,1,NoOp()
+	same => n,Dial(PJSIP/bob)
+	same => n,Hangup()
diff --git a/tests/channels/pjsip/connected_line/connected_line_allow/configs/ast1/pjsip.conf b/tests/channels/pjsip/connected_line/connected_line_allow/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..2d5bcc5
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/connected_line_allow/configs/ast1/pjsip.conf
@@ -0,0 +1,33 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[local]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint](!)
+type=endpoint
+context=default
+disallow=all
+allow=ulaw
+direct_media=no
+send_rpid=yes
+send_connected_line=yes
+trust_connected_line=yes
+trust_id_outbound=yes
+trust_id_inbound=yes
+
+[alice](endpoint)
+callerid=Alice <alice>
+
+[bob](endpoint)
+aors=bob
+callerid=Bob <bob>
+
+[bob]
+type=aor
+contact=sip:bob at 127.0.0.1:5063
+
diff --git a/tests/channels/pjsip/connected_line/connected_line_allow/sipp/alice.xml b/tests/channels/pjsip/connected_line/connected_line_allow/sipp/alice.xml
new file mode 100644
index 0000000..7281153
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/connected_line_allow/sipp/alice.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAC Requestor">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:bob@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: Alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:bob@[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
+      Remote-Party-ID: "Alice" <sip:alice at 127.0.0.1>;party=called;pvacy=off;screen=no
+      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="180" optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+      <action>
+          <ereg regexp="\"Bob2\" <sip:bob2 at 127.0.0.1>"
+              header="Remote-Party-ID"
+              search_in="hdr"
+              check_it="true"
+              assign_to="connected_party_id"/>
+      </action>
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:bob@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:bob@[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>
+
+  <pause milliseconds="1000"/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:bob@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:bob@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 INVITE
+      Contact: sip:alice@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Type: application/sdp
+      Remote-Party-ID: "Charle" <sip:charle at 127.0.0.1>;party=called;pvacy=off;screen=no
+      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="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:bob@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:bob@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 ACK
+      Contact: sip:alice@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause milliseconds="1000"/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:bob@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:bob@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 3 BYE
+      Contact: sip:alice@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200"/>
+
+  <Reference variables="connected_party_id" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/connected_line/connected_line_allow/sipp/bob.xml b/tests/channels/pjsip/connected_line/connected_line_allow/sipp/bob.xml
new file mode 100644
index 0000000..5c151e5
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/connected_line_allow/sipp/bob.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAS responder">
+
+  <recv request="INVITE">
+      <action>
+          <ereg regexp="\"Alice\" <sip:alice at 127.0.0.1>"
+              header="From"
+              search_in="hdr"
+              check_it="true"
+              assign_to="from"/>
+          <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 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>
+
+  <pause milliseconds="1000"/>
+
+  <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]>
+      Remote-Party-ID: "Bob2" <sip:bob2 at 127.0.0.1>;party=called;pvacy=off;screen=no
+      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">
+  </recv>
+
+  <recv request="INVITE">
+      <action>
+          <ereg regexp="\"Alice\" <sip:alice at 127.0.0.1>"
+              header="From"
+              search_in="hdr"
+              check_it="true"
+              assign_to="connected_from"/>
+          <ereg regexp="\"Charle\" <sip:charle at 127.0.0.1>"
+              header="Remote-Party-ID"
+              search_in="hdr"
+              check_it="true"
+              assign_to="connected_party_id"/>
+      </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">
+  </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>
+
+  <Reference variables="from" />
+  <Reference variables="remote_party_id" />
+  <Reference variables="connected_from" />
+  <Reference variables="connected_party_id" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/connected_line/connected_line_allow/test-config.yaml b/tests/channels/pjsip/connected_line/connected_line_allow/test-config.yaml
new file mode 100644
index 0000000..f13949a
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/connected_line_allow/test-config.yaml
@@ -0,0 +1,30 @@
+testinfo:
+    summary: Test connected line updates are allowed both ways.
+    description: |
+        Alice calls Bob, verifies the RPID is changed on asnwer, updates connected line after answer.
+        Bob updates connected line before answer and verifies the RPID is changed on 2nd INVITE.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: sipp.SIPpTestCase
+
+test-object-config:
+    memcheck-delay-stop: 7
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario':'alice.xml', '-p':'5062'} }
+                - { 'key-args': {'scenario':'bob.xml', '-p':'5063'} }
+
+properties:
+    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/connected_line/connected_line_no_send/configs/ast1/extensions.conf b/tests/channels/pjsip/connected_line/connected_line_no_send/configs/ast1/extensions.conf
new file mode 100644
index 0000000..bc9969a
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/connected_line_no_send/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+
+[default]
+exten => bob,1,NoOp()
+	same => n,Dial(PJSIP/bob)
+	same => n,Hangup()
diff --git a/tests/channels/pjsip/connected_line/connected_line_no_send/configs/ast1/pjsip.conf b/tests/channels/pjsip/connected_line/connected_line_no_send/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..9b12bb2
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/connected_line_no_send/configs/ast1/pjsip.conf
@@ -0,0 +1,33 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[local]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint](!)
+type=endpoint
+context=default
+disallow=all
+allow=ulaw
+direct_media=no
+send_rpid=yes
+send_connected_line=no
+trust_connected_line=yes
+trust_id_outbound=yes
+trust_id_inbound=yes
+
+[alice](endpoint)
+callerid=Alice <alice>
+
+[bob](endpoint)
+aors=bob
+callerid=Bob <bob>
+
+[bob]
+type=aor
+contact=sip:bob at 127.0.0.1:5063
+
diff --git a/tests/channels/pjsip/connected_line/connected_line_no_send/sipp/alice.xml b/tests/channels/pjsip/connected_line/connected_line_no_send/sipp/alice.xml
new file mode 100644
index 0000000..ae9587f
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/connected_line_no_send/sipp/alice.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAC Requestor">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:bob@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: Alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:bob@[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
+      Remote-Party-ID: "Alice" <sip:alice at 127.0.0.1>;party=called;pvacy=off;screen=no
+      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="180" optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+      <action>
+          <ereg regexp="\"Bob\" <sip:bob at 127.0.0.1>"
+              header="Remote-Party-ID"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_party_id"/>
+      </action>
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:bob@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:bob@[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>
+
+  <pause milliseconds="1000"/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:bob@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:bob@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 INVITE
+      Contact: sip:alice@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Type: application/sdp
+      Remote-Party-ID: "Charle" <sip:charle at 127.0.0.1>;party=called;pvacy=off;screen=no
+      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="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:bob@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:bob@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 ACK
+      Contact: sip:alice@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause milliseconds="1000"/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:bob@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:bob@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 3 BYE
+      Contact: sip:alice@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200"/>
+
+  <Reference variables="remote_party_id" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/connected_line/connected_line_no_send/sipp/bob.xml b/tests/channels/pjsip/connected_line/connected_line_no_send/sipp/bob.xml
new file mode 100644
index 0000000..2eddf40
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/connected_line_no_send/sipp/bob.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAS responder">
+
+  <recv request="INVITE">
+      <action>
+          <ereg regexp="\"Alice\" <sip:alice at 127.0.0.1>"
+              header="From"
+              search_in="hdr"
+              check_it="true"
+              assign_to="from"/>
+          <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 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>
+
+  <pause milliseconds="1000"/>
+
+  <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]>
+      Remote-Party-ID: "Bob2" <sip:bob2 at 127.0.0.1>;party=called;pvacy=off;screen=no
+      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">
+  </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>
+
+  <Reference variables="from" />
+  <Reference variables="remote_party_id" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/connected_line/connected_line_no_send/test-config.yaml b/tests/channels/pjsip/connected_line/connected_line_no_send/test-config.yaml
new file mode 100644
index 0000000..e1872ea
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/connected_line_no_send/test-config.yaml
@@ -0,0 +1,30 @@
+testinfo:
+    summary: Test connected line updates are not sent.
+    description: |
+        Alice calls Bob, verifies the RPID is not changed on asnwer, updates connected line after answer.
+        Bob updates connected line before answer and verifies the RPID is not changed on 2nd INVITE.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: sipp.SIPpTestCase
+
+test-object-config:
+    memcheck-delay-stop: 7
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario':'alice.xml', '-p':'5062'} }
+                - { 'key-args': {'scenario':'bob.xml', '-p':'5063'} }
+
+properties:
+    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/connected_line/connected_line_no_trust/configs/ast1/extensions.conf b/tests/channels/pjsip/connected_line/connected_line_no_trust/configs/ast1/extensions.conf
new file mode 100644
index 0000000..bc9969a
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/connected_line_no_trust/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+
+[default]
+exten => bob,1,NoOp()
+	same => n,Dial(PJSIP/bob)
+	same => n,Hangup()
diff --git a/tests/channels/pjsip/connected_line/connected_line_no_trust/configs/ast1/pjsip.conf b/tests/channels/pjsip/connected_line/connected_line_no_trust/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..415a7b2
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/connected_line_no_trust/configs/ast1/pjsip.conf
@@ -0,0 +1,33 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[local]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint](!)
+type=endpoint
+context=default
+disallow=all
+allow=ulaw
+direct_media=no
+send_rpid=yes
+send_connected_line=yes
+trust_connected_line=no
+trust_id_outbound=yes
+trust_id_inbound=yes
+
+[alice](endpoint)
+callerid=Alice <alice>
+
+[bob](endpoint)
+aors=bob
+callerid=Bob <bob>
+
+[bob]
+type=aor
+contact=sip:bob at 127.0.0.1:5063
+
diff --git a/tests/channels/pjsip/connected_line/connected_line_no_trust/sipp/alice.xml b/tests/channels/pjsip/connected_line/connected_line_no_trust/sipp/alice.xml
new file mode 100644
index 0000000..ae9587f
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/connected_line_no_trust/sipp/alice.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAC Requestor">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:bob@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: Alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:bob@[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
+      Remote-Party-ID: "Alice" <sip:alice at 127.0.0.1>;party=called;pvacy=off;screen=no
+      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="180" optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+      <action>
+          <ereg regexp="\"Bob\" <sip:bob at 127.0.0.1>"
+              header="Remote-Party-ID"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_party_id"/>
+      </action>
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:bob@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:bob@[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>
+
+  <pause milliseconds="1000"/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:bob@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:bob@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 INVITE
+      Contact: sip:alice@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Type: application/sdp
+      Remote-Party-ID: "Charle" <sip:charle at 127.0.0.1>;party=called;pvacy=off;screen=no
+      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="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:bob@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:bob@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 ACK
+      Contact: sip:alice@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause milliseconds="1000"/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:bob@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:bob@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 3 BYE
+      Contact: sip:alice@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200"/>
+
+  <Reference variables="remote_party_id" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/connected_line/connected_line_no_trust/sipp/bob.xml b/tests/channels/pjsip/connected_line/connected_line_no_trust/sipp/bob.xml
new file mode 100644
index 0000000..2eddf40
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/connected_line_no_trust/sipp/bob.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAS responder">
+
+  <recv request="INVITE">
+      <action>
+          <ereg regexp="\"Alice\" <sip:alice at 127.0.0.1>"
+              header="From"
+              search_in="hdr"
+              check_it="true"
+              assign_to="from"/>
+          <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 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>
+
+  <pause milliseconds="1000"/>
+
+  <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]>
+      Remote-Party-ID: "Bob2" <sip:bob2 at 127.0.0.1>;party=called;pvacy=off;screen=no
+      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">
+  </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>
+
+  <Reference variables="from" />
+  <Reference variables="remote_party_id" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/connected_line/connected_line_no_trust/test-config.yaml b/tests/channels/pjsip/connected_line/connected_line_no_trust/test-config.yaml
new file mode 100644
index 0000000..470a257
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/connected_line_no_trust/test-config.yaml
@@ -0,0 +1,30 @@
+testinfo:
+    summary: Test connected line updates are not trusted.
+    description: |
+        Alice calls Bob, verifies the RPID is not changed on asnwer, updates connected line after answer.
+        Bob updates connected line before answer and verifies the RPID is not changed on 2nd INVITE.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: sipp.SIPpTestCase
+
+test-object-config:
+    memcheck-delay-stop: 7
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario':'alice.xml', '-p':'5062'} }
+                - { 'key-args': {'scenario':'bob.xml', '-p':'5063'} }
+
+properties:
+    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/connected_line/tests.yaml b/tests/channels/pjsip/connected_line/tests.yaml
new file mode 100644
index 0000000..6fbe2c5
--- /dev/null
+++ b/tests/channels/pjsip/connected_line/tests.yaml
@@ -0,0 +1,5 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'connected_line_allow'
+    - test: 'connected_line_no_send'
+    - test: 'connected_line_no_trust'
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index b1118f9..04d104e 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -26,6 +26,7 @@
     - dir: 'video_calls'
     - dir: 'ice'
     - dir: 'use_callerid_contact'
+    - dir: 'connected_line'
     - test: 'accountcode'
     - test: 'acl_call'
     - test: 'allow_overlap'

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

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I032b2a7cd92defbcac4e3fd1c75039a29776459c
Gerrit-Change-Number: 10545
Gerrit-PatchSet: 2
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2 (1000185)
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181101/5b1eb2de/attachment-0001.html>


More information about the asterisk-code-review mailing list