Telephony APIs
22 min
Criado por Knowledge Engineering Team em 01/12/2020 19:23
Atualizado por Agente Zenvia - Jean em 09/08/2024 15:53

On this page

Telephony APIs concepts and usage

Phone call distribution

Sequencing API requests

RRCD – Incoming call

RRCD – Call transferred to agent

RRCD – Missed call

RRCD – Abandoned call

RRCD – Call ended

ECD – Call transferred to agent

ECD – Abandoned call

ECD – Call ended

 

 

Telephony APIs concepts and usage

There are a few different Telephony API resources in Movidesk, each used to send Movidesk information about a different phone call scenario.

Each resource has a set of query parameters, but none of the telephony API resources interact with JSON objects.

API Base URL

All API endpoint URLs in this article use the following base URL:

https://api.movidesk.com/public/v1

 

 

Phone call distribution

The Round-robin call distribution API resources are only applicable if you want to let Movidesk distribute calls round-robin between agents in a call group.

If you don’t want call distribution to be controlled by Movidesk—for example if it will be controlled by your telephony system—you should send your API requests to the External call distribution API resources.

Round-robin call distribution resources (RRCD)

POST: /asterisk_receivedCall

POST: /asterisk_transferedCall

POST: /asterisk_lostCall

POST: /asterisk_canceledCall

POST: /asterisk_completedCall

External call distribution resources (ECD)

GET: /asterisk_startTransferedCall

GET: /asterisk_startCanceledCall

GET: /asterisk_completedCall

Clipboard

Note We apologize for the “transfered" spelling issue in the /asterisk_transferedCall and  /asterisk_startTransferedCall API endpoints and are working to create an alternate set of endpoints with the correct spelling. Our goal in maintaining the current spelling is to minimize impact to existing applications of the Telephony API.

 

Sequencing API requests

Requests to the Telephony API must follow a specific sequence to ensure appropriate system behavior and accurate calculations for KPIs and metrics.

Sequence for Round-robin call distribution

  1. All calls should start with a POST request to the /asterisk_receivedCall endpoint, to notify Movidesk of an incoming call. This will begin the timer for the wait time metrics.
  2. If there are no agents available to pick up the call, send a POST request to the /asterisk_lostCall endpoint. This will flag the call as a missed call and create a ticket in Movidesk via the Missed call channel. You should send a request to this endpoint whenever the code returned by the /asterisk_receivedCall endpoint is 0, 1, or 2.
  3. Continue sending POST requests to the /asterisk_receivedCall endpoint until an agent answers the call or the customer hangs up. You should continue sending API requests to this endpoint whenever the code returned by the /asterisk_receivedCall endpoint is 3 or 4.
    1. Also continue sending requests if the telephony system identifies that the phone extension returned by the API is currently busy, for example if they made an outgoing call. Movidesk will cycle through available agents and the API will return a different agent phone extension on the next API request.
  4. If the customer abandons the call while waiting in queue, send a POST request to the /asterisk_canceledCall endpoint. This will flag the call as an abandoned call and create a ticket in Movidesk via the Abandoned call channel.
  5. If an agent answers the call, send a POST request to the /asterisk_transferedCall endpoint to open the active call screen for the agent.
  6. If the call is transferred to another agent, also send a POST request to the /asterisk_transferedCall endpoint. The request should include the phone extension of the new agent taking the call, which will open the active call screen for them.
  7. When the call ends after being answered by an agent, send a POST request to the /asterisk_completedCall endpoint to notify Movidesk the call has ended.

All sequences must end with a request to one of these resources:

POST: /asterisk_lostCall

POST: /asterisk_canceledCall

POST: /asterisk_completedCall

 

