PHP code example of jtrw / voiptime-cleint

1. Go to this page and download the library: Download jtrw/voiptime-cleint library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jtrw / voiptime-cleint example snippets




use GuzzleHttp\Client;
use Jtrw\Voiptime\Voiptime;
use Jtrw\Voiptime\VoipClient;
use Jtrw\Voiptime\Client\VoipClientFields;
use Jtrw\Voiptime\Client\VoipClientPhone;

$voip = new Voiptime(
    new Client(['http_errors' => false]),
    $login,
    $password
);

$result = $voip->createClients(
    true,
    new VoipClient(
        1,
        'SIMPLE',
        'Europe/Kiev',
        new VoipClientFields([
            "id"        => 0,
            "firstname" => "test",
            "lastname"  => "Test",
        ]),
        [new VoipClientPhone('380991117978', VoipClientPhone::PHONE_TYPE_MOBILE, true)]
    )
);

$clients = [
    [
        'clientIdentifiers' => [
            'id' => $result['createResult'][0]['createdClientId'] ?? 0
        ],
    ]
];
$result = $voip->addClientToTacsByCampaignId(
    108,
    10,
    false,
    $clients
);