|
15 | 15 |
|
16 | 16 | import StringIO, re, testrun, threading, time, uuid
|
17 | 17 | from termcolor import colored
|
18 |
| -from utils import tee_received_text, tee_sent_text |
| 18 | +from utils import log_append, tee_received_text, tee_sent_text |
19 | 19 |
|
20 | 20 | USER_AGENT = 'Linphone/3.5.2 (eXosip2/3.6.0)'
|
21 | 21 | #USER_AGENT = 'Asterix PBX'
|
@@ -106,6 +106,15 @@ def handle_udp_sip(socket, data, srcpeername, dstport):
|
106 | 106 | rheaders = { 'From': headers['From'], 'To': headers['To'], 'Call-ID': headers['Call-ID'], 'CSeq': headers['CSeq'] }
|
107 | 107 | rheaders['Via'] = '{};received={}'.format(headers['Via'].replace(';rport', ''), srcpeername[0])
|
108 | 108 | rheaders['User-Agent'] = USER_AGENT
|
| 109 | + elif method == 'INVITE': |
| 110 | + print("The intruder is trying to make a call") |
| 111 | + # Pretend we don't understand to stop further interactions |
| 112 | + resp = 'SIP/2.0 501 Not Implemented\n' |
| 113 | + rheaders = {} |
| 114 | + to_hdr = headers.get('To', '') |
| 115 | + from_hdr = headers.get('From', '') |
| 116 | + ua_hdr = headers.get('User-Agent', '') |
| 117 | + log_append('udp_sip_invites', srcpeername[0], to_hdr, from_hdr, ua_hdr) |
109 | 118 | elif (method == 'ACK' or method == 'BYE'):
|
110 | 119 | resp = 'SIP/2.0 200 OK\n'
|
111 | 120 | rheaders = dict(headers)
|
|
0 commit comments