Overview
SIPTransport makes a pipeline a SIP endpoint. The bot registers a SIP account (or dials through a registration-less trunk), answers inbound calls, places outbound calls, and exchanges audio, video, and DTMF with the pipeline. Its events and call-control methods use the same names as the dial-in and dial-out surface of DailyTransport, so a bot can switch between the two by changing the constructor and params.
The transport is one half of the endpoint. A SIPConnection holds the SIP side: the account, the stack settings, and one call. The transport holds the pipeline side: frames in and out, and the events a bot handles. Each SIPTransport handles one call and owns the connection it is given. To hold several conversations on one account, create several transports, each with its own connection; more than two at a time also needs max_concurrent_calls raised on every connection.
baresip-python
The SIP stack the transport is built on
Development Runner
Run a SIP bot locally with
-t sipInstallation
sip extra installs baresip-python, the SIP stack, as a binary wheel: no compiler and no system SIP software are needed. Wheels exist for Linux (x86_64, aarch64) and macOS (Apple Silicon and Intel) on Python 3.11 to 3.14. There is no Windows wheel; on Windows, run the bot under WSL2, where the Linux wheel applies.
Prerequisites
A SIP account to register with, or a Daily domain to provision one on. With the development runner, a bot with no configured account gets a temporary Daily SIP client (DAILY_API_KEY). See DailyRESTHelper to create SIP clients yourself.
The fastest way to hear the transport is that zero-configuration path: with DAILY_API_KEY set, python bot.py -t sip -d provisions a temporary SIP client, logs its dialable URI (Created Daily SIP client: sip:pipecat-<id>@<domain>.sip-us.daily.co), and deletes it when the bot exits. Dial that URI from any SIP softphone and the bot answers. The runner guide covers the other two account sources, a Daily SIP trunk and a plain SIP account on any registrar.
Configuration
SIPTransport
The SIP account and stack settings the call runs over. A connection belongs to
one transport instance.
SIPParams
SIPParams extends TransportParams; the fields below are the ones it adds or overrides.
SIPConnection
ASIPConnection is the SIP endpoint itself: the account (user@domain and its credentials), the registration or trunk behaviour, the process-wide stack settings, and one call at a time. The transport does not create it, because the connection is also the application’s handle on the SIP side of the call: a bot with auto_answer=False answers or declines on it (connection.answer(), connection.reject()), connection.aor is the registered address, connection.final_stats holds the close-time statistics, and consult_connection() produces the second leg an attended transfer dials on. Its constructor arguments are plain types; the underlying binding never appears in application code.
One connection serves one transport instance, since the transport binds its handlers to the connection it is given. Connections that share a user and domain share one registration: an inbound call goes to the first idle connection, and a call that finds every connection busy is refused with 486. Those connections must agree on transport, registrar, password, auth_user, audio_codecs, dtmf_mode, and extra_params.
All parameters are keyword-only. Parameters marked runtime-wide configure the SIP stack the whole process shares; the first connection to connect fixes them, and a later connection that disagrees raises ValueError.
Digest username, when the credential store keys it differently from
user
(credential-list trunks).Seconds between registration refreshes. A refresh goes out at about 90% of the
interval and, over TCP or TLS, keeps the connection inbound calls arrive on
open through a NAT. The default (a refresh every 216 s) fits common cloud NAT
idle timeouts; lower it for a NAT that drops idle connections sooner.
0
disables registration (trunk mode): the connection never sends REGISTER and
dials targets directly. A SIP server then cannot route inbound calls to the
bot, so dial-in works only when the peer reaches the bot’s listening socket
directly, and on_dialin_ready never fires.Codec preference order by stack name, for example
("opus/48000/2", "PCMU/8000/1"). None uses the stack default.Raw baresip account parameters, each a
"key=value" string appended verbatim
to the SIP address-of-record, for account directives Pipecat does not model.
For media-NAT traversal, ("medianat=stun", "stunserver=stun:HOST:PORT")
advertises the address a STUN server reports, which reaches the bot through an
endpoint-independent NAT. Behind a symmetric NAT (such as an AWS NAT Gateway)
that address is unreachable: the call needs a peer that latches onto the bot’s
RTP source address, or medianat=turn with a TURN server.Receive jitter buffer:
"off", "fixed", or "adaptive". With no mode and
no jitter_buffer_ms, the buffer is fixed at 40-60 ms. The buffer holds media
before the transport reads it, so its size adds to turn latency. A fixed
buffer costs its minimum on every packet; an adaptive buffer widens under
jitter and does not narrow again for the rest of the call. A packet arriving
later than the minimum plus one packet time is discarded. Runtime-wide.(min, max) in milliseconds for a fixed or adaptive buffer. Given alone, it
selects "fixed". Not accepted with "off". Runtime-wide.Restrict the stack to one local interface, by name or address, for example
"127.0.0.1" for a registrar on loopback or one address of a multi-homed
host. None lets the OS pick the source address per destination.
Runtime-wide.Simultaneous-call cap for the process; further inbound INVITEs are refused
with 486.
None means unlimited. Runtime-wide.Seconds without received RTP after which a call is closed with reason
"rtp stream error". Held and send-only streams are not checked. 0 disables
detection. Runtime-wide.A canonical lowercase UUID identifying this endpoint across restarts (RFC 5626
+sip.instance), so a supporting registrar replaces a restarted bot’s stale
registration. None sends no instance parameter. Runtime-wide.Lowest severity captured from the native SIP stack’s logging:
"debug",
"info", "warning", or "error". Records appear in Pipecat’s log output.
Runtime-wide.Log every SIP message sent and received, verbatim. The trace contains call
metadata and digest authentication material, so leave it off in production.
Runtime-wide.
Whether inbound calls on the account are routed to this connection. Set it to
False for a connection that only places calls.Usage
Dial-in
Dial-out
Creating the transport with the runner
Under the development runner, or on Pipecat Cloud,create_transport() builds the connection from the runner arguments, so the bot code is the same everywhere:
Video
Calls made or answered with a video direction enabled carry VP8 video. Video crosses the pipeline as RGBInputImageRawFrame and OutputImageRawFrame. With video_out_enabled, the transport sets the call’s video size and frame rate from video_out_width, video_out_height, and video_out_framerate. A peer that declines video leaves a working audio call.
Methods
All call-control methods return an error description as astr, or None on success. They do not raise.
start_dialout
(session_id, error). settings takes:
Returns an error when the transport already has an active call.
stop_dialout
participant_id.
send_dtmf
settings takes tones (the digits), and optionally sessionId and method ("telephone-event" or "sip-info"). The wire method is set by the connection’s dtmf_mode; a method that does not match it returns an error.
sip_refer
settings["toEndPoint"] (blind transfer). On success the call closes. Takes an optional sessionId.
sip_attended_transfer
settings["toEndPoint"] on a consult leg, waits for it to answer, then sends a REFER with a Replaces header so the two peers connect directly. Both of the bot’s legs close, and the active call’s close is reported with reason "transferred". If the transfer fails, the original call resumes. Takes an optional sessionId.
sip_refer() and sip_attended_transfer() need a peer that processes REFER, such as a SIP PBX or registrar (FreeSWITCH, Asterisk, Kamailio), not a carrier PSTN trunk.
sip_call_transfer
sip_refer() or sip_attended_transfer().
Video control
set_video_direction() changes the active call’s video mid-call by sending a re-INVITE; the audio call is untouched while the far end answers it. The direction is the bot’s side of the SDP:
Three conditions apply. The call must already carry a video stream, dialed with a
video setting or answered to a video offer; a plain audio call cannot grow one, and the method returns an error. Right after the call is established the stack may answer “retry shortly”, because the ACK of the first offer is still in flight; the requested direction is kept, so calling again a moment later converges. And the far end decides: a peer that declines the re-INVITE leaves the previous direction in force and the method returns the stack’s error. When a renegotiation completes, on_participant_updated fires on the transport, and the connection’s renegotiated and media_restarted events fire as well; a consumer that caches frame geometry should re-read it after media_restarted("video").
add_video() and remove_video() are set_video_direction("sendrecv") and set_video_direction("inactive"). request_keyframe() asks the far end for a video keyframe, for a consumer that joins mid-stream and wants a decodable picture sooner than the next natural keyframe; it returns nothing.
Notes
- Transfers: A transfer that succeeds closes the bot’s side of the call.
sip_call_transferis not supported. - Trunk mode:
reg_interval=0is independent ofSIPParams.trunk, which only buildssip:+E164@trunkURIs fromphoneNumber. PSTN trunking typically uses both. Treaton_connectedas the ready signal, sinceon_dialin_readydoes not fire. - DTMF: Received digits that are not keypad entries (
A-D) fireon_dtmf_eventbut produce noInputDTMFFrame. - Debugging:
sip_traceandnative_log_levelon the connection (SIP_TRACEandSIP_NATIVE_LOG_LEVELunder the runner) show the signaling and the stack’s view of it; the symptom table in the runner guide covers registration failures, one-way audio, and trunk calls that never arrive. - Differences from DailyTransport:
on_connectedcarries no payload, so cross-transport handlers should acceptdata=None. Dial-out has no per-callcallerId,codecs, orvideoSettings; use the connection’suser,audio_codecs, andvideo_size. Rooms,on_app_message, transcription, and recording events do not exist on this transport.
Event Handlers
The names followDailyTransport, so one bot can serve both transports. The differences:
- Only on
SIPTransport:on_call_quality_stats, the close-time media statistics of a call (duration, packets, loss, jitter, round-trip time). Daily has no equivalent. - Only on
DailyTransport, never fired here:on_joined,on_app_message,on_active_speaker_changed,on_network_connection_status_updated, and the recording and transcription events (on_recording_started,on_recording_stopped,on_recording_error,on_transcription_message,on_transcription_stopped,on_transcription_error). A handler registered for one of them on aSIPTransportis never called, so a bot written for both transports keeps working. - Same name, different payload or timing:
on_connectedcarries no data here (acceptdata=None);on_participant_updatedreports hold, resume, and video renegotiation rather than Daily’s participant property changes;on_first_participant_joinedfires once per call, since each call is its own session.
Dial event
data dicts carry sessionId and sipCallId. Dial-in data adds sipFrom, sipTo, and sipHeaders; dial-out data adds origin and destination; error and warning data carries errorMsg.
SIPConnection Events
SIPConnection has its own event handlers, registered with connection.add_event_handler(name, handler). Most bots use the transport’s events above; the connection’s incoming event is how a bot with auto_answer=False answers or declines a call.