FreeSWITCH Enterprise Support Lead
Len GrahamCreating an Interactive AI Lenny Bot
Spam calls and telemarketers continue to be an annoyance for everybody. Even in 2023, Americans received billions of robocalls per month! There are a few ways to deal with unwanted spam calls, and one way is to waste the caller’s time.
SignalWire offers a unique opportunity to create your own AI assistant that can interact with these callers, all while being amusing for you.
In this post, we'll explore a JSON code snippet of an interactive AI spam mitigation system. This example bot is a twist on the classic "It's Lenny" system, built using SignalWire AI Agent. Lenny answers your phone with pre-recorded messages to waste the time of telemarketers and fool them into thinking they’re speaking with a real person.
What is an AI agent?
SignalWire’s AI agent is a programmable voice agent you can use as a virtual receptionist or your own personal AI assistant. With the power of AI, the agent does not require text-to-speech prompts - it’s smart enough to engage in conversation with callers based on simple instructions. However, for this example, we instruct the AI to stick to certain lines when speaking.
This snippet contains the code for building a specific type of AI agent: an AI version of Lenny. If you would like to see how this homemade Lenny bot works, you can call him at +1 (681) 485-3669. However, you can build an AI agent of your own to handle calls however you would like.
How Lenny Works
Lenny is designed to interact with telemarketers and scammers, deterring them from calling you again. Like the original "It's Lenny" made from multiple WAV files in a loop, our AI Lenny has the personality of a grumpy old man who distracts the caller with mindless rambling about his third eldest child and ducks.
You can see how the original Lenny works in the video below.
For our AI version, when a spam call is detected, AI Lenny is activated. The call is recorded, and Lenny's AI engine is engaged. He speaks in English using the voice of "Matthew."
Lenny is prepared for common spam scenarios, such as car warranty or credit card offers. He responds with a series of humorous and unrelated statements, leading to confusion on the caller's end.
Throughout the call, Lenny records the conversation. After the call ends, Lenny summarizes the interaction, which can be useful for analysis and tracking spam calls - or just for your own amusement.
AI Lenny Bot Code Snippet
Configuration and Parameters
Record Call: Lenny records the call conversation, ensuring that all interactions are captured for later analysis.
AI Configuration: This section defines Lenny's AI configuration. It specifies the language, voice, fillers, and engine to be used.
Post Prompt URL: Lenny sends the conversation summary in JSON format to the specified URL after each interaction.
Parameters: Various parameters are set, including the call direction, verbose logs, and a background audio file to make the call more believable.
Defining the prompt and post-prompt
Though most AI agents require only a loose set of instructions, this example contains a strict set of lines Lenny can say in the spirit of the original system. However, this is where you can expand the number of lines or customize how Lenny can respond. The AI will also summarize the call for you.
Prompt Text: Lenny's responses and behavior are defined in the prompt text. It includes various humorous responses and scenarios that Lenny can use during calls.
Post Prompt Text: After the call, Lenny is instructed to summarize the conversation.
Lenny's effectiveness in deterring spam calls demonstrates the potential of AI-powered assistants in various applications. As AI technology continues to evolve, we can expect more creative and useful solutions to emerge in the fight against spam and unwanted communications.
To try out SignalWire AI Agent for free, sign up today for a SignalWire space. If you have any questions as you get started, bring them to our community Forum or Slack!