Loading...
Loading...
Advanced call control features including DTMF sending, SIPREC recording, noise suppression, client state, and supervisor controls. This skill provides Ruby SDK examples.
npx skill4agent add team-telnyx/telnyx-ext-agent-skills telnyx-voice-advanced-rubygem install telnyxrequire "telnyx"
client = Telnyx::Client.new(
api_key: ENV["TELNYX_API_KEY"], # This is the default and can be omitted
)clientPUT /calls/{call_control_id}/actions/client_state_updateclient_stateresponse = client.calls.actions.update_client_state("call_control_id", client_state: "aGF2ZSBhIG5pY2UgZGF5ID1d")
puts(response)POST /calls/{call_control_id}/actions/refersip_addressclient_statecommand_idcustom_headerssip_auth_passwordsip_auth_usernamesip_headersresponse = client.calls.actions.refer("call_control_id", sip_address: "sip:username@sip.non-telnyx-address.com")
puts(response)POST /calls/{call_control_id}/actions/send_dtmfdigitsclient_statecommand_idduration_millisresponse = client.calls.actions.send_dtmf("call_control_id", digits: "1www2WABCDw9")
puts(response)POST /calls/{call_control_id}/actions/siprec_startclient_stateconnector_nameinclude_metadata_custom_headerssecuresession_timeout_secssip_transportsiprec_trackresponse = client.calls.actions.start_siprec("call_control_id")
puts(response)POST /calls/{call_control_id}/actions/siprec_stopclient_statecommand_idresponse = client.calls.actions.stop_siprec("call_control_id")
puts(response)POST /calls/{call_control_id}/actions/suppression_startclient_statecommand_iddirectionnoise_suppression_enginenoise_suppression_engine_configresponse = client.calls.actions.start_noise_suppression("call_control_id")
puts(response)POST /calls/{call_control_id}/actions/suppression_stopclient_statecommand_idresponse = client.calls.actions.stop_noise_suppression("call_control_id")
puts(response)POST /calls/{call_control_id}/actions/switch_supervisor_roleroleresponse = client.calls.actions.switch_supervisor_role("call_control_id", role: :barge)
puts(response)telnyx-timestamptelnyx-signature-ed25519| Event | Description |
|---|---|
| Call Refer Started |
| Call Refer Completed |
| Call Refer Failed |
| Call Siprec Started |
| Call Siprec Stopped |
| Call Siprec Failed |
callReferStarted| Field | Type | Description |
|---|---|---|
| enum | Identifies the type of the resource. |
| enum | The type of event being delivered. |
| uuid | Identifies the type of resource. |
| date-time | ISO 8601 datetime of when the event occurred. |
| string | Unique ID for controlling the call. |
| string | ID that is unique to the call and can be used to correlate webhook events. |
| string | ID that is unique to the call session and can be used to correlate webhook events. |
| string | Call Control App ID (formerly Telnyx connection ID) used in the call. |
| string | State received from a command. |
| string | Number or SIP URI placing the call. |
| integer | SIP NOTIFY event status for tracking the REFER attempt. |
| string | Destination number or SIP URI of the call. |
callReferCompleted| Field | Type | Description |
|---|---|---|
| enum | Identifies the type of the resource. |
| enum | The type of event being delivered. |
| uuid | Identifies the type of resource. |
| date-time | ISO 8601 datetime of when the event occurred. |
| string | Unique ID for controlling the call. |
| string | ID that is unique to the call and can be used to correlate webhook events. |
| string | ID that is unique to the call session and can be used to correlate webhook events. |
| string | Call Control App ID (formerly Telnyx connection ID) used in the call. |
| string | State received from a command. |
| string | Number or SIP URI placing the call. |
| integer | SIP NOTIFY event status for tracking the REFER attempt. |
| string | Destination number or SIP URI of the call. |
callReferFailed| Field | Type | Description |
|---|---|---|
| enum | Identifies the type of the resource. |
| enum | The type of event being delivered. |
| uuid | Identifies the type of resource. |
| date-time | ISO 8601 datetime of when the event occurred. |
| string | Unique ID for controlling the call. |
| string | ID that is unique to the call and can be used to correlate webhook events. |
| string | ID that is unique to the call session and can be used to correlate webhook events. |
| string | Call Control App ID (formerly Telnyx connection ID) used in the call. |
| string | State received from a command. |
| string | Number or SIP URI placing the call. |
| integer | SIP NOTIFY event status for tracking the REFER attempt. |
| string | Destination number or SIP URI of the call. |
callSiprecStarted| Field | Type | Description |
|---|---|---|
| enum | Identifies the type of the resource. |
| enum | The type of event being delivered. |
| uuid | Identifies the type of resource. |
| date-time | ISO 8601 datetime of when the event occurred. |
| string | Call ID used to issue commands via Call Control API. |
| string | Call Control App ID (formerly Telnyx connection ID) used in the call. |
| string | ID that is unique to the call and can be used to correlate webhook events. |
| string | ID that is unique to the call session and can be used to correlate webhook events. |
| string | State received from a command. |
callSiprecStopped| Field | Type | Description |
|---|---|---|
| enum | Identifies the type of the resource. |
| enum | The type of event being delivered. |
| uuid | Identifies the type of resource. |
| date-time | ISO 8601 datetime of when the event occurred. |
| string | Call ID used to issue commands via Call Control API. |
| string | Call Control App ID (formerly Telnyx connection ID) used in the call. |
| string | ID that is unique to the call and can be used to correlate webhook events. |
| string | ID that is unique to the call session and can be used to correlate webhook events. |
| string | State received from a command. |
| string | Q850 reason why the SIPREC session was stopped. |
callSiprecFailed| Field | Type | Description |
|---|---|---|
| enum | Identifies the resource. |
| enum | The type of event being delivered. |
| uuid | Identifies the type of resource. |
| date-time | ISO 8601 datetime of when the event occurred. |
| string | Call ID used to issue commands via Call Control API. |
| string | Call Control App ID (formerly Telnyx connection ID) used in the call. |
| string | ID that is unique to the call and can be used to correlate webhook events. |
| string | ID that is unique to the call session and can be used to correlate webhook events. |
| string | State received from a command. |
| string | Q850 reason why siprec session failed. |