<p>Richard Mudgett has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7937">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">channel/pjsip/identify/header_ordering: Test endpoint identification order.<br><br>The two tests check that the endpoint identification header and ip methods<br>are triggered in the expected priority order specified by<br>endpoint_identifier_order.<br><br>ASTERISK-27491<br><br>Change-Id: I12560bdcc36f7df170de79e11666fe6b812e67f4<br>---<br>A tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/extensions.conf<br>A tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/pjsip.conf<br>A tests/channels/pjsip/identify/header_ordering_header_ip/sipp/nominal.xml<br>A tests/channels/pjsip/identify/header_ordering_header_ip/test-config.yaml<br>A tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/extensions.conf<br>A tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/pjsip.conf<br>A tests/channels/pjsip/identify/header_ordering_ip_header/sipp/nominal.xml<br>A tests/channels/pjsip/identify/header_ordering_ip_header/test-config.yaml<br>M tests/channels/pjsip/identify/tests.yaml<br>9 files changed, 370 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/37/7937/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/extensions.conf b/tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/extensions.conf<br>new file mode 100644<br>index 0000000..bed05dd<br>--- /dev/null<br>+++ b/tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/extensions.conf<br>@@ -0,0 +1,14 @@<br>+[default]<br>+<br>+[header]<br>+exten = echo,1,NoOp()<br>+same = n,Answer()<br>+same = n,UserEvent(Header)<br>+same = n,Hangup()<br>+<br>+[ip]<br>+exten = echo,1,NoOp()<br>+same = n,Answer()<br>+same = n,UserEvent(Ip)<br>+same = n,Hangup()<br>+<br>diff --git a/tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/pjsip.conf b/tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/pjsip.conf<br>new file mode 100644<br>index 0000000..2c4dfae<br>--- /dev/null<br>+++ b/tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/pjsip.conf<br>@@ -0,0 +1,39 @@<br>+[global]<br>+type=global<br>+endpoint_identifier_order=header,ip<br>+debug=yes<br>+<br>+[system]<br>+type=system<br>+timer_t1=100<br>+timer_b=6400<br>+<br>+[local-transport-template](!)<br>+type=transport<br>+bind=127.0.0.1<br>+<br>+[local-transport-udp](local-transport-template)<br>+protocol=udp<br>+<br>+[endpoint-template](!)<br>+type=endpoint<br>+allow=!all,ulaw,alaw<br>+<br>+[alice-header](endpoint-template)<br>+identify_by=header<br>+context=header<br>+<br>+[alice-ip](endpoint-template)<br>+identify_by=ip<br>+context=ip<br>+<br>+[identify-template](!)<br>+type=identify<br>+<br>+[alice-header-identify](identify-template)<br>+endpoint=alice-header<br>+match_header=X-ASTERISK-TOKEN: e7657250-07fa-11e7-92f8-1b946c0c7e84<br>+<br>+[alice-ip-identify](identify-template)<br>+endpoint=alice-ip<br>+match=127.0.0.1<br>diff --git a/tests/channels/pjsip/identify/header_ordering_header_ip/sipp/nominal.xml b/tests/channels/pjsip/identify/header_ordering_header_ip/sipp/nominal.xml<br>new file mode 100644<br>index 0000000..d0eb174<br>--- /dev/null<br>+++ b/tests/channels/pjsip/identify/header_ordering_header_ip/sipp/nominal.xml<br>@@ -0,0 +1,75 @@<br>+<?xml version="1.0" encoding="ISO-8859-1" ?><br>+<!DOCTYPE scenario SYSTEM "sipp.dtd"><br>+<br>+<scenario name="INVITE to echo with SDP in initial INVITE"><br>+      <send retrans="500"><br>+         <![CDATA[<br>+                 INVITE sip:echo@[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>+                        X-ASTERISK-TOKEN: [ident_key]<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>+       </send><br>+<br>+     <recv response="100" optional="true"><br>+      </recv><br>+<br>+     <recv response="200" rtd="true"><br>+   </recv><br>+<br>+     <send><br>+         <![CDATA[<br>+                 ACK sip:echo@[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>+                        X-ASTERISK-TOKEN: [ident_key]<br>+                        Content-Length: 0<br>+            ]]><br>+       </send><br>+<br>+     <recv request="BYE"><br>+ </recv><br>+<br>+     <send><br>+         <![CDATA[<br>+                 SIP/2.0 200 OK<br>+                       [last_Via:]<br>+                  [last_From:]<br>+                 [last_To:]<br>+                   [last_Call-ID:]<br>+                      [last_CSeq:]<br>+                 Content-Length: 0<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/identify/header_ordering_header_ip/test-config.yaml b/tests/channels/pjsip/identify/header_ordering_header_ip/test-config.yaml<br>new file mode 100644<br>index 0000000..0c91298<br>--- /dev/null<br>+++ b/tests/channels/pjsip/identify/header_ordering_header_ip/test-config.yaml<br>@@ -0,0 +1,56 @@<br>+testinfo:<br>+    summary:     'Tests incoming calls identified by header and source IP'<br>+    description: |<br>+        This test covers sending calls to an Asterisk instance<br>+        identifiable by a custom header and by a source IP address.<br>+        It is expected that the requests are accepted by the correct<br>+        endpoint determined by endpoint_identifier_order.<br>+        This test expects the call to be accepted by the header identifier.<br>+<br>+test-modules:<br>+    test-object:<br>+        config-section: test-object-config<br>+        typename: 'sipp.SIPpTestCase'<br>+    modules:<br>+        -<br>+            config-section: ami-config<br>+            typename: 'ami.AMIEventModule'<br>+<br>+test-object-config:<br>+    memcheck-delay-stop: 7<br>+    fail-on-any: True<br>+    test-iterations:<br>+        # IPv4 & UDP<br>+        -<br>+            scenarios:<br>+                - { 'key-args': {'scenario': 'nominal.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 's'},<br>+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }<br>+<br>+ami-config:<br>+    -<br>+        type: 'headermatch'<br>+        id: '0'<br>+        conditions:<br>+            match:<br>+                Event: 'UserEvent'<br>+                UserEvent: 'Header'<br>+        count: '1'<br>+    -<br>+        type: 'headermatch'<br>+        id: '0'<br>+        conditions:<br>+            match:<br>+                Event: 'UserEvent'<br>+                UserEvent: 'Ip'<br>+        count: '0'<br>+<br>+properties:<br>+    minversion: ['13.20.0', '15.3.0']<br>+    dependencies:<br>+        - sipp :<br>+            version : 'v3.0'<br>+        - asterisk : 'app_userevent'<br>+        - asterisk : 'res_pjsip'<br>+        - asterisk : 'res_pjsip_endpoint_identifier_ip'<br>+    tags:<br>+        - pjsip<br>diff --git a/tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/extensions.conf b/tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/extensions.conf<br>new file mode 100644<br>index 0000000..bed05dd<br>--- /dev/null<br>+++ b/tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/extensions.conf<br>@@ -0,0 +1,14 @@<br>+[default]<br>+<br>+[header]<br>+exten = echo,1,NoOp()<br>+same = n,Answer()<br>+same = n,UserEvent(Header)<br>+same = n,Hangup()<br>+<br>+[ip]<br>+exten = echo,1,NoOp()<br>+same = n,Answer()<br>+same = n,UserEvent(Ip)<br>+same = n,Hangup()<br>+<br>diff --git a/tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/pjsip.conf b/tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/pjsip.conf<br>new file mode 100644<br>index 0000000..3ae78ac<br>--- /dev/null<br>+++ b/tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/pjsip.conf<br>@@ -0,0 +1,39 @@<br>+[global]<br>+type=global<br>+endpoint_identifier_order=ip,header<br>+debug=yes<br>+<br>+[system]<br>+type=system<br>+timer_t1=100<br>+timer_b=6400<br>+<br>+[local-transport-template](!)<br>+type=transport<br>+bind=127.0.0.1<br>+<br>+[local-transport-udp](local-transport-template)<br>+protocol=udp<br>+<br>+[endpoint-template](!)<br>+type=endpoint<br>+allow=!all,ulaw,alaw<br>+<br>+[alice-header](endpoint-template)<br>+identify_by=header<br>+context=header<br>+<br>+[alice-ip](endpoint-template)<br>+identify_by=ip<br>+context=ip<br>+<br>+[identify-template](!)<br>+type=identify<br>+<br>+[alice-header-identify](identify-template)<br>+endpoint=alice-header<br>+match_header=X-ASTERISK-TOKEN: e7657250-07fa-11e7-92f8-1b946c0c7e84<br>+<br>+[alice-ip-identify](identify-template)<br>+endpoint=alice-ip<br>+match=127.0.0.1<br>diff --git a/tests/channels/pjsip/identify/header_ordering_ip_header/sipp/nominal.xml b/tests/channels/pjsip/identify/header_ordering_ip_header/sipp/nominal.xml<br>new file mode 100644<br>index 0000000..d0eb174<br>--- /dev/null<br>+++ b/tests/channels/pjsip/identify/header_ordering_ip_header/sipp/nominal.xml<br>@@ -0,0 +1,75 @@<br>+<?xml version="1.0" encoding="ISO-8859-1" ?><br>+<!DOCTYPE scenario SYSTEM "sipp.dtd"><br>+<br>+<scenario name="INVITE to echo with SDP in initial INVITE"><br>+    <send retrans="500"><br>+         <![CDATA[<br>+                 INVITE sip:echo@[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>+                        X-ASTERISK-TOKEN: [ident_key]<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>+       </send><br>+<br>+     <recv response="100" optional="true"><br>+      </recv><br>+<br>+     <recv response="200" rtd="true"><br>+   </recv><br>+<br>+     <send><br>+         <![CDATA[<br>+                 ACK sip:echo@[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>+                        X-ASTERISK-TOKEN: [ident_key]<br>+                        Content-Length: 0<br>+            ]]><br>+       </send><br>+<br>+     <recv request="BYE"><br>+ </recv><br>+<br>+     <send><br>+         <![CDATA[<br>+                 SIP/2.0 200 OK<br>+                       [last_Via:]<br>+                  [last_From:]<br>+                 [last_To:]<br>+                   [last_Call-ID:]<br>+                      [last_CSeq:]<br>+                 Content-Length: 0<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/identify/header_ordering_ip_header/test-config.yaml b/tests/channels/pjsip/identify/header_ordering_ip_header/test-config.yaml<br>new file mode 100644<br>index 0000000..0dc4167<br>--- /dev/null<br>+++ b/tests/channels/pjsip/identify/header_ordering_ip_header/test-config.yaml<br>@@ -0,0 +1,56 @@<br>+testinfo:<br>+    summary:     'Tests incoming calls identified by header and source IP'<br>+    description: |<br>+        This test covers sending calls to an Asterisk instance<br>+        identifiable by a custom header and by a source IP address.<br>+        It is expected that the requests are accepted by the correct<br>+        endpoint determined by endpoint_identifier_order.<br>+        This test expects the call to be accepted by the ip identifier.<br>+<br>+test-modules:<br>+    test-object:<br>+        config-section: test-object-config<br>+        typename: 'sipp.SIPpTestCase'<br>+    modules:<br>+        -<br>+            config-section: ami-config<br>+            typename: 'ami.AMIEventModule'<br>+<br>+test-object-config:<br>+    memcheck-delay-stop: 7<br>+    fail-on-any: True<br>+    test-iterations:<br>+        # IPv4 & UDP<br>+        -<br>+            scenarios:<br>+                - { 'key-args': {'scenario': 'nominal.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 's'},<br>+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }<br>+<br>+ami-config:<br>+    -<br>+        type: 'headermatch'<br>+        id: '0'<br>+        conditions:<br>+            match:<br>+                Event: 'UserEvent'<br>+                UserEvent: 'Header'<br>+        count: '0'<br>+    -<br>+        type: 'headermatch'<br>+        id: '0'<br>+        conditions:<br>+            match:<br>+                Event: 'UserEvent'<br>+                UserEvent: 'Ip'<br>+        count: '1'<br>+<br>+properties:<br>+    minversion: ['13.20.0', '15.3.0']<br>+    dependencies:<br>+        - sipp :<br>+            version : 'v3.0'<br>+        - asterisk : 'app_userevent'<br>+        - asterisk : 'res_pjsip'<br>+        - asterisk : 'res_pjsip_endpoint_identifier_ip'<br>+    tags:<br>+        - pjsip<br>diff --git a/tests/channels/pjsip/identify/tests.yaml b/tests/channels/pjsip/identify/tests.yaml<br>index 43969c1..60215c3 100644<br>--- a/tests/channels/pjsip/identify/tests.yaml<br>+++ b/tests/channels/pjsip/identify/tests.yaml<br>@@ -2,4 +2,6 @@<br> tests:<br>     - test: 'header'<br>     - test: 'header_or_ip'<br>+    - test: 'header_ordering_header_ip'<br>+    - test: 'header_ordering_ip_header'<br>     - test: 'ordering'<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7937">change 7937</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/7937"/><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: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I12560bdcc36f7df170de79e11666fe6b812e67f4 </div>
<div style="display:none"> Gerrit-Change-Number: 7937 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>