This page has sample code for :

  • Add voice number for given personnel
  • List voice numbers for given personnel
  • Delete voice numbers for given personnel
  • Delete one voice number for given personnel

Above code wraps underlying API calls to create, delete, read voice numbers . Please refer to here   for details about the group api.

Voice is a sub-resource for personnel. All calls inbound or outbound originating or terminating at this voice number via braango system are recorded

/**
 * 
 */
package com.braango.virtualdealer.personnel.voice;

import java.util.List;
import java.util.Map;

import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.VoiceApi;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.VoiceInput;
import com.braango.client.braangomodel.VoiceInputBody;
import com.braango.client.braangomodel.VoiceOutput;
import com.braango.client.braangomodel.VoiceOutputBodyDataVoiceList;

/**
 * @author braango
 * 
 *         Sample code showing how to create add VOICE number for personnel
 *
 */
public class CreateVoice {

	static String basePath = "https://testapi2.braango.com/v2/braango";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ApiClient braangoApiClient = new ApiClient();
		// TEST auth token. Please contact
		// sales@braango.com to have one
		// created for you
		String authToken = "ISNWF0P30WM0CMK";
		braangoApiClient.setBasePath(basePath);

		// Set the auth_token for api client to
		// interact with Braango system
		braangoApiClient.setApiKey(authToken);

		// Api key is authorization to to access
		// resources within braango system
		//
		// This key is different than auth_token
		// that is used to validate the master account

		String apiKey = "ISNfTMNOumV3xYNDd2g";

		// Create personnel api. Personnel is hosted by subDealer
		VoiceApi voiceApi = new VoiceApi(braangoApiClient);

		ApiCallback<VoiceOutput> callBack = new ApiCallback<VoiceOutput>() {

			@Override
			public void onUploadProgress(long bytesWritten, 
					long contentLength,
					boolean done) {

				System.out
						.println("Place holder for tracking"
								+ " request progress");

			}

			@Override
			public void onSuccess(VoiceOutput result, int statusCode,
					Map<String, List<String>> responseHeaders) {

				List<VoiceOutputBodyDataVoiceList> voiceList = result.getBody()
						.getData().getVoiceList();

				System.out.println("VOICE LIST : " + voiceList);

			}

			@Override
			public void onFailure(ApiException e, int statusCode,
					Map<String, List<String>> responseHeaders) {
				System.out.println("Error is " + statusCode + " "
						+ e.getResponseBody());

			}

			@Override
			public void onDownloadProgress(long bytesRead, long contentLength,
					boolean done) {

			}
		};

		// PersonnelRequestInput wraps RequestHeader and personnelRequestBody
		VoiceInput voiceInput = new VoiceInput();

		/*
		 * { "api_key": "ISNGvAzwuy4X7vAqrtV", "id": "any value",
		 * "account_type": "partner" }
		 */
		RequestHeader hdr = new RequestHeader();

		// Set the account type to partner for
		// virtual dealer and partner hosted
		// accounts

		hdr.setAccountType("partner");

		// dealer_api_key returned
		// when partner_dealer was created

		hdr.setApiKey(apiKey);

		// ID that will be reflected back
		hdr.setId("voice-create-s1002r2");
		voiceInput.setHeader(hdr);

		VoiceInputBody body = new VoiceInputBody();

		// Create new SMS number for this personnel
		body.setPhoneNumber("4088723444");

		voiceInput.setBody(body);

		try {
			String subDealerId = "subdealers1002";
			String salesPersonId = "0550c168-6117-45d5-a95f-e66593e6336b";
			voiceApi.createVoiceAsync(subDealerId, salesPersonId, voiceInput,
					callBack);
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}
/**
 * 
 */
package com.braango.virtualdealer.personnel.voice;

import java.util.List;
import java.util.Map;
import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.VoiceApi;
import com.braango.client.braangomodel.VoiceOutput;
import com.braango.client.braangomodel.VoiceOutputBodyDataVoiceList;

/**
 * @author braango
 * 
 * Sample code showing how to get Voice number list for 
 * given personnel
 * 
 */
public class GetVoice {

	static String basePath = "https://testapi2.braango.com/v2/braango";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ApiClient braangoApiClient = new ApiClient();
		// TEST auth token. Please contact
		// sales@braango.com to have one
		// created for you
		String authToken = "ISNWF0P30WM0CMK";
		braangoApiClient.setBasePath(basePath);

