[Asterisk-code-review] Add nominal 'identify by header' tests (testsuite[master])

Anonymous Coward asteriskteam at digium.com
Wed Mar 15 13:32:00 CDT 2017


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

Change subject: Add nominal 'identify by header' tests
......................................................................


Add nominal 'identify by header' tests

This patch adds basic call tests that identify the inbound requests by a
header/value pair in the inbound SIP request. This patch takes the same
form as the existing basic_call tests, and covers the intersection of
endpoint identification, authentication, basic transport types, address
schemes, and other small perturbations.

ASTERISK-26863

Change-Id: If26a2ed475c43cbfca8d39ab2c349ceb28a1fc88
---
A tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/configs/ast1/extensions.conf
A tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/configs/ast1/pjsip.conf
A tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/echo_with_deferred_sdp.xml
A tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/echo_with_initial_sdp.xml
A tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/playback_with_deferred_sdp.xml
A tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/playback_with_initial_sdp.xml
A tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/test-config.yaml
M tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/tests.yaml
A tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/configs/ast1/extensions.conf
A tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/configs/ast1/pjsip.conf
A tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/echo_with_deferred_sdp.xml
A tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/echo_with_initial_sdp.xml
A tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/playback_with_deferred_sdp.xml
A tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/playback_with_initial_sdp.xml
A tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/test-config.yaml
M tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/tests.yaml
A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/configs/ast1/extensions.conf
A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/configs/ast1/pjsip.conf
A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/echo_with_deferred_sdp.xml
A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/echo_with_initial_sdp.xml
A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/playback_with_deferred_sdp.xml
A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/playback_with_initial_sdp.xml
A tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/test-config.yaml
M tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/tests.yaml
24 files changed, 1,932 insertions(+), 0 deletions(-)

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



diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/configs/ast1/extensions.conf b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/configs/ast1/extensions.conf
new file mode 100644
index 0000000..bcea565
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/configs/ast1/extensions.conf
@@ -0,0 +1,16 @@
+[default]
+exten => echo,1,Answer()
+same  =>      n,Echo()
+same  =>      n,Hangup()
+
+exten => playback,1,Answer()
+same  =>          n,Playback(hello-world)
+same  =>          n,Hangup()
+
+exten => early,1,Progress()
+same  =>       n,Playback(hello-world,noanswer)
+same  =>       n,Hangup(INTERWORKING)
+
+;This dialstring can be altered once endpoints can be used directly
+exten => bob,1,Dial(PJSIP/sip:bob at 127.0.0.1:5062)
+same  =>     n,Hangup()
diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..495629c
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/configs/ast1/pjsip.conf
@@ -0,0 +1,71 @@
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[local-transport6-template](!)
+type=transport
+bind=[::1]
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[local-transport-udp6](local-transport6-template)
+protocol=udp
+
+[local-transport-tcp](local-transport-template)
+protocol=tcp
+
+[local-transport-tcp6](local-transport6-template)
+protocol=tcp
+
+[endpoint-template-ipv4](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+media_address=127.0.0.1
+
+[endpoint-template-ipv6](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+media_address=[::1]
+rtp_ipv6=yes
+
+[alice-ipv4-udp](endpoint-template-ipv4)
+auth=alice-auth
+
+[alice-ipv4-tcp](endpoint-template-ipv4)
+auth=alice-auth
+
+[alice-ipv6-udp](endpoint-template-ipv6)
+auth=alice-auth
+
+[alice-ipv6-tcp](endpoint-template-ipv6)
+auth=alice-auth
+
+[auth-template](!)
+type=auth
+
+[alice-auth](auth-template)
+username=alice
+auth_type=md5
+md5_cred=c9b9e23e2160fd69b19f99116da19711
+
+[identify-template](!)
+type=identify
+
+[alice-identify-ipv4-udp](identify-template)
+endpoint=alice-ipv4-udp
+match_header=X-ASTERISK-TOKEN: e7657250-07fa-11e7-92f8-1b946c0c7e84
+
+[alice-identify-ipv4-tcp](identify-template)
+endpoint=alice-ipv4-tcp
+match_header=X-ASTERISK-TOKEN: 6589e618-081c-11e7-b9cd-97b9bfb99334
+
+[alice-identify-ipv6-udp](identify-template)
+endpoint=alice-ipv6-udp
+match_header=X-ASTERISK-TOKEN: 664fa1be-081c-11e7-a079-c3d965562f3e
+
+[alice-identify-ipv6-tcp](identify-template)
+endpoint=alice-ipv6-tcp
+match_header=X-ASTERISK-TOKEN: c2d29890-07fb-11e7-b3f4-3b8d2e8ef30d
diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/echo_with_deferred_sdp.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/echo_with_deferred_sdp.xml
new file mode 100644
index 0000000..d162c51
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/echo_with_deferred_sdp.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in ACK">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      User-Agent: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+    ]]>
+  </send>
+
+  <recv response="401" auth="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:unknown@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:sipp@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Performance Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 2 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      [authentication username=alice password=swordfish]
+      Subject: Test
+      User-Agent: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <pause/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 3 BYE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- 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/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/echo_with_initial_sdp.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/echo_with_initial_sdp.xml
new file mode 100644
index 0000000..ff88a94
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/echo_with_initial_sdp.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in initial INVITE">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="401" auth="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:unknown@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:sipp@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Performance Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 2 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      [authentication username=alice password=swordfish]
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 3 BYE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- 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/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/playback_with_deferred_sdp.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/playback_with_deferred_sdp.xml
new file mode 100644
index 0000000..3edc357
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/playback_with_deferred_sdp.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to playback with SDP in ACK">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Length: 0
+    ]]>
+  </send>
+
+  <recv response="401" auth="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:unknown@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:sipp@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Performance Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 2 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      [authentication username=alice password=swordfish]
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Length: 0
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <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]>
+      X-ASTERISK-TOKEN: [ident_key]
+      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/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/playback_with_initial_sdp.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/playback_with_initial_sdp.xml
new file mode 100644
index 0000000..5632474
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/sipp/playback_with_initial_sdp.xml
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to playback with SDP in initial INVITE">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="401" auth="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:unknown@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:sipp@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Performance Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 2 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      [authentication username=alice password=swordfish]
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <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]>
+      X-ASTERISK-TOKEN: [ident_key]
+      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/basic_calls/incoming/nominal/authed/md5/ident_by_header/test-config.yaml b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/test-config.yaml
new file mode 100644
index 0000000..e18ca7c
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/ident_by_header/test-config.yaml
@@ -0,0 +1,99 @@
+testinfo:
+    summary:     'Tests incoming calls with authentication'
+    description: |
+        Run a SIPp scenario that sends various calls to res_pjsip,
+        which should be authenticated.
+
+        All calls are identified by a custom SIP header with a
+        keyword that maps to an endpoint.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    reactor-timeout: 80
+    fail-on-any: False
+    test-iterations:
+        # IPv4 & UDP
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'echo_with_initial_sdp.xml', '-i': '127.0.0.1', '-p': '5062', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'playback_with_deferred_sdp.xml', '-i': '127.0.0.1', '-p': '5063', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'echo_with_deferred_sdp.xml', '-i': '127.0.0.1', '-p': '5064', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }
+        # IPv4 & TCP
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '127.0.0.1', '-p': '5065', '-t': 't1', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '6589e618-081c-11e7-b9cd-97b9bfb99334'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'echo_with_initial_sdp.xml', '-i': '127.0.0.1', '-p': '5066', '-t': 't1', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '6589e618-081c-11e7-b9cd-97b9bfb99334'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'playback_with_deferred_sdp.xml', '-i': '127.0.0.1', '-p': '5067', '-t': 't1', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '6589e618-081c-11e7-b9cd-97b9bfb99334'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'echo_with_deferred_sdp.xml', '-i': '127.0.0.1', '-p': '5068', '-t': 't1', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '6589e618-081c-11e7-b9cd-97b9bfb99334'] }
+        # IPv6 & UDP
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '[::1]', '-p': '5071', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '664fa1be-081c-11e7-a079-c3d965562f3e'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'echo_with_initial_sdp.xml', '-i': '[::1]', '-p': '5072', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '664fa1be-081c-11e7-a079-c3d965562f3e'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'playback_with_deferred_sdp.xml', '-i': '[::1]', '-p': '5073', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '664fa1be-081c-11e7-a079-c3d965562f3e'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'echo_with_deferred_sdp.xml', '-i': '[::1]', '-p': '5074', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '664fa1be-081c-11e7-a079-c3d965562f3e'] }
+
+        # IPv6 & TCP
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '[::1]', '-p': '5075', '-t': 't1', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'c2d29890-07fb-11e7-b3f4-3b8d2e8ef30d'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'echo_with_initial_sdp.xml', '-i': '[::1]', '-p': '5076', '-t': 't1', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'c2d29890-07fb-11e7-b3f4-3b8d2e8ef30d'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'playback_with_deferred_sdp.xml', '-i': '[::1]', '-p': '5077', '-t': 't1', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'c2d29890-07fb-11e7-b3f4-3b8d2e8ef30d'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'echo_with_deferred_sdp.xml', '-i': '[::1]', '-p': '5078', '-t': 't1', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'c2d29890-07fb-11e7-b3f4-3b8d2e8ef30d'] }
+
+properties:
+    minversion: '14.4.0'
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'app_dial'
+        - asterisk : 'app_echo'
+        - asterisk : 'app_playback'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/tests.yaml b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/tests.yaml
index 308d8bc..ed1244b 100644
--- a/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/tests.yaml
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/md5/tests.yaml
@@ -2,3 +2,4 @@
     - test: 'ident_by_host'
     - test: 'ident_by_user'
     - test: 'ident_by_user_drop_options'
