[asterisk-commits] pjsip session refresh: Add a test for the PJSIP SEND SESSION... (testsuite[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Aug 11 10:31:35 CDT 2016
Anonymous Coward #1000019 has submitted this change and it was merged.
Change subject: pjsip_session_refresh: Add a test for the PJSIP_SEND_SESSION_REFRESH function
......................................................................
pjsip_session_refresh: Add a test for the PJSIP_SEND_SESSION_REFRESH function
This patch adds a test for the PJSIP_SEND_SESSION_REFRESH dialplan
function. In all cases, the formats on the channel are updated via
PJSIP_MEDIA_OFFER, and then PJSIP_SEND_SESSION_REFRESH is invoked in
some fashion to trigger a session update. The test verifies that the
formats on the channel are updated (or not updated) as expected. This
includes:
- Update the session using a re-INVITE
- Update the session using an UPDATE
- Failure to update the session due to a 488
ASTERISK-26277
Change-Id: Ia3902446f4628ddd52dae1e7b30afd363a902cac
---
A tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/configs/ast1/extensions.conf
A tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/configs/ast1/pjsip.conf
A tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/sipp/uac-reinvite.xml
A tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/sipp/uac-rejected.xml
A tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/sipp/uac-update.xml
A tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/test-config.yaml
M tests/channels/pjsip/dialplan_functions/tests.yaml
7 files changed, 498 insertions(+), 0 deletions(-)
Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Richard Mudgett: Looks good to me, but someone else must approve
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, approved
diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/configs/ast1/extensions.conf b/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/configs/ast1/extensions.conf
new file mode 100644
index 0000000..45e2239
--- /dev/null
+++ b/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/configs/ast1/extensions.conf
@@ -0,0 +1,26 @@
+
+[default]
+
+exten => reinvite,1,NoOp()
+ same => n,Answer()
+ same => n,Set(PJSIP_MEDIA_OFFER(audio)=!all,g722)
+ same => n,Set(PJSIP_SEND_SESSION_REFRESH()=invite)
+ same => n,Wait(2) ; Wait a second or two to let the re-INVITE process
+ same => n,UserEvent(Reinvite, Read: ${CHANNEL(audioreadformat)}, Write: ${CHANNEL(audiowriteformat)}, Native: ${CHANNEL(audionativeformat)})
+ same => n,Hangup()
+
+exten => update,1,NoOp()
+ same => n,Answer()
+ same => n,Set(PJSIP_MEDIA_OFFER(audio)=!all,alaw)
+ same => n,Set(PJSIP_SEND_SESSION_REFRESH()=update)
+ same => n,Wait(2) ; Wait a second or two to let the UPDATE process
+ same => n,UserEvent(Update, Read: ${CHANNEL(audioreadformat)}, Write: ${CHANNEL(audiowriteformat)}, Native: ${CHANNEL(audionativeformat)})
+ same => n,Hangup()
+
+exten => rejected,1,NoOp()
+ same => n,Answer()
+ same => n,Set(PJSIP_MEDIA_OFFER(audio)=!all,g722)
+ same => n,Set(PJSIP_SEND_SESSION_REFRESH()=invite)
+ same => n,Wait(2) ; Wait a second or two to let the re-INVITE get its 488
+ same => n,UserEvent(Rejected, Read: ${CHANNEL(audioreadformat)}, Write: ${CHANNEL(audiowriteformat)}, Native: ${CHANNEL(audionativeformat)})
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/configs/ast1/pjsip.conf b/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..f7b9726
--- /dev/null
+++ b/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/configs/ast1/pjsip.conf
@@ -0,0 +1,29 @@
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1:5061
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw,g722
+
+[aors-template](!)
+type=aor
+
+[identify-template](!)
+type=identify
+
+[alice-identify-ipv4](identify-template)
+endpoint=alice
+match=127.0.0.1:5062
+
+[alice](aors-template)
+contact=sip:127.0.0.1:5062
+
+; alice is the caller
+[alice](endpoint-template)
+aors=alice
+from_user=Alice
diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/sipp/uac-reinvite.xml b/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/sipp/uac-reinvite.xml
new file mode 100644
index 0000000..d00cafc
--- /dev/null
+++ b/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/sipp/uac-reinvite.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic Sipstone UAC">
+ <send retrans="500">
+ <![CDATA[
+
+ INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+ To: sut <sip:[service]@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: 1 INVITE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=user1 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 9 101
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:9 G722/8000
+ a=rtpmap:101 telephone-event/8000
+
+ ]]>
+ </send>
+
+ <recv response="100"
+ optional="true">
+ </recv>
+
+ <recv response="181"
+ optional="true">
+ </recv>
+
+ <recv response="180" optional="true">
+ </recv>
+
+ <recv response="183" optional="true">
+ </recv>
+
+ <recv response="200" rtd="true">
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+ To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 1 ACK
+ Contact: sip:sipp@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv request="INVITE">
+ </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]>
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=user1 53655765 2353687642 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 9 101
+ a=rtpmap:9 G722/8000
+ a=rtpmap:101 telephone-event/8000
+
+ ]]>
+ </send>
+
+ <recv request="ACK">
+ </recv>
+
+ <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]>
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <timewait milliseconds="4000"/>
+
+ <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+ <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/sipp/uac-rejected.xml b/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/sipp/uac-rejected.xml
new file mode 100644
index 0000000..624f54a
--- /dev/null
+++ b/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/sipp/uac-rejected.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic Sipstone UAC">
+ <send retrans="500">
+ <![CDATA[
+
+ INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+ To: sut <sip:[service]@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: 1 INVITE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=user1 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 9 101
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:9 G722/8000
+ a=rtpmap:101 telephone-event/8000
+
+ ]]>
+ </send>
+
+ <recv response="100"
+ optional="true">
+ </recv>
+
+ <recv response="181"
+ optional="true">
+ </recv>
+
+ <recv response="180" optional="true">
+ </recv>
+
+ <recv response="183" optional="true">
+ </recv>
+
+ <recv response="200" rtd="true">
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+ To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 1 ACK
+ Contact: sip:sipp@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv request="INVITE">
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 488 Not Acceptable Here
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv request="ACK">
+ </recv>
+
+ <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]>
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <timewait milliseconds="4000"/>
+
+ <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+ <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/sipp/uac-update.xml b/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/sipp/uac-update.xml
new file mode 100644
index 0000000..e5fc470
--- /dev/null
+++ b/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/sipp/uac-update.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic Sipstone UAC">
+ <send retrans="500">
+ <![CDATA[
+
+ INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+ To: sut <sip:[service]@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: 1 INVITE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=user1 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 1 9 101
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:1 PCMA/8000
+ a=rtpmap:9 G722/16000
+ a=rtpmap:101 telephone-event/8000
+
+ ]]>
+ </send>
+
+ <recv response="100"
+ optional="true">
+ </recv>
+
+ <recv response="181"
+ optional="true">
+ </recv>
+
+ <recv response="180" optional="true">
+ </recv>
+
+ <recv response="183" optional="true">
+ </recv>
+
+ <recv response="200" rtd="true">
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+ To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 1 ACK
+ Contact: sip:sipp@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv request="UPDATE">
+ </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]>
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=user1 53655765 2353687642 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 1 101
+ a=rtpmap:1 PCMA/8000
+ a=rtpmap:101 telephone-event/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]>
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <timewait milliseconds="4000"/>
+
+ <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+ <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/test-config.yaml b/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/test-config.yaml
new file mode 100644
index 0000000..de01724
--- /dev/null
+++ b/tests/channels/pjsip/dialplan_functions/pjsip_session_refresh/test-config.yaml
@@ -0,0 +1,85 @@
+testinfo:
+ summary: 'Test the PJSIP_SESSION_SEND_REFRESH function for PJSIP'
+ description: |
+ This test verifies that the PJSIP_SESSION_SEND_REFRESH function will
+ send a re-INVITE or UPDATE request and that, upon successful completion,
+ will update the channel to whatever formats have changed. If the
+ request fails, the formats on the channel are left unmodified.
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+ modules:
+ -
+ config-section: ami-config
+ typename: 'ami.AMIEventModule'
+
+
+test-object-config:
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': { 'scenario': 'uac-reinvite.xml', '-p': '5062', '-i': '127.0.0.1', '-s': 'reinvite', '-rsa': '127.0.0.1:5061'} }
+ -
+ scenarios:
+ - { 'key-args': { 'scenario': 'uac-update.xml', '-p': '5062', '-i': '127.0.0.1', '-s': 'update', '-rsa': '127.0.0.1:5061'} }
+ -
+ scenarios:
+ - { 'key-args': { 'scenario': 'uac-rejected.xml', '-p': '5062', '-i': '127.0.0.1', '-s': 'rejected', '-rsa': '127.0.0.1:5061'} }
+
+
+ami-config:
+ -
+ id: '0'
+ type: 'headermatch'
+ count: '1'
+ conditions:
+ match:
+ Event: 'UserEvent'
+ UserEvent: 'Reinvite'
+ requirements:
+ match:
+ Read: 'g722'
+ Write: 'g722'
+ Native: '\(g722\)'
+ -
+ id: '0'
+ type: 'headermatch'
+ count: '1'
+ conditions:
+ match:
+ Event: 'UserEvent'
+ UserEvent: 'Update'
+ requirements:
+ match:
+ Read: 'alaw'
+ Write: 'alaw'
+ Native: '\(alaw\)'
+ -
+ id: '0'
+ type: 'headermatch'
+ count: '1'
+ conditions:
+ match:
+ Event: 'UserEvent'
+ UserEvent: 'Rejected'
+ requirements:
+ match:
+ Read: 'ulaw'
+ Write: 'ulaw'
+ Native: '\(ulaw|g722\)'
+
+
+properties:
+ minversion: '13.12.0'
+ dependencies:
+ - python : 'twisted'
+ - python : 'starpy'
+ - asterisk : 'res_pjsip'
+ - asterisk : 'res_pjsip_session'
+ - asterisk : 'chan_pjsip'
+ - asterisk : 'func_channel'
+ - asterisk : 'app_userevent'
+ tags:
+ - pjsip
diff --git a/tests/channels/pjsip/dialplan_functions/tests.yaml b/tests/channels/pjsip/dialplan_functions/tests.yaml
index bdcfa51..038634c 100644
--- a/tests/channels/pjsip/dialplan_functions/tests.yaml
+++ b/tests/channels/pjsip/dialplan_functions/tests.yaml
@@ -4,3 +4,4 @@
- test: 'pjsip_endpoint'
- test: 'pjsip_aor'
- test: 'pjsip_contact'
+ - test: 'pjsip_session_refresh'
--
To view, visit https://gerrit.asterisk.org/3427
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia3902446f4628ddd52dae1e7b30afd363a902cac
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: Richard Mudgett <rmudgett at digium.com>
More information about the asterisk-commits
mailing list