		// Set the auth_token for api client to
		// interact with Braango system
		braangoApiClient.setApiKey(authToken);

		// Api key is authorization to to access
		// resources within braango system
		//
		// This key is different than auth_token
		// that is used to validate the master account

		String apiKey = "ISNfTMNOumV3xYNDd2g";

		// Create personnel api. Personnel is hosted by subDealer
		VoiceApi VoiceApi = new VoiceApi(braangoApiClient);

		ApiCallback<VoiceOutput> callBack = new ApiCallback<VoiceOutput>() {

			@Override
			public void onUploadProgress(long bytesWritten, long contentLength,
					boolean done) {

				System.out
						.println("Place holder for tracking request progress");

			}

			@Override
			public void onSuccess(VoiceOutput result, int statusCode,
					Map<String, List<String>> responseHeaders) {

				List<VoiceOutputBodyDataVoiceList> VoiceList = result.getBody()
						.getData().getVoiceList();

				System.out.println("Voice LIST : " + VoiceList);

			}

			@Override
			public void onFailure(ApiException e, int statusCode,
					Map<String, List<String>> responseHeaders) {
				System.out.println("Error is " + statusCode + " "
						+ e.getResponseBody());

			}

			@Override
			public void onDownloadProgress(long bytesRead, long contentLength,
					boolean done) {

			}
		};

		

		try {
			String subDealerId = "subdealers1002";
			
			String salesPersonId = "0550c168-6117-45d5-a95f-e66593e6336b";
			
			String accountType   = "partner";
			
			
			
			
			VoiceApi.getVoiceAsync(subDealerId, salesPersonId, 
					            apiKey, accountType, callBack);
			
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}
/**
 * 
 */
package com.braango.virtualdealer.personnel.voice;

import java.util.List;
import java.util.Map;
import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.VoiceApi;
import com.braango.client.braangomodel.VoiceOutput;
import com.braango.client.braangomodel.VoiceOutputBodyDataVoiceList;

/**
 * @author braango
 * 
 * Sample code showing how to delete all Voice numbers for 
 * given personnel
 * 
 */
public class DeleteAllVoice {

	static String basePath = "https://testapi2.braango.com/v2/braango";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ApiClient braangoApiClient = new ApiClient();
		// TEST auth token. Please contact
		// sales@braango.com to have one
		// created for you
		String authToken = "ISNWF0P30WM0CMK";
		braangoApiClient.setBasePath(basePath);

		// Set the auth_token for api client to
		// interact with Braango system
		braangoApiClient.setApiKey(authToken);

		// Api key is authorization to to access
		// resources within braango system
		//
		// This key is different than auth_token
		// that is used to validate the master account

		String apiKey = "ISNfTMNOumV3xYNDd2g";

		// Create personnel api. Personnel is hosted by subDealer
		VoiceApi VoiceApi = new VoiceApi(braangoApiClient);

		ApiCallback<VoiceOutput> callBack = new ApiCallback<VoiceOutput>() {

			@Override
			public void onUploadProgress(long bytesWritten, long contentLength,
					boolean done) {

				System.out
						.println("Place holder for tracking request progress");

			}

			@Override
			public void onSuccess(VoiceOutput result, int statusCode,
					Map<String, List<String>> responseHeaders) {

				List<VoiceOutputBodyDataVoiceList> VoiceList = result.getBody()
						.getData().getVoiceList();

				System.out.println("Voice LIST : " + VoiceList);

			}

			@Override
			public void onFailure(ApiException e, int statusCode,
					Map<String, List<String>> responseHeaders) {
				System.out.println("Error is " + statusCode + " "
						+ e.getResponseBody());

			}

			@Override
			public void onDownloadProgress(long bytesRead, long contentLength,
					boolean done) {

			}
		};

		

		try {
			String subDealerId = "subdealers1002";
			
			String salesPersonId = "0550c168-6117-45d5-a95f-e66593e6336b";
			
			String accountType   = "partner";
			
			
			
			
			
			VoiceApi.deleteVoiceAsync(subDealerId, salesPersonId, 
					apiKey, accountType, callBack);
			
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}
/**
 * 
 */
package com.braango.virtualdealer.personnel.voice;

import java.util.List;
import java.util.Map;
import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.VoiceApi;
import com.braango.client.braangomodel.VoiceOutput;
import com.braango.client.braangomodel.VoiceOutputBodyDataVoiceList;

/**
 * @author braango
 * 
 * Sample code showing how to delete one Voice number for 
 * given personnel
 * 
 */
public class DeleteOneVoice {

