lib/pwn/plugins/baresip.rb in pwn-0.5.10 vs lib/pwn/plugins/baresip.rb in pwn-0.5.11
- old
+ new
@@ -452,11 +452,13 @@
)
puts '/listcalls RESP:'
puts cmd_resp.xpath('//pre').text
puts red
+ # TODO: This is a brittle mess. Refactor.
# Conditions to hangup when less than seconds_to_record
+ forbidden = '403 Caller Origination Number is Invalid'
terminated = 'terminated (duration:'
unavail = '503 Service Unavailable'
not_found = 'session closed: 404 Not Found'
reason = 'recording limit reached'
@@ -467,9 +469,14 @@
print "\r"
dump_session_data = File.readlines(screenlog_path)
dump_session_data.delete_if do |line|
line.include?('ua: using best effort AF: af=AF_INET')
+ end
+
+ if dump_session_data.select { |s| s.include?(forbidden) }.length.positive?
+ reason = 'SIP 403 (forbidden)'
+ break
end
if dump_session_data.select { |s| s.include?(terminated) }.length.positive?
reason = 'call terminated by other party'
break