+    - test: 'ident_by_header'
diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/configs/ast1/extensions.conf b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/configs/ast1/extensions.conf
new file mode 100644
index 0000000..bcea565
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/configs/ast1/extensions.conf
@@ -0,0 +1,16 @@
+[default]
+exten => echo,1,Answer()
+same  =>      n,Echo()
+same  =>      n,Hangup()
+
+exten => playback,1,Answer()
+same  =>          n,Playback(hello-world)
+same  =>          n,Hangup()
+
+exten => early,1,Progress()
+same  =>       n,Playback(hello-world,noanswer)
+same  =>       n,Hangup(INTERWORKING)
+
+;This dialstring can be altered once endpoints can be used directly
+exten => bob,1,Dial(PJSIP/sip:bob at 127.0.0.1:5062)
+same  =>     n,Hangup()
diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..232b1f2
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/configs/ast1/pjsip.conf
@@ -0,0 +1,70 @@
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[local-transport6-template](!)
+type=transport
+bind=[::1]
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[local-transport-udp6](local-transport6-template)
+protocol=udp
+
+[local-transport-tcp](local-transport-template)
+protocol=tcp
+
+[local-transport-tcp6](local-transport6-template)
+protocol=tcp
+
+[endpoint-template-ipv4](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+media_address=127.0.0.1
+
+[endpoint-template-ipv6](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+media_address=[::1]
+rtp_ipv6=yes
+
+[alice-ipv4-udp](endpoint-template-ipv4)
+auth=alice-auth
+
+[alice-ipv4-tcp](endpoint-template-ipv4)
+auth=alice-auth
+
+[alice-ipv6-udp](endpoint-template-ipv6)
+auth=alice-auth
+
+[alice-ipv6-tcp](endpoint-template-ipv6)
+auth=alice-auth
+
+[auth-template](!)
+type=auth
+
+[alice-auth](auth-template)
+username=alice
+password=swordfish
+
+[identify-template](!)
+type=identify
+
+[alice-identify-ipv4-udp](identify-template)
+endpoint=alice-ipv4-udp
+match_header=X-ASTERISK-TOKEN: e7657250-07fa-11e7-92f8-1b946c0c7e84
+
+[alice-identify-ipv4-tcp](identify-template)
+endpoint=alice-ipv4-tcp
+match_header=X-ASTERISK-TOKEN: 6589e618-081c-11e7-b9cd-97b9bfb99334
+
+[alice-identify-ipv6-udp](identify-template)
+endpoint=alice-ipv6-udp
+match_header=X-ASTERISK-TOKEN: 664fa1be-081c-11e7-a079-c3d965562f3e
+
+[alice-identify-ipv6-tcp](identify-template)
+endpoint=alice-ipv6-tcp
+match_header=X-ASTERISK-TOKEN: c2d29890-07fb-11e7-b3f4-3b8d2e8ef30d
diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/echo_with_deferred_sdp.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/echo_with_deferred_sdp.xml
new file mode 100644
index 0000000..3b3cc04
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/echo_with_deferred_sdp.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in ACK">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Length: 0
+    ]]>
+  </send>
+
+  <recv response="401" auth="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:unknown@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:sipp@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Performance Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 2 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      [authentication username=alice password=swordfish]
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Length: 0
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <pause/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 3 BYE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- 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/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/echo_with_initial_sdp.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/echo_with_initial_sdp.xml
new file mode 100644
index 0000000..ff88a94
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/echo_with_initial_sdp.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in initial INVITE">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="401" auth="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:unknown@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:sipp@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Performance Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 2 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      [authentication username=alice password=swordfish]
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 3 BYE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- 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/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/playback_with_deferred_sdp.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/playback_with_deferred_sdp.xml
new file mode 100644
index 0000000..3edc357
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/playback_with_deferred_sdp.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to playback with SDP in ACK">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Length: 0
+    ]]>
+  </send>
+
+  <recv response="401" auth="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:unknown@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:sipp@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Performance Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 2 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      [authentication username=alice password=swordfish]
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Length: 0
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <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]>
+      X-ASTERISK-TOKEN: [ident_key]
+      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/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/playback_with_initial_sdp.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/playback_with_initial_sdp.xml
new file mode 100644
index 0000000..5632474
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/sipp/playback_with_initial_sdp.xml
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to playback with SDP in initial INVITE">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="401" auth="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:unknown@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:sipp@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Performance Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 2 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      [authentication username=alice password=swordfish]
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <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]>
+      X-ASTERISK-TOKEN: [ident_key]
+      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/basic_calls/incoming/nominal/authed/userpass/ident_by_header/test-config.yaml b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/test-config.yaml
new file mode 100644
index 0000000..e18ca7c
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/ident_by_header/test-config.yaml
@@ -0,0 +1,99 @@
+testinfo:
+    summary:     'Tests incoming calls with authentication'
+    description: |
+        Run a SIPp scenario that sends various calls to res_pjsip,
+        which should be authenticated.
+
+        All calls are identified by a custom SIP header with a
+        keyword that maps to an endpoint.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    reactor-timeout: 80
+    fail-on-any: False
+    test-iterations:
+        # IPv4 & UDP
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'echo_with_initial_sdp.xml', '-i': '127.0.0.1', '-p': '5062', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'playback_with_deferred_sdp.xml', '-i': '127.0.0.1', '-p': '5063', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'echo_with_deferred_sdp.xml', '-i': '127.0.0.1', '-p': '5064', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }
+        # IPv4 & TCP
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '127.0.0.1', '-p': '5065', '-t': 't1', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '6589e618-081c-11e7-b9cd-97b9bfb99334'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'echo_with_initial_sdp.xml', '-i': '127.0.0.1', '-p': '5066', '-t': 't1', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '6589e618-081c-11e7-b9cd-97b9bfb99334'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'playback_with_deferred_sdp.xml', '-i': '127.0.0.1', '-p': '5067', '-t': 't1', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '6589e618-081c-11e7-b9cd-97b9bfb99334'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'echo_with_deferred_sdp.xml', '-i': '127.0.0.1', '-p': '5068', '-t': 't1', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '6589e618-081c-11e7-b9cd-97b9bfb99334'] }
+        # IPv6 & UDP
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '[::1]', '-p': '5071', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '664fa1be-081c-11e7-a079-c3d965562f3e'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'echo_with_initial_sdp.xml', '-i': '[::1]', '-p': '5072', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '664fa1be-081c-11e7-a079-c3d965562f3e'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'playback_with_deferred_sdp.xml', '-i': '[::1]', '-p': '5073', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '664fa1be-081c-11e7-a079-c3d965562f3e'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'echo_with_deferred_sdp.xml', '-i': '[::1]', '-p': '5074', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '664fa1be-081c-11e7-a079-c3d965562f3e'] }
+
+        # IPv6 & TCP
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '[::1]', '-p': '5075', '-t': 't1', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'c2d29890-07fb-11e7-b3f4-3b8d2e8ef30d'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'echo_with_initial_sdp.xml', '-i': '[::1]', '-p': '5076', '-t': 't1', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'c2d29890-07fb-11e7-b3f4-3b8d2e8ef30d'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'playback_with_deferred_sdp.xml', '-i': '[::1]', '-p': '5077', '-t': 't1', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'c2d29890-07fb-11e7-b3f4-3b8d2e8ef30d'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'echo_with_deferred_sdp.xml', '-i': '[::1]', '-p': '5078', '-t': 't1', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'c2d29890-07fb-11e7-b3f4-3b8d2e8ef30d'] }
+
+properties:
+    minversion: '14.4.0'
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'app_dial'
+        - asterisk : 'app_echo'
+        - asterisk : 'app_playback'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/tests.yaml b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/tests.yaml
index c97a336..23301ee 100644
--- a/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/tests.yaml
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/authed/userpass/tests.yaml
@@ -3,3 +3,4 @@
     - test: 'ident_by_host'
     - test: 'ident_by_user'
     - test: 'ident_by_user_drop_options'
