Loading...
Loading...
Advanced call control features including DTMF sending, SIPREC recording, noise suppression, client state, and supervisor controls. This skill provides Java SDK examples.
npx skill4agent add team-telnyx/telnyx-ext-agent-skills telnyx-voice-advanced-java// See https://github.com/team-telnyx/telnyx-java for Maven/Gradle setupimport com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
TelnyxClient client = TelnyxOkHttpClient.fromEnv();clientPUT /calls/{call_control_id}/actions/client_state_updateclient_stateimport com.telnyx.sdk.models.calls.actions.ActionUpdateClientStateParams;
import com.telnyx.sdk.models.calls.actions.ActionUpdateClientStateResponse;
ActionUpdateClientStateParams params = ActionUpdateClientStateParams.builder()
.callControlId("call_control_id")
.clientState("aGF2ZSBhIG5pY2UgZGF5ID1d")
.build();
ActionUpdateClientStateResponse response = client.calls().actions().updateClientState(params);POST /calls/{call_control_id}/actions/refersip_addressclient_statecommand_idcustom_headerssip_auth_passwordsip_auth_usernamesip_headersimport com.telnyx.sdk.models.calls.actions.ActionReferParams;
import com.telnyx.sdk.models.calls.actions.ActionReferResponse;
ActionReferParams params = ActionReferParams.builder()
.callControlId("call_control_id")
.sipAddress("sip:username@sip.non-telnyx-address.com")
.build();
ActionReferResponse response = client.calls().actions().refer(params);POST /calls/{call_control_id}/actions/send_dtmfdigitsclient_statecommand_idduration_millisimport com.telnyx.sdk.models.calls.actions.ActionSendDtmfParams;
import com.telnyx.sdk.models.calls.actions.ActionSendDtmfResponse;
ActionSendDtmfParams params = ActionSendDtmfParams.builder()
.callControlId("call_control_id")
.digits("1www2WABCDw9")
.build();
ActionSendDtmfResponse response = client.calls().actions().sendDtmf(params);POST /calls/{call_control_id}/actions/siprec_startclient_stateconnector_nameinclude_metadata_custom_headerssecuresession_timeout_secssip_transportsiprec_trackimport com.telnyx.sdk.models.calls.actions.ActionStartSiprecParams;
import com.telnyx.sdk.models.calls.actions.ActionStartSiprecResponse;
ActionStartSiprecResponse response = client.calls().actions().startSiprec("call_control_id");POST /calls/{call_control_id}/actions/siprec_stopclient_statecommand_idimport com.telnyx.sdk.models.calls.actions.ActionStopSiprecParams;
import com.telnyx.sdk.models.calls.actions.ActionStopSiprecResponse;
ActionStopSiprecResponse response = client.calls().actions().stopSiprec("call_control_id");POST /calls/{call_control_id}/actions/suppression_startclient_statecommand_iddirectionnoise_suppression_enginenoise_suppression_engine_configimport com.telnyx.sdk.models.calls.actions.ActionStartNoiseSuppressionParams;
import com.telnyx.sdk.models.calls.actions.ActionStartNoiseSuppressionResponse;
ActionStartNoiseSuppressionResponse response = client.calls().actions().startNoiseSuppression("call_control_id");POST /calls/{call_control_id}/actions/suppression_stopclient_statecommand_idimport com.telnyx.sdk.models.calls.actions.ActionStopNoiseSuppressionParams;
import com.telnyx.sdk.models.calls.actions.ActionStopNoiseSuppressionResponse;
ActionStopNoiseSuppressionResponse response = client.calls().actions().stopNoiseSuppression("call_control_id");POST /calls/{call_control_id}/actions/switch_supervisor_roleroleimport com.telnyx.sdk.models.calls.actions.ActionSwitchSupervisorRoleParams;
import com.telnyx.sdk.models.calls.actions.ActionSwitchSupervisorRoleResponse;
ActionSwitchSupervisorRoleParams params = ActionSwitchSupervisorRoleParams.builder()
.callControlId("call_control_id")
.role(ActionSwitchSupervisorRoleParams.Role.BARGE)
.build();
ActionSwitchSupervisorRoleResponse response = client.calls().actions().switchSupervisorRole(params);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. |