Channels

Method

Path

Return Model

Summary

GET

/channels

List[Channel]

List active channels.

POST

/channels

void

Create a new channel (originate).

GET

/channels/{channelId}

Channel

Channel details.

DELETE

/channels/{channelId}

void

Delete (i.e. hangup) a channel.

POST

/channels/{channelId}/dial

Dialed

Create a new channel (originate) and bridge to this channel.

POST

/channels/{channelId}/continue

void

Exit application; continue execution in the dialplan.

POST

/channels/{channelId}/answer

void

Answer a channel.

POST

/channels/{channelId}/mute

void

Mute a channel.

POST

/channels/{channelId}/unmute

void

Unmute a channel.

POST

/channels/{channelId}/hold

void

Hold a channel.

POST

/channels/{channelId}/unhold

void

Remove a channel from hold.

POST

/channels/{channelId}/mohstart

void

Play music on hold to a channel.

POST

/channels/{channelId}/mohstop

void

Stop playing music on hold to a channel.

POST

/channels/{channelId}/play

Playback

Start playback of media.

POST

/channels/{channelId}/record

LiveRecording

Start a recording.

GET

/channels/{channelId}/variable

Variable

Get the value of a channel variable or function.

POST

/channels/{channelId}/variable

void

Set the value of a channel variable or function.

GET /channels

List active channels.

POST /channels

Create a new channel (originate).

Query parameters

  • endpoint: string - (required) Endpoint to call.
  • extension: string - The extension to dial after the endpoint answers
  • context: string - The context to dial after the endpoint answers. If omitted, uses 'default'
  • priority: long - The priority to dial after the endpoint answers. If omitted, uses 1
  • app: string - The application name to pass to the Stasis application.
  • appArgs: string - The application arguments to pass to the Stasis application.
  • callerId: string - CallerID to use when dialing the endpoint or extension.
  • timeout: int = 30 - Timeout (in seconds) before giving up dialing, or -1 for no timeout.

Error Responses

  • 400 - Invalid parameters for originating a channel.

GET /channels/{channelId}

Channel details.

Path parameters

  • channelId: string - Channel's id

Error Responses

  • 404 - Channel not found

DELETE /channels/{channelId}

Delete (i.e. hangup) a channel.

Path parameters

  • channelId: string - Channel's id

Error Responses

  • 404 - Channel not found

POST /channels/{channelId}/dial

Create a new channel (originate) and bridge to this channel.

Path parameters

  • channelId: string - Channel's id

Query parameters

  • endpoint: string - Endpoint to call. If not specified, dial is routed via dialplan
  • extension: string - Extension to dial
  • context: string - When routing via dialplan, the context use. If omitted, uses 'default'
  • timeout: int = 30 - Timeout (in seconds) before giving up dialing, or -1 for no timeout.

Error Responses

  • 404 - Channel not found
  • 409 - Channel not in a Stasis application

POST /channels/{channelId}/continue

Exit application; continue execution in the dialplan.

Path parameters

  • channelId: string - Channel's id

Query parameters

  • context: string - The context to continue to.
  • extension: string - The extension to continue to.
  • priority: int - The priority to continue to.

Error Responses

  • 404 - Channel not found
  • 409 - Channel not in a Stasis application

POST /channels/{channelId}/answer

Answer a channel.

Path parameters

  • channelId: string - Channel's id

Error Responses

  • 404 - Channel not found
  • 409 - Channel not in a Stasis application

POST /channels/{channelId}/mute

Mute a channel.

Path parameters

  • channelId: string - Channel's id

Query parameters

  • direction: string = both - Direction in which to mute audio

Error Responses

  • 404 - Channel not found
  • 409 - Channel not in a Stasis application

POST /channels/{channelId}/unmute

Unmute a channel.

Path parameters

  • channelId: string - Channel's id

Query parameters

  • direction: string = both - Direction in which to unmute audio

Error Responses

  • 404 - Channel not found
  • 409 - Channel not in a Stasis application

POST /channels/{channelId}/hold

Hold a channel.

Path parameters

  • channelId: string - Channel's id

Error Responses

  • 404 - Channel not found
  • 409 - Channel not in a Stasis application

POST /channels/{channelId}/unhold

Remove a channel from hold.

Path parameters

  • channelId: string - Channel's id

Error Responses

  • 404 - Channel not found
  • 409 - Channel not in a Stasis application

POST /channels/{channelId}/mohstart

Play music on hold to a channel. Using media operations such as playOnChannel on a channel playing MOH in this manner will suspend MOH without resuming automatically. If continuing music on hold is desired, the stasis application must reinitiate music on hold.

Path parameters

  • channelId: string - Channel's id

Query parameters

  • mohClass: string - Music on hold class to use

Error Responses

  • 404 - Channel not found
  • 409 - Channel not in a Stasis application

POST /channels/{channelId}/mohstop

Stop playing music on hold to a channel.

Path parameters

  • channelId: string - Channel's id

Error Responses

  • 404 - Channel not found
  • 409 - Channel not in a Stasis application

POST /channels/{channelId}/play

Start playback of media. The media URI may be any of a number of URI's. You may use http: and https: URI's, as well as sound: and recording: URI's. This operation creates a playback resource that can be used to control the playback of media (pause, rewind, fast forward, etc.)

Path parameters

  • channelId: string - Channel's id

Query parameters

  • media: string - (required) Media's URI to play.
  • lang: string - For sounds, selects language for sound.
  • offsetms: int - Number of media to skip before playing.
  • skipms: int = 3000 - Number of milliseconds to skip for forward/reverse operations.

Error Responses

  • 404 - Channel not found
  • 409 - Channel not in a Stasis application

POST /channels/{channelId}/record

Start a recording. Record audio from a channel. Note that this will not capture audio sent to the channel. The bridge itself has a record feature if that's what you want.

Path parameters

  • channelId: string - Channel's id

Query parameters

  • name: string - (required) Recording's filename
  • format: string - (required) Format to encode audio in
  • maxDurationSeconds: int - Maximum duration of the recording, in seconds. 0 for no limit
  • maxSilenceSeconds: int - Maximum duration of silence, in seconds. 0 for no limit
  • ifExists: string = fail - Action to take if a recording with the same name already exists.
  • beep: boolean - Play beep when recording begins
  • terminateOn: string = none - DTMF input to terminate recording

Error Responses

  • 400 - Invalid parameters
  • 404 - Channel not found
  • 409 - Channel is not in a Stasis application; the channel is currently bridged with other channels; A recording with the same name is currently in progress.

GET /channels/{channelId}/variable

Get the value of a channel variable or function.

Path parameters

  • channelId: string - Channel's id

Query parameters

  • variable: string - (required) The channel variable or function to get

Error Responses

  • 400 - Missing variable parameter.
  • 404 - Channel not found
  • 409 - Channel not in a Stasis application

POST /channels/{channelId}/variable

Set the value of a channel variable or function.

Path parameters

  • channelId: string - Channel's id

Query parameters

  • variable: string - (required) The channel variable or function to set
  • value: string - The value to set the variable to

Error Responses

  • 400 - Missing variable parameter.
  • 404 - Channel not found
  • 409 - Channel not in a Stasis application