[Asterisk-code-review] fax/pjsip/maxdatagram: Add tests for the maxdatagram configuration op... (testsuite[16])

Kevin Harwell asteriskteam at digium.com
Fri Dec 13 14:46:14 CST 2019


Kevin Harwell has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/13444 )


Change subject: fax/pjsip/maxdatagram: Add tests for the maxdatagram configuration option
......................................................................

fax/pjsip/maxdatagram: Add tests for the maxdatagram configuration option

This patch adds four tests that ensure the "T38FaxMaxDatagram" SDP attribute
is properly set when the "t38_udptl_maxdatagram" configuration option is used.

none - option not set on either endpoint
callee - option only set on callee endpoint
caller - option only set on caller endpoint
both - option set on both endpoints

Change-Id: I2bdca86602d74c28dde2db13686bdf5515331f44
---
A tests/fax/pjsip/maxdatagram/both/configs/ast1/extensions.conf
A tests/fax/pjsip/maxdatagram/both/configs/ast1/pjsip.conf
A tests/fax/pjsip/maxdatagram/both/sipp/alice.xml
A tests/fax/pjsip/maxdatagram/both/sipp/bob.xml
A tests/fax/pjsip/maxdatagram/both/test-config.yaml
A tests/fax/pjsip/maxdatagram/callee/configs/ast1/extensions.conf
A tests/fax/pjsip/maxdatagram/callee/configs/ast1/pjsip.conf
A tests/fax/pjsip/maxdatagram/callee/sipp/alice.xml
A tests/fax/pjsip/maxdatagram/callee/sipp/bob.xml
A tests/fax/pjsip/maxdatagram/callee/test-config.yaml
A tests/fax/pjsip/maxdatagram/caller/configs/ast1/extensions.conf
A tests/fax/pjsip/maxdatagram/caller/configs/ast1/pjsip.conf
A tests/fax/pjsip/maxdatagram/caller/sipp/alice.xml
A tests/fax/pjsip/maxdatagram/caller/sipp/bob.xml
A tests/fax/pjsip/maxdatagram/caller/test-config.yaml
A tests/fax/pjsip/maxdatagram/none/configs/ast1/extensions.conf
A tests/fax/pjsip/maxdatagram/none/configs/ast1/pjsip.conf
A tests/fax/pjsip/maxdatagram/none/sipp/alice.xml
A tests/fax/pjsip/maxdatagram/none/sipp/bob.xml
A tests/fax/pjsip/maxdatagram/none/test-config.yaml
A tests/fax/pjsip/maxdatagram/tests.yaml
M tests/fax/pjsip/tests.yaml
22 files changed, 1,431 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/44/13444/1