+    - test: 'ident_by_header'
diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/configs/ast1/extensions.conf b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/configs/ast1/extensions.conf
new file mode 100644
index 0000000..bcea565
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/configs/ast1/extensions.conf
@@ -0,0 +1,16 @@
+[default]
+exten => echo,1,Answer()
+same  =>      n,Echo()
+same  =>      n,Hangup()
+
+exten => playback,1,Answer()
+same  =>          n,Playback(hello-world)
+same  =>          n,Hangup()
+
+exten => early,1,Progress()
+same  =>       n,Playback(hello-world,noanswer)
+same  =>       n,Hangup(INTERWORKING)
+
+;This dialstring can be altered once endpoints can be used directly
+exten => bob,1,Dial(PJSIP/sip:bob at 127.0.0.1:5062)
+same  =>     n,Hangup()
diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..d7354ea
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/configs/ast1/pjsip.conf
@@ -0,0 +1,59 @@
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[local-transport6-template](!)
+type=transport
+bind=[::1]
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[local-transport-udp6](local-transport6-template)
+protocol=udp
+
+[local-transport-tcp](local-transport-template)
+protocol=tcp
+
+[local-transport-tcp6](local-transport6-template)
+protocol=tcp
+
+[endpoint-template-ipv4](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+media_address=127.0.0.1
+
+[endpoint-template-ipv6](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+media_address=[::1]
+rtp_ipv6=yes
+
+[alice-ipv4-udp](endpoint-template-ipv4)
+
+[alice-ipv4-tcp](endpoint-template-ipv4)
+
+[alice-ipv6-udp](endpoint-template-ipv6)
+
+[alice-ipv6-tcp](endpoint-template-ipv6)
+
+[identify-template](!)
+type=identify
+
+[alice-identify-ipv4-udp](identify-template)
+endpoint=alice-ipv4-udp
+match_header=X-ASTERISK-TOKEN: e7657250-07fa-11e7-92f8-1b946c0c7e84
+
+[alice-identify-ipv4-tcp](identify-template)
+endpoint=alice-ipv4-tcp
+match_header=X-ASTERISK-TOKEN: 6589e618-081c-11e7-b9cd-97b9bfb99334
+
+[alice-identify-ipv6-udp](identify-template)
+endpoint=alice-ipv6-udp
+match_header=X-ASTERISK-TOKEN: 664fa1be-081c-11e7-a079-c3d965562f3e
+
+[alice-identify-ipv6-tcp](identify-template)
+endpoint=alice-ipv6-tcp
+match_header=X-ASTERISK-TOKEN: c2d29890-07fb-11e7-b3f4-3b8d2e8ef30d
diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/echo_with_deferred_sdp.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/echo_with_deferred_sdp.xml
new file mode 100644
index 0000000..918a011
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/echo_with_deferred_sdp.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in ACK">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Length: 0
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <pause/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 BYE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- 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/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/echo_with_initial_sdp.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/echo_with_initial_sdp.xml
new file mode 100644
index 0000000..f8018a9
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/echo_with_initial_sdp.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in initial INVITE">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 BYE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- 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/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/playback_with_deferred_sdp.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/playback_with_deferred_sdp.xml
new file mode 100644
index 0000000..fa0d227
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/playback_with_deferred_sdp.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to playback with SDP in ACK">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Length: 0
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <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]>
+      X-ASTERISK-TOKEN: [ident_key]
+      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/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/playback_with_initial_sdp.xml b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/playback_with_initial_sdp.xml
new file mode 100644
index 0000000..7ff6a14
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/sipp/playback_with_initial_sdp.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to playback with SDP in initial INVITE">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      X-ASTERISK-TOKEN: [ident_key]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <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]>
+      X-ASTERISK-TOKEN: [ident_key]
+      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/basic_calls/incoming/nominal/unauthed/ident_by_header/test-config.yaml b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/test-config.yaml
new file mode 100644
index 0000000..c287368
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/ident_by_header/test-config.yaml
@@ -0,0 +1,99 @@
+testinfo:
+    summary:     'Tests incoming calls without authentication'
+    description: |
+        Run a SIPp scenario that sends various calls to res_pjsip,
+        which should not be authenticated
+
+        All calls are identified by a custom SIP header with a
+        keyword that maps to an endpoint.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    reactor-timeout: 80
+    fail-on-any: False
+    test-iterations:
+        # IPv4 & UDP
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'echo_with_initial_sdp.xml', '-i': '127.0.0.1', '-p': '5062', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'playback_with_deferred_sdp.xml', '-i': '127.0.0.1', '-p': '5063', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'echo_with_deferred_sdp.xml', '-i': '127.0.0.1', '-p': '5064', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }
+        # IPv4 & TCP
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '127.0.0.1', '-p': '5065', '-t': 't1', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '6589e618-081c-11e7-b9cd-97b9bfb99334'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'echo_with_initial_sdp.xml', '-i': '127.0.0.1', '-p': '5066', '-t': 't1', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '6589e618-081c-11e7-b9cd-97b9bfb99334'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'playback_with_deferred_sdp.xml', '-i': '127.0.0.1', '-p': '5067', '-t': 't1', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '6589e618-081c-11e7-b9cd-97b9bfb99334'] }
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'echo_with_deferred_sdp.xml', '-i': '127.0.0.1', '-p': '5068', '-t': 't1', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '6589e618-081c-11e7-b9cd-97b9bfb99334'] }
+        # IPv6 & UDP
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '[::1]', '-p': '5071', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '664fa1be-081c-11e7-a079-c3d965562f3e'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'echo_with_initial_sdp.xml', '-i': '[::1]', '-p': '5072', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '664fa1be-081c-11e7-a079-c3d965562f3e'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'playback_with_deferred_sdp.xml', '-i': '[::1]', '-p': '5073', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '664fa1be-081c-11e7-a079-c3d965562f3e'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'echo_with_deferred_sdp.xml', '-i': '[::1]', '-p': '5074', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', '664fa1be-081c-11e7-a079-c3d965562f3e'] }
+
+        # IPv6 & TCP
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'playback_with_initial_sdp.xml', '-i': '[::1]', '-p': '5075', '-t': 't1', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'c2d29890-07fb-11e7-b3f4-3b8d2e8ef30d'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'echo_with_initial_sdp.xml', '-i': '[::1]', '-p': '5076', '-t': 't1', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'c2d29890-07fb-11e7-b3f4-3b8d2e8ef30d'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'playback_with_deferred_sdp.xml', '-i': '[::1]', '-p': '5077', '-t': 't1', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'c2d29890-07fb-11e7-b3f4-3b8d2e8ef30d'] }
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'echo_with_deferred_sdp.xml', '-i': '[::1]', '-p': '5078', '-t': 't1', '-d': '5000', '-s': 'alice'},
+                    'ordered-args': ['-key', 'ident_key', 'c2d29890-07fb-11e7-b3f4-3b8d2e8ef30d'] }
+
+properties:
+    minversion: '14.4.0'
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'app_dial'
+        - asterisk : 'app_echo'
+        - asterisk : 'app_playback'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/tests.yaml b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/tests.yaml
index 308d8bc..ed1244b 100644
--- a/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/tests.yaml
+++ b/tests/channels/pjsip/basic_calls/incoming/nominal/unauthed/tests.yaml
@@ -2,3 +2,4 @@
     - test: 'ident_by_host'
     - test: 'ident_by_user'
     - test: 'ident_by_user_drop_options'
+    - test: 'ident_by_header'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If26a2ed475c43cbfca8d39ab2c349ceb28a1fc88
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list