Lately I have been really interested in voice over IP, I think there is a lot of power in it. I was using Asterisk, but I’ve moved onto a much better and more powerful solution, FreeSWITCH. I was playing with it recently and decided a Caller ID spoofing interface would be fun.
When the following script is ran, it will prompt you for an access code, and if it is correct, it will let you specify a number to spoof, and a number to call. Its fun :). Also, it can send an email whenever a spoofed call is made (if you want to track your friends usage, for example).
To use the following script, put this in your dialplan: (I’ve put spoof.py in the fspy package.)
<application action="python" data="fspy.spoof"/>
import os,sys from freeswitch import * from datetime import datetime from time import mktime import httplib import urllib import random import smtplib def get_number(session,invalid,num=10): digits = session.getDigits(num, "#", 6000) if digits == '': if invalid == 3: session.speak('You have entered too many in valid entries. Goodbye.') session.hangup() else: session.speak('Invalid entry. Please try again.') get_number(session,invalid+1) else: return digits def handler(session, args): session.answer() session.set_tts_parms('cepstral', 'Allison') session.speak('Please enter the 4 digit access code.') code = get_number(session,2,num=4) if(code == None or code != '6969'): session.speak('Invalid access code, goodbye!') session.hangup() return session.speak('Please enter the number you would like to spoof.') spoof_number = get_number(session, 0) session.speak('Please enter the number you would like to call.') dest_number = get_number(session, 0) session.setVariable("effective_caller_id_number", spoof_number) session.speak('Calling...please wait') server = smtplib.SMTP('smtp.mydomain.com') fromaddr = 'email@example.com' toaddrs = ['firstname.lastname@example.org'] subject = "A spoofed call was made" msg = ("From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (fromaddr, ", ".join(toaddrs), subject)) d = datetime.now().strftime('%A, %B %d, %Y %I:%M%p') msgContents = "Date: %s\nCaller ID: %s\n\nDestination Number: %s\nSpoofed Number: %s\n\n\nSincerely, \nFreeSwitch Spoofer" % (d, session.getVariable("caller_id_number"), dest_number, spoof_number) server.sendmail(fromaddr, toaddrs, msg+msgContents) session.execute('transfer', dest_number)