`siphon.telephony.outbound.Call`

siphon.telephony.outbound.Call

Call places an outbound call and attaches agent configuration via metadata.

Import:

from siphon.telephony.outbound import Call

SIPConfig

Call accepts sip_trunk_setup either as a dict or as a SIPConfig model.

See: Telephony models & helpers

Constructor

Call(
    id: Optional[str] = None,
    agent_name: Optional[str] = "Calling-Agent-System",
    sip_trunk_id: Optional[str] = None,
    number_to_call_from: Optional[str] = None,
    sip_trunk_setup: Optional[SIPConfig] = None,
    number_to_call: str = None,
    llm: Optional[Any] = None,
    stt: Optional[Any] = None,
    tts: Optional[Any] = None,
    greeting_instructions: Optional[str] = None,
    system_instructions: Optional[str] = None,
    wait_until_answered: Optional[bool] = False,
)

Parameters

  • number_to_call (required)
    • Destination number.
  • agent_name
    • Must match the worker name you’re running.
  • Trunk selection (one of)
    • sip_trunk_id: use an existing outbound trunk.
    • sip_trunk_setup: pass SIP credentials so SIPHON can look up or create the trunk.
  • number_to_call_from
    • Caller-id / from-number. If omitted and you provide sip_trunk_id, SIPHON tries to infer it from the trunk.
  • Optional agent config overrides
    • llm, stt, tts, greeting_instructions, system_instructions
  • wait_until_answered
    • If True, dialing waits until the call is answered before returning.

start()

def start(self)

Places the call. Internally it:

  • Resolves/creates an outbound trunk ID (from sip_trunk_id or sip_trunk_setup)
  • Creates an agent dispatch (session + metadata)
  • Creates a SIP participant to dial the PSTN

Return value

Call.start() returns a dict like:

  • agent_name
  • dispatch_id
  • sip_participant_id
  • sip_call_id
  • error

error is None on success. On failure you may see:

  • dispatch_error: ...
  • sip_error: ...

See also