	static String basePath = "https://testapi2.braango.com/v2/braango";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ApiClient braangoApiClient = new ApiClient();
		// TEST auth token. Please contact
		// sales@braango.com to have one
		// created for you
		String authToken = "ISNWF0P30WM0CMK";
		braangoApiClient.setBasePath(basePath);

		// Set the auth_token for api client to
		// interact with Braango system
		braangoApiClient.setApiKey(authToken);

		// Api key is authorization to to access
		// resources within braango system
		//
		// This key is different than auth_token
		// that is used to validate the master account

		String apiKey = "ISNfTMNOumV3xYNDd2g";

		// Create personnel api. Personnel is hosted by subDealer
		VoiceApi VoiceApi = new VoiceApi(braangoApiClient);

		ApiCallback<VoiceOutput> callBack = new ApiCallback<VoiceOutput>() {

			@Override
			public void onUploadProgress(long bytesWritten, long contentLength,
					boolean done) {

				System.out
						.println("Place holder for tracking request progress");

			}

			@Override
			public void onSuccess(VoiceOutput result, int statusCode,
					Map<String, List<String>> responseHeaders) {

				List<VoiceOutputBodyDataVoiceList> VoiceList = result.getBody()
						.getData().getVoiceList();

				System.out.println("Voice LIST : " + VoiceList);

			}

			@Override
			public void onFailure(ApiException e, int statusCode,
					Map<String, List<String>> responseHeaders) {
				System.out.println("Error is " + statusCode + " "
						+ e.getResponseBody());

			}

			@Override
			public void onDownloadProgress(long bytesRead, long contentLength,
					boolean done) {

			}
		};

		

