<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6908">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Jenkins2: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjsip: Add tests for 'ip' option of 'identify_by' on endpoint.<br><br>This change adds two tests:<br><br>The first test sends various calls to Asterisk that initially match<br>based on the username portion of the From header. The endpoint<br>is configured to not allow it to be matched based on username.<br>Afterwards matching based on IP address occurs to a valid<br>endpoint.<br><br>The second test sends various calls to Asterisk that initially match<br>based on the source IP address of the INVITE. The endpoint is<br>configured to not allow it to be matched based on this. Afterwards<br>matching based on username occurs to a valid endpoint.<br><br>In both tests if calls work then the right endpoint has been<br>matched. If calls fail then the endpoint was matched incorrectly.<br><br>ASTERISK-27206<br><br>Change-Id: Ieb4e504b0063c723f6cdafd0f78281e33027f7ac<br>---<br>A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/configs/ast1/extensions.conf<br>A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/configs/ast1/pjsip.conf<br>A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/sipp/playback_with_initial_sdp.xml<br>A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/test-config.yaml<br>A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/configs/ast1/extensions.conf<br>A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/configs/ast1/pjsip.conf<br>A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/sipp/playback_with_initial_sdp.xml<br>A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/test-config.yaml<br>M tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/tests.yaml<br>M tests/channels/pjsip/dialplan_functions/pjsip_endpoint/configs/ast1/pjsip.conf<br>10 files changed, 342 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/configs/ast1/extensions.conf b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/configs/ast1/extensions.conf<br>new file mode 100644<br>index 0000000..a52330b<br>--- /dev/null<br>+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/configs/ast1/extensions.conf<br>@@ -0,0 +1,4 @@<br>+[default]<br>+exten => playback,1,Answer()<br>+same  =>          n,Playback(hello-world)<br>+same  =>          n,Hangup()<br>diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/configs/ast1/pjsip.conf<br>new file mode 100644<br>index 0000000..e41c733<br>--- /dev/null<br>+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/configs/ast1/pjsip.conf<br>@@ -0,0 +1,51 @@<br>+[global]<br>+type=global<br>+endpoint_identifier_order=username,ip<br>+<br>+[local-transport-template](!)<br>+type=transport<br>+bind=127.0.0.1<br>+<br>+[local-transport6-template](!)<br>+type=transport<br>+bind=[::1]<br>+<br>+[local-transport-udp](local-transport-template)<br>+protocol=udp<br>+<br>+[local-transport-udp6](local-transport6-template)<br>+protocol=udp<br>+<br>+[endpoint-template-ipv4](!)<br>+type=endpoint<br>+context=default<br>+allow=!all,ulaw,alaw<br>+media_address=127.0.0.1<br>+identify_by=ip<br>+<br>+[endpoint-template-ipv6](!)<br>+type=endpoint<br>+context=default<br>+allow=!all,ulaw,alaw<br>+media_address=[::1]<br>+rtp_ipv6=yes<br>+identify_by=ip<br>+<br>+[alice-ipv4-udp](endpoint-template-ipv4)<br>+<br>+[alice-ipv6-udp](endpoint-template-ipv6)<br>+<br>+[unknown](endpoint-template-ipv4)<br>+context=does-not-exist<br>+<br>+[identify-template](!)<br>+type=identify<br>+<br>+[alice-identify-ipv4](identify-template)<br>+endpoint=alice-ipv4-udp<br>+match=127.0.0.1<br>+<br>+[alice-identify-ipv6](identify-template)<br>+endpoint=alice-ipv6-udp<br>+match=[::1]<br>+<br>diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/sipp/playback_with_initial_sdp.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/sipp/playback_with_initial_sdp.xml<br>new file mode 100644<br>index 0000000..ea7d68a<br>--- /dev/null<br>+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/sipp/playback_with_initial_sdp.xml<br>@@ -0,0 +1,81 @@<br>+<?xml version="1.0" encoding="ISO-8859-1" ?><br>+<!DOCTYPE scenario SYSTEM "sipp.dtd"><br>+<br>+<scenario name="INVITE to playback with SDP in initial INVITE"><br>+  <send retrans="500"><br>+    <![CDATA[<br>+<br>+      INVITE sip:playback@[remote_ip]:[remote_port] SIP/2.0<br>+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]<br>+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]<br>+      To: test <sip:test@[remote_ip]:[remote_port]><br>+      Call-ID: [call_id]<br>+      CSeq: 1 INVITE<br>+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]><br>+      Max-Forwards: 70<br>+      Subject: Test<br>+      User-Agent: Test<br>+      Content-Type: application/sdp<br>+      Content-Length: [len]<br>+<br>+      v=0<br>+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]<br>+      s=-<br>+      c=IN IP[media_ip_type] [media_ip]<br>+      t=0 0<br>+      m=audio 6000 RTP/AVP 0<br>+      a=rtpmap:0 PCMU/8000<br>+<br>+    ]]><br>+  </send><br>+<br>+  <recv response="100"<br>+        optional="true"><br>+  </recv><br>+<br>+  <recv response="200" rtd="true"><br>+  </recv><br>+<br>+  <send><br>+    <![CDATA[<br>+<br>+      ACK sip:playback@[remote_ip]:[remote_port] SIP/2.0<br>+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]<br>+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]<br>+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]<br>+      Call-ID: [call_id]<br>+      CSeq: 1 ACK<br>+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]><br>+      Max-Forwards: 70<br>+      Subject: Test<br>+      Content-Length: 0<br>+<br>+    ]]><br>+  </send><br>+<br>+  <recv request="BYE"><br>+  </recv><br>+<br>+  <send><br>+    <![CDATA[<br>+<br>+      SIP/2.0 200 OK<br>+      [last_Via:]<br>+      [last_From:]<br>+      [last_To:]<br>+      [last_Call-ID:]<br>+      [last_CSeq:]<br>+      Contact: <sip:[local_ip]:[local_port];transport=[transport]><br>+      Content-Length: 0<br>+<br>+    ]]><br>+  </send><br>+<br>+  <!-- definition of the response time repartition table (unit is ms)   --><br>+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/><br>+<br>+  <!-- definition of the call length repartition table (unit is ms)     --><br>+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/><br>+<br>+</scenario><br>+<br>diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/test-config.yaml b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/test-config.yaml<br>new file mode 100644<br>index 0000000..a7061f1<br>--- /dev/null<br>+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_host_only/test-config.yaml<br>@@ -0,0 +1,34 @@<br>+testinfo:<br>+    summary:     'Tests incoming calls without authentication matching only on IP address'<br>+    description: |<br>+        'Run a SIPp scenario that sends various calls to res_pjsip, which should be matched only on IP address'<br>+<br>+test-modules:<br>+    test-object:<br>+        config-section: test-object-config<br>+        typename: 'sipp.SIPpTestCase'<br>+<br>+test-object-config:<br>+    reactor-timeout: 80<br>+    fail-on-any: False<br>+    test-iterations:<br>+        # IPv4 & UDP<br>+        -<br>+            scenarios:<br>+                - { 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '127.0.0.1', '-p': '5061'} }<br>+        # IPv6 & UDP<br>+        -<br>+            scenarios:<br>+                 - { 'target': '[::1]', 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '[::1]', '-p': '5061'} }<br>+<br>+properties:<br>+    minversion: [ '13.19.0', '15.2.0' ]<br>+    dependencies:<br>+        - sipp :<br>+            version : 'v3.0'<br>+        - asterisk : 'res_pjsip'<br>+        - asterisk : 'res_pjsip_session'<br>+        - asterisk : 'chan_pjsip'<br>+        - asterisk : 'res_pjsip_endpoint_identifier_ip'<br>+    tags:<br>+        - pjsip<br>diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/configs/ast1/extensions.conf b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/configs/ast1/extensions.conf<br>new file mode 100644<br>index 0000000..a52330b<br>--- /dev/null<br>+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/configs/ast1/extensions.conf<br>@@ -0,0 +1,4 @@<br>+[default]<br>+exten => playback,1,Answer()<br>+same  =>          n,Playback(hello-world)<br>+same  =>          n,Hangup()<br>diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/configs/ast1/pjsip.conf<br>new file mode 100644<br>index 0000000..a123c13<br>--- /dev/null<br>+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/configs/ast1/pjsip.conf<br>@@ -0,0 +1,51 @@<br>+[local-transport-template](!)<br>+type=transport<br>+bind=127.0.0.1<br>+<br>+[local-transport6-template](!)<br>+type=transport<br>+bind=[::1]<br>+<br>+[local-transport-udp](local-transport-template)<br>+protocol=udp<br>+<br>+[local-transport-udp6](local-transport6-template)<br>+protocol=udp<br>+<br>+[endpoint-template-ipv4](!)<br>+type=endpoint<br>+context=default<br>+allow=!all,ulaw,alaw<br>+media_address=127.0.0.1<br>+identify_by=username<br>+transport=local-transport-udp<br>+<br>+[endpoint-template-ipv6](!)<br>+type=endpoint<br>+context=default<br>+allow=!all,ulaw,alaw<br>+media_address=[::1]<br>+identify_by=username<br>+transport=local-transport-udp6<br>+<br>+[alice-ipv4-udp](endpoint-template-ipv4)<br>+<br>+[alice-ipv6-udp](endpoint-template-ipv6)<br>+<br>+[alice-ipv4-invalid](endpoint-template-ipv4)<br>+context=does-not-exist<br>+<br>+[alice-ipv6-invalid](endpoint-template-ipv6)<br>+context=does-not-exist<br>+<br>+[identify-template](!)<br>+type=identify<br>+<br>+[alice-identify-ipv4](identify-template)<br>+endpoint=alice-ipv4-invalid<br>+match=127.0.0.1<br>+<br>+[alice-identify-ipv6](identify-template)<br>+endpoint=alice-ipv6-invalid<br>+match=[::1]<br>+<br>diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/sipp/playback_with_initial_sdp.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/sipp/playback_with_initial_sdp.xml<br>new file mode 100644<br>index 0000000..790992f<br>--- /dev/null<br>+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/sipp/playback_with_initial_sdp.xml<br>@@ -0,0 +1,81 @@<br>+<?xml version="1.0" encoding="ISO-8859-1" ?><br>+<!DOCTYPE scenario SYSTEM "sipp.dtd"><br>+<br>+<scenario name="INVITE to playback with SDP in initial INVITE"><br>+  <send retrans="500"><br>+    <![CDATA[<br>+<br>+      INVITE sip:playback@[remote_ip]:[remote_port] SIP/2.0<br>+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]<br>+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]<br>+      To: test <sip:test@[remote_ip]:[remote_port]><br>+      Call-ID: [call_id]<br>+      CSeq: 1 INVITE<br>+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]><br>+      Max-Forwards: 70<br>+      Subject: Test<br>+      User-Agent: Test<br>+      Content-Type: application/sdp<br>+      Content-Length: [len]<br>+<br>+      v=0<br>+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]<br>+      s=-<br>+      c=IN IP[media_ip_type] [media_ip]<br>+      t=0 0<br>+      m=audio 6000 RTP/AVP 0<br>+      a=rtpmap:0 PCMU/8000<br>+<br>+    ]]><br>+  </send><br>+<br>+  <recv response="100"<br>+        optional="true"><br>+  </recv><br>+<br>+  <recv response="200" rtd="true"><br>+  </recv><br>+<br>+  <send><br>+    <![CDATA[<br>+<br>+      ACK sip:playback@[remote_ip]:[remote_port] SIP/2.0<br>+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]<br>+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]<br>+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]<br>+      Call-ID: [call_id]<br>+      CSeq: 1 ACK<br>+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]><br>+      Max-Forwards: 70<br>+      Subject: Test<br>+      Content-Length: 0<br>+<br>+    ]]><br>+  </send><br>+<br>+  <recv request="BYE"><br>+  </recv><br>+<br>+  <send><br>+    <![CDATA[<br>+<br>+      SIP/2.0 200 OK<br>+      [last_Via:]<br>+      [last_From:]<br>+      [last_To:]<br>+      [last_Call-ID:]<br>+      [last_CSeq:]<br>+      Contact: <sip:[local_ip]:[local_port];transport=[transport]><br>+      Content-Length: 0<br>+<br>+    ]]><br>+  </send><br>+<br>+  <!-- definition of the response time repartition table (unit is ms)   --><br>+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/><br>+<br>+  <!-- definition of the call length repartition table (unit is ms)     --><br>+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/><br>+<br>+</scenario><br>+<br>diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/test-config.yaml b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/test-config.yaml<br>new file mode 100644<br>index 0000000..7b9e7b5<br>--- /dev/null<br>+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_user_only/test-config.yaml<br>@@ -0,0 +1,33 @@<br>+testinfo:<br>+    summary:     'Tests incoming calls without authentication matching only based on user'<br>+    description: |<br>+        'Run a SIPp scenario that sends various calls to res_pjsip, which should be matched using username only'<br>+<br>+test-modules:<br>+    test-object:<br>+        config-section: test-object-config<br>+        typename: 'sipp.SIPpTestCase'<br>+<br>+test-object-config:<br>+    fail-on-any: False<br>+    test-iterations:<br>+        -<br>+            scenarios:<br>+        # IPv4 & UDP<br>+                - { 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice-ipv4-udp'} }<br>+        # IPv6 & UDP<br>+        -<br>+            scenarios:<br>+                 - { 'target': '[::1]', 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '[::1]', '-p': '5061', '-s': 'alice-ipv6-udp'} }<br>+<br>+properties:<br>+    minversion: [ '13.19.0', '15.2.0' ]<br>+    dependencies:<br>+        - sipp :<br>+            version : 'v3.0'<br>+        - asterisk : 'app_dial'<br>+        - asterisk : 'app_echo'<br>+        - asterisk : 'app_playback'<br>+        - asterisk : 'res_pjsip'<br>+    tags:<br>+        - pjsip<br>diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/tests.yaml b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/tests.yaml<br>index ed1244b..722964b 100644<br>--- a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/tests.yaml<br>+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/tests.yaml<br>@@ -1,5 +1,7 @@<br> tests:<br>     - test: 'ident_by_host'<br>+    - test: 'ident_by_host_only'<br>     - test: 'ident_by_user'<br>+    - test: 'ident_by_user_only'<br>     - test: 'ident_by_user_drop_options'<br>     - test: 'ident_by_header'<br>diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_endpoint/configs/ast1/pjsip.conf b/tests/channels/pjsip/dialplan_functions/pjsip_endpoint/configs/ast1/pjsip.conf<br>index 9cb6dbb..3baa86b 100644<br>--- a/tests/channels/pjsip/dialplan_functions/pjsip_endpoint/configs/ast1/pjsip.conf<br>+++ b/tests/channels/pjsip/dialplan_functions/pjsip_endpoint/configs/ast1/pjsip.conf<br>@@ -9,6 +9,7 @@<br> type=endpoint<br> context=default<br> allow=!all,ulaw,alaw<br>+identify_by=username<br> <br> [aors-template](!)<br> type=aor<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6908">change 6908</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6908"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ieb4e504b0063c723f6cdafd0f78281e33027f7ac </div>
<div style="display:none"> Gerrit-Change-Number: 6908 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>