Docs

Modify live call

https://api.apifonica.com/v2/accounts/{accountSID}/calls/{callSID}

Overview

You can modify the flow of a live call by redirecting its flow control to another controller script.

To do this, make the POST request to the call resource instance /accounts/{accountSID}/calls/{callSID} that is in progress and pass the new controller URL.

Parameter

Description

call_app_sid

Link to the existing application, which will be used for Call operations

Required

yes

Description

Link to the existing application, which will be used for Call operations

Default value

N/A

Request example

The following example demonstrates modifying a live call.

curl –X POST ‘https://api.apifonica.com/v2/accounts/{accountSID}/calls/{callSID}’ \
-H ‘Content-Type: application/json’ \
-d ‘{ \
     “call_app_sid”: “app1f255680-95dd-34c6-b83f-c86b8095adcb” \
    }’ \
-u {accountSID}:{authToken}

Response example

{
    "status_code": 201,
    "status_message": "CREATED",
    "uri": "/accounts/{accountSID}/calls/{callSID}"
}

Apifonica request parameters being sent to controller URL

The following parameters are sent to controller URL if it is provided. Empty answer or Apifonica XML file is expected in return. Empty answer will be treated as no action. Apifonica XML file will break current scenario and execute as call flow modification

Parameter name

Description

call_sid

Call unique identifier.

created

Date and time of the adding the call to queue .

status

Call (A-leg) status.

from

Caller phone number (conventional or virtual).

to

Recipient’s phone number (conventional or virtual).

direction

Call direction.

Either inbound or outbound.

leg_status

B-leg status.

leg_from

The phone number or virtual number of the caller for B-leg.

leg_to

The phone number or virtual number which is used in B-leg to receive the call.

Description

Call unique identifier.

Description

Date and time of the adding the call to queue.

Description

Call (A-leg) status.

Description

Caller phone number (conventional or virtual).

Description

Recipient’s phone number (conventional or virtual).

Description

Call direction.

Either inbound or outbound.

Description

B-leg status.

Description

The phone number or virtual number of the caller for B-leg.

Description

The phone number or virtual number which is used in B-leg to receive the call.

Example of request from Apifonica to controller URL

{
        "call_sid":"calf3efd4c0-f11e-37cd-ba44-085e81f8381c",
        "created":"2017-04-24 09:12:09",
        "status":"answered",
        "from":"883140100000086",
        "to":"79031550066",
        "direction":"outbound",
        "leg_status":"ringing",
        "leg_from":"883140100000086",
        "leg_to":"883140100000099"
}