Sequence for External call distribution

  1. If the call ends before the customer speaks to an agent, send a GET request to the /asterisk_startCanceledCall endpoint. This will flag the call as an abandoned call and create a ticket in Movidesk via the Abandoned call channel.
  2. If an agent answers the call, send a GET request to the /asterisk_startTransferedCall endpoint to open the active call screen for the agent.
  3. If the call is transferred to another agent, also send a GET request to the /asterisk_startTransferedCall endpoint. The request should include the phone extension of the new agent taking the call, which will open the active call screen for them.
  4. When the call ends after being answered by an agent, send a GET request to the /asterisk_completedCall endpoint to notify Movidesk the call has ended.

All sequences must end with a request to one of these resources:

GET: /asterisk_canceledCall

GET: /asterisk_completedCall

 

RRCD – Incoming call

Notifies Movidesk of an incoming call that was placed in a call queue. Must always be the first API request in the RRCD sequence.

The API response will determine what the next API request in the RRCD sequence should be.

POST: /asterisk_receivedCall

 

Parameters

Location

 

Type

Required?

Description

token

Query string

 

String

Yes

Movidesk API token found in Configurations > Account > Parameters

queueId

Query string

 

Int

Yes

ID of the call queue in the telephony system. Must correspond to the Queue ID in a Movidesk call group

Max length of 10 digits

clientNumber

Query string

 

String

Yes

Phone number of the caller

Max length of 128 characters

id

Query string

 

String

Yes

Unique ID of the phone call

This ID will be used to identify the call in subsequent API requests

Max length of 256 characters

callDate

Query string

 

UTC datetime

Yes

Date and time when the call was received

 

This example is a request notifying Movidesk of a call received on May 1st, 2019 at 5:00 PM UTC from phone number +15553990777.

The ID of the call is 82746, and the call was placed in queue 1, which also corresponds to one of the call groups configured in Movidesk.

The response will either return the phone extension of an available agent from the call group, or a single digit code corresponding to a specific scenario.

Clipboard

Note To automatically identify a customer in the Telephony module, the phone number in the API request must match the customer contact info exactly.

 

Sample request

POST: https://api.movidesk.com/public/v1/asterisk_receivedCall?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&queueId=1&clientNumber=15553990777&id=82746&callDate=2019-5-1T17:00:00

Possible responses

There are a few possible API responses:

  • Phone extension of an agent
    • API returned the phone extension of an available agent
  • 0
    • Holiday. No agents are available
  • 1
    • Outside of business hours. No agents are available
  • 2
    • No agents in this call group are currently signed in to Movidesk
  • 3
    • No agents in this call group are currently online in the Telephony module
  • 4
    • All agents in this call group are busy with ongoing calls

Clipboard

Note The phone extension returned by the API may be occupied by a call that is not being monitored by Movidesk, for example by an outbound call. If the telephony system identifies the phone extension is currently available, make another identical API request to obtain the phone extension of the next available agent.

 

RRCD – Call transferred to agent

Notifies Movidesk that the call was transferred to an agent.

The API request will open the active call screen for the agent corresponding to the phone extension in the branchLine parameter.

POST: /asterisk_transferedCall

 

Parameters

Location

Type

Required?

Description

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

id

Query string

String

Yes

Unique ID of the phone call

Must match the ID in the id parameter of the API request to /asterisk_receivedCall

Max length of 256 characters

branchLine

Query string

String

Yes

Phone extension of the agent

Must match the phone extension registered under Other contacts in the agent’s profile in Movidesk

Max length of 128 characters

transferDate

Query string

UTC datetime

Yes

Date and time when the call was transferred

 

This example is a request notifying Movidesk that the call with id 82746 was transferred to an agent. The call was transferred to the agent with phone extension 5252 on May 1st, 2019 at 5:01 PM UTC.

The response will return status code 200.

Sample request

POST: https://api.movidesk.com/public/v1/asterisk_transferedCall?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&id=82746&branchLine=5252&transferDate=2019-5-1T17:01:00

 

 

RRCD – Missed call

Notifies Movidesk that a customer called, but the call could not be transferred to an agent.

Should be used when a request to /asterisk_receivedCall returns codes 0, 1, or 2.

An API request to this resource will finalize the call sequence and automatically open a ticket in Movidesk using the channel Missed call.

POST: /asterisk_lostCall

 

Parameters

Location

Type

Required?

Description

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

id

Query string

String

Yes

Unique ID of the phone call

Must match the ID in the id parameter of the API request to /asterisk_receivedCall

Max length of 256 characters

link

Query string

String

Yes

URL for the voice message, which will be added to the ticket as a link

This parameter is required, but you can send a blank value in the request if no link is available

completedDate

Query string

UTC datetime

Yes

Date and time when the call was finalized

 

This example is a request notifying Movidesk that the call with id 82750 was a missed call, which ended on May 1st, 2019 at 5:09 PM UTC.

The request includes the following link to the voice message left by the customer, which will be added to the ticket as a ticket note for future reference:
https://api.telephonysystem.com/2019-05-01/APItoken/Recordings/RecordingXXXX

The response will return status code 200, and a ticket will be created in Movidesk.

Sample request

POST: https://api.movidesk.com/public/v1/asterisk_lostCall?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&id=82750&link= https://api.telephonysystem.com/2019-05-01/APItoken/Recordings/RecordingXXXX&completedDate=2019-5-1T17:09:00

 

 

RRCD – Abandoned call

Notifies Movidesk that a customer called and abandoned the call before talking to an agent.

Should be used when a request to /asterisk_receivedCall returns codes 3 or 4 and the customer ends the call before the call is transferred to an agent.

An API request to this resource will finalize the call sequence and automatically open a ticket in Movidesk using the channel Abandoned call.

POST: /asterisk_canceledCall

 

Parameters

Location

Type

Required?

Description

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

id

Query string

String

Yes

Unique ID of the phone call

Must match the ID in the id parameter of the API request to /asterisk_receivedCall

Max length of 256 characters

canceledDate

Query string

UTC datetime

Yes

Date and time when the call was abandoned

 

This example is a request notifying Movidesk that the call with id 82751 was abandoned on May 1st, 2019 at 5:05 PM UTC.

The response will return status code 200, and a ticket will be created in Movidesk.

Sample request

POST: https://api.movidesk.com/public/v1/asterisk_canceledCall?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&id=82751&canceledDate=2019-5-1T17:05:00

 

 

RRCD – Call ended

Notifies Movidesk that the call has ended.

Should be used after the call is transferred to an agent and the customer finishes talking to the agent.

An API request to this resource will finalize the call sequence.

POST: /asterisk_completedCall

 

Parameters

Location

Type

Required?

Description

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

id

Query string

String

Yes

Unique ID of the phone call

Must match the ID in the id parameter of the API request to /asterisk_receivedCall

Max length of 256 characters

link

Query string

String

Yes

URL for the call recording, which will be added to the ticket as a link

This parameter is required, but you can send a blank value in the request if no link is available

completedDate

Query string

UTC datetime

Yes

Date and time when the call ended

 

This example is a request notifying Movidesk that the call with id 82746 ended on May 1st, 2019 at 5:15 PM UTC.

The request includes the following link to the call recording, which will be added to the ticket as a ticket note for future reference:
https://api.telephonysystem.com/2019-05-01/APItoken/Recordings/RecordingXXXX

The response will return status code 200.

Sample request

POST: https://api.movidesk.com/public/v1/asterisk_completedCall?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&id=82746&link= https://api.telephonysystem.com/2019-05-01/APItoken/Recordings/RecordingXXXX&completeddDate=2019-5-1T17:15:00

 

 

ECD – Call transferred to agent

Notifies Movidesk that a call was received and transferred to an agent.

The API request will open the active call screen for the agent corresponding to the phone extension in the branchLine parameter.

GET: /asterisk_startTransferedCall

 

Parameters

Location

Type

Required?

Description

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

queueId

Query string

Int

Yes

ID of the call queue in the telephony system. Must correspond to the Queue ID in a Movidesk call group

Max length of 10 digits

