[Asterisk-code-review] channels/pjsip/transport/reuse: Tests for reuse of TCP trans... (testsuite[master])
Jenkins2
asteriskteam at digium.com
Tue Nov 7 08:53:41 CST 2017
Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/6956 )
Change subject: channels/pjsip/transport/reuse: Tests for reuse of TCP transports.
......................................................................
channels/pjsip/transport/reuse: Tests for reuse of TCP transports.
These tests check to see if the TCP transport that was used to register
the endpoint is reused. The tests depend upon the rewrite_contact option
because the REGISTERed contact points to a nonexistent location. If the
transport isn't reused then any SIP request sent by Asterisk will fail and
cause the test to fail.
Change-Id: Id89af15fb3e7a63bd58d6115d923cb30a07d99ae
---
A tests/channels/pjsip/transport/reuse/invite/configs/ast1/extensions.conf
A tests/channels/pjsip/transport/reuse/invite/configs/ast1/pjsip.conf
A tests/channels/pjsip/transport/reuse/invite/sipp/invite.xml
A tests/channels/pjsip/transport/reuse/invite/sipp/register.xml
A tests/channels/pjsip/transport/reuse/invite/test-config.yaml
A tests/channels/pjsip/transport/reuse/notify/configs/ast1/extensions.conf
A tests/channels/pjsip/transport/reuse/notify/configs/ast1/pjsip.conf
A tests/channels/pjsip/transport/reuse/notify/configs/ast1/voicemail.conf
A tests/channels/pjsip/transport/reuse/notify/sipp/initial_notify.xml
A tests/channels/pjsip/transport/reuse/notify/sipp/reg_sub.xml
A tests/channels/pjsip/transport/reuse/notify/test-config.yaml
A tests/channels/pjsip/transport/reuse/options/configs/ast1/pjsip.conf
A tests/channels/pjsip/transport/reuse/options/sipp/options.xml
A tests/channels/pjsip/transport/reuse/options/sipp/register.xml
A tests/channels/pjsip/transport/reuse/options/test-config.yaml
A tests/channels/pjsip/transport/reuse/tests.yaml
M tests/channels/pjsip/transport/tests.yaml
17 files changed, 793 insertions(+), 0 deletions(-)
Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
diff --git a/tests/channels/pjsip/transport/reuse/invite/configs/ast1/extensions.conf b/tests/channels/pjsip/transport/reuse/invite/configs/ast1/extensions.conf
new file mode 100644
index 0000000..950774c
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/invite/configs/ast1/extensions.conf
@@ -0,0 +1,20 @@
+[answered_routine]
+exten = s,1,NoOp()
+same = n,UserEvent(CallAnswered)
+same = n,SoftHangup(${CHANNEL(name)})
+same = n,Return()
+
+[default]
+; Wait for alice to register before we try to call alice.
+exten = registration_wait,1,NoOp()
+same = n(loop),GotoIf($["${DEVICE_STATE(PJSIP/alice)}"="NOT_INUSE"]?registered)
+same = n,Wait(0.25)
+same = n,Goto(loop)
+same = n(registered),Answer()
+same = n,Echo()
+same = n,Hangup()
+
+exten = alice,1,NoOp()
+same = n,Dial(PJSIP/alice,,U(answered_routine))
+same = n,Hangup()
+
diff --git a/tests/channels/pjsip/transport/reuse/invite/configs/ast1/pjsip.conf b/tests/channels/pjsip/transport/reuse/invite/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..cbfd5b7
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/invite/configs/ast1/pjsip.conf
@@ -0,0 +1,24 @@
+[global]
+type=global
+debug=yes
+
+[local-transport-5066]
+type=transport
+bind=127.0.0.1:5066
+protocol=tcp
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=tcp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw
+context=default
+aors=alice
+rewrite_contact=yes
+
+[alice]
+type=aor
+max_contacts=5
diff --git a/tests/channels/pjsip/transport/reuse/invite/sipp/invite.xml b/tests/channels/pjsip/transport/reuse/invite/sipp/invite.xml
new file mode 100644
index 0000000..31f985d
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/invite/sipp/invite.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="UAS Test transport">
+ <recv request="INVITE">
+ <action>
+ <ereg regexp="127.0.0.1:5066;rport" search_in="hdr" header="Via"
+ check_it="true" assign_to="1" />
+ </action>
+ </recv>
+
+ <send retrans="500">
+ <![CDATA[
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:5062;transport=[transport]>
+ 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
+ a=rtpmap:0 PCMU/8000
+ ]]>
+ </send>
+
+ <recv request="ACK">
+ <action>
+ <ereg regexp="127.0.0.1:5066;rport" search_in="hdr" header="Via"
+ check_it="true" assign_to="2" />
+ </action>
+ </recv>
+
+ <recv request="BYE" crlf="true">
+ <action>
+ <ereg regexp="127.0.0.1:5066;rport" search_in="hdr" header="Via"
+ check_it="true" assign_to="3" />
+ </action>
+ </recv>
+
+ <send retrans="500">
+ <![CDATA[
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:5062;transport=[transport]>
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <Reference variables="1,2,3" />
+</scenario>
diff --git a/tests/channels/pjsip/transport/reuse/invite/sipp/register.xml b/tests/channels/pjsip/transport/reuse/invite/sipp/register.xml
new file mode 100644
index 0000000..c1c2d2a
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/invite/sipp/register.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="UAS Test transport">
+ <send>
+ <![CDATA[
+ REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:5062;rport;branch=[branch]
+ From: "[service]" <sip:[service]@[local_ip]:5062>;tag=[pid]SIPpTag00[call_number]
+ To: "[service]" <sip:[service]@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: [cseq] REGISTER
+ Max-Forwards: 70
+ Expires: 60
+ Contact: <sip:[service]@[local_ip]:5062>;transport=[transport]
+ Subject: Transport reuse Test
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv response="200" crlf="true" />
+
+ <pause milliseconds="4000"/>
+
+ <send>
+ <![CDATA[
+ REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:5062;rport;branch=[branch]
+ From: "[service]" <sip:[service]@[local_ip]:5062>;tag=[pid]SIPpTag00[call_number]
+ To: "[service]" <sip:[service]@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: [cseq] REGISTER
+ Max-Forwards: 70
+ Expires: 0
+ Contact: <sip:[service]@[local_ip]:5062>;transport=[transport]
+ Subject: Transport reuse Test
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv response="200" crlf="true" />
+</scenario>
+
diff --git a/tests/channels/pjsip/transport/reuse/invite/test-config.yaml b/tests/channels/pjsip/transport/reuse/invite/test-config.yaml
new file mode 100644
index 0000000..77f4d2c
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/invite/test-config.yaml
@@ -0,0 +1,96 @@
+testinfo:
+ summary: 'Tests reusing transport on INVITE'
+ description: |
+ "Two transports are defined, the first on port 5066 and the other
+ (the default) on 5060. The aor it registers with sends the INVITE.
+ The outgoing call waits for the endpoint to register before placing
+ the call to the endpoint. If the call gets answered then the
+ transport was reused as nothing will be listening for a new transport
+ connection.
+
+ * Send REGISTER
+ * In the out-of-call scenario file, check the INVITE Via
+ specifies 5066 as the port.
+ * Send unREGISTER
+ "
+
+properties:
+ minversion: ['13.18.0', '14.7.0', '15.1.0']
+ dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
+ - sipp :
+ version : 'v3.0'
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'app_echo'
+ - asterisk: 'app_stack'
+ - asterisk: 'app_softhangup'
+ - asterisk: 'app_userevent'
+ - asterisk: 'func_channel'
+ - asterisk: 'res_pjsip'
+ tags:
+ - pjsip
+
+test-modules:
+ test-object:
+ -
+ config-section: sipp-config
+ typename: 'sipp.SIPpTestCase'
+ modules:
+ -
+ config-section: originator-config
+ typename: 'pluggable_modules.Originator'
+ -
+ config-section: 'ami-config'
+ typename: 'ami.AMIEventModule'
+
+sipp-config:
+ reactor-timeout: 15
+ fail-on-any: True
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'register.xml',
+ '-oocsf': 'invite.xml',
+ '-p': '5061', '-s': 'alice', '-t': 't1'},
+ 'target': '127.0.0.1:5066'}
+
+originator-config:
+ trigger: 'ami_connect'
+ ignore-originate-failure: 'no'
+ id: '0'
+ channel: 'Local/registration_wait at default'
+ context: 'default'
+ exten: 'alice'
+ priority: '1'
+ async: 'True'
+
+ami-config:
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'TestEvent'
+ State: 'AOR_CONTACT_ADDED'
+ AOR: 'alice'
+ count: '1'
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'UserEvent'
+ UserEvent: 'CallAnswered'
+ count: '1'
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'TestEvent'
+ State: 'AOR_CONTACT_REMOVED'
+ AOR: 'alice'
+ count: '1'
+
diff --git a/tests/channels/pjsip/transport/reuse/notify/configs/ast1/extensions.conf b/tests/channels/pjsip/transport/reuse/notify/configs/ast1/extensions.conf
new file mode 100644
index 0000000..6f22648
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/notify/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[default]
+exten = 1000,hint,PJSIP/1000
+exten = 1000,1,NoOp()
+same = n,Hangup()
+
diff --git a/tests/channels/pjsip/transport/reuse/notify/configs/ast1/pjsip.conf b/tests/channels/pjsip/transport/reuse/notify/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..cce5c32
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/notify/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[global]
+type=global
+debug=yes
+
+[local-transport-5066]
+type=transport
+bind=127.0.0.1:5066
+protocol=tcp
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=tcp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw
+context=default
+aors=alice
+auth=alice
+mailboxes=1000 at default
+mwi_subscribe_replaces_unsolicited=no
+rewrite_contact=yes
+
+[alice]
+type=aor
+max_contacts=5
+mailboxes=1000e at default
+
+[alice]
+type=auth
+auth_type=userpass
+username=alice
+password=password
diff --git a/tests/channels/pjsip/transport/reuse/notify/configs/ast1/voicemail.conf b/tests/channels/pjsip/transport/reuse/notify/configs/ast1/voicemail.conf
new file mode 100644
index 0000000..253c745
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/notify/configs/ast1/voicemail.conf
@@ -0,0 +1,2 @@
+[default]
+1000 => 4242,Example Mailbox
diff --git a/tests/channels/pjsip/transport/reuse/notify/sipp/initial_notify.xml b/tests/channels/pjsip/transport/reuse/notify/sipp/initial_notify.xml
new file mode 100644
index 0000000..e497c1e
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/notify/sipp/initial_notify.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Out-of-Call NOTIFY after REGISTER">
+ <recv request="NOTIFY">
+ <action>
+ <ereg regexp="127.0.0.1:5066;rport" search_in="hdr" header="Via"
+ assign_to="1" />
+ </action>
+ </recv>
+
+ <!-- ereg 'check_it' doesn't work in an out-of-call scenario file because there's
+ no call to mark as failed so we have to explicitly kill sipp if the regex
+ didn't match. -->
+
+ <nop condexec="1" condexec_inverse="true">
+ <action>
+ <exec int_cmd="stop_now" />
+ </action>
+ </nop>
+
+ <send>
+ <![CDATA[
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:5062;transport=[transport]>
+ Content-Length: 0
+ ]]>
+ </send>
+</scenario>
diff --git a/tests/channels/pjsip/transport/reuse/notify/sipp/reg_sub.xml b/tests/channels/pjsip/transport/reuse/notify/sipp/reg_sub.xml
new file mode 100644
index 0000000..7211e02
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/notify/sipp/reg_sub.xml
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="REGISTER, SUBSCRIBE, unSUBSCRIBE, unREGISTER">
+ <send>
+ <![CDATA[
+ REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:5062;rport;branch=[branch]
+ From: "[service]" <sip:[service]@[local_ip]:5062>;tag=[pid]SIPpTag00[call_number]
+ To: "[service]" <sip:[service]@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: 1 REGISTER
+ Max-Forwards: 70
+ Expires: 60
+ Contact: <sip:[service]@[local_ip]:5062>;transport=[transport]
+ Subject: Performance Test
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv response="401" auth="true" />
+
+ <send>
+ <![CDATA[
+ REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:5062;rport;branch=[branch]
+ From: "[service]" <sip:[service]@[local_ip]:5062>;tag=[pid]SIPpTag00[call_number]
+ To: "[service]" <sip:[service]@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: [cseq] REGISTER
+ Max-Forwards: 70
+ Expires: 60
+ Contact: <sip:[service]@[local_ip]:5062>;transport=[transport]
+ Subject: Performance Test
+ [authentication]
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv response="200" crlf="true" />
+ <pause milliseconds="500" />
+
+ <send retrans="500">
+ <![CDATA[
+ SUBSCRIBE sip:[mbx]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:5062;rport;branch=[branch]
+ From: "[service]" <sip:[service]@[local_ip]:5062>;tag=[pid]SIPpTag00[call_number]
+ To: <sip:[service]@[remote_ip]:[remote_port]>
+ Contact: <sip:[service]@[local_ip]:5062>
+ Call-ID: [call_id]
+ CSeq: [cseq] SUBSCRIBE
+ Max-Forwards: 70
+ Event: presence
+ Expires: 10
+ Supported: replaces, 100rel, timer, norefersub
+ Accept: application/pidf+xml, application/xpidf+xml, application/simple-message-summary
+ Allow-Events: presence, message-summary, refer
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv response="401" auth="true" />
+
+ <send retrans="500">
+ <![CDATA[
+ SUBSCRIBE sip:[mbx]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:5062;rport;branch=[branch]
+ From: "[service]" <sip:[service]@[local_ip]:5062>;tag=[pid]SIPpTag00[call_number]
+ To: <sip:[service]@[remote_ip]:[remote_port]>
+ Contact: <sip:[service]@[local_ip]:5062>
+ Call-ID: [call_id]
+ CSeq: [cseq] SUBSCRIBE
+ Max-Forwards: 70
+ Event: presence
+ Expires: 10
+ Supported: replaces, 100rel, timer, norefersub
+ Accept: application/pidf+xml, application/xpidf+xml, application/simple-message-summary
+ Allow-Events: presence, message-summary, refer
+ [authentication]
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv response="200" crlf="true" />
+
+ <recv request="NOTIFY">
+ <action>
+ <ereg regexp="127.0.0.1:5066;rport" search_in="hdr" header="Via"
+ check_it="true" assign_to="1" />
+ </action>
+ </recv>
+ <Reference variables="1" />
+
+ <send crlf="true">
+ <![CDATA[
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:5062;transport=[transport]>
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <pause milliseconds="500" />
+
+ <send retrans="500">
+ <![CDATA[
+ SUBSCRIBE sip:[mbx]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:5062;rport;branch=[branch]
+ From: "[service]" <sip:[service]@[local_ip]:5062>;tag=[pid]SIPpTag00[call_number]
+ To: <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+ Contact: <sip:[service]@[local_ip]:5062>
+ Call-ID: [call_id]
+ CSeq: [cseq] SUBSCRIBE
+ Max-Forwards: 70
+ Event: presence
+ Expires: 0
+ Supported: replaces, 100rel, timer, norefersub
+ Accept: application/pidf+xml, application/xpidf+xml, application/simple-message-summary
+ Allow-Events: presence, message-summary, refer
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv response="200" />
+
+ <recv request="NOTIFY">
+ <action>
+ <ereg regexp="127.0.0.1:5066;rport" search_in="hdr" header="Via"
+ check_it="true" assign_to="2" />
+ </action>
+ </recv>
+ <Reference variables="2" />
+
+ <send crlf="true">
+ <![CDATA[
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:5062;transport=[transport]>
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <pause milliseconds="1000" />
+
+ <send retrans="500">
+ <![CDATA[
+ REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:5062;rport;branch=[branch]
+ From: "[service]" <sip:[service]@[local_ip]:5062>;tag=[pid]SIPpTag00[call_number]
+ To: "[service]" <sip:[service]@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: [cseq] REGISTER
+ Max-Forwards: 70
+ Expires: 0
+ Contact: <sip:[service]@[local_ip]:5062>;transport=[transport]
+ Subject: Performance Test
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv response="401" auth="true" />
+
+ <send>
+ <![CDATA[
+ REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:5062;rport;branch=[branch]
+ From: "[service]" <sip:[service]@[local_ip]:5062>;tag=[pid]SIPpTag00[call_number]
+ To: "[service]" <sip:[service]@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: [cseq] REGISTER
+ Max-Forwards: 70
+ Expires: 0
+ Contact: <sip:[service]@[local_ip]:5062>;transport=[transport]
+ Subject: Performance Test
+ [authentication]
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv response="200" />
+
+ <pause milliseconds="1000" />
+</scenario>
diff --git a/tests/channels/pjsip/transport/reuse/notify/test-config.yaml b/tests/channels/pjsip/transport/reuse/notify/test-config.yaml
new file mode 100644
index 0000000..797313e
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/notify/test-config.yaml
@@ -0,0 +1,95 @@
+testinfo:
+ summary: 'Tests reusing transport on SUBSCRIBE NOTIFY'
+ description: |
+ "Two transports are defined, the first on port 5066 and the last
+ (the default) on 5060. The endpoint/aor allows MWI subscription
+ and unsolicited MWI.
+ If the NOTIFY messages get answered then the transport was reused as
+ nothing will be listening for a new transport connection.
+
+ * Send REGISTER/auth
+ * In the out-of-call scenario file, check the unsolicited NOTIFY Via
+ specifies 5066 as the port.
+ * Send SUBSCRIBE/auth
+ * check the NOTIFY Via specifies 5066 as the port.
+ * Send unSUBSCRIBE/auth
+ * check the NOTIFY Via specifies 5066 as the port.
+ * Send unREGISTER/auth
+ "
+
+properties:
+ minversion: ['13.18.0', '14.7.0', '15.1.0']
+ dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
+ - sipp :
+ version : 'v3.0'
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_mwi'
+ tags:
+ - pjsip
+
+test-modules:
+ test-object:
+ -
+ config-section: sipp-config
+ typename: 'sipp.SIPpTestCase'
+ modules:
+ -
+ config-section: 'ami-config'
+ typename: 'ami.AMIEventModule'
+
+sipp-config:
+ reactor-timeout: 15
+ fail-on-any: True
+ test-iterations:
+ -
+ #
+ # The only way to test an unsolicited NOTIFY is in an out-of-call
+ # scenario file.
+ #
+ scenarios:
+ - { 'key-args': {'scenario': 'reg_sub.xml',
+ '-oocsf': 'initial_notify.xml',
+ '-p': '5061', '-s': 'alice', '-au': 'alice', '-ap': 'password', '-t': 't1'},
+ 'ordered-args': ['-key', 'mbx', '1000'], 'target': '127.0.0.1:5066'}
+
+ami-config:
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'TestEvent'
+ State: 'AOR_CONTACT_ADDED'
+ AOR: 'alice'
+ count: '1'
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'TestEvent'
+ State: 'SUBSCRIPTION_ESTABLISHED'
+ Resource: '1000'
+ count: '1'
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'TestEvent'
+ State: 'SUBSCRIPTION_TERMINATED'
+ Resource: '1000'
+ count: '1'
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'TestEvent'
+ State: 'AOR_CONTACT_REMOVED'
+ AOR: 'alice'
+ count: '1'
+
diff --git a/tests/channels/pjsip/transport/reuse/options/configs/ast1/pjsip.conf b/tests/channels/pjsip/transport/reuse/options/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..4223d88
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/options/configs/ast1/pjsip.conf
@@ -0,0 +1,26 @@
+[global]
+type=global
+debug=yes
+max_initial_qualify_time=1
+
+[local-transport-5066]
+type=transport
+bind=127.0.0.1:5066
+protocol=tcp
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=tcp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw
+context=default
+aors=alice
+rewrite_contact=yes
+
+[alice]
+type=aor
+max_contacts=5
+qualify_frequency=10
diff --git a/tests/channels/pjsip/transport/reuse/options/sipp/options.xml b/tests/channels/pjsip/transport/reuse/options/sipp/options.xml
new file mode 100644
index 0000000..2a866cd
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/options/sipp/options.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="UAS Test transport">
+ <!-- ereg 'check_it' doesn't work in an out-of-call scenario file because
+ there's no call to mark as failed so we have to explicitly kill sipp if the
+ regex didn't match. -->
+
+ <recv request="OPTIONS">
+ <action>
+ <ereg regexp="127.0.0.1:5066;rport" search_in="hdr" header="Via"
+ check_it="true" assign_to="1" />
+ </action>
+ </recv>
+ <nop condexec="1" condexec_inverse="true">
+ <action>
+ <exec int_cmd="stop_now" />
+ </action>
+ </nop>
+
+ <send>
+ <![CDATA[
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:5062;transport=[transport]>
+ Content-Length: 0
+ ]]>
+ </send>
+</scenario>
diff --git a/tests/channels/pjsip/transport/reuse/options/sipp/register.xml b/tests/channels/pjsip/transport/reuse/options/sipp/register.xml
new file mode 100644
index 0000000..c1c2d2a
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/options/sipp/register.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="UAS Test transport">
+ <send>
+ <![CDATA[
+ REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:5062;rport;branch=[branch]
+ From: "[service]" <sip:[service]@[local_ip]:5062>;tag=[pid]SIPpTag00[call_number]
+ To: "[service]" <sip:[service]@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: [cseq] REGISTER
+ Max-Forwards: 70
+ Expires: 60
+ Contact: <sip:[service]@[local_ip]:5062>;transport=[transport]
+ Subject: Transport reuse Test
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv response="200" crlf="true" />
+
+ <pause milliseconds="4000"/>
+
+ <send>
+ <![CDATA[
+ REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:5062;rport;branch=[branch]
+ From: "[service]" <sip:[service]@[local_ip]:5062>;tag=[pid]SIPpTag00[call_number]
+ To: "[service]" <sip:[service]@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: [cseq] REGISTER
+ Max-Forwards: 70
+ Expires: 0
+ Contact: <sip:[service]@[local_ip]:5062>;transport=[transport]
+ Subject: Transport reuse Test
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv response="200" crlf="true" />
+</scenario>
+
diff --git a/tests/channels/pjsip/transport/reuse/options/test-config.yaml b/tests/channels/pjsip/transport/reuse/options/test-config.yaml
new file mode 100644
index 0000000..284c8d3
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/options/test-config.yaml
@@ -0,0 +1,80 @@
+testinfo:
+ summary: 'Tests reusing transport on OPTIONS'
+ description: |
+ "Two transports are defined, the first on port 5066 and the other
+ (the default) on 5060. The aor it registers with sends the OPTIONS.
+ If the OPTIONS ping gets answered then the transport was reused as
+ nothing will be listening for a new transport connection.
+
+ * Send REGISTER
+ * In the out-of-call scenario file, check the OPTIONS Via
+ specifies 5066 as the port.
+ * Send unREGISTER
+ "
+
+properties:
+ minversion: ['13.18.0', '14.7.0', '15.1.0']
+ dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
+ - sipp :
+ version : 'v3.0'
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'res_pjsip'
+ tags:
+ - pjsip
+
+test-modules:
+ test-object:
+ -
+ config-section: sipp-config
+ typename: 'sipp.SIPpTestCase'
+ modules:
+ -
+ config-section: 'ami-config'
+ typename: 'ami.AMIEventModule'
+
+sipp-config:
+ reactor-timeout: 15
+ fail-on-any: True
+ test-iterations:
+ -
+ #
+ # The only way to test a REGISTER and an OPTIONS is to put the
+ # OPTIONS in an out-of-call scenario file.
+ #
+ scenarios:
+ - { 'key-args': {'scenario': 'register.xml',
+ '-oocsf': 'options.xml',
+ '-p': '5061', '-s': 'alice', '-t': 't1'},
+ 'target': '127.0.0.1:5066'}
+
+ami-config:
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'TestEvent'
+ State: 'AOR_CONTACT_ADDED'
+ AOR: 'alice'
+ count: '1'
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'TestEvent'
+ State: 'AOR_CONTACT_QUALIFY_RESULT'
+ Status: 'Reachable'
+ count: '1'
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'TestEvent'
+ State: 'AOR_CONTACT_REMOVED'
+ AOR: 'alice'
+ count: '1'
+
diff --git a/tests/channels/pjsip/transport/reuse/tests.yaml b/tests/channels/pjsip/transport/reuse/tests.yaml
new file mode 100644
index 0000000..cfda588
--- /dev/null
+++ b/tests/channels/pjsip/transport/reuse/tests.yaml
@@ -0,0 +1,4 @@
+tests:
+ - test: 'invite'
+ - test: 'notify'
+ - test: 'options'
diff --git a/tests/channels/pjsip/transport/tests.yaml b/tests/channels/pjsip/transport/tests.yaml
index 811f55e..1fbc0c8 100644
--- a/tests/channels/pjsip/transport/tests.yaml
+++ b/tests/channels/pjsip/transport/tests.yaml
@@ -1,2 +1,3 @@
tests:
+ - dir: 'reuse'
- dir: 'symmetric'
--
To view, visit https://gerrit.asterisk.org/6956
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id89af15fb3e7a63bd58d6115d923cb30a07d99ae
Gerrit-Change-Number: 6956
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171107/1018d2d3/attachment-0001.html>
More information about the asterisk-code-review
mailing list