Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create and launch a text-to-speech broadcast using the API's ExtCreateBroadcast function.
#include "soapH.h" // include header files
#include "soapCEAAPI_USCOREv2Soap12Proxy.h" // get proxy
#include "CEAAPI_USCOREv2Soap12.nsmap" // get namespace bindings
using namespace std;
int main()
{
CEAAPI_USCOREv2Soap12Proxy q;
q.soap_endpoint = "http://staging-api.call-em-all.com/webservices/CEAAPI_v2.asmx";
// for production use once approved
// q.soap_endpoint = "http://api.call-em-all.com/webservices/CEAAPI_v2.asmx";
char *username = "99919991";
char *pin = "9991";
char *broadcastType = "1";
char *phoneNumberSource = "3";
char *broadcastName = "C++ Example";
char *callerID = "9725551212";
char *phoneNumbers = "9725551313";
char *TTSText = "This is an example of launching a text to speech broadcast";
_ns1__ExtCreateBroadcast *Request = new _ns1__ExtCreateBroadcast;
Request->myRequest = new ns1__ExtCreateBroadcastRequestType;
_ns1__ExtCreateBroadcastResponse *Response = new _ns1__ExtCreateBroadcastResponse;
Response->ExtCreateBroadcastResult = new ns1__ExtCreateBroadcastResponseType;
Request->myRequest->username = username;
Request->myRequest->pin = pin;
Request->myRequest->broadcastType = broadcastType;
Request->myRequest->phoneNumberSource = phoneNumberSource;
Request->myRequest->broadcastName = broadcastName;
Request->myRequest->callerID = callerID;
Request->myRequest->commaDelimitedPhoneNumbers = phoneNumbers;
Request->myRequest->TTSText = TTSText;
if (q.ExtCreateBroadcast(Request, Response) == SOAP_OK)
{
printf("ErrorCode : %d \n",Response->ExtCreateBroadcastResult->errorCode);
printf("ErrorMessage : %s \n",Response->ExtCreateBroadcastResult->errorMessage);
if (Response->ExtCreateBroadcastResult->errorCode == 0)
{
printf("\n\n");
printf("BroadcastID : %s \n",Response->ExtCreateBroadcastResult->broadcastID);
printf("GoodrecordCount : %d \n",Response->ExtCreateBroadcastResult->goodRecordCountOnFile);
printf("BadRecordCount : %d \n",Response->ExtCreateBroadcastResult->badRecordCountOnFile);
}
}
else
{
printf("\n\nSomething went horribly awry!\n\n");
q.soap_stream_fault(std::cerr);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.