[asterisk-commits] publish: Add tests for publishing of extension state. (testsuite[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon May 23 16:42:14 CDT 2016
Anonymous Coward #1000019 has submitted this change and it was merged.
Change subject: publish: Add tests for publishing of extension state.
......................................................................
publish: Add tests for publishing of extension state.
This adds three tests: one for application/pidf+xml, one
for application/xpidf+xml and one for application/dialog-info+xml.
These tests are written to publish extension state to another
server and to enact device state changes which would result
in extension state changes. A SIPp scenario for each type
is written which examines the body and confirms it is
what it should be for each extension state change.
ASTERISK-26027 #close
Change-Id: I82325628ba96914f148a3697ae9bf3875ea8ef55
---
A tests/channels/pjsip/publish/dialog_info_xml/configs/ast1/extensions.conf
A tests/channels/pjsip/publish/dialog_info_xml/configs/ast1/pjsip.conf
A tests/channels/pjsip/publish/dialog_info_xml/sipp/publish.xml
A tests/channels/pjsip/publish/dialog_info_xml/test-config.yaml
A tests/channels/pjsip/publish/presence_pidf/configs/ast1/extensions.conf
A tests/channels/pjsip/publish/presence_pidf/configs/ast1/pjsip.conf
A tests/channels/pjsip/publish/presence_pidf/sipp/publish.xml
A tests/channels/pjsip/publish/presence_pidf/test-config.yaml
A tests/channels/pjsip/publish/presence_xpidf/configs/ast1/extensions.conf
A tests/channels/pjsip/publish/presence_xpidf/configs/ast1/pjsip.conf
A tests/channels/pjsip/publish/presence_xpidf/sipp/publish.xml
A tests/channels/pjsip/publish/presence_xpidf/test-config.yaml
M tests/channels/pjsip/publish/tests.yaml
13 files changed, 705 insertions(+), 0 deletions(-)
Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Anonymous Coward #1000019: Verified
Matthew Fredrickson: Looks good to me, approved
diff --git a/tests/channels/pjsip/publish/dialog_info_xml/configs/ast1/extensions.conf b/tests/channels/pjsip/publish/dialog_info_xml/configs/ast1/extensions.conf
new file mode 100644
index 0000000..5354079
--- /dev/null
+++ b/tests/channels/pjsip/publish/dialog_info_xml/configs/ast1/extensions.conf
@@ -0,0 +1,11 @@
+[default]
+exten => presence,hint,Custom:presence
+
+exten => change_state,1,Set(DEVICE_STATE(Custom:presence)=NOT_INUSE)
+ same => n,Set(DEVICE_STATE(Custom:presence)=RINGING)
+ same => n,Set(DEVICE_STATE(Custom:presence)=INUSE)
+ same => n,Set(DEVICE_STATE(Custom:presence)=ONHOLD)
+
+exten => dummy,1,Answer
+ same => n,Echo
+
diff --git a/tests/channels/pjsip/publish/dialog_info_xml/configs/ast1/pjsip.conf b/tests/channels/pjsip/publish/dialog_info_xml/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..417b927
--- /dev/null
+++ b/tests/channels/pjsip/publish/dialog_info_xml/configs/ast1/pjsip.conf
@@ -0,0 +1,11 @@
+[main-transport]
+type=transport
+bind=127.0.0.1:5060
+
+[ast2]
+type=outbound-publish
+server_uri=sip:127.0.0.1:5061
+event=dialog
+multi_user=yes
+ at body=application/dialog-info+xml
+ at exten=^presence
diff --git a/tests/channels/pjsip/publish/dialog_info_xml/sipp/publish.xml b/tests/channels/pjsip/publish/dialog_info_xml/sipp/publish.xml
new file mode 100644
index 0000000..e3d90db
--- /dev/null
+++ b/tests/channels/pjsip/publish/dialog_info_xml/sipp/publish.xml
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="PUBLISH">
+ <recv request="PUBLISH" crlf="true">
+ <action>
+ <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
+<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"0\" state=\"full\" entity=\"sip:presence at 127.0.0.1:5061\">
+ <dialog id=\"presence\">
+ <state>terminated</state>
+ </dialog>
+</dialog-info>" check_it="true" search_in="body" assign_to="presence1" />
+ </action>
+ </recv>
+
+ <Reference variables="presence1" />
+
+ <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>
+
+ <recv request="PUBLISH" crlf="true">
+ <action>
+ <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
+<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"1\" state=\"full\" entity=\"sip:presence at 127.0.0.1:5061\">
+ <dialog id=\"presence\">
+ <state>terminated</state>
+ </dialog>
+</dialog-info>" check_it="true" search_in="body" assign_to="presence2" />
+ </action>
+ </recv>
+
+ <Reference variables="presence2" />
+
+ <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>
+
+ <recv request="PUBLISH" crlf="true">
+ <action>
+ <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
+<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"2\" state=\"full\" entity=\"sip:presence at 127.0.0.1:5061\">
+ <dialog id=\"presence\" direction=\"recipient\">
+ <state>early</state>
+ </dialog>
+</dialog-info>" check_it="true" search_in="body" assign_to="presence3" />
+ </action>
+ </recv>
+
+ <Reference variables="presence3" />
+
+ <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>
+
+ <recv request="PUBLISH" crlf="true">
+ <action>
+ <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
+<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"3\" state=\"full\" entity=\"sip:presence at 127.0.0.1:5061\">
+ <dialog id=\"presence\">
+ <state>confirmed</state>
+ </dialog>
+</dialog-info>" check_it="true" search_in="body" assign_to="presence4" />
+ </action>
+ </recv>
+
+ <Reference variables="presence4" />
+
+ <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>
+
+ <recv request="PUBLISH" crlf="true">
+ <action>
+ <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
+<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"4\" state=\"full\" entity=\"sip:presence at 127.0.0.1:5061\">
+ <dialog id=\"presence\">
+ <state>confirmed</state>
+ <local>
+ <target uri=\"sip:presence at 127.0.0.1:5061\">
+ <param pname=\"\+sip.rendering\" pvalue=\"no\" />
+ </target>
+ </local>
+ </dialog>
+</dialog-info>" check_it="true" search_in="body" assign_to="presence5" />
+ </action>
+ </recv>
+
+ <Reference variables="presence5" />
+
+ <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>
+
+</scenario>
diff --git a/tests/channels/pjsip/publish/dialog_info_xml/test-config.yaml b/tests/channels/pjsip/publish/dialog_info_xml/test-config.yaml
new file mode 100644
index 0000000..92b06a9
--- /dev/null
+++ b/tests/channels/pjsip/publish/dialog_info_xml/test-config.yaml
@@ -0,0 +1,45 @@
+testinfo:
+ summary: 'Ensure that outgoing application/pidf+xml PUBLISH messages are sent.'
+ description: |
+ 'A single Asterisk instance is started and is configured to PUBLISH messages to
+ a SIPp scenario using application/pidf+xml. Device state changes are queued up.
+ If the PUBLISH messages are not received by the SIPp scenario then the test fails.'
+
+properties:
+ minversion: '14.0.0'
+ dependencies:
+ - sipp :
+ version : 'v3.0'
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_outbound_publish'
+ - asterisk: 'res_pjsip_exten_state'
+ tags:
+ - pjsip
+
+test-modules:
+ test-object:
+ config-section: sipp-config
+ typename: 'sipp.SIPpTestCase'
+ modules:
+ -
+ config-section: originator
+ typename: 'pluggable_modules.Originator'
+
+sipp-config:
+ reactor-timeout: 30
+ fail-on-any: True
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'publish.xml', '-p': '5061'} }
+
+originator:
+ trigger: 'ami_connect'
+ id: '0'
+ channel: 'Local/change_state at default'
+ context: 'default'
+ exten: 'dummy'
+ priority: '1'
+ async: 'True'
diff --git a/tests/channels/pjsip/publish/presence_pidf/configs/ast1/extensions.conf b/tests/channels/pjsip/publish/presence_pidf/configs/ast1/extensions.conf
new file mode 100644
index 0000000..5354079
--- /dev/null
+++ b/tests/channels/pjsip/publish/presence_pidf/configs/ast1/extensions.conf
@@ -0,0 +1,11 @@
+[default]
+exten => presence,hint,Custom:presence
+
+exten => change_state,1,Set(DEVICE_STATE(Custom:presence)=NOT_INUSE)
+ same => n,Set(DEVICE_STATE(Custom:presence)=RINGING)
+ same => n,Set(DEVICE_STATE(Custom:presence)=INUSE)
+ same => n,Set(DEVICE_STATE(Custom:presence)=ONHOLD)
+
+exten => dummy,1,Answer
+ same => n,Echo
+
diff --git a/tests/channels/pjsip/publish/presence_pidf/configs/ast1/pjsip.conf b/tests/channels/pjsip/publish/presence_pidf/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..f453bbf
--- /dev/null
+++ b/tests/channels/pjsip/publish/presence_pidf/configs/ast1/pjsip.conf
@@ -0,0 +1,11 @@
+[main-transport]
+type=transport
+bind=127.0.0.1:5060
+
+[ast2]
+type=outbound-publish
+server_uri=sip:127.0.0.1:5061
+event=presence
+multi_user=yes
+ at body=application/pidf+xml
+ at exten=^presence
diff --git a/tests/channels/pjsip/publish/presence_pidf/sipp/publish.xml b/tests/channels/pjsip/publish/presence_pidf/sipp/publish.xml
new file mode 100644
index 0000000..84b34e9
--- /dev/null
+++ b/tests/channels/pjsip/publish/presence_pidf/sipp/publish.xml
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="PUBLISH">
+ <recv request="PUBLISH" crlf="true">
+ <action>
+ <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
+<presence entity=\"sip:presence at 127.0.0.1:5061\" xmlns=\"urn:ietf:params:xml:ns:pidf\" xmlns:pp=\"urn:ietf:params:xml:ns:pidf:person\" xmlns:es=\"urn:ietf:params:xml:ns:pidf:rpid:status:rpid-status\" xmlns:ep=\"urn:ietf:params:xml:ns:pidf:rpid:rpid-person\">
+ <note>Ready</note>
+ <tuple id=\"presence\">
+ <status>
+ <basic>open</basic>
+ </status>
+ <contact priority=\"1\">sip:presence at 127.0.0.1:5061</contact>
+ </tuple>
+ <pp:person>
+ <status />
+ </pp:person>
+</presence>" check_it="true" search_in="body" assign_to="presence1" />
+ </action>
+ </recv>
+
+ <Reference variables="presence1" />
+
+ <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>
+
+ <recv request="PUBLISH" crlf="true">
+ <action>
+ <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
+<presence entity=\"sip:presence at 127.0.0.1:5061\" xmlns=\"urn:ietf:params:xml:ns:pidf\" xmlns:pp=\"urn:ietf:params:xml:ns:pidf:person\" xmlns:es=\"urn:ietf:params:xml:ns:pidf:rpid:status:rpid-status\" xmlns:ep=\"urn:ietf:params:xml:ns:pidf:rpid:rpid-person\">
+ <note>Ready</note>
+ <tuple id=\"presence\">
+ <status>
+ <basic>open</basic>
+ </status>
+ <contact priority=\"1\">sip:presence at 127.0.0.1:5061</contact>
+ </tuple>
+ <pp:person>
+ <status />
+ </pp:person>
+</presence>" check_it="true" search_in="body" assign_to="presence2" />
+ </action>
+ </recv>
+
+ <Reference variables="presence2" />
+
+ <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>
+
+ <recv request="PUBLISH" crlf="true">
+ <action>
+ <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
+<presence entity=\"sip:presence at 127.0.0.1:5061\" xmlns=\"urn:ietf:params:xml:ns:pidf\" xmlns:pp=\"urn:ietf:params:xml:ns:pidf:person\" xmlns:es=\"urn:ietf:params:xml:ns:pidf:rpid:status:rpid-status\" xmlns:ep=\"urn:ietf:params:xml:ns:pidf:rpid:rpid-person\">
+ <note>Ringing</note>
+ <tuple id=\"presence\">
+ <status>
+ <basic>closed</basic>
+ </status>
+ <contact priority=\"1\">sip:presence at 127.0.0.1:5061</contact>
+ </tuple>
+ <pp:person>
+ <status>
+ <ep:activities>ep:busy</ep:activities>
+ </status>
+ </pp:person>
+</presence>" check_it="true" search_in="body" assign_to="presence3" />
+ </action>
+ </recv>
+
+ <Reference variables="presence3" />
+
+ <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>
+
+ <recv request="PUBLISH" crlf="true">
+ <action>
+ <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
+<presence entity=\"sip:presence at 127.0.0.1:5061\" xmlns=\"urn:ietf:params:xml:ns:pidf\" xmlns:pp=\"urn:ietf:params:xml:ns:pidf:person\" xmlns:es=\"urn:ietf:params:xml:ns:pidf:rpid:status:rpid-status\" xmlns:ep=\"urn:ietf:params:xml:ns:pidf:rpid:rpid-person\">
+ <note>On the phone</note>
+ <tuple id=\"presence\">
+ <status>
+ <basic>closed</basic>
+ </status>
+ <contact priority=\"1\">sip:presence at 127.0.0.1:5061</contact>
+ </tuple>
+ <pp:person>
+ <status>
+ <ep:activities>ep:busy</ep:activities>
+ </status>
+ </pp:person>
+</presence>" check_it="true" search_in="body" assign_to="presence4" />
+ </action>
+ </recv>
+
+ <Reference variables="presence4" />
+
+ <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>
+
+ <recv request="PUBLISH" crlf="true">
+ <action>
+ <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
+<presence entity=\"sip:presence at 127.0.0.1:5061\" xmlns=\"urn:ietf:params:xml:ns:pidf\" xmlns:pp=\"urn:ietf:params:xml:ns:pidf:person\" xmlns:es=\"urn:ietf:params:xml:ns:pidf:rpid:status:rpid-status\" xmlns:ep=\"urn:ietf:params:xml:ns:pidf:rpid:rpid-person\">
+ <note>On hold</note>
+ <tuple id=\"presence\">
+ <status>
+ <basic>closed</basic>
+ </status>
+ <contact priority=\"1\">sip:presence at 127.0.0.1:5061</contact>
+ </tuple>
+ <pp:person>
+ <status>
+ <ep:activities>ep:busy</ep:activities>
+ </status>
+ </pp:person>
+</presence>" check_it="true" search_in="body" assign_to="presence5" />
+ </action>
+ </recv>
+
+ <Reference variables="presence5" />
+
+ <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>
+
+</scenario>
diff --git a/tests/channels/pjsip/publish/presence_pidf/test-config.yaml b/tests/channels/pjsip/publish/presence_pidf/test-config.yaml
new file mode 100644
index 0000000..92b06a9
--- /dev/null
+++ b/tests/channels/pjsip/publish/presence_pidf/test-config.yaml
@@ -0,0 +1,45 @@
+testinfo:
+ summary: 'Ensure that outgoing application/pidf+xml PUBLISH messages are sent.'
+ description: |
+ 'A single Asterisk instance is started and is configured to PUBLISH messages to
+ a SIPp scenario using application/pidf+xml. Device state changes are queued up.
+ If the PUBLISH messages are not received by the SIPp scenario then the test fails.'
+
+properties:
+ minversion: '14.0.0'
+ dependencies:
+ - sipp :
+ version : 'v3.0'
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_outbound_publish'
+ - asterisk: 'res_pjsip_exten_state'
+ tags:
+ - pjsip
+
+test-modules:
+ test-object:
+ config-section: sipp-config
+ typename: 'sipp.SIPpTestCase'
+ modules:
+ -
+ config-section: originator
+ typename: 'pluggable_modules.Originator'
+
+sipp-config:
+ reactor-timeout: 30
+ fail-on-any: True
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'publish.xml', '-p': '5061'} }
+
+originator:
+ trigger: 'ami_connect'
+ id: '0'
+ channel: 'Local/change_state at default'
+ context: 'default'
+ exten: 'dummy'
+ priority: '1'
+ async: 'True'
diff --git a/tests/channels/pjsip/publish/presence_xpidf/configs/ast1/extensions.conf b/tests/channels/pjsip/publish/presence_xpidf/configs/ast1/extensions.conf
new file mode 100644
index 0000000..5354079
--- /dev/null
+++ b/tests/channels/pjsip/publish/presence_xpidf/configs/ast1/extensions.conf
@@ -0,0 +1,11 @@
+[default]
+exten => presence,hint,Custom:presence
+
+exten => change_state,1,Set(DEVICE_STATE(Custom:presence)=NOT_INUSE)
+ same => n,Set(DEVICE_STATE(Custom:presence)=RINGING)
+ same => n,Set(DEVICE_STATE(Custom:presence)=INUSE)
+ same => n,Set(DEVICE_STATE(Custom:presence)=ONHOLD)
+
+exten => dummy,1,Answer
+ same => n,Echo
+
diff --git a/tests/channels/pjsip/publish/presence_xpidf/configs/ast1/pjsip.conf b/tests/channels/pjsip/publish/presence_xpidf/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..0898b2d
--- /dev/null
+++ b/tests/channels/pjsip/publish/presence_xpidf/configs/ast1/pjsip.conf
@@ -0,0 +1,11 @@
+[main-transport]
+type=transport
+bind=127.0.0.1:5060
+
+[ast2]
+type=outbound-publish
+server_uri=sip:127.0.0.1:5061
+event=presence
+multi_user=yes
+ at body=application/xpidf+xml
+ at exten=^presence
diff --git a/tests/channels/pjsip/publish/presence_xpidf/sipp/publish.xml b/tests/channels/pjsip/publish/presence_xpidf/sipp/publish.xml
new file mode 100644
index 0000000..07cf6c4
--- /dev/null
+++ b/tests/channels/pjsip/publish/presence_xpidf/sipp/publish.xml
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="PUBLISH">
+ <recv request="PUBLISH" crlf="true">
+ <action>
+ <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
+<presence>
+ <presentity uri=\"sip:presence at 127.0.0.1:5061;method=SUBSCRIBE\" />
+ <atom atomid=(.*?) id=\"presence\">
+ <address uri=\"sip:presence at 127.0.0.1:5061;user=ip\" priority=\"0.80000\">
+ <status status=\"open\" />
+ <msnsubstatus substatus=\"online\" />
+ </address>
+ </atom>
+</presence>" check_it="true" search_in="body" assign_to="presence1" />
+ </action>
+ </recv>
+
+ <Reference variables="presence1" />
+
+ <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>
+
+ <recv request="PUBLISH" crlf="true">
+ <action>
+ <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
+<presence>
+ <presentity uri=\"sip:presence at 127.0.0.1:5061;method=SUBSCRIBE\" />
+ <atom atomid=(.*?) id=\"presence\">
+ <address uri=\"sip:presence at 127.0.0.1:5061;user=ip\" priority=\"0.80000\">
+ <status status=\"open\" />
+ <msnsubstatus substatus=\"online\" />
+ </address>
+ </atom>
+</presence>" check_it="true" search_in="body" assign_to="presence2" />
+ </action>
+ </recv>
+
+ <Reference variables="presence2" />
+
+ <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>
+
+ <recv request="PUBLISH" crlf="true">
+ <action>
+ <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
+<presence>
+ <presentity uri=\"sip:presence at 127.0.0.1:5061;method=SUBSCRIBE\" />
+ <atom atomid=(.*?) id=\"presence\">
+ <address uri=\"sip:presence at 127.0.0.1:5061;user=ip\" priority=\"0.80000\">
+ <status status=\"inuse\" />
+ <msnsubstatus substatus=\"onthephone\" />
+ </address>
+ </atom>
+</presence>" check_it="true" search_in="body" assign_to="presence3" />
+ </action>
+ </recv>
+
+ <Reference variables="presence3" />
+
+ <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>
+
+ <recv request="PUBLISH" crlf="true">
+ <action>
+ <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
+<presence>
+ <presentity uri=\"sip:presence at 127.0.0.1:5061;method=SUBSCRIBE\" />
+ <atom atomid=(.*?) id=\"presence\">
+ <address uri=\"sip:presence at 127.0.0.1:5061;user=ip\" priority=\"0.80000\">
+ <status status=\"inuse\" />
+ <msnsubstatus substatus=\"onthephone\" />
+ </address>
+ </atom>
+</presence>" check_it="true" search_in="body" assign_to="presence4" />
+ </action>
+ </recv>
+
+ <Reference variables="presence4" />
+
+ <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>
+
+ <recv request="PUBLISH" crlf="true">
+ <action>
+ <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
+<presence>
+ <presentity uri=\"sip:presence at 127.0.0.1:5061;method=SUBSCRIBE\" />
+ <atom atomid=(.*?) id=\"presence\">
+ <address uri=\"sip:presence at 127.0.0.1:5061;user=ip\" priority=\"0.80000\">
+ <status status=\"closed\" />
+ <msnsubstatus substatus=\"offline\" />
+ </address>
+ </atom>
+</presence>" check_it="true" search_in="body" assign_to="presence5" />
+ </action>
+ </recv>
+
+ <Reference variables="presence5" />
+
+ <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>
+
+</scenario>
diff --git a/tests/channels/pjsip/publish/presence_xpidf/test-config.yaml b/tests/channels/pjsip/publish/presence_xpidf/test-config.yaml
new file mode 100644
index 0000000..493f09a
--- /dev/null
+++ b/tests/channels/pjsip/publish/presence_xpidf/test-config.yaml
@@ -0,0 +1,45 @@
+testinfo:
+ summary: 'Ensure that outgoing application/xpidf+xml PUBLISH messages are sent.'
+ description: |
+ 'A single Asterisk instance is started and is configured to PUBLISH messages to
+ a SIPp scenario using application/xpidf+xml. Device state changes are queued up.
+ If the PUBLISH messages are not received by the SIPp scenario then the test fails.'
+
+properties:
+ minversion: '14.0.0'
+ dependencies:
+ - sipp :
+ version : 'v3.0'
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_outbound_publish'
+ - asterisk: 'res_pjsip_exten_state'
+ tags:
+ - pjsip
+
+test-modules:
+ test-object:
+ config-section: sipp-config
+ typename: 'sipp.SIPpTestCase'
+ modules:
+ -
+ config-section: originator
+ typename: 'pluggable_modules.Originator'
+
+sipp-config:
+ reactor-timeout: 30
+ fail-on-any: True
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'publish.xml', '-p': '5061'} }
+
+originator:
+ trigger: 'ami_connect'
+ id: '0'
+ channel: 'Local/change_state at default'
+ context: 'default'
+ exten: 'dummy'
+ priority: '1'
+ async: 'True'
diff --git a/tests/channels/pjsip/publish/tests.yaml b/tests/channels/pjsip/publish/tests.yaml
index e1a7782..f1a0161 100644
--- a/tests/channels/pjsip/publish/tests.yaml
+++ b/tests/channels/pjsip/publish/tests.yaml
@@ -2,3 +2,6 @@
tests:
- test: 'asterisk_event_devicestate'
- test: 'asterisk_event_mwi'
+ - test: 'presence_pidf'
+ - test: 'presence_xpidf'
+ - test: 'dialog_info_xml'
--
To view, visit https://gerrit.asterisk.org/2851
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I82325628ba96914f148a3697ae9bf3875ea8ef55
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
More information about the asterisk-commits
mailing list