diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_hangup/configs/ast1/extensions.conf b/tests/channels/pjsip/dialplan_functions/pjsip_hangup/configs/ast1/extensions.conf new file mode 100644 index 000000000..de8ba2ad4 --- /dev/null +++ b/tests/channels/pjsip/dialplan_functions/pjsip_hangup/configs/ast1/extensions.conf @@ -0,0 +1,35 @@ +[default] + +exten = expect_437_1,1,NoOp() +same = n,Wait(1) +same = n,Progress() +same = n,Wait(1) +same = n,PJSIPHangup(437) + +exten = expect_437_2,1,NoOp() +same = n,Wait(1) +same = n,Progress() +same = n,Wait(1) +same = n,PJSIPHangup(UNSUPPORTED_CERTIFICATE) + +exten = expect_200,1,NoOp() +same = n,Wait(1) +same = n,Progress() +same = n,Wait(1) +same = n,Answer() +same = n,PJSIPHangup(437) + +exten = expect_603_1,1,NoOp() +same = n,Wait(1) +same = n,Progress() +same = n,Wait(1) +same = n,PJSIPHangup(999) + +exten = expect_603_2,1,NoOp() +same = n,Wait(1) +same = n,Progress() +same = n,Wait(1) +same = n,PJSIPHangup(SOMETHINGOROTHER) + + + diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_hangup/configs/ast1/pjsip.conf b/tests/channels/pjsip/dialplan_functions/pjsip_hangup/configs/ast1/pjsip.conf new file mode 100644 index 000000000..67a24ff8e --- /dev/null +++ b/tests/channels/pjsip/dialplan_functions/pjsip_hangup/configs/ast1/pjsip.conf @@ -0,0 +1,28 @@ +[system] +type=system +timer_t1=100 +timer_b=6400 + +[local] +type=transport +protocol=udp +bind=0.0.0.0 + +[endpoint_t](!) +type=endpoint +context=default +transport=local +direct_media=no +disallow=all +allow=ulaw + +[aor_t](!) +type=aor +max_contacts=1 + +[alice](endpoint_t) +aors=alice + +[alice](aor_t) +contact=sip:alice@127.0.0.1:5061 + diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_hangup/sipp/invite-expects-200-then-bye.xml b/tests/channels/pjsip/dialplan_functions/pjsip_hangup/sipp/invite-expects-200-then-bye.xml new file mode 100644 index 000000000..236599b34 --- /dev/null +++ b/tests/channels/pjsip/dialplan_functions/pjsip_hangup/sipp/invite-expects-200-then-bye.xml @@ -0,0 +1,70 @@ + + + + + + ;tag=[pid]SIPpTag00[call_number] + To: sut + Call-ID: [call_id] + CSeq: 1 INVITE + Contact: sip:sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Test + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=phoneA 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 + ]]> + + + + + + + + + + + + + ;tag=[pid]SIPpTag00[call_number] + To: sut [peer_tag_param] + Call-ID: [call_id] + CSeq: 1 ACK + Contact: sip:sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Test + Content-Length: 0 + ]]> + + + + + + + Allow: INVITE, ACK, MESSAGE, BYE + Content-Lnegth: 0 + ]]> + + + + diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_hangup/sipp/invite-expects-437.xml b/tests/channels/pjsip/dialplan_functions/pjsip_hangup/sipp/invite-expects-437.xml new file mode 100644 index 000000000..eed864dc1 --- /dev/null +++ b/tests/channels/pjsip/dialplan_functions/pjsip_hangup/sipp/invite-expects-437.xml @@ -0,0 +1,53 @@ + + + + + + ;tag=[pid]SIPpTag00[call_number] + To: sut + Call-ID: [call_id] + CSeq: 1 INVITE + Contact: sip:sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Test + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=phoneA 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 + ]]> + + + + + + + + + + + + + ;tag=[pid]SIPpTag00[call_number] + To: sut [peer_tag_param] + Call-ID: [call_id] + CSeq: 1 ACK + Contact: sip:sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Test + Content-Length: 0 + ]]> + + + diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_hangup/sipp/invite-expects-603.xml b/tests/channels/pjsip/dialplan_functions/pjsip_hangup/sipp/invite-expects-603.xml new file mode 100644 index 000000000..dfe2423be --- /dev/null +++ b/tests/channels/pjsip/dialplan_functions/pjsip_hangup/sipp/invite-expects-603.xml @@ -0,0 +1,53 @@ + + + + + + ;tag=[pid]SIPpTag00[call_number] + To: sut + Call-ID: [call_id] + CSeq: 1 INVITE + Contact: sip:sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Test + Content-Type: application/sdp + Content-Length: [len] + + v=0 + o=phoneA 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 + ]]> + + + + + + + + + + + + + ;tag=[pid]SIPpTag00[call_number] + To: sut [peer_tag_param] + Call-ID: [call_id] + CSeq: 1 ACK + Contact: sip:sipp@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Test + Content-Length: 0 + ]]> + + + diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_hangup/test-config.yaml b/tests/channels/pjsip/dialplan_functions/pjsip_hangup/test-config.yaml new file mode 100644 index 000000000..205ad1b53 --- /dev/null +++ b/tests/channels/pjsip/dialplan_functions/pjsip_hangup/test-config.yaml @@ -0,0 +1,47 @@ +testinfo: + summary: 'Tests PJSIPHangup' + description: + 'Checks PJSIPHangup with good parameters (437 and UNSUPPORTED_CERTIFICATE) + which should return 437, and with bad parameters (999 and SOMETHINGOROTHER), + which should return 603. Also test PJSIPHangup after an Answer() which should + be ignored and return a 200, then a BYE.' + +test-modules: + test-object: + config-section: test-object-config + typename: 'sipp.SIPpTestCase' + +test-object-config: + memcheck-delay-stop: 7 + fail-on-any: True + test-iterations: + - + scenarios: + - { 'key-args': { 'scenario':'invite-expects-200-then-bye.xml', '-i':'127.0.0.1', + '-p':'5061', '-s':'alice' }, + 'ordered-args': [ '-bind_local', '-key', 'dest', 'expect_200']} + + - { 'key-args': { 'scenario':'invite-expects-437.xml', '-i':'127.0.0.1', + '-p':'5062', '-s':'alice' }, + 'ordered-args': [ '-bind_local', '-key', 'dest', 'expect_437_1']} + + - { 'key-args': { 'scenario':'invite-expects-437.xml', '-i':'127.0.0.1', + '-p':'5063', '-s':'alice' }, + 'ordered-args': [ '-bind_local', '-key', 'dest', 'expect_437_2']} + + - { 'key-args': { 'scenario':'invite-expects-603.xml', '-i':'127.0.0.1', + '-p':'5064', '-s':'alice' }, + 'ordered-args': [ '-bind_local', '-key', 'dest', 'expect_603_1']} + + - { 'key-args': { 'scenario':'invite-expects-603.xml', '-i':'127.0.0.1', + '-p':'5065', '-s':'alice' }, + 'ordered-args': [ '-bind_local', '-key', 'dest', 'expect_603_2']} + + +properties: + dependencies: + - app : 'sipp' + - asterisk : 'chan_pjsip' + - asterisk : 'res_pjsip' + tags: + - pjsip diff --git a/tests/channels/pjsip/dialplan_functions/tests.yaml b/tests/channels/pjsip/dialplan_functions/tests.yaml index 59821e5e9..95d4cc7d4 100644 --- a/tests/channels/pjsip/dialplan_functions/tests.yaml +++ b/tests/channels/pjsip/dialplan_functions/tests.yaml @@ -10,3 +10,5 @@ tests: - test: 'pjsip_header' - test: 'pjsip_parse_uri' - test: 'pjsip_session_refresh' + - test: 'pjsip_hangup' + \ No newline at end of file