clientNumber

Query string

String

Yes

Phone number of the caller

Max length of 128 characters

id

Query string

String

Yes

Unique ID of the phone call

This ID will be used to identify the call in subsequent API requests

Max length of 256 characters

branchLine

Query string

String

Yes

Phone extension of the agent

Must match the phone extension registered under Other contacts in the agent’s profile in Movidesk

Max length of 128 characters

callDate

Query string

UTC datetime

 

Date and time when the call was received

If blank, the current date and time will be used

transferDate

Query string

UTC datetime

 

Date and time when the call was transferred

If blank, the current date and time will be used

 

This example is a request notifying Movidesk that a call with id 82746 in queue 1 was received and transferred to an agent.

The call from phone number +15553990777 was received on May 1st, 2019 at 5:00 PM UTC and transferred to the agent with phone extension 5252 at 5:01 PM UTC.

The response will return status code 200.

Sample request

GET: https://api.movidesk.com/public/v1/asterisk_startTransferedCall?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&queueId=1&clientNumber=15553990777&id=82746&branchLine=5252&callDate=2019-5-1T17:00:00&transferDate=2019-5-1T17:01:00

 

 

ECD – Abandoned call

Notifies Movidesk that a customer called and abandoned the call before talking to an agent.

An API request to this resource will finalize the call sequence and automatically open a ticket in Movidesk using the channel Abandoned call.

GET: /asterisk_startCanceledCall

 

Parameters

Location

Type

Required?

Description

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

queueId

Query string

Int

Yes

ID of the call queue in the telephony system. Must correspond to the Queue ID in a Movidesk call group

Max length of 10 digits

clientNumber

Query string

String

Yes

Phone number of the caller

Max length of 128 characters

id

Query string

String

Yes

Unique ID of the phone call

This ID will be used to identify the call in subsequent API requests

Max length of 256 characters

callDate

Query string

UTC datetime

 

Date and time when the call was received

If blank, the current date and time will be used

canceledDate

Query string

UTC datetime

 

Date and time when the call was abandoned

If blank, the current date and time will be used

  

This example is a request notifying Movidesk that a call with id 82746 in queue 1 was received and abandoned.

The call from phone number +15553990777 was received on May 1st, 2019 at 5:00 PM UTC and abandoned at 5:14 PM UTC.

The response will return status code 200.

Sample request

GET: https://api.movidesk.com/public/v1/asterisk_startCanceledCall?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&queueId=1&clientNumber=15553990777&id=82746&callDate=2019-5-1T17:00:00&transferDate=2019-5-1T17:14:00

 

ECD – Call ended

Notifies Movidesk that the call has ended.

Should be used after the call is transferred to an agent and the customer finishes talking to the agent.

An API request to this resource will finalize the call sequence.

GET: /asterisk_completedCall

 

Parameters

Location

Type

Required?

Description

token

Query string

String

Yes

Movidesk API token found in Configurations > Account > Parameters

id

Query string

String

Yes

Unique ID of the phone call

Must match the ID in the id parameter of the API request to /asterisk_startTransferedCall

Max length of 256 characters

link

Query string

String

Yes

URL for the call recording, which will be added to the ticket as a link

This parameter is required, but you can send a blank value in the request if no link is available

completedDate

Query string

UTC datetime

Yes

Date and time when the call ended

 

This example is a request notifying Movidesk that the call with id 82746 ended on May 1st, 2019 at 5:15 PM UTC.

The request includes the following link to the call recording, which will be added to the ticket as a ticket note for future reference:
https://api.telephonysystem.com/2019-05-01/APItoken/Recordings/RecordingXXXX

The response will return status code 200.

Sample request

GET: https://api.movidesk.com/public/v1/asterisk_completedCall?token=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&id=82746&link= https://api.telephonysystem.com/2019-05-01/APItoken/Recordings/RecordingXXXX&completedDate=2019-5-1T17:15:00

Classifique este artigo
Últimos artigos visitados