Project

General

Profile

API - CallQueue Save

The CallQueue / Save API is used to schedule calls to be called later, according to a predetermined schedule, using Originate call.

API URL

https://[YOUR-PBX-URL]/api/call-queue

The data are transmitted by POST or GET and must be of the form:

Array
(
    [api_username] => your_api_usr
    [api_password] => your_api_pass
    [action] => save
    [data] => Array
        (
            [project_id] => 1
            [type] => queue
            [destination] => test-queue
            [campaign_name] => Test campaign
            [campaign_info] => Some special info
            [outbound_type] => auto
            [attend_type] => attended
            [outbound_number] => +40212345678
            [outbound_trunk] => default-trunk
            [calls] => Array
                (
                    [0] => Array
                        (
                            [caller_id] => 0123456789
                            [caller_id_name] => John Doe
                            [priority] => 0
                            [schedule] => 
                            [external_id] => asdf1234
                            [max_retries] => 5
                            [vars] => Array
                                (
                                    [SKIP_WELCOME] => 1
                                    [SKIP_WE_ARE_RECORDING] => 1
                                    [SKIP_ENTER_QUEUE] => 0
                                    [BACKEND_LINK] => https://[YOUR-EXTERNAL-CRM-URL]/?change_this_url=1234
                                )

                        )

                )

        )

    [api_hash] => 20b093246dac88454f390553e813aa0d
)

The action parameter must have the save value

Parameters:

  • project_id: project ID in PBX
  • type: the type of destination to which the Inbound Call is sent (user, queue, context)
  • destination: the user/queue in PBX for which the call is initiated
  • campaign_name: campaign name
  • campaign_info: additional information about the campaign
  • outbound_type: the type of automatic or manual campaign (auto, manual)
  • attend_type: the call is made with or without an agent (attended, unattended)
  • outbound_number: the number that is displayed to the recipient, optional
  • outbound_trunk: the provider through which the call is made, optional
  • calls: call array
    • caller_id: the phone number being called
    • caller_id_name: the name of the person being called
    • priority: call queue priority
    • schedule: the date and time the call is scheduled. Format: Y-m-d H:i:s (e.g.: 2017-02-16 00:00:00)
    • external_id: ID from external database (e.g.: activity ID)
    • max_retries: the maximum number of retries until the call is abandoned
    • vars: array with different variables for the context in the PBX, optional

Example of parameter generation:

$params = array(
    'api_username' => 'your_api_usr',
    'api_password' => 'your_api_pass',
    'action' => 'save',
    'data' => array(
        'project_id' => 1,
        'type' => 'queue', // user, queue, context
        'destination' => 'test-queue',
        'campaign_name' => 'Test campaign',
        'campaign_info' => 'Some special info',
        'outbound_type' => 'auto', // auto, manual
        'attend_type' => 'attended', // attended, unattended
        'outbound_number' => '+40212345678', // dnid
        'outbound_trunk' => 'default-trunk',
        'calls' => array(
            array(
                'caller_id' => '0123456789',
                'caller_id_name' => 'John Doe',
                'priority' => 0,
                'schedule' => '', // default NOW()
                'external_id' => 'asdf1234',
                'max_retries' => 5,
                'vars' => array(
                    'SKIP_WELCOME' => 1,
                    'SKIP_WE_ARE_RECORDING' => 1,
                    'SKIP_ENTER_QUEUE' => 0,
                    'BACKEND_LINK' => 'https://[YOUR-EXTERNAL-CRM-URL]/?change_this_url=1234', // for pop-up
                ),
            )
        )
    )
);

Example of hash generation:

$params['api_hash'] = md5(http_build_query($params) . 'your_api_key'); // make hash

Example for sending data:

$url = 'https://[YOUR-PBX-URL]/api/call-queue';
header('Content-Type: application/json');
echo curlPost($url, $params);

Answer

If successful:

{

    "has_error": false,
    "messages": [ ],
    "pagination": [ ],
    "results": [
        {
            "external_id": "asdf12345",
            "queue_id": 79,
            "schedule": "2017-02-20 15:22:32" 
        }
    ]

}

Or in case of error:

{

    "has_error": true,
    "messages": [
        "Call #0 is already scheduled with queue_id #78" 
    ],
    "pagination": [ ],
    "results": [ ]

}

Available in other languages: RO

Go to top