diff --git a/tests/channels/pjsip/rfc7329/disabled_no_session_id/configs/ast1/extensions.conf b/tests/channels/pjsip/rfc7329/disabled_no_session_id/configs/ast1/extensions.conf
new file mode 100644
index 000000000..564f57b64
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/disabled_no_session_id/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+
+exten => bob,1,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/rfc7329/disabled_no_session_id/configs/ast1/pjsip.conf b/tests/channels/pjsip/rfc7329/disabled_no_session_id/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..ae3b0c850
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/disabled_no_session_id/configs/ast1/pjsip.conf
@@ -0,0 +1,43 @@
+[global]
+type=global
+rfc7329_enable=no
+
+[transport-udp]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint-template](!)
+type=endpoint
+transport=transport-udp
+context=default
+identify_by=ip
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor-template](!)
+type=aor
+max_contacts=1
+
+[alice](aor-template)
+contact=sip:alice@127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
+
+[bob](aor-template)
+contact=sip:bob@127.0.0.1:5062
+
+[bob](endpoint-template)
+aors=bob
+
+[alice-identify]
+type=identify
+endpoint=alice
+match=127.0.0.1:5061
+
+[bob-identify]
+type=identify
+endpoint=bob
+match=127.0.0.1:5062
diff --git a/tests/channels/pjsip/rfc7329/disabled_no_session_id/sipp/alice_with_sid.xml b/tests/channels/pjsip/rfc7329/disabled_no_session_id/sipp/alice_with_sid.xml
new file mode 100644
index 000000000..575f3cf33
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/disabled_no_session_id/sipp/alice_with_sid.xml
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+ ;tag=[call_number]
+ To: bob
+ Call-ID: [call_id]
+ CSeq: 1 INVITE
+ Session-ID: 13579bdf2468ace013579bdf2468ace0
+ Contact:
+ Max-Forwards: 70
+ Subject: Test
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=alice 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ;tag=[call_number]
+ To: bob [peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 1 ACK
+ Session-ID: 13579bdf2468ace013579bdf2468ace0
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[call_number]
+ To: bob [peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 2 BYE
+ Session-ID: 13579bdf2468ace013579bdf2468ace0
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/disabled_no_session_id/sipp/bob_with_sid.xml b/tests/channels/pjsip/rfc7329/disabled_no_session_id/sipp/bob_with_sid.xml
new file mode 100644
index 000000000..3bea6011b
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/disabled_no_session_id/sipp/bob_with_sid.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=bob 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/disabled_no_session_id/test-config.yaml b/tests/channels/pjsip/rfc7329/disabled_no_session_id/test-config.yaml
new file mode 100644
index 000000000..95a350888
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/disabled_no_session_id/test-config.yaml
@@ -0,0 +1,31 @@
+testinfo:
+ summary: 'RFC7329 disabled: with_sid caller/callee only'
+ description: |
+ 'With rfc7329_enable=no, both caller and callee send Session-ID,
+ but Asterisk must not inject Session-ID on forwarded in-dialog
+ requests and responses.'
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+ memcheck-delay-stop: 7
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'bob_with_sid.xml', '-i': '127.0.0.1', '-p': '5062'} }
+ - { 'key-args': {'scenario': 'alice_with_sid.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'bob'} }
+
+properties:
+ dependencies:
+ - app: 'sipp'
+ - asterisk: 'app_dial'
+ - asterisk: 'chan_pjsip'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_session'
+ - asterisk: 'res_pjsip_rfc7329'
+ tags:
+ - pjsip
+ - rfc7329
diff --git a/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration/configs/ast1/pjsip.conf b/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..885be52f2
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration/configs/ast1/pjsip.conf
@@ -0,0 +1,45 @@
+[global]
+type=global
+rfc7329_enable=no
+
+[transport-udp]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint-template](!)
+type=endpoint
+transport=transport-udp
+context=default
+identify_by=username
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor-template](!)
+type=aor
+max_contacts=1
+
+[auth-template](!)
+type=auth
+auth_type=userpass
+
+[alice](aor-template)
+
+[alice](endpoint-template)
+aors=alice
+auth=alice-auth
+
+[alice-auth](auth-template)
+username=alice
+password=alicepass
+
+[bob](aor-template)
+
+[bob](endpoint-template)
+aors=bob
+auth=bob-auth
+
+[bob-auth](auth-template)
+username=bob
+password=bobpass
diff --git a/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration/sipp/alice_register_with_sid.xml b/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration/sipp/alice_register_with_sid.xml
new file mode 100644
index 000000000..c2c6517d1
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration/sipp/alice_register_with_sid.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+ ;tag=[pid]SIPpTag00[call_number]
+ To: alice
+ Call-ID: [call_id]
+ CSeq: 1 REGISTER
+ Session-ID: 13579bdf2468ace013579bdf2468ace0
+ Contact:
+ Max-Forwards: 70
+ Expires: 300
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+ ;tag=[pid]SIPpTag00[call_number]
+ To: alice
+ Call-ID: [call_id]
+ CSeq: 2 REGISTER
+ Session-ID: 13579bdf2468ace013579bdf2468ace0
+ Contact:
+ Max-Forwards: 70
+ Expires: 300
+ [authentication username=alice password=alicepass]
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration/test-config.yaml b/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration/test-config.yaml
new file mode 100644
index 000000000..8f6542218
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration/test-config.yaml
@@ -0,0 +1,32 @@
+testinfo:
+ summary: 'RFC7329 disabled + module loaded + auth registration'
+ description: |
+ 'With rfc7329_enable=no and res_pjsip_rfc7329 loaded,
+ a REGISTER transaction with Session-ID must not return Session-ID
+ in Asterisk responses.'
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+ memcheck-delay-stop: 7
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'alice_register_with_sid.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+properties:
+ dependencies:
+ - app: 'sipp'
+ - asterisk: 'chan_pjsip'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_registrar'
+ - asterisk: 'res_pjsip_endpoint_identifier_user'
+ - asterisk: 'res_pjsip_authenticator_digest'
+ - asterisk: 'res_pjsip_session'
+ - asterisk: 'res_pjsip_rfc7329'
+ tags:
+ - pjsip
+ - rfc7329
diff --git a/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration_unloaded/configs/ast1/modules.conf b/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration_unloaded/configs/ast1/modules.conf
new file mode 100644
index 000000000..14a41e386
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration_unloaded/configs/ast1/modules.conf
@@ -0,0 +1,11 @@
+; Do not delete -
+; May be appended with noloads due to conflicts (see conflicts.txt)
+
+[modules]
+autoload=yes
+
+noload => chan_alsa.so
+noload => chan_oss.so
+noload => chan_console.so
+noload => res_pjsip_rfc7329.so
+#include "modules.conf.inc"
diff --git a/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration_unloaded/configs/ast1/pjsip.conf b/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration_unloaded/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..885be52f2
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration_unloaded/configs/ast1/pjsip.conf
@@ -0,0 +1,45 @@
+[global]
+type=global
+rfc7329_enable=no
+
+[transport-udp]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint-template](!)
+type=endpoint
+transport=transport-udp
+context=default
+identify_by=username
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor-template](!)
+type=aor
+max_contacts=1
+
+[auth-template](!)
+type=auth
+auth_type=userpass
+
+[alice](aor-template)
+
+[alice](endpoint-template)
+aors=alice
+auth=alice-auth
+
+[alice-auth](auth-template)
+username=alice
+password=alicepass
+
+[bob](aor-template)
+
+[bob](endpoint-template)
+aors=bob
+auth=bob-auth
+
+[bob-auth](auth-template)
+username=bob
+password=bobpass
diff --git a/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration_unloaded/sipp/alice_register_with_sid.xml b/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration_unloaded/sipp/alice_register_with_sid.xml
new file mode 100644
index 000000000..c2c6517d1
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration_unloaded/sipp/alice_register_with_sid.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+ ;tag=[pid]SIPpTag00[call_number]
+ To: alice
+ Call-ID: [call_id]
+ CSeq: 1 REGISTER
+ Session-ID: 13579bdf2468ace013579bdf2468ace0
+ Contact:
+ Max-Forwards: 70
+ Expires: 300
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+ ;tag=[pid]SIPpTag00[call_number]
+ To: alice
+ Call-ID: [call_id]
+ CSeq: 2 REGISTER
+ Session-ID: 13579bdf2468ace013579bdf2468ace0
+ Contact:
+ Max-Forwards: 70
+ Expires: 300
+ [authentication username=alice password=alicepass]
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration_unloaded/test-config.yaml b/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration_unloaded/test-config.yaml
new file mode 100644
index 000000000..4266134b0
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/disabled_no_session_id_registration_unloaded/test-config.yaml
@@ -0,0 +1,31 @@
+testinfo:
+ summary: 'RFC7329 disabled + module unloaded + auth registration'
+ description: |
+ 'With rfc7329_enable=no and res_pjsip_rfc7329 not loaded,
+ a REGISTER transaction with Session-ID must not return Session-ID
+ in Asterisk responses.'
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+ memcheck-delay-stop: 7
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'alice_register_with_sid.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+properties:
+ dependencies:
+ - app: 'sipp'
+ - asterisk: 'chan_pjsip'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_registrar'
+ - asterisk: 'res_pjsip_endpoint_identifier_user'
+ - asterisk: 'res_pjsip_authenticator_digest'
+ - asterisk: 'res_pjsip_session'
+ tags:
+ - pjsip
+ - rfc7329
diff --git a/tests/channels/pjsip/rfc7329/enabled_dialog_generation/configs/ast1/extensions.conf b/tests/channels/pjsip/rfc7329/enabled_dialog_generation/configs/ast1/extensions.conf
new file mode 100644
index 000000000..564f57b64
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_dialog_generation/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+
+exten => bob,1,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/rfc7329/enabled_dialog_generation/configs/ast1/pjsip.conf b/tests/channels/pjsip/rfc7329/enabled_dialog_generation/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..f2f211534
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_dialog_generation/configs/ast1/pjsip.conf
@@ -0,0 +1,43 @@
+[global]
+type=global
+rfc7329_enable=yes
+
+[transport-udp]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint-template](!)
+type=endpoint
+transport=transport-udp
+context=default
+identify_by=ip
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor-template](!)
+type=aor
+max_contacts=1
+
+[alice](aor-template)
+contact=sip:alice@127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
+
+[bob](aor-template)
+contact=sip:bob@127.0.0.1:5062
+
+[bob](endpoint-template)
+aors=bob
+
+[alice-identify]
+type=identify
+endpoint=alice
+match=127.0.0.1:5061
+
+[bob-identify]
+type=identify
+endpoint=bob
+match=127.0.0.1:5062
diff --git a/tests/channels/pjsip/rfc7329/enabled_dialog_generation/sipp/alice_with_sid.xml b/tests/channels/pjsip/rfc7329/enabled_dialog_generation/sipp/alice_with_sid.xml
new file mode 100644
index 000000000..d2d948bb7
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_dialog_generation/sipp/alice_with_sid.xml
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+ ;tag=[call_number]
+ To: bob
+ Call-ID: [call_id]
+ CSeq: 1 INVITE
+ Session-ID: 2468ace013579bdf2468ace013579bdf
+ Contact:
+ Max-Forwards: 70
+ Subject: Test
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=alice 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ;tag=[call_number]
+ To: bob [peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 1 ACK
+ Session-ID: 2468ace013579bdf2468ace013579bdf
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[call_number]
+ To: bob [peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 2 BYE
+ Session-ID: 2468ace013579bdf2468ace013579bdf
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/enabled_dialog_generation/sipp/bob_with_sid.xml b/tests/channels/pjsip/rfc7329/enabled_dialog_generation/sipp/bob_with_sid.xml
new file mode 100644
index 000000000..8b86167f6
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_dialog_generation/sipp/bob_with_sid.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=bob 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/enabled_dialog_generation/test-config.yaml b/tests/channels/pjsip/rfc7329/enabled_dialog_generation/test-config.yaml
new file mode 100644
index 000000000..e09c1a5f0
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_dialog_generation/test-config.yaml
@@ -0,0 +1,31 @@
+testinfo:
+ summary: 'RFC7329 enabled: with_sid caller/callee only'
+ description: |
+ 'With rfc7329_enable=yes and Session-ID present on both legs,
+ Asterisk must preserve and propagate Session-ID consistently
+ for in-dialog messages.'
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+ memcheck-delay-stop: 7
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'bob_with_sid.xml', '-i': '127.0.0.1', '-p': '5062'} }
+ - { 'key-args': {'scenario': 'alice_with_sid.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'bob'} }
+
+properties:
+ dependencies:
+ - app: 'sipp'
+ - asterisk: 'app_dial'
+ - asterisk: 'chan_pjsip'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_session'
+ - asterisk: 'res_pjsip_rfc7329'
+ tags:
+ - pjsip
+ - rfc7329
diff --git a/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration/configs/ast1/pjsip.conf b/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..1d8895adf
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration/configs/ast1/pjsip.conf
@@ -0,0 +1,45 @@
+[global]
+type=global
+rfc7329_enable=yes
+
+[transport-udp]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint-template](!)
+type=endpoint
+transport=transport-udp
+context=default
+identify_by=username
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor-template](!)
+type=aor
+max_contacts=1
+
+[auth-template](!)
+type=auth
+auth_type=userpass
+
+[alice](aor-template)
+
+[alice](endpoint-template)
+aors=alice
+auth=alice-auth
+
+[alice-auth](auth-template)
+username=alice
+password=alicepass
+
+[bob](aor-template)
+
+[bob](endpoint-template)
+aors=bob
+auth=bob-auth
+
+[bob-auth](auth-template)
+username=bob
+password=bobpass
diff --git a/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration/sipp/alice_register_with_sid.xml b/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration/sipp/alice_register_with_sid.xml
new file mode 100644
index 000000000..e957254a2
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration/sipp/alice_register_with_sid.xml
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+ ;tag=[pid]SIPpTag00[call_number]
+ To: alice
+ Call-ID: [call_id]
+ CSeq: 1 REGISTER
+ Session-ID: 13579bdf2468ace013579bdf2468ace0
+ Contact:
+ Max-Forwards: 70
+ Expires: 300
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+ ;tag=[pid]SIPpTag00[call_number]
+ To: alice
+ Call-ID: [call_id]
+ CSeq: 2 REGISTER
+ Session-ID: 13579bdf2468ace013579bdf2468ace0
+ Contact:
+ Max-Forwards: 70
+ Expires: 300
+ [authentication username=alice password=alicepass]
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration/test-config.yaml b/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration/test-config.yaml
new file mode 100644
index 000000000..2cfa109bd
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration/test-config.yaml
@@ -0,0 +1,32 @@
+testinfo:
+ summary: 'RFC7329 enabled + module loaded + auth registration'
+ description: |
+ 'With rfc7329_enable=yes and res_pjsip_rfc7329 loaded,
+ a REGISTER transaction with Session-ID must return Session-ID
+ in Asterisk responses.'
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+ memcheck-delay-stop: 7
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'alice_register_with_sid.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+properties:
+ dependencies:
+ - app: 'sipp'
+ - asterisk: 'chan_pjsip'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_registrar'
+ - asterisk: 'res_pjsip_endpoint_identifier_user'
+ - asterisk: 'res_pjsip_authenticator_digest'
+ - asterisk: 'res_pjsip_session'
+ - asterisk: 'res_pjsip_rfc7329'
+ tags:
+ - pjsip
+ - rfc7329
diff --git a/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration_unloaded/configs/ast1/modules.conf b/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration_unloaded/configs/ast1/modules.conf
new file mode 100644
index 000000000..14a41e386
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration_unloaded/configs/ast1/modules.conf
@@ -0,0 +1,11 @@
+; Do not delete -
+; May be appended with noloads due to conflicts (see conflicts.txt)
+
+[modules]
+autoload=yes
+
+noload => chan_alsa.so
+noload => chan_oss.so
+noload => chan_console.so
+noload => res_pjsip_rfc7329.so
+#include "modules.conf.inc"
diff --git a/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration_unloaded/configs/ast1/pjsip.conf b/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration_unloaded/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..1d8895adf
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration_unloaded/configs/ast1/pjsip.conf
@@ -0,0 +1,45 @@
+[global]
+type=global
+rfc7329_enable=yes
+
+[transport-udp]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint-template](!)
+type=endpoint
+transport=transport-udp
+context=default
+identify_by=username
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor-template](!)
+type=aor
+max_contacts=1
+
+[auth-template](!)
+type=auth
+auth_type=userpass
+
+[alice](aor-template)
+
+[alice](endpoint-template)
+aors=alice
+auth=alice-auth
+
+[alice-auth](auth-template)
+username=alice
+password=alicepass
+
+[bob](aor-template)
+
+[bob](endpoint-template)
+aors=bob
+auth=bob-auth
+
+[bob-auth](auth-template)
+username=bob
+password=bobpass
diff --git a/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration_unloaded/sipp/alice_register_with_sid.xml b/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration_unloaded/sipp/alice_register_with_sid.xml
new file mode 100644
index 000000000..c2c6517d1
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration_unloaded/sipp/alice_register_with_sid.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+ ;tag=[pid]SIPpTag00[call_number]
+ To: alice
+ Call-ID: [call_id]
+ CSeq: 1 REGISTER
+ Session-ID: 13579bdf2468ace013579bdf2468ace0
+ Contact:
+ Max-Forwards: 70
+ Expires: 300
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+ ;tag=[pid]SIPpTag00[call_number]
+ To: alice
+ Call-ID: [call_id]
+ CSeq: 2 REGISTER
+ Session-ID: 13579bdf2468ace013579bdf2468ace0
+ Contact:
+ Max-Forwards: 70
+ Expires: 300
+ [authentication username=alice password=alicepass]
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration_unloaded/test-config.yaml b/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration_unloaded/test-config.yaml
new file mode 100644
index 000000000..344568eb1
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_dialog_generation_registration_unloaded/test-config.yaml
@@ -0,0 +1,31 @@
+testinfo:
+ summary: 'RFC7329 enabled + module unloaded + auth registration'
+ description: |
+ 'With rfc7329_enable=yes but res_pjsip_rfc7329 not loaded,
+ a REGISTER transaction with Session-ID must not return Session-ID
+ in Asterisk responses.'
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+ memcheck-delay-stop: 7
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'alice_register_with_sid.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+properties:
+ dependencies:
+ - app: 'sipp'
+ - asterisk: 'chan_pjsip'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_registrar'
+ - asterisk: 'res_pjsip_endpoint_identifier_user'
+ - asterisk: 'res_pjsip_authenticator_digest'
+ - asterisk: 'res_pjsip_session'
+ tags:
+ - pjsip
+ - rfc7329
diff --git a/tests/channels/pjsip/rfc7329/enabled_linkedid_immutable/configs/ast1/extensions.conf b/tests/channels/pjsip/rfc7329/enabled_linkedid_immutable/configs/ast1/extensions.conf
new file mode 100644
index 000000000..0144c3f21
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_linkedid_immutable/configs/ast1/extensions.conf
@@ -0,0 +1,12 @@
+[default]
+
+exten => bob,1,Dial(PJSIP/bob,,b(default^mutate_headers^1))
+ same => n,Hangup()
+
+exten => mutate_headers,1,NoOp()
+ same => n,Set(PJSIP_HEADER(add,Session-ID)=89abcdef0123456789abcdef01234567)
+ same => n,Set(PJSIP_HEADER(update,Session-ID)=fedcba9876543210fedcba9876543210)
+ same => n,Set(PJSIP_HEADER(remove,Session-ID)=)
+ same => n,Set(PJSIP_HEADER(remove,Session-*)=)
+ same => n,Set(PJSIP_HEADER(remove,*)=)
+ same => n,Return()
diff --git a/tests/channels/pjsip/rfc7329/enabled_linkedid_immutable/configs/ast1/pjsip.conf b/tests/channels/pjsip/rfc7329/enabled_linkedid_immutable/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..f2f211534
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_linkedid_immutable/configs/ast1/pjsip.conf
@@ -0,0 +1,43 @@
+[global]
+type=global
+rfc7329_enable=yes
+
+[transport-udp]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint-template](!)
+type=endpoint
+transport=transport-udp
+context=default
+identify_by=ip
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor-template](!)
+type=aor
+max_contacts=1
+
+[alice](aor-template)
+contact=sip:alice@127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
+
+[bob](aor-template)
+contact=sip:bob@127.0.0.1:5062
+
+[bob](endpoint-template)
+aors=bob
+
+[alice-identify]
+type=identify
+endpoint=alice
+match=127.0.0.1:5061
+
+[bob-identify]
+type=identify
+endpoint=bob
+match=127.0.0.1:5062
diff --git a/tests/channels/pjsip/rfc7329/enabled_linkedid_immutable/sipp/alice.xml b/tests/channels/pjsip/rfc7329/enabled_linkedid_immutable/sipp/alice.xml
new file mode 100644
index 000000000..874671ef7
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_linkedid_immutable/sipp/alice.xml
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+ ;tag=[call_number]
+ To: bob
+ Call-ID: [call_id]
+ CSeq: 1 INVITE
+ Session-ID: 0123456789abcdef0123456789abcdef
+ Contact:
+ Max-Forwards: 70
+ Subject: Test
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=alice 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ;tag=[call_number]
+ To: bob [peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 1 ACK
+ Session-ID: 0123456789abcdef0123456789abcdef
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[call_number]
+ To: bob [peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 2 BYE
+ Session-ID: 0123456789abcdef0123456789abcdef
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/enabled_linkedid_immutable/sipp/bob_with_sid.xml b/tests/channels/pjsip/rfc7329/enabled_linkedid_immutable/sipp/bob_with_sid.xml
new file mode 100644
index 000000000..90b3c3ea5
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_linkedid_immutable/sipp/bob_with_sid.xml
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=bob 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/enabled_linkedid_immutable/test-config.yaml b/tests/channels/pjsip/rfc7329/enabled_linkedid_immutable/test-config.yaml
new file mode 100644
index 000000000..d54968698
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_linkedid_immutable/test-config.yaml
@@ -0,0 +1,32 @@
+testinfo:
+ summary: 'RFC7329 enabled: linkedid propagation with with_sid caller/callee'
+ description: |
+ 'With Session-ID present on both legs, inbound Session-ID must be
+ reused on the outbound leg, and attempts to modify Session-ID via
+ PJSIP_HEADER(add/update/remove) must be ignored.'
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+ memcheck-delay-stop: 7
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'bob_with_sid.xml', '-i': '127.0.0.1', '-p': '5062'} }
+ - { 'key-args': {'scenario': 'alice.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'bob'} }
+
+properties:
+ dependencies:
+ - app: 'sipp'
+ - asterisk: 'app_dial'
+ - asterisk: 'chan_pjsip'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_header_funcs'
+ - asterisk: 'res_pjsip_session'
+ - asterisk: 'res_pjsip_rfc7329'
+ tags:
+ - pjsip
+ - rfc7329
diff --git a/tests/channels/pjsip/rfc7329/enabled_options_out_of_dialog/configs/ast1/extensions.conf b/tests/channels/pjsip/rfc7329/enabled_options_out_of_dialog/configs/ast1/extensions.conf
new file mode 100644
index 000000000..83cd7311d
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_options_out_of_dialog/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+
+exten => 1234,1,NoOp()
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/rfc7329/enabled_options_out_of_dialog/configs/ast1/pjsip.conf b/tests/channels/pjsip/rfc7329/enabled_options_out_of_dialog/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..633ed4ec6
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_options_out_of_dialog/configs/ast1/pjsip.conf
@@ -0,0 +1,19 @@
+[global]
+type=global
+rfc7329_enable=yes
+
+[transport-udp]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[sipp]
+type=endpoint
+transport=transport-udp
+context=default
+identify_by=ip
+
+[sipp-identify]
+type=identify
+endpoint=sipp
+match=127.0.0.1
diff --git a/tests/channels/pjsip/rfc7329/enabled_options_out_of_dialog/sipp/options_with_sid.xml b/tests/channels/pjsip/rfc7329/enabled_options_out_of_dialog/sipp/options_with_sid.xml
new file mode 100644
index 000000000..19ecd3142
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_options_out_of_dialog/sipp/options_with_sid.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+ ;tag=[call_number]
+ To: Asterisk
+ Call-ID: [call_id]
+ CSeq: 1 OPTIONS
+ Session-ID: 00112233445566778899aabbccddeeff
+ Contact: sip:sipp@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Asterisk Testsuite
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/enabled_options_out_of_dialog/test-config.yaml b/tests/channels/pjsip/rfc7329/enabled_options_out_of_dialog/test-config.yaml
new file mode 100644
index 000000000..356ce3f8e
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_options_out_of_dialog/test-config.yaml
@@ -0,0 +1,27 @@
+testinfo:
+ summary: 'RFC7329 enabled: out-of-dialog OPTIONS with Session-ID'
+ description: |
+ 'For out-of-dialog OPTIONS with Session-ID present, Asterisk should
+ preserve and forward a valid Session-ID.'
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+ memcheck-delay-stop: 7
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'options_with_sid.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+properties:
+ dependencies:
+ - app: 'sipp'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_session'
+ - asterisk: 'res_pjsip_rfc7329'
+ tags:
+ - pjsip
+ - rfc7329
diff --git a/tests/channels/pjsip/rfc7329/enabled_refer_invite_from_channel_var/configs/ast1/extensions.conf b/tests/channels/pjsip/rfc7329/enabled_refer_invite_from_channel_var/configs/ast1/extensions.conf
new file mode 100644
index 000000000..a0a129dad
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_refer_invite_from_channel_var/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[default]
+
+exten => bob,1,Dial(PJSIP/bob,,b(setsid^s^1))
+ same => n,Hangup()
+
+[setsid]
+exten => s,1,Set(SIPSESSIONID_REFERTO=abcdef0123456789abcdef0123456789)
+ same => n,Return()
diff --git a/tests/channels/pjsip/rfc7329/enabled_refer_invite_from_channel_var/configs/ast1/pjsip.conf b/tests/channels/pjsip/rfc7329/enabled_refer_invite_from_channel_var/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..f2f211534
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_refer_invite_from_channel_var/configs/ast1/pjsip.conf
@@ -0,0 +1,43 @@
+[global]
+type=global
+rfc7329_enable=yes
+
+[transport-udp]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint-template](!)
+type=endpoint
+transport=transport-udp
+context=default
+identify_by=ip
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor-template](!)
+type=aor
+max_contacts=1
+
+[alice](aor-template)
+contact=sip:alice@127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
+
+[bob](aor-template)
+contact=sip:bob@127.0.0.1:5062
+
+[bob](endpoint-template)
+aors=bob
+
+[alice-identify]
+type=identify
+endpoint=alice
+match=127.0.0.1:5061
+
+[bob-identify]
+type=identify
+endpoint=bob
+match=127.0.0.1:5062
diff --git a/tests/channels/pjsip/rfc7329/enabled_refer_invite_from_channel_var/sipp/alice_with_sid.xml b/tests/channels/pjsip/rfc7329/enabled_refer_invite_from_channel_var/sipp/alice_with_sid.xml
new file mode 100644
index 000000000..5f6b03812
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_refer_invite_from_channel_var/sipp/alice_with_sid.xml
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+ ;tag=[call_number]
+ To: bob
+ Call-ID: [call_id]
+ CSeq: 1 INVITE
+ Session-ID: 13579bdf2468ace013579bdf2468ace0
+ Contact:
+ Max-Forwards: 70
+ Subject: Test
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=alice 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ;tag=[call_number]
+ To: bob [peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 1 ACK
+ Session-ID: [$sid_180]
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[call_number]
+ To: bob [peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 2 BYE
+ Session-ID: [$sid_180]
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/enabled_refer_invite_from_channel_var/sipp/bob_with_sid.xml b/tests/channels/pjsip/rfc7329/enabled_refer_invite_from_channel_var/sipp/bob_with_sid.xml
new file mode 100644
index 000000000..1cc735315
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_refer_invite_from_channel_var/sipp/bob_with_sid.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=bob 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/enabled_refer_invite_from_channel_var/test-config.yaml b/tests/channels/pjsip/rfc7329/enabled_refer_invite_from_channel_var/test-config.yaml
new file mode 100644
index 000000000..17a36a0a2
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_refer_invite_from_channel_var/test-config.yaml
@@ -0,0 +1,31 @@
+testinfo:
+ summary: 'RFC7329 enabled: channel-var REFER with with_sid caller/callee'
+ description: |
+ 'If SIPSESSIONID_REFERTO is set on the channel before Dial(), and both
+ legs use Session-ID, the outgoing INVITE must carry a valid RFC7329
+ Session-ID.'
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+ memcheck-delay-stop: 7
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'bob_with_sid.xml', '-i': '127.0.0.1', '-p': '5062'} }
+ - { 'key-args': {'scenario': 'alice_with_sid.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'bob'} }
+
+properties:
+ dependencies:
+ - app: 'sipp'
+ - asterisk: 'app_dial'
+ - asterisk: 'chan_pjsip'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_refer'
+ - asterisk: 'res_pjsip_rfc7329'
+ tags:
+ - pjsip
+ - rfc7329
diff --git a/tests/channels/pjsip/rfc7329/enabled_refer_refer_to_session_id/configs/ast1/extensions.conf b/tests/channels/pjsip/rfc7329/enabled_refer_refer_to_session_id/configs/ast1/extensions.conf
new file mode 100644
index 000000000..c2b54fb58
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_refer_refer_to_session_id/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+ same => n,Answer()
+ same => n,Transfer(PJSIP/sip:asterisk@127.0.0.2)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/rfc7329/enabled_refer_refer_to_session_id/configs/ast1/pjsip.conf b/tests/channels/pjsip/rfc7329/enabled_refer_refer_to_session_id/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..5f32d6221
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_refer_refer_to_session_id/configs/ast1/pjsip.conf
@@ -0,0 +1,29 @@
+[global]
+type=global
+rfc7329_enable=yes
+
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[local-transport]
+type=transport
+protocol=udp
+bind=127.0.0.1
+
+[endpoint-template](!)
+type=endpoint
+context=default
+transport=local-transport
+allow=!all,ulaw
+
+[aor-template](!)
+type=aor
+max_contacts=1
+
+[alice-aors](aor-template)
+contact=sip:alice@127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice-aors
diff --git a/tests/channels/pjsip/rfc7329/enabled_refer_refer_to_session_id/sipp/invite_with_sid.xml b/tests/channels/pjsip/rfc7329/enabled_refer_refer_to_session_id/sipp/invite_with_sid.xml
new file mode 100644
index 000000000..b5ef0ee37
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_refer_refer_to_session_id/sipp/invite_with_sid.xml
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+
+ ;tag=[call_number]
+ To: s
+ Call-ID: [call_id]
+ CSeq: 1 INVITE
+ Session-ID: 11223344556677889900aabbccddeeff
+ Contact:
+ Max-Forwards: 70
+ Subject: Test
+ 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
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ ;tag=[call_number]
+ To: s [peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 1 ACK
+ Session-ID: 11223344556677889900aabbccddeeff
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER
+ Supported: 100rel,replaces
+ Content-Length: 0
+ ]]>
+
+
+
+ ;tag=[call_number]
+ To: s [peer_tag_param]
+ [last_call-ID:]
+ CSeq: 2 NOTIFY
+ Session-ID: 11223344556677889900aabbccddeeff
+ Contact:
+ Max-Forward: 70
+ Event: refer
+ Subscription-State: terminated
+ Content-Type: message/sipfrag
+ Content-Length: [len]
+
+ SIP/2.0 200 OK
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER
+ Supported: 100rel,replaces
+ User-Agent: Test
+ Accept-Language: en
+ Content-Type: application/sdp
+ Content-Length: 0
+ ]]>
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/enabled_refer_refer_to_session_id/test-config.yaml b/tests/channels/pjsip/rfc7329/enabled_refer_refer_to_session_id/test-config.yaml
new file mode 100644
index 000000000..25341e071
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_refer_refer_to_session_id/test-config.yaml
@@ -0,0 +1,30 @@
+testinfo:
+ summary: 'RFC7329 enabled: outgoing REFER with with_sid dialog'
+ description: |
+ 'When Transfer() emits an outbound REFER from a with_sid dialog,
+ the request must carry Session-ID derived from the inbound dialog.'
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+ memcheck-delay-stop: 7
+ fail-on-any: False
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': { 'scenario':'invite_with_sid.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice' } }
+
+properties:
+ dependencies:
+ - app: 'sipp'
+ - asterisk: 'app_transfer'
+ - asterisk: 'chan_pjsip'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_refer'
+ - asterisk: 'res_pjsip_rfc7329'
+ tags:
+ - pjsip
+ - rfc7329
diff --git a/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/configs/ast1/extensions.conf b/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/configs/ast1/extensions.conf
new file mode 100644
index 000000000..da910d6cf
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[default]
+
+exten => bob,1,Dial(PJSIP/bob)
+ same => n,Hangup()
+
+exten => charlie,1,UserEvent(Result,Status: passed)
+ same => n,Dial(PJSIP/charlie,,L(1200:0:0))
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/configs/ast1/pjsip.conf b/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..668f7533e
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/configs/ast1/pjsip.conf
@@ -0,0 +1,54 @@
+[global]
+type=global
+rfc7329_enable=yes
+
+[transport-udp]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint-template](!)
+type=endpoint
+transport=transport-udp
+context=default
+identify_by=ip
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor-template](!)
+type=aor
+max_contacts=1
+
+[alice](aor-template)
+contact=sip:alice@127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
+
+[bob](aor-template)
+contact=sip:bob@127.0.0.1:5062
+
+[bob](endpoint-template)
+aors=bob
+
+[charlie](aor-template)
+contact=sip:charlie@127.0.0.1:5063
+
+[charlie](endpoint-template)
+aors=charlie
+
+[alice-identify]
+type=identify
+endpoint=alice
+match=127.0.0.1:5061
+
+[bob-identify]
+type=identify
+endpoint=bob
+match=127.0.0.1:5062
+
+[charlie-identify]
+type=identify
+endpoint=charlie
+match=127.0.0.1:5063
diff --git a/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/sipp/alice_with_sid.xml b/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/sipp/alice_with_sid.xml
new file mode 100644
index 000000000..f02a0fcf5
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/sipp/alice_with_sid.xml
@@ -0,0 +1,242 @@
+
+
+
+
+
+
+
+ ;tag=[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: 1 INVITE
+ Session-ID: 2468ace013579bdf2468ace013579bdf
+ Contact:
+ Max-Forwards: 70
+ Subject: Test
+ 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
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ;tag=[call_number]
+ To: [peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 1 ACK
+ Session-ID: 2468ace013579bdf2468ace013579bdf
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[call_number]
+ To: "[service]" [peer_tag_param]
+ [last_Call-ID:]
+ CSeq: [cseq] INVITE
+ Session-ID: 2468ace013579bdf2468ace013579bdf
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio 12345 RTP/AVP 0 bob
+ a=sendonly
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:bob telephone-event/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ ;tag=[call_number]
+ To: [peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: [cseq] ACK
+ Session-ID: 2468ace013579bdf2468ace013579bdf
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+ Call-ID: [call_id]
+ CSeq: [cseq] REFER
+ Session-ID: 2468ace013579bdf2468ace013579bdf
+ Max-Forwards: 70
+ Refer-To:
+ Referred-By: alice
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Content-Length:0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Content-Length:0
+
+ ]]>
+
+
+
+
+
+ ;tag=[call_number]
+ To: [peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Session-ID: 2468ace013579bdf2468ace013579bdf
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+ ]]>
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/sipp/bob_with_sid.xml b/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/sipp/bob_with_sid.xml
new file mode 100644
index 000000000..c98ca04e5
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/sipp/bob_with_sid.xml
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=bob 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/sipp/charlie.xml b/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/sipp/charlie.xml
new file mode 100644
index 000000000..41b494745
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/sipp/charlie.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=charlie 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
diff --git a/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/test-config.yaml b/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/test-config.yaml
new file mode 100644
index 000000000..ca9090acd
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/enabled_refer_store_refer_to_session_id/test-config.yaml
@@ -0,0 +1,58 @@
+testinfo:
+ summary: 'RFC7329 enabled: store Refer-To Session-ID with with_sid legs'
+ description: |
+ 'When an inbound REFER contains a Session-ID URI header parameter
+ in Refer-To and all legs use Session-ID, Asterisk must persist it
+ and use it on the outbound INVITE sent to the transfer target.'
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+ modules:
+ -
+ config-section: ami-config
+ typename: 'ami.AMIEventModule'
+
+test-object-config:
+ memcheck-delay-stop: 7
+ fail-on-any: False
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'charlie.xml', '-i': '127.0.0.1', '-p': '5063'} }
+ - { 'key-args': {'scenario': 'bob_with_sid.xml', '-i': '127.0.0.1', '-p': '5062'} }
+ - { 'key-args': {'scenario': 'alice_with_sid.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'bob', '-sleep': '1'} }
+
+ami-config:
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'VarSet'
+ Variable: '__SIPSESSIONID_REFERTO'
+ Value: '00112233445566778899aabbccddeeff'
+ count: '>0'
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'UserEvent'
+ UserEvent: 'Result'
+ Status: 'passed'
+ count: '>0'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - app: 'sipp'
+ - asterisk: 'app_dial'
+ - asterisk: 'app_userevent'
+ - asterisk: 'chan_pjsip'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_refer'
+ - asterisk: 'res_pjsip_rfc7329'
+ tags:
+ - pjsip
+ - rfc7329
diff --git a/tests/channels/pjsip/rfc7329/tests.yaml b/tests/channels/pjsip/rfc7329/tests.yaml
new file mode 100644
index 000000000..6ad582cd3
--- /dev/null
+++ b/tests/channels/pjsip/rfc7329/tests.yaml
@@ -0,0 +1,12 @@
+tests:
+ - test: 'enabled_options_out_of_dialog'
+ - test: 'disabled_no_session_id_registration'
+ - test: 'disabled_no_session_id_registration_unloaded'
+ - test: 'enabled_dialog_generation_registration'
+ - test: 'enabled_dialog_generation_registration_unloaded'
+ - test: 'disabled_no_session_id'
+ - test: 'enabled_dialog_generation'
+ - test: 'enabled_linkedid_immutable'
+ - test: 'enabled_refer_invite_from_channel_var'
+ - test: 'enabled_refer_refer_to_session_id'
+ - test: 'enabled_refer_store_refer_to_session_id'
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index b0c09da68..474d3318b 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -43,6 +43,7 @@ tests:
- dir: 'session_timers'
- dir: 'dtmf_sdp'
- dir: 'oli'
+ - dir: 'rfc7329'
- test: 'accountcode'
- test: 'acl_call'
- test: 'allow_overlap'