Skip to content

Commit 0631c83

Browse files
gtjosephgithub-actions[bot]
authored andcommitted
pjsip/stir_shaken: Add test for invalid or missing callerid.
1 parent 6715e8a commit 0631c83

File tree

10 files changed

+208
-0
lines changed

10 files changed

+208
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[default]
2+
exten => _X.,1,Answer()
3+
same => n,UserEvent(TestResult, result: ${STIR_SHAKEN(0,verify_result)})
4+
same => n,Hangup()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[system]
2+
type=system
3+
timer_t1=100
4+
timer_b=6400
5+
6+
[transport-udp]
7+
type=transport
8+
protocol=udp
9+
bind=127.0.0.1:5060
10+
11+
[sipp]
12+
type=endpoint
13+
context=default
14+
allow=!all,ulaw
15+
send_pai = yes
16+
direct_media = no
17+
connected_line_method = update
18+
send_connected_line = no
19+
send_diversion = no
20+
trust_id_inbound = true
21+
trust_id_outbound = true
22+
identify_by = ip
23+
stir_shaken_profile=from-sipp
24+
25+
[sipp]
26+
type = identify
27+
endpoint=sipp
28+
match=127.0.0.4
29+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
[verification]
3+
load_system_certs = no
4+
ca_file=<<astetcdir>>/stir/astdev-ca.crt
5+
curl_timeout=2
6+
max_iat_age=60
7+
max_date_header_age=60
8+
max_cache_entry_age = 300
9+
max_cache_size=666
10+
failure_action = continue
11+
x5u_deny=0.0.0.0/0.0.0.0
12+
x5u_permit = 127.0.0.0/8
13+
relax_x5u_path_restrictions = yes
14+
relax_x5u_port_scheme_restrictions = yes
15+
16+
[attestation]
17+
global_disable = no
18+
check_tn_cert_public_url = no
19+
20+
[from-sipp]
21+
type = profile
22+
endpoint_behavior = verify
23+
failure_action = continue_return_reason
24+
send_mky = no
25+
use_rfc9410_responses = no
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../keys/SPAST1/SPAST1-cert.pem
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../keys/SPAST1/SPAST1-key.pem
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../keys/astdev-ca.crt

Diff for: tests/channels/pjsip/stir_shaken/stir_shaken_anon_callerid/files/ast1/astvarlibdir/keys/stir_shaken/cache/.gitkeep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="ISO-8859-1" ?>
2+
<!DOCTYPE scenario SYSTEM "sipp.dtd">
3+
<scenario name="INVITE to echo with SDP in initial INVITE">
4+
5+
<send retrans="0">
6+
<![CDATA[
7+
8+
INVITE sip:[dest]@[remote_ip]:[remote_port] SIP/2.0
9+
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
10+
From: <sip:[email protected]:[local_port]>;tag=[call_number]
11+
To: <sip:[dest]@[remote_ip]:[remote_port]>
12+
Call-ID: [call_id]
13+
CSeq: 1 INVITE
14+
Max-Forwards: 70
15+
Contact: <sip:[service]@[local_ip]:[local_port]>
16+
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, PRACK, REGISTER, REFER, MESSAGE
17+
User-Agent: Test
18+
Content-Type: application/sdp
19+
Content-Length: [len]
20+
21+
v=0
22+
o=- 20110306451 20110306451 IN IP[media_ip_type] [media_ip]
23+
s=-
24+
c=IN IP[media_ip_type] [media_ip]
25+
t=0 0
26+
m=audio [media_port] RTP/AVP 18 0 8 101
27+
a=rtpmap:0 PCMU/8000
28+
a=rtpmap:8 PCMA/8000
29+
a=rtpmap:101 telephone-event/8000
30+
a=fmtp:18 annexb=no
31+
a=fmtp:101 0-16
32+
a=ptime:20
33+
a=sendrecv
34+
]]>
35+
</send>
36+
37+
<recv response="100"
38+
optional="true">
39+
</recv>
40+
41+
<recv response="180"
42+
optional="true">
43+
</recv>
44+
45+
<recv response="183"
46+
optional="true">
47+
</recv>
48+
49+
<recv response="200" rtd="true"/>
50+
51+
52+
<send>
53+
<![CDATA[
54+
55+
ACK sip:[dest]@[remote_ip]:[remote_port] SIP/2.0
56+
[last_Via:]
57+
[last_From:]
58+
[last_To:]
59+
[last_Call-ID:]
60+
CSeq: 1 ACK
61+
[last_Contact:]
62+
[last_Allow:]
63+
Content-Length: 0
64+
65+
]]>
66+
</send>
67+
68+
69+
<recv request="BYE"/>
70+
71+
<send>
72+
<![CDATA[
73+
74+
SIP/2.0 200 OK
75+
[last_Via:]
76+
[last_From:]
77+
[last_To:]
78+
[last_Call-ID:]
79+
[last_CSeq:]
80+
Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
81+
Content-Length: 0
82+
83+
]]>
84+
</send>
85+
86+
</scenario>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
testinfo:
2+
summary: 'Tests invalid_or_no_callerid'
3+
description: |
4+
'Run a single instance of Asterisk and send an INVITE with
5+
no PAI or RPID and with an anonymized From header.
6+
Asterisk will test this with the STIR_SHAKEN dialplan
7+
function, ensuring that "invalid_or_no_callerid" is the result.'
8+
9+
test-modules:
10+
test-object:
11+
config-section: test-object-config
12+
typename: sipp.SIPpTestCase
13+
modules:
14+
-
15+
config-section: 'ami-config'
16+
typename: 'ami.AMIEventModule'
17+
-
18+
config-section: 'http-server'
19+
typename: 'http_static_server.HTTPStaticServer'
20+
-
21+
config-section: 'hangup-monitor'
22+
typename: 'pluggable_modules.HangupMonitor'
23+
24+
test-object-config:
25+
memcheck-delay-stop: 7
26+
asterisk-instances: 1
27+
test-iterations:
28+
-
29+
scenarios:
30+
- { 'key-args': {'scenario': 'invite.xml', '-p': '5060', '-i': '127.0.0.4', '-timeout': '20s', '-mi': '127.0.0.4', '-s': 'sipp'},
31+
'ordered-args': ['-timeout_error', '-key', 'dest', '18005556666'] }
32+
33+
hangup-monitor:
34+
ids: [ '1', ]
35+
36+
http-server:
37+
port: 8087
38+
root-directory: 'tests/channels/pjsip/stir_shaken/webroot'
39+
40+
41+
ami-config:
42+
-
43+
type: 'headermatch'
44+
id: '0'
45+
conditions:
46+
match:
47+
Event: 'UserEvent'
48+
UserEvent: 'TestResult'
49+
requirements:
50+
match:
51+
result: 'invalid_or_no_callerid'
52+
count: '1'
53+
54+
properties:
55+
dependencies:
56+
- asterisk : 'res_pjsip'
57+
- asterisk : 'res_stir_shaken'
58+
tags:
59+
- pjsip
60+
- stir_shaken

Diff for: tests/channels/pjsip/stir_shaken/tests.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ tests:
77
- test: 'stir_shaken_sig_fail'
88
- test: 'stir_shaken_acl_fail'
99
- test: 'stir_shaken_fail_return_reason'
10+
- test: 'stir_shaken_anon_callerid'

0 commit comments

Comments
 (0)