Skip to main content

Server-side Python SDK for the Virturing Voice API

Project description

Virturing Python SDK

Dependency-free synchronous and asynchronous clients for Python 3.10+.

import os
from virturing import Virturing

voice = Virturing(os.environ["VIRTURING_API_KEY"])
call = voice.create_call(
    agent_id="agent_uuid",
    phone_number_id="number_uuid",
    to_number="+94771234567",
    channel="ai",
    metadata={"employee_id": "EMP-1042", "shift": "morning"},
)

For a monitoring alert, create a one-way alert agent in the portal and send the exact text from trusted server code:

alert = voice.create_alert_call(
    agent_id="alert_agent_uuid",
    phone_number_id="number_uuid",
    to_number="+94771234567",
    message="Production alert. Checkout latency has exceeded two seconds.",
    metadata={"incident_id": "INC-2042"},
    idempotency_key="incident-INC-2042",
)

Virturing speaks the message with the alert agent's configured voice and hangs up. No STT, LLM, tools, or conversational workflow is started. Carrier usage and generated TTS audio remain prepaid and metered.

To keep an existing Twilio number and carrier account, point its incoming-call webhook to the connector URL shown in Virturing. Start outgoing calls through that connector with:

call = voice.create_twilio_call(
    connector_id="connector_uuid",
    agent_id="agent_uuid",
    to_number="+94771234567",
    metadata={"customer_ref": "CUST-1042"},
    idempotency_key="customer-call-CUST-1042",
)

Twilio continues to bill the carrier leg; Virturing deducts only metered AI/platform usage from the USD wallet.

To use a Virturing number with your own AI or media server, register a WSS endpoint and start a programmable call:

created = voice.create_media_endpoint(
    name="My voice service",
    url="wss://voice.example.com/virturing/media",
)
# Store created["signing_secret"] once in your server-side secret manager.
voice.create_programmable_call(
    phone_number_id="number_uuid",
    media_endpoint_id=created["endpoint"]["id"],
    to_number="+94771234567",
)

verify_media_stream_signature authenticates the WSS opening handshake. The stream uses bidirectional PCM16 mono audio at 8 kHz. See docs/programmable-media.md for the complete contract and customer-hosted Python and Node examples.

The client automatically uses idempotency keys and retries only safe operations. Keep the API key in server-side secrets. verify_webhook_signature validates the exact raw request body before JSON parsing.

Use Virturing(client_id=..., client_secret=..., scopes=[...]) for OAuth client credentials. Access tokens are cached and refreshed automatically. create_media_session(...) creates a metered realtime voice session for a web, desktop, or mobile client.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

virturing-0.3.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

virturing-0.3.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file virturing-0.3.0.tar.gz.

File metadata

  • Download URL: virturing-0.3.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for virturing-0.3.0.tar.gz
Algorithm Hash digest
SHA256 fca31cd717e976b7aeb0475c0f01c56589fec09ac944ed2f253cb7d13f8a5abf
MD5 dc59337611f478a15ffea07607139a2d
BLAKE2b-256 3459dae46600194df7688d3b0495f4934337a59159119b5e55909e90d3980a0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for virturing-0.3.0.tar.gz:

Publisher: sdk-release.yml on Virturing/virturing_app

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file virturing-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: virturing-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for virturing-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 79459b1157d90bbeec0f95742747ed1f306cea3af14a735bfcc14cd47ea0915b
MD5 48fe8e85d0eda57b8cb06f9b711f6637
BLAKE2b-256 7185db721e8eafcb4f3cacd3e827badce7ad35e1a119e968d89ef49867ad1074

See more details on using hashes here.

Provenance

The following attestation bundles were made for virturing-0.3.0-py3-none-any.whl:

Publisher: sdk-release.yml on Virturing/virturing_app

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page