Transports
In AI voice applications, a Transport is the crucial network layer that handles sending and receiving streaming audio (and metadata) between your code and the outside world.
While many AI frameworks require you to configure complex WebRTC connections or integrate third-party telephony APIs manually, Piopiy handles this automatically through its built-in TeleCMITransport.
What is TeleCMITransport?
TeleCMITransport is the underlying infrastructure that connects your Python VoiceAgent to global phone networks (PSTN) and web clients with ultra-low, sub-second latency.
Key Advantages
Zero Configuration
You never instantiate TeleCMITransport directly. By initializing an Agent with your AGENT_ID, the transport protocol is negotiated, established, and secured on your behalf.
Built-in SIP / PSTN
It natively bridges traditional phone calls to modern WebRTC sockets. You do not need to stitch together separate CPaaS providers (like Twilio or Vonage) with your AI code. Piopiy is the carrier and the AI orchestration layer.
Optimized for AI
Traditional voice protocols are built for human-to-human latency (where 500ms is acceptable). TeleCMITransport is heavily tuned for streaming conversational AI, ensuring the round-trip interval between human speech and AI response is nearly imperceptible.
How it Works
When a user dials your provisioned Piopiy phone number, the following high-speed pipeline is orchestrated:
- The Piopiy edge network receives the call and connects the audio stream to the
TeleCMITransportlayer. - The transport securely locates your running python script and fires your
create_session(...)callback. - Your
VoiceAgentreceives the streaming audio frames and processes them through your STT ➔ LLM ➔ TTS stack. - The synthesized TTS audio frames are streamed back through the transport to the caller's ear.
Implicit Transport Setup
You never need to import transport logic. The Agent.connect() method handles the multiplexing.
from piopiy.agent import Agent
# The Agent class implicitly establishes the TeleCMITransport
agent = Agent(
agent_id="your_agent_id",
agent_token="your_agent_token",
create_session=your_session_handler
)
# Connects the transport securely to the Piopiy edge router
await agent.connect()
Supported Modes
Currently, the Piopiy SDK prioritizes:
- PSTN Inbound: Regular cellphones and landlines dialing into your AI.
- PSTN Outbound: AI dialing out to real phone numbers.
- WebRTC: High-quality in-app browser or mobile calling (Available in specific tiers).