		try {
			String subDealerId = "subdealers1002";
			
			String salesPersonId = "0550c168-6117-45d5-a95f-e66593e6336b";
			
			String accountType   = "partner";
			
			String voiceNumberToBeDeleted = "(408) 976-3435";
			
			
			
			
			VoiceApi.deleteOneVoiceAsync(subDealerId, salesPersonId, 
					voiceNumberToBeDeleted, apiKey, accountType, callBack);
			
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}
<?php
use Braango\braangomodel as model;
use Braango\braangomodel\RequestHeader as rhdr;
require_once (__DIR__ . '/../../vendor/autoload.php');
/**
 *
 * @author braango
 *        
 *         Sample code showing how to create add VOICE number for personnel
 *        
 */

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

$api_instance = new Braango\braangoapi\VoiceApi();

// string | id of _sub_dealer_
$subdealerid = "subdealers2002";

// string | id of _personnel_
$salespersonid = "945cddce-6ef6-46e4-ac70-09375cf5165a";

// \Braango\braangomodel\VoiceInput |
$voiceInput = new \Braango\braangomodel\VoiceInput();

/*
 * { "api_key": "ISNGvAzwuy4X7vAqrtV", "id": "any value",
 * "account_type": "partner" }
 */
$hrd = new rhdr();

// dealer_api_key returned
// when partner_dealer was created
$hrd->setApiKey("ISNMdzuNiKG7jhl9d9v");

// Set the account type to partner for
// virtual dealer and partner hosted
// accounts
$hrd->setAccountType("partner");

// ID that will be reflected back
$hrd->setId("voice-create-s2002");

$voiceInput->setHeader($hrd);

$voiceInputBody = new model\VoiceInputBody();

// Create new SMS number for this personnel
$voiceInputBody->setPhoneNumber("4088723445");

$voiceInput->setBody($voiceInputBody);

try {
    $result = $api_instance->createVoice($subdealerid, $salespersonid, $voiceInput);
    if ($result != null) {
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
        }
        
        $rspBdy = $result->getBody();
        if ($rspBdy != null) {
            
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "\n");
            
            $voiceOutputBodyData = $rspBdy->getData();
            
            $voiceOutputBodyDataVoiceList = array();
            $voiceList = $voiceOutputBodyData->getVoiceList();
            print "Voice List : ";
            print_r(array_values($voiceList));
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling VoiceApi->createVoice: ', $e->getMessage(), PHP_EOL;
}
?>
<?php
require_once(__DIR__ . '/../../vendor/autoload.php');

/**
 * @author braango
 *
 * Sample code showing how to get Voice number list for
 * given personnel
 *
 */

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');


$api_instance = new Braango\braangoapi\VoiceApi();

// string | id of _sub_dealer_
$subdealerid = "subdealers2002"; 

// string | id of _personnel_
$salespersonid = "945cddce-6ef6-46e4-ac70-09375cf5165a"; 

// string | API Key to access this dealer's resources. 
// Value was returned when create_account api 
// was called and dealer was created first time
$apiKey = "ISNMdzuNiKG7jhl9d9v";

// string | Dealer or partner is accessing this API
$accountType = "partner"; 

try {
    $result = $api_instance->getVoice($subdealerid, $salespersonid, $apiKey, $accountType);
    if($result != null) {
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if($requestHdr =! null)
        {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
            
        }
        
        $rspBdy = $result->getBody();
        if($rspBdy != null) {
            
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "\n");
            
            $voiceOutputBodyData = $rspBdy->getData();
            
            $voiceOutputBodyDataVoiceList = array();
            $voiceList = $voiceOutputBodyData->getVoiceList();
            print "Voice List : ";
            print_r(array_values($voiceList));
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling VoiceApi->getVoice: ', $e->getMessage(), PHP_EOL;
}
?>
<?php
require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Sample code showing how to delete all Voice numbers for
 *         given personnel
 *        
 */

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

$api_instance = new Braango\braangoapi\VoiceApi();
// string | id of _sub_account_
$subdealerid = "subdealers2002";

// string | id of salesperson
$salespersonid = "945cddce-6ef6-46e4-ac70-09375cf5165a";

// string | API Key to access this dealer's resources. 
// Value was returned when create_account api was called and dealer was created first time
$apiKey = "ISNMdzuNiKG7jhl9d9v";

// string | Dealer or partner is accessing this API
$accountType = "partner";

try {
    $result = $api_instance->deleteVoice($subdealerid, $salespersonid, $apiKey, $accountType);
    if ($result != null) {
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
        }
        
        $rspBdy = $result->getBody();
        if ($rspBdy != null) {
            
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "\n");
            
            $voiceOutputBodyData = $rspBdy->getData();
            
            $voiceOutputBodyDataVoiceList = array();
            $voiceList = $voiceOutputBodyData->getVoiceList();
            print "Voice List : ";
            print_r(array_values($voiceList));
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling VoiceApi->deleteVoice: ', $e->getMessage(), PHP_EOL;
}
?>
<?php
require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Sample code showing how to delete one Voice number for
 *         given personnel
 *        
 */

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

$api_instance = new Braango\braangoapi\VoiceApi();

// string | id of _sub_dealer_
$subdealerid = "subdealers2002";

// string | id of _personnel_
$salespersonid = "945cddce-6ef6-46e4-ac70-09375cf5165a";

// string | voice number
$number = "(408) 872-3445";

// string | API Key to access this dealer's resources.
// Value was returned when create_account api was called and dealer was created first time
$apiKey = "ISNMdzuNiKG7jhl9d9v";

// string | Dealer or partner is accessing this API
$accountType = "partner";

try {
    $result = $api_instance->deleteOneVoice($subdealerid, $salespersonid, $number, $apiKey, $accountType);
    
    if ($result != null) {
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
        }
        
        $rspBdy = $result->getBody();
        if ($rspBdy != null) {
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "\n");
            
            $voiceOutputBodyData = $rspBdy->getData();
            
            $voiceOutputBodyDataVoiceList = array();
            $voiceList = $voiceOutputBodyData->getVoiceList();
            print "Voice List : ";
            print_r(array_values($voiceList));
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling VoiceApi->deleteOneVoice: ', $e->getMessage(), PHP_EOL;
}
?>
Braango
CONTACT US
Unified customer engagement platform for inbound and outbound communications
Thank You. We will contact you as soon as possible.
PGlmcmFtZSB3aWR0aD0iNTYwIiBoZWlnaHQ9IjMxNSIgc3JjPSJodHRwczovL3d3dy55b3V0dWJlLmNvbS9lbWJlZC9sMVZqaUxUMUFKdyIgZnJhbWVib3JkZXI9IjAiIGFsbG93ZnVsbHNjcmVlbj48L2lmcmFtZT4=