AI-powered voice assistant with Python, PJSIP and VoIPstudio (Part 1)

An illustration with a Python, PJSIP and VoIPstudio logos and an AI voice assistant illustration

Table of contents

A VoIPstudio customer needed their SCADA system to automatically call engineers when critical alarms were triggered.

Using an open-source Python SIP client built on PJSIP (PJSUA2), they connected their infrastructure directly to a VoIPstudio SIP trunk and began placing automated voice calls triggered by system events.

They then extended the solution by integrating a local AI conversational engine, transforming one-way alarm calls into dynamic, two-way voice interactions.

The full client implementation is open source. 

This case demonstrates how VoIPstudio provides a standards-based, developer-friendly SIP foundation for programmable and AI-powered voice applications.

The evolution of voice: From people to systems

Voice is no longer just human-to-human communication.

Modern operational environments increasingly require system-to-human escalation:

  • Industrial control alarms
  • IT infrastructure failures
  • IoT-triggered events
  • Monitoring thresholds
  • Safety alerts

Email and SMS are often insufficient for high-priority incidents. Voice remains the most reliable real-time escalation channel.

The initial use case: SCADA alarm escalation

The customer operates a SCADA (Supervisory Control and Data Acquisition) system monitoring critical infrastructure.

Requirement:

When a priority alarm is triggered, the system must immediately call the responsible engineer and deliver a clear warning, with the following business requirements:

  • No human intervention.
  • No manual dialing.
  • No hardware PBX.

Architecture Overview

The solution was intentionally minimal and standards-based:

When an alarm condition is met:

  1. The Python script registers to VoIPstudio using SIP credentials.
  2. It initiates an outbound SIP call.
  3. Upon answer, it plays a pre-recorded .wav alert file.
  4. The call terminates once playback completes.

This required no proprietary SDKs and no telephony middleware, just SIP.

The open-source foundation: voip-client-python

At the core of this implementation is an open-source project developed by Luis Miguel.

Repository:
https://github.com/luismiguelbp/voip-client-python
Project: voip-client-python

This is a functional Python SIP client built using PJSIP / PJSUA2, demonstrating:

  • SIP registration
  • Call initiation and teardown
  • RTP media handling
  • Audio playback injection
  • Event-driven call lifecycle management

Rather than being a theoretical example, this is working, inspectable code that developers can fork and adapt.

Example (Simplified Call Placement Logic)

Below is a simplified conceptual example based on how PJSUA2 is used in Python:

				
					call = MyCall(account, pj.CallOpParam(True))
call.makeCall("sip:+441234567890@sip.voipstudio.com", pj.CallOpParam(True))
				
			

From there, media callbacks allow injection of audio files or real-time generated audio streams.

From static alerts to AI conversations

The customer did not stop at playing a static .wav file.

They extended the architecture by integrating a local AI conversational engine running on the same machine as the SIP client.

The upgraded flow:

  1. SCADA triggers alarm.
  2. Python client initiates call via VoIPstudio.
  3. AI generates dynamic spoken alert.
  4. Human responds verbally.
  5. AI processes speech input.
  6. System continues conversational logic.

The result is a two-way voice interaction over a standard SIP trunk.

Instead of:

“Critical temperature alarm.”

The system can now say:

“A temperature alarm has triggered at Site B. Do you acknowledge responsibility? Please say ‘confirmed’ to accept.”

And then process the response in real time.

There is no cloud AI telephony lock-in, or proprietary voice bot platform. Just SIP + Python + AI. VoIPstudio just provides the telephony transport layer.

Architecture Overview

Below is a simplified representation of the production architecture used in this deployment:

				
					+--------------------+        SIP        +----------------------+
|   Python App       | <----------------> |    VoIPstudio SIP   |
| (voip-client)      |                    |      Infrastructure  |
|                    |                    |  - Authentication    |
|  - Alarm Logic     |                    |  - Call Routing      |
|  - Call Control    |                    |  - PSTN Termination  |
|  - AI Integration  |                    |  - Number Provision  |
+---------+----------+                    +----------+-----------+
          |                                            |
          | RTP Media                                  |
          v                                            v
+--------------------+                      +----------------------+
|  Local AI Engine   |                      |   Public Telephone   |
|                    |                      |      Network         |
|  - STT             |                      |                      |
|  - Conversational  |                      |  Engineer / Operator |
|  - Response Gen    |                      |      Receives Call   |
+--------------------+                      +----------------------+

				
			

Call Flow

Because the solution is based on standard SIP:

  • It can be deployed on-premise or in the cloud.
  • AI engines can be swapped without changing telephony infrastructure.
  • Call logic remains fully programmable.

This separation between intelligence and telephony transport is what makes the architecture scalable.

Beyond SCADA: Where this architecture applies

The same VoIPstudio + Python + AI pattern supports:

NOTE: Here, in each case, VoIPstudio can act as the reliable SIP backbone.

Explore the code

If you are building automation systems, AI assistants, monitoring platforms or intelligent escalation workflows, start here:

Repository:
https://github.com/luismiguelbp/voip-client-python
Project: voip-client-python

Review, fork, extend, then connect it to a VoIPstudio SIP trunk and begin experimenting.

Ready to voice-enable your applications?

VoIPstudio provides:

  • Global SIP connectivity
  • Flexible trunking
  • Developer-friendly configuration
  • Reliable PSTN termination

Start a free trial and begin building your own programmable voice solutions.

The intelligence is yours. We provide the voice layer.

Read this post in: Deutsch Español Polski Português

Want to improve your business communication?

Unlock enterprise-class call center power at affordable prices – no hardware, no delays, no surprises!

Install VoIPstudio on Linux

.deb

1. Download .deb package

				
					wget https://repo.ssl7.net/repo/voipstudio/stable/main/binary/VoIPstudio_current_amd64.deb
				
			

2. Install VoIPstudio

				
					sudo dpkg -i VoIPstudio_current_amd64.deb