diff --git a/tests/fax/pjsip/maxdatagram/both/configs/ast1/extensions.conf b/tests/fax/pjsip/maxdatagram/both/configs/ast1/extensions.conf
new file mode 100644
index 0000000..b237faf
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/both/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[general]
+
+[default]
+exten => bob,1,Dial(PJSIP/${EXTEN})
+	same => n,Hangup()
diff --git a/tests/fax/pjsip/maxdatagram/both/configs/ast1/pjsip.conf b/tests/fax/pjsip/maxdatagram/both/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..aa4e42c
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/both/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1:5060
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw
+direct_media=false
+t38_udptl=yes
+
+[alice](aor-template)
+contact=sip:alice at 127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
+t38_udptl_maxdatagram=200
+
+[bob](aor-template)
+contact=sip:bob at 127.0.0.1:5062
+
+[bob](endpoint-template)
+aors=bob
+t38_udptl_maxdatagram=300
+
diff --git a/tests/fax/pjsip/maxdatagram/both/sipp/alice.xml b/tests/fax/pjsip/maxdatagram/both/sipp/alice.xml
new file mode 100644
index 0000000..f505892
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/both/sipp/alice.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="alice">
+
+	<send retrans="500">
+		<![CDATA[
+			INVITE sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [exten] <sip:[exten]@[remote_ip]:[remote_port]>
+			Call-ID: [call_id]
+			CSeq: [cseq] INVITE
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 53256789 2345687132 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 101
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+		]]>
+	</send>
+
+	<recv response="100" optional="true" />
+	<recv response="180" optional="true" />
+	<recv response="183" optional="true" />
+	<recv response="200" />
+
+	<send>
+		<![CDATA[
+			ACK sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [exten] <sip:[exten]@[remote_ip]:[remote_port]>[peer_tag_param]
+			Call-ID: [call_id]
+			CSeq: [cseq] ACK
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Length: 0
+		]]>
+	</send>
+
+	<!-- Reinvite received for T38 -->
+	<recv request="INVITE">
+		<action>
+			<!-- Asterisk calculates this value based on the configured value,
+				and error correction mode. In this scenario we should end up
+				with one below the configured value due to rounding. -->
+			<ereg regexp=".*(T38FaxMaxDatagram:299)"
+				search_in="body"
+				check_it="true"
+				assign_to="maxdatagram"/>
+		</action>
+	</recv>
+	<Reference variables="maxdatagram" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901700 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=image 31002 udptl t38
+			a=sendrecv
+			a=T38FaxVersion:0
+			a=T38MaxBitRate:9600
+			a=T38FaxMaxBuffer:1024
+			a=T38FaxMaxDatagram:400
+			a=T38FaxRateManagement:transferredTCF
+		]]>
+	</send>
+
+	<recv request="ACK"/>
+
+	<!-- Reinvite received to switch back to audio -->
+	<recv request="INVITE" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
+			s=Polycom IP Phone
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			a=sendrecv
+			m=audio [media_port] RTP/AVP 0 101
+			a=sendrecv
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+		]]>
+	</send>
+
+	<recv request="ACK" />
+
+	<recv request="BYE" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+		]]>
+	</send>
+
+</scenario>
+
diff --git a/tests/fax/pjsip/maxdatagram/both/sipp/bob.xml b/tests/fax/pjsip/maxdatagram/both/sipp/bob.xml
new file mode 100644
index 0000000..6dd09bf
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/both/sipp/bob.xml
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="bob">
+
+	<recv request="INVITE">
+		<action>
+			<ereg regexp=".*(;tag=.*)"
+				header="From:"
+				search_in="hdr"
+				check_it="true"
+				assign_to="remote_tag"/>
+		</action>
+	</recv>
+	<Reference variables="remote_tag" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 100 Trying
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+		]]>
+	</send>
+
+	<send>
+		<![CDATA[
+			SIP/2.0 180 Ringing
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+		]]>
+	</send>
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
+			s=Polycom IP Phone
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			a=sendrecv
+			m=audio [media_port] RTP/AVP 0 101
+			a=sendrecv
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+		]]>
+	</send>
+
+	<recv request="ACK" />
+
+	<pause milliseconds="1000"/>
+
+	<!-- Reinvite to set up T38 Fax session -->
+	<send>
+	  <![CDATA[
+			INVITE sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [$remote_tag]
+			[last_Call-ID:]
+			CSeq: [cseq] INVITE
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+
+			v=0
+			o=- 1324901698 1324901700 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=image 31002 udptl t38
+			a=sendrecv
+			a=T38FaxVersion:0
+			a=T38MaxBitRate:9600
+			a=T38FaxMaxBuffer:1024
+			a=T38FaxMaxDatagram:400
+			a=T38FaxRateManagement:transferredTCF
+		]]>
+	</send>
+
+	<recv response="100" optional="true" />
+
+	<recv response="200">
+		<action>
+			<!-- Asterisk calculates this value based on the configured value,
+				and error correction mode. In this scenario we should end up
+				with one below the configured value due to rounding. -->
+			<ereg regexp=".*(T38FaxMaxDatagram:199)"
+				search_in="body"
+				check_it="true"
+				assign_to="maxdatagram"/>
+		</action>
+	</recv>
+	<Reference variables="maxdatagram" />
+
+	<send>
+		<![CDATA[
+			ACK sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [$remote_tag]
+			Call-ID: [call_id]
+			CSeq: [cseq] ACK
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Length: 0
+		]]>
+	</send>
+
+	<send>
+		<![CDATA[
+
+			BYE sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [$remote_tag]
+			[last_Call-ID:]
+			CSeq: [cseq] BYE
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Length: 0
+		]]>
+	</send>
+
+	<recv response="200" />
+
+</scenario>
+
diff --git a/tests/fax/pjsip/maxdatagram/both/test-config.yaml b/tests/fax/pjsip/maxdatagram/both/test-config.yaml
new file mode 100644
index 0000000..c0635a4
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/both/test-config.yaml
@@ -0,0 +1,31 @@
+testinfo:
+    summary: 'Make sure the correct max datagram is sent in SDPs'
+    description: |
+        'Both the caller and callee t38_udptl_maxdatagram endpoint configuration
+        options are set to override what's declared in the SDP.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'bob.xml', '-p':'5062', '-s': 'bob'},
+                    'ordered-args': ['-key', 'exten', 'alice'] }
+                - { 'key-args': {'scenario': 'alice.xml', '-p':'5061', '-s': 'alice'},
+                    'ordered-args': ['-key', 'exten', 'bob'] }
+
+properties:
+    dependencies:
+        - sipp :
+            version : 'v3.5'
+        - asterisk : 'res_fax'
+        - asterisk : 'res_fax_spandsp'
+        - asterisk : 'chan_pjsip'
+        - asterisk : 'res_pjsip_t38'
+    tags:
+        - pjsip
+        - fax
diff --git a/tests/fax/pjsip/maxdatagram/callee/configs/ast1/extensions.conf b/tests/fax/pjsip/maxdatagram/callee/configs/ast1/extensions.conf
new file mode 100644
index 0000000..b237faf
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/callee/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[general]
+
+[default]
+exten => bob,1,Dial(PJSIP/${EXTEN})
+	same => n,Hangup()
diff --git a/tests/fax/pjsip/maxdatagram/callee/configs/ast1/pjsip.conf b/tests/fax/pjsip/maxdatagram/callee/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..0580089
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/callee/configs/ast1/pjsip.conf
@@ -0,0 +1,33 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1:5060
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw
+direct_media=false
+t38_udptl=yes
+
+[alice](aor-template)
+contact=sip:alice at 127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
+
+[bob](aor-template)
+contact=sip:bob at 127.0.0.1:5062
+
+[bob](endpoint-template)
+aors=bob
+t38_udptl_maxdatagram=300
+
diff --git a/tests/fax/pjsip/maxdatagram/callee/sipp/alice.xml b/tests/fax/pjsip/maxdatagram/callee/sipp/alice.xml
new file mode 100644
index 0000000..f505892
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/callee/sipp/alice.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="alice">
+
+	<send retrans="500">
+		<![CDATA[
+			INVITE sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [exten] <sip:[exten]@[remote_ip]:[remote_port]>
+			Call-ID: [call_id]
+			CSeq: [cseq] INVITE
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 53256789 2345687132 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 101
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+		]]>
+	</send>
+
+	<recv response="100" optional="true" />
+	<recv response="180" optional="true" />
+	<recv response="183" optional="true" />
+	<recv response="200" />
+
+	<send>
+		<![CDATA[
+			ACK sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [exten] <sip:[exten]@[remote_ip]:[remote_port]>[peer_tag_param]
+			Call-ID: [call_id]
+			CSeq: [cseq] ACK
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Length: 0
+		]]>
+	</send>
+
+	<!-- Reinvite received for T38 -->
+	<recv request="INVITE">
+		<action>
+			<!-- Asterisk calculates this value based on the configured value,
+				and error correction mode. In this scenario we should end up
+				with one below the configured value due to rounding. -->
+			<ereg regexp=".*(T38FaxMaxDatagram:299)"
+				search_in="body"
+				check_it="true"
+				assign_to="maxdatagram"/>
+		</action>
+	</recv>
+	<Reference variables="maxdatagram" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901700 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=image 31002 udptl t38
+			a=sendrecv
+			a=T38FaxVersion:0
+			a=T38MaxBitRate:9600
+			a=T38FaxMaxBuffer:1024
+			a=T38FaxMaxDatagram:400
+			a=T38FaxRateManagement:transferredTCF
+		]]>
+	</send>
+
+	<recv request="ACK"/>
+
+	<!-- Reinvite received to switch back to audio -->
+	<recv request="INVITE" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
+			s=Polycom IP Phone
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			a=sendrecv
+			m=audio [media_port] RTP/AVP 0 101
+			a=sendrecv
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+		]]>
+	</send>
+
+	<recv request="ACK" />
+
+	<recv request="BYE" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+		]]>
+	</send>
+
+</scenario>
+
diff --git a/tests/fax/pjsip/maxdatagram/callee/sipp/bob.xml b/tests/fax/pjsip/maxdatagram/callee/sipp/bob.xml
new file mode 100644
index 0000000..b2f13d3
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/callee/sipp/bob.xml
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="bob">
+
+	<recv request="INVITE">
+		<action>
+			<ereg regexp=".*(;tag=.*)"
+				header="From:"
+				search_in="hdr"
+				check_it="true"
+				assign_to="remote_tag"/>
+		</action>
+	</recv>
+	<Reference variables="remote_tag" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 100 Trying
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+		]]>
+	</send>
+
+	<send>
+		<![CDATA[
+			SIP/2.0 180 Ringing
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+		]]>
+	</send>
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
+			s=Polycom IP Phone
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			a=sendrecv
+			m=audio [media_port] RTP/AVP 0 101
+			a=sendrecv
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+		]]>
+	</send>
+
+	<recv request="ACK" />
+
+	<pause milliseconds="1000"/>
+
+	<!-- Reinvite to set up T38 Fax session -->
+	<send>
+	  <![CDATA[
+			INVITE sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [$remote_tag]
+			[last_Call-ID:]
+			CSeq: [cseq] INVITE
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+
+			v=0
+			o=- 1324901698 1324901700 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=image 31002 udptl t38
+			a=sendrecv
+			a=T38FaxVersion:0
+			a=T38MaxBitRate:9600
+			a=T38FaxMaxBuffer:1024
+			a=T38FaxMaxDatagram:400
+			a=T38FaxRateManagement:transferredTCF
+		]]>
+	</send>
+
+	<recv response="100" optional="true" />
+
+	<recv response="200">
+		<action>
+			<!-- Asterisk calculates this value based on the configured value,
+				and error correction mode. In this scenario we should end up
+				with one below the SDP value due to rounding. -->
+			<ereg regexp=".*(T38FaxMaxDatagram:399)"
+				search_in="body"
+				check_it="true"
+				assign_to="maxdatagram"/>
+		</action>
+	</recv>
+	<Reference variables="maxdatagram" />
+
+	<send>
+		<![CDATA[
+			ACK sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [$remote_tag]
+			Call-ID: [call_id]
+			CSeq: [cseq] ACK
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Length: 0
+		]]>
+	</send>
+
+	<send>
+		<![CDATA[
+
+			BYE sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [$remote_tag]
+			[last_Call-ID:]
+			CSeq: [cseq] BYE
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Length: 0
+		]]>
+	</send>
+
+	<recv response="200" />
+
+</scenario>
+
diff --git a/tests/fax/pjsip/maxdatagram/callee/test-config.yaml b/tests/fax/pjsip/maxdatagram/callee/test-config.yaml
new file mode 100644
index 0000000..4901361
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/callee/test-config.yaml
@@ -0,0 +1,31 @@
+testinfo:
+    summary: 'Make sure the correct max datagram is sent in SDPs'
+    description: |
+        'The callee's t38_udptl_maxdatagram endpoint configuration option is set
+        to override what's declared in the SDP.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'bob.xml', '-p':'5062', '-s': 'bob'},
+                    'ordered-args': ['-key', 'exten', 'alice'] }
+                - { 'key-args': {'scenario': 'alice.xml', '-p':'5061', '-s': 'alice'},
+                    'ordered-args': ['-key', 'exten', 'bob'] }
+
+properties:
+    dependencies:
+        - sipp :
+            version : 'v3.5'
+        - asterisk : 'res_fax'
+        - asterisk : 'res_fax_spandsp'
+        - asterisk : 'chan_pjsip'
+        - asterisk : 'res_pjsip_t38'
+    tags:
+        - pjsip
+        - fax
diff --git a/tests/fax/pjsip/maxdatagram/caller/configs/ast1/extensions.conf b/tests/fax/pjsip/maxdatagram/caller/configs/ast1/extensions.conf
new file mode 100644
index 0000000..b237faf
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/caller/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[general]
+
+[default]
+exten => bob,1,Dial(PJSIP/${EXTEN})
+	same => n,Hangup()
diff --git a/tests/fax/pjsip/maxdatagram/caller/configs/ast1/pjsip.conf b/tests/fax/pjsip/maxdatagram/caller/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..bd5e590
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/caller/configs/ast1/pjsip.conf
@@ -0,0 +1,32 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1:5060
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw
+direct_media=false
+t38_udptl=yes
+
+[alice](aor-template)
+contact=sip:alice at 127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
+t38_udptl_maxdatagram=200
+
+[bob](aor-template)
+contact=sip:bob at 127.0.0.1:5062
+
+[bob](endpoint-template)
+aors=bob
diff --git a/tests/fax/pjsip/maxdatagram/caller/sipp/alice.xml b/tests/fax/pjsip/maxdatagram/caller/sipp/alice.xml
new file mode 100644
index 0000000..68065d8
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/caller/sipp/alice.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="alice">
+
+	<send retrans="500">
+		<![CDATA[
+			INVITE sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [exten] <sip:[exten]@[remote_ip]:[remote_port]>
+			Call-ID: [call_id]
+			CSeq: [cseq] INVITE
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 53256789 2345687132 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 101
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+		]]>
+	</send>
+
+	<recv response="100" optional="true" />
+	<recv response="180" optional="true" />
+	<recv response="183" optional="true" />
+	<recv response="200" />
+
+	<send>
+		<![CDATA[
+			ACK sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [exten] <sip:[exten]@[remote_ip]:[remote_port]>[peer_tag_param]
+			Call-ID: [call_id]
+			CSeq: [cseq] ACK
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Length: 0
+		]]>
+	</send>
+
+	<!-- Reinvite received for T38 -->
+	<recv request="INVITE">
+		<action>
+			<!-- Asterisk calculates this value based on the configured value,
+				and error correction mode. In this scenario we should end up
+				with one below the SDP value due to rounding. -->
+			<ereg regexp=".*(T38FaxMaxDatagram:399)"
+				search_in="body"
+				check_it="true"
+				assign_to="maxdatagram"/>
+		</action>
+	</recv>
+	<Reference variables="maxdatagram" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901700 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=image 31002 udptl t38
+			a=sendrecv
+			a=T38FaxVersion:0
+			a=T38MaxBitRate:9600
+			a=T38FaxMaxBuffer:1024
+			a=T38FaxMaxDatagram:400
+			a=T38FaxRateManagement:transferredTCF
+		]]>
+	</send>
+
+	<recv request="ACK"/>
+
+	<!-- Reinvite received to switch back to audio -->
+	<recv request="INVITE" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
+			s=Polycom IP Phone
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			a=sendrecv
+			m=audio [media_port] RTP/AVP 0 101
+			a=sendrecv
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+		]]>
+	</send>
+
+	<recv request="ACK" />
+
+	<recv request="BYE" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+		]]>
+	</send>
+
+</scenario>
+
diff --git a/tests/fax/pjsip/maxdatagram/caller/sipp/bob.xml b/tests/fax/pjsip/maxdatagram/caller/sipp/bob.xml
new file mode 100644
index 0000000..6dd09bf
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/caller/sipp/bob.xml
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="bob">
+
+	<recv request="INVITE">
+		<action>
+			<ereg regexp=".*(;tag=.*)"
+				header="From:"
+				search_in="hdr"
+				check_it="true"
+				assign_to="remote_tag"/>
+		</action>
+	</recv>
+	<Reference variables="remote_tag" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 100 Trying
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+		]]>
+	</send>
+
+	<send>
+		<![CDATA[
+			SIP/2.0 180 Ringing
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+		]]>
+	</send>
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
+			s=Polycom IP Phone
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			a=sendrecv
+			m=audio [media_port] RTP/AVP 0 101
+			a=sendrecv
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+		]]>
+	</send>
+
+	<recv request="ACK" />
+
+	<pause milliseconds="1000"/>
+
+	<!-- Reinvite to set up T38 Fax session -->
+	<send>
+	  <![CDATA[
+			INVITE sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [$remote_tag]
+			[last_Call-ID:]
+			CSeq: [cseq] INVITE
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+
+			v=0
+			o=- 1324901698 1324901700 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=image 31002 udptl t38
+			a=sendrecv
+			a=T38FaxVersion:0
+			a=T38MaxBitRate:9600
+			a=T38FaxMaxBuffer:1024
+			a=T38FaxMaxDatagram:400
+			a=T38FaxRateManagement:transferredTCF
+		]]>
+	</send>
+
+	<recv response="100" optional="true" />
+
+	<recv response="200">
+		<action>
+			<!-- Asterisk calculates this value based on the configured value,
+				and error correction mode. In this scenario we should end up
+				with one below the configured value due to rounding. -->
+			<ereg regexp=".*(T38FaxMaxDatagram:199)"
+				search_in="body"
+				check_it="true"
+				assign_to="maxdatagram"/>
+		</action>
+	</recv>
+	<Reference variables="maxdatagram" />
+
+	<send>
+		<![CDATA[
+			ACK sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [$remote_tag]
+			Call-ID: [call_id]
+			CSeq: [cseq] ACK
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Length: 0
+		]]>
+	</send>
+
+	<send>
+		<![CDATA[
+
+			BYE sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [$remote_tag]
+			[last_Call-ID:]
+			CSeq: [cseq] BYE
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Length: 0
+		]]>
+	</send>
+
+	<recv response="200" />
+
+</scenario>
+
diff --git a/tests/fax/pjsip/maxdatagram/caller/test-config.yaml b/tests/fax/pjsip/maxdatagram/caller/test-config.yaml
new file mode 100644
index 0000000..9870f8b
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/caller/test-config.yaml
@@ -0,0 +1,31 @@
+testinfo:
+    summary: 'Make sure the correct max datagram is sent in SDPs'
+    description: |
+        'The caller's t38_udptl_maxdatagram endpoint configuration option is set
+        to override what's declared in the SDP.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'bob.xml', '-p':'5062', '-s': 'bob'},
+                    'ordered-args': ['-key', 'exten', 'alice'] }
+                - { 'key-args': {'scenario': 'alice.xml', '-p':'5061', '-s': 'alice'},
+                    'ordered-args': ['-key', 'exten', 'bob'] }
+
+properties:
+    dependencies:
+        - sipp :
+            version : 'v3.5'
+        - asterisk : 'res_fax'
+        - asterisk : 'res_fax_spandsp'
+        - asterisk : 'chan_pjsip'
+        - asterisk : 'res_pjsip_t38'
+    tags:
+        - pjsip
+        - fax
diff --git a/tests/fax/pjsip/maxdatagram/none/configs/ast1/extensions.conf b/tests/fax/pjsip/maxdatagram/none/configs/ast1/extensions.conf
new file mode 100644
index 0000000..b237faf
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/none/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[general]
+
+[default]
+exten => bob,1,Dial(PJSIP/${EXTEN})
+	same => n,Hangup()
diff --git a/tests/fax/pjsip/maxdatagram/none/configs/ast1/pjsip.conf b/tests/fax/pjsip/maxdatagram/none/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..874a4c4
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/none/configs/ast1/pjsip.conf
@@ -0,0 +1,33 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1:5060
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw
+direct_media=false
+t38_udptl=yes
+
+[alice](aor-template)
+contact=sip:alice at 127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
+
+[bob](aor-template)
+contact=sip:bob at 127.0.0.1:5062
+
+[bob](endpoint-template)
+aors=bob
+
+
diff --git a/tests/fax/pjsip/maxdatagram/none/sipp/alice.xml b/tests/fax/pjsip/maxdatagram/none/sipp/alice.xml
new file mode 100644
index 0000000..68065d8
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/none/sipp/alice.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="alice">
+
+	<send retrans="500">
+		<![CDATA[
+			INVITE sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [exten] <sip:[exten]@[remote_ip]:[remote_port]>
+			Call-ID: [call_id]
+			CSeq: [cseq] INVITE
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 53256789 2345687132 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 101
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+		]]>
+	</send>
+
+	<recv response="100" optional="true" />
+	<recv response="180" optional="true" />
+	<recv response="183" optional="true" />
+	<recv response="200" />
+
+	<send>
+		<![CDATA[
+			ACK sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [exten] <sip:[exten]@[remote_ip]:[remote_port]>[peer_tag_param]
+			Call-ID: [call_id]
+			CSeq: [cseq] ACK
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Length: 0
+		]]>
+	</send>
+
+	<!-- Reinvite received for T38 -->
+	<recv request="INVITE">
+		<action>
+			<!-- Asterisk calculates this value based on the configured value,
+				and error correction mode. In this scenario we should end up
+				with one below the SDP value due to rounding. -->
+			<ereg regexp=".*(T38FaxMaxDatagram:399)"
+				search_in="body"
+				check_it="true"
+				assign_to="maxdatagram"/>
+		</action>
+	</recv>
+	<Reference variables="maxdatagram" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901700 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=image 31002 udptl t38
+			a=sendrecv
+			a=T38FaxVersion:0
+			a=T38MaxBitRate:9600
+			a=T38FaxMaxBuffer:1024
+			a=T38FaxMaxDatagram:400
+			a=T38FaxRateManagement:transferredTCF
+		]]>
+	</send>
+
+	<recv request="ACK"/>
+
+	<!-- Reinvite received to switch back to audio -->
+	<recv request="INVITE" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
+			s=Polycom IP Phone
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			a=sendrecv
+			m=audio [media_port] RTP/AVP 0 101
+			a=sendrecv
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+		]]>
+	</send>
+
+	<recv request="ACK" />
+
+	<recv request="BYE" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+		]]>
+	</send>
+
+</scenario>
+
diff --git a/tests/fax/pjsip/maxdatagram/none/sipp/bob.xml b/tests/fax/pjsip/maxdatagram/none/sipp/bob.xml
new file mode 100644
index 0000000..b2f13d3
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/none/sipp/bob.xml
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="bob">
+
+	<recv request="INVITE">
+		<action>
+			<ereg regexp=".*(;tag=.*)"
+				header="From:"
+				search_in="hdr"
+				check_it="true"
+				assign_to="remote_tag"/>
+		</action>
+	</recv>
+	<Reference variables="remote_tag" />
+
+	<send>
+		<![CDATA[
+			SIP/2.0 100 Trying
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+		]]>
+	</send>
+
+	<send>
+		<![CDATA[
+			SIP/2.0 180 Ringing
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+		]]>
+	</send>
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
+			s=Polycom IP Phone
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			a=sendrecv
+			m=audio [media_port] RTP/AVP 0 101
+			a=sendrecv
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+		]]>
+	</send>
+
+	<recv request="ACK" />
+
+	<pause milliseconds="1000"/>
+
+	<!-- Reinvite to set up T38 Fax session -->
+	<send>
+	  <![CDATA[
+			INVITE sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [$remote_tag]
+			[last_Call-ID:]
+			CSeq: [cseq] INVITE
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+
+			v=0
+			o=- 1324901698 1324901700 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=image 31002 udptl t38
+			a=sendrecv
+			a=T38FaxVersion:0
+			a=T38MaxBitRate:9600
+			a=T38FaxMaxBuffer:1024
+			a=T38FaxMaxDatagram:400
+			a=T38FaxRateManagement:transferredTCF
+		]]>
+	</send>
+
+	<recv response="100" optional="true" />
+
+	<recv response="200">
+		<action>
+			<!-- Asterisk calculates this value based on the configured value,
+				and error correction mode. In this scenario we should end up
+				with one below the SDP value due to rounding. -->
+			<ereg regexp=".*(T38FaxMaxDatagram:399)"
+				search_in="body"
+				check_it="true"
+				assign_to="maxdatagram"/>
+		</action>
+	</recv>
+	<Reference variables="maxdatagram" />
+
+	<send>
+		<![CDATA[
+			ACK sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [$remote_tag]
+			Call-ID: [call_id]
+			CSeq: [cseq] ACK
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Length: 0
+		]]>
+	</send>
+
+	<send>
+		<![CDATA[
+
+			BYE sip:[exten]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+			To: [$remote_tag]
+			[last_Call-ID:]
+			CSeq: [cseq] BYE
+			Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+			Max-Forwards: 70
+			Content-Length: 0
+		]]>
+	</send>
+
+	<recv response="200" />
+
+</scenario>
+
diff --git a/tests/fax/pjsip/maxdatagram/none/test-config.yaml b/tests/fax/pjsip/maxdatagram/none/test-config.yaml
new file mode 100644
index 0000000..4e0e077
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/none/test-config.yaml
@@ -0,0 +1,31 @@
+testinfo:
+    summary: 'Make sure the correct max datagram is sent in SDPs'
+    description: |
+        'This is a baseline test where neither the caller nor callee sets the
+        t38_udptl_maxdatagram endpoint configuration option.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'bob.xml', '-p':'5062', '-s': 'bob'},
+                    'ordered-args': ['-key', 'exten', 'alice'] }
+                - { 'key-args': {'scenario': 'alice.xml', '-p':'5061', '-s': 'alice'},
+                    'ordered-args': ['-key', 'exten', 'bob'] }
+
+properties:
+    dependencies:
+        - sipp :
+            version : 'v3.5'
+        - asterisk : 'res_fax'
+        - asterisk : 'res_fax_spandsp'
+        - asterisk : 'chan_pjsip'
+        - asterisk : 'res_pjsip_t38'
+    tags:
+        - pjsip
+        - fax
diff --git a/tests/fax/pjsip/maxdatagram/tests.yaml b/tests/fax/pjsip/maxdatagram/tests.yaml
new file mode 100644
index 0000000..91c3948
--- /dev/null
+++ b/tests/fax/pjsip/maxdatagram/tests.yaml
@@ -0,0 +1,6 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'none'
+    - test: 'callee'
+    - test: 'caller'
+    - test: 'both'
diff --git a/tests/fax/pjsip/tests.yaml b/tests/fax/pjsip/tests.yaml
index fafb797..dd55995 100644
--- a/tests/fax/pjsip/tests.yaml
+++ b/tests/fax/pjsip/tests.yaml
@@ -6,6 +6,7 @@
     - test: 'gateway_native_t38'
     - test: 'gateway_t38_g711_rx'
     - test: 'gateway_t38_g711_tx'
+    - dir: 'maxdatagram'
     - test: 't38'
     - test: 't38_1xx_response'
     - test: 't38_fast_reject'

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

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: I2bdca86602d74c28dde2db13686bdf5515331f44
Gerrit-Change-Number: 13444
Gerrit-PatchSet: 1
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191213/12439039/attachment-0001.html>


More information about the asterisk-code-review mailing list