Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def handle_request(self, message, addr):
to = message.uri.username
fromm = sip.parseAddress(message.headers['from'][0])[1].username
if message.method == 'MESSAGE':
rpdu = sms_utilities.rpdu.RPDU.fromPDU(message.body)
sms_deliver = SMS_DELIVER.fromPDU(rpdu.user_data,
rpdu.rp_originator_address)
self.sms_h(to, fromm, sms_deliver.user_data)
r = self.responseFromRequest(200, message)
elif message.method == 'ACK':
r = self.responseFromRequest(200, message)
elif message.method == 'INVITE':
self.call_h(to, fromm)
# We don't know how to actually handle calls.
r = self.responseFromRequest(487, message)
else:
raise Exception("Received unhandled request")
self.deliverResponse(r)