For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReference
GuidesReference
    • Core
      • Overview
    • Agents
      • Overview
      • AgentBase
      • AgentServer
      • BedrockAgent
      • CLI Tools
      • Configuration
      • ContextBuilder
      • DataMap
      • FunctionResult
      • Helper Functions
      • LiveWire
      • MCP Gateway
      • PomBuilder
      • Prefabs
      • Search
      • SkillBase
      • Skills
      • SWAIGFunction
      • SWMLBuilder
      • SWMLService
      • WebService
    • RELAY
      • Overview
      • Actions
      • Call
        • ai
        • ai_hold
        • ai_message
        • ai_unhold
        • amazon_bedrock
        • answer
        • bind_digit
        • clear_digit_bindings
        • collect
        • connect
        • denoise
        • denoise_stop
        • detect
        • disconnect
        • echo
        • hangup
        • hold
        • join_conference
        • join_room
        • leave_conference
        • leave_room
        • live_transcribe
        • live_translate
        • on
        • pass_
        • pay
        • play
        • play_and_collect
        • queue_enter
        • queue_leave
        • receive_fax
        • record
        • refer
        • send_digits
        • send_fax
        • stream
        • tap
        • transfer
        • unhold
        • user_event
        • wait_for
        • wait_for_ended
      • Constants
      • Events
      • Message
      • RelayClient
      • RelayError
    • REST Client
      • Overview
      • Addresses
      • Calling
      • Chat
      • Compat
      • Datasphere
      • Fabric
      • Imported Numbers
      • Logs
      • Lookup
      • MFA
      • Number Groups
      • Phone Numbers
      • Project
      • PubSub
      • Queues
      • Recordings
      • Registry
      • RestClient
      • Short Codes
      • SignalWireRestError
      • SIP Profile
      • Verified Callers
      • Video
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Parameters
  • Returns
  • Example
RELAYCall

bind_digit

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

clear_digit_bindings

Next
Built with

Bind a DTMF digit sequence to automatically trigger a RELAY method when the caller presses those digits. This enables in-call DTMF shortcuts without requiring an active collect operation.

Use clear_digit_bindings() to remove bindings.

Parameters

digits
strRequired

The DTMF digit sequence to bind (e.g., "*1", "##").

bind_method
strRequired

The RELAY calling method to execute when the digit sequence is detected (e.g., "calling.transfer", "calling.play").

bind_params
Optional[dict]

Parameters to pass to the bound method when triggered.

realm
Optional[str]

A namespace for grouping digit bindings. Useful for selectively clearing bindings by realm.

max_triggers
Optional[int]

Maximum number of times this binding can be triggered. After reaching the limit, the binding is automatically removed.

Returns

dict — Server response confirming the binding.

Example

1from signalwire.relay import RelayClient
2
3client = RelayClient(
4 project="your-project-id",
5 token="your-api-token",
6 host="your-space.signalwire.com",
7 contexts=["default"],
8)
9
10@client.on_call
11async def handle_call(call):
12 await call.answer()
13
14 # Bind *0 to transfer to an operator
15 result = await call.bind_digit(
16 digits="*0",
17 bind_method="calling.transfer",
18 bind_params={"dest": "operator"},
19 realm="shortcuts",
20 )
21 print(f"Digit binding created: {result}")
22
23 # Bind *9 to play a help message
24 await call.bind_digit(
25 digits="*9",
26 bind_method="calling.play",
27 bind_params={"play": [{"type": "tts", "text": "Press star-zero for an operator."}]},
28 realm="shortcuts",
29 )
30
31client.run()