Call Us Today! 877.742.2583

Page tree
Skip to end of metadata
Go to start of metadata


by 'Chrismoos'

Caller ID spoofing, TTS, and getDigits. This first prompts a caller to enter an access code, and if correct, the caller can then enter a number to spoof, and a destination number. Also, this example will send an email whenever a spoofed call is made (for abuse purposes, possibly).


 Click here to expand Table of Contents




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.speak('Invalid entry. Please try again.')
		return digits
def handler(session, args):
	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.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('')
	fromaddr = ''
	toaddrs = ['']
	subject = "A spoofed call was made"
	msg = ("From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (fromaddr, ", ".join(toaddrs), subject))
	d ='%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)