DOCS

<makeCall>

This command initiates a call to the specified conventional or SIP phone number and connects a recipient with the current caller.

Important! For proper operation, it is required to include at least one nested element into this command. These could be <number> or <sip>.

If the <makeCall> command contains more than one nested object, the Apifonica platform performs simultaneous calls to all specified phone numbers and SIP endpoints. The first one to answer will be then connected with the calling party and all the rest will be skipped.

AttributeDescriptionDefault value
from

Number to be used as a CallerID. This number must be rented from Apifonica.

If no number is passed using the 'from' property of the <makeCall> command, the 'from' number of leg A will be shown to the call recipient.

controller

The URL to which call parameters are submitted.

Apifonica will expect to receive a new Apifonica XML file to which flow control will be transferred. In this connection, any command after the command is unreachable.

If no controller URL is provided, Apifonica proceeds to process the current XML file and doesn’t send any call parameters.

none
method

Method to be used to make a request to the specified controller.

POST
timeout

The number of seconds to wait for the answer.

f the timeout period has expired and nobody has answered, Apifonica finishes executing the command and moves to the next one.

Important! The period starts when you send the request to the API.

30
whisper_a

The URL of the file to be played back to leg A when the call is answered.*

none
whisper_b

The URL of the file to be played back to leg B when the call is answered.*

none

The following call parameters are sent to the controller URL if specified

ParameterDescription
call_sid
Unique call identifier.
created
Date and time the call was added to the 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 the B-leg.
leg_to
The phone number or virtual number which is used in the B-leg to receive the call.

* It is possible to use both .mp3 and .wav files with the whisper_a and whisper_b properties.

<number>

This command indicates a phone number for Apifonica to call.

It is possible to include more than one <number> into the <makeCall> command. Apifonica will call all of the specified numbers at the same time. This use case is very important for building virtual call centers.

If there is a need to call different numbers in a sequence, use several <makeCall> commands one after another and specify the timeout attribute.

<sip>

This command indicates a SIP endpoint for Apifonica to call. It is the same as the command, but calls a virtual number (SIP number) instead of a conventional phone number.

It is possible to mix <sip> and <number> commands within one <makeCall> instruction.

REQUEST EXAMPLES

The following example demonstrates how Apifonica starts calling the first recipient (with the 35315313424 number) and, in case there is no answer within 10 seconds, ends the first call and starts a call to another number (447860041755).

<?xml version="1.0" encoding="UTF-8" ?>
<response>
  <makeCall from="358942704951" timeout="10">
    <number>35315313424</number>
  </makeCall>
  <makeCall from="358942704951">
    <number>447860041755</number>
  </makeCall>
  </endCall>
</response>

The following example demonstrates Apifonica calling two numbers at the same time (phones will be ringing simultaneously). After one of the numbers picks up, the second connection is ended.

<?xml version="1.0" encoding="UTF-8" ?>
<response>
  <makeCall from="358942704951">
    <number>35315313424</number>
    <number>447860041755</number>
  </makeCall>
  </endCall>
</response>

The following example demonstrates Apifonica calling the conventional and the virtual number at the same time.

<?xml version="1.0" encoding="UTF-8" ?>
<response>
  <makeCall from="447860041755">
    <sip>883431234567</sip>
    <number>35315313424</number>
  </makeCall>
  </endCall>
</response>