Matt Jordan has submitted this change and it was merged. Change subject: PJSIP: Added test to ensure retransmissions are not handled twice. ......................................................................
PJSIP: Added test to ensure retransmissions are not handled twice. In this test, a SIPp scenario sends the exact same MESSAGE request to Asterisk twice. The test ensures that the dialplan is only called into a single time. Without the patch from https://reviewboard.asterisk.org/r/4532/ , this test fails because the UserEvent in the dialplan is sent twice. With that patch, this test succeeds. ASTERSIK-24920 Reported by Mark Michelson Change-Id: I524a3eb1cde4489d0ff9866913ae1be318c72115 --- A tests/channels/pjsip/message/message_retrans/configs/ast1/extensions.conf A tests/channels/pjsip/message/message_retrans/configs/ast1/pjsip.conf A tests/channels/pjsip/message/message_retrans/sipp/message_retrans.xml A tests/channels/pjsip/message/message_retrans/test-config.yaml M tests/channels/pjsip/message/tests.yaml 5 files changed, 94 insertions(+), 0 deletions(-) Approvals: Matt Jordan: Looks good to me, approved; Verified diff --git a/tests/channels/pjsip/message/message_retrans/configs/ast1/extensions.conf b/tests/channels/pjsip/message/message_retrans/configs/ast1/extensions.conf new file mode 100644 index 0000000..b5b6eec --- /dev/null +++ b/tests/channels/pjsip/message/message_retrans/configs/ast1/extensions.conf @@ -0,0 +1,3 @@ +[default] +exten => test,1,NoOp() +same => n,UserEvent(MessageHandled) diff --git a/tests/channels/pjsip/message/message_retrans/configs/ast1/pjsip.conf b/tests/channels/pjsip/message/message_retrans/configs/ast1/pjsip.conf new file mode 100644 index 0000000..5f335b2 --- /dev/null +++ b/tests/channels/pjsip/message/message_retrans/configs/ast1/pjsip.conf @@ -0,0 +1,8 @@ +[main-transport] +type = transport +bind = 127.0.0.1:5060 +protocol = udp + +[sipp] +type = endpoint +context = default diff --git a/tests/channels/pjsip/message/message_retrans/sipp/message_retrans.xml b/tests/channels/pjsip/message/message_retrans/sipp/message_retrans.xml new file mode 100644 index 0000000..af12f97 --- /dev/null +++ b/tests/channels/pjsip/message/message_retrans/sipp/message_retrans.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> + +<scenario name="Basic MESSAGE send and receive"> + <send> + <![CDATA[ + + MESSAGE sip:test@[remote_ip]:[remote_port] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=z9hG4bK-24096-1-0 + From: user <sip:sipp@[local_ip]:[local_port]>;tag=1 + To: <sip:test@[remote_ip]:[remote_port]> + Call-ID: 1234567890 + CSeq: 1 MESSAGE + Max-Forwards: 70 + Expires: 3600 + Content-Type: text/plain + Content-Length: 18 + + Watson, come here. + + ]]> + </send> + + <send> + <![CDATA[ + + MESSAGE sip:test@[remote_ip]:[remote_port] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=z9hG4bK-24096-1-0 + From: user <sip:sipp@[local_ip]:[local_port]>;tag=1 + To: <sip:test@[remote_ip]:[remote_port]> + Call-ID: 1234567890 + CSeq: 1 MESSAGE + Max-Forwards: 70 + Expires: 3600 + Content-Type: text/plain + Content-Length: 18 + + Watson, come here. + + ]]> + </send> + +</scenario> diff --git a/tests/channels/pjsip/message/message_retrans/test-config.yaml b/tests/channels/pjsip/message/message_retrans/test-config.yaml new file mode 100644 index 0000000..e1015af --- /dev/null +++ b/tests/channels/pjsip/message/message_retrans/test-config.yaml @@ -0,0 +1,40 @@ +testinfo: + summary: 'Test that Asterisk does not handle MESSAGE retransmissions' + description: | + 'A SIPp scenario sends the same SIP MESSAGE request twice. The test ensures that + Asterisk only attempts to process one of them. If both MESSAGEs reach the dialplan, + the test fails.' + +properties: + minversion: '13.4.0' + dependencies: + - app: 'sipp' + - asterisk: 'res_pjsip' + - asterisk: 'res_pjsip_messaging' + tags: + - pjsip + +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': 'message_retrans.xml', '-p': '5061' } } + +ami-config: + - + type: 'headermatch' + conditions: + match: + Event: 'UserEvent' + UserEvent: 'MessageHandled' + count: '1' diff --git a/tests/channels/pjsip/message/tests.yaml b/tests/channels/pjsip/message/tests.yaml index de6741a..faf4e86 100644 --- a/tests/channels/pjsip/message/tests.yaml +++ b/tests/channels/pjsip/message/tests.yaml @@ -7,3 +7,4 @@ - test: 'message_cust_hdr' - test: 'message_in_dialog' - test: 'message_send_ami' + - test: 'message_retrans' -- To view, visit https://gerrit.asterisk.org/14 To unsubscribe, visit https://gerrit.asterisk.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I524a3eb1cde4489d0ff9866913ae1be318c72115 Gerrit-PatchSet: 3 Gerrit-Project: testsuite Gerrit-Branch: master Gerrit-Owner: Mark Michelson <mmichel...@digium.com> Gerrit-Reviewer: Mark Michelson <mmichel...@digium.com> Gerrit-Reviewer: Matt Jordan <mjor...@digium.com> -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev