This page contains links, tips, and tricks to leverage CallFire's Voice XML infrastructure.
Voice XML is a markup language used for handling a wide variety of telephone applications.
Note: You must include a FULL vxml header with all the namespaces for your document to be read correctly.
In addition to creating Voice XML campaigns via the web portal, developers can create Voice XML campaigns via the CallPeer (https://www.callfire.com/service) service.
We now have answering machine detection for Voice XML, read more about it here
The main Method is createVXMLCampaign. It takes the following
Parameters
Response
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<tnsa:createVXMLCampaign xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tnsa="http://vxml.callpeer.callfire.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tnsa:key>string</tnsa:key>
<tnsa:callerid>string</tnsa:callerid>
<tnsa:numbers>
<tnsa:string>string</tnsa:string>
<tnsa:string>string</tnsa:string>
<tnsa:string>string</tnsa:string>
<tnsa:string>string</tnsa:string>
</tnsa:numbers>
<tnsa:url>string</tnsa:url>
</tnsa:createVXMLCampaign>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
public function createVXMLCampaign($api_key,$caller_id,$phoneNumbers,$awayMessage,$debug)
{
$createOtboundcampaignWsdl = 'http://www.callfire.com/service/CallPeer?wsdl';
$campaignOutboundClient = new SoapClient($createOtboundcampaignWsdl,array('trace' => true));
$lines = file($phoneNumbers) or die('Unable to upload phone numbers');
foreach($lines as $line)
{
$pnumber['string'][] = $line;
}
$createcampaign = array(
'key' => $api_key,
'callerid' => $caller_id,
'numbers' => $pnumber,
'url' => $awayMessage
);
try
{
$createcampaignResponse = $campaignOutboundClient->createVXMLCampaign($createcampaign);
$campaignId = $createcampaignResponse->out;
if($debug)
{
echo "CampaignID : ".$campaignId."<br/>";
}
}
catch(SoapFault $error)
{
if($debug)
{
echo $error."<br/>";
}
}
}
public long createVXMLCampaign(string key,string callerid,List<string> numbers, string url)
{
//LOG.Info("Entered createVXMLCampaign(string key,string callerid,List<string>, string url)");
try
{
long response = this.callPeerService.createVXMLCampaign(key, callerid, numbers.ToArray(), url);
return response;
}
catch (Exception e)
{
string msg = "unable to create vxml campaign";
LOG.Error(msg);
throw new CallPeerServiceException(msg, e);
}
finally
{
//LOG.Info("Exited createVXMLCampaign(string key,string callerid,List<string> numbers, string url)");
}
}
Use this function to create a VXML Object. Parameters
* key: The API key for your CallFire account * callerid: The Caller ID for the campaign. * enableAM: set this true if you want to enable answering machine detection, otherwise set it to false. * numbers: A sequence of numbers in CSV format. * laUrl: The URL of the Live Answer VXML document. This has to be an alive link as the API will validate the document during campaign creation. * amUrl: The URL of the Answering Machine VXML document. This has to be an alive link as the API will validate the document during campaign creation.
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<tnsa:createVXMLCampaignObject xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tnsa="http://vxml.callpeer.callfire.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tnsa:vo>
<tnsa:amUrl>string</tnsa:amUrl>
<tnsa:callerid>string</tnsa:callerid>
<tnsa:enableAM>false</tnsa:enableAM>
<tnsa:key>string</tnsa:key>
<tnsa:laUrl>string</tnsa:laUrl>
<tnsa:numbers>
<tnsa:string>string</tnsa:string>
<tnsa:string>string</tnsa:string>
</tnsa:numbers>
</tnsa:vo>
</tnsa:createVXMLCampaignObject>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
public function createVXMLCampaignObject($amUrl,$caller_id,$enableAM,$key,$laUrl,$phoneNumbers,$debug)
{
$createOtboundcampaignWsdl = 'http://www.callfire.com/service/CallPeer?wsdl';
$campaignOutboundClient = new SoapClient($createOtboundcampaignWsdl,array('trace' => true));
$lines = file($phoneNumbers) or die('Unable to upload phone numbers');
foreach($lines as $line)
{
$pnumber['string'][] = $line;
}
//Creating the VXMLCampaignObject
$campaignObject = new VxmlCampaignObject();
$campaignObject->amUrl = $amUrl;
$campaignObject->callerid = $caller_id;
$campaignObject->enableAM = $enableAM;
$campaignObject->key = $key;
$campaignObject->laUrl = $laUrl;
$campaignObject->numbers = $pnumber;
try
{
$createcampaignResponse = $campaignOutboundClient->createVXMLCampaignObject($campaignObject);
$campaignId = $createcampaignResponse->out;
if($debug)
{
echo "CampaignID : ".$campaignId."<br/>";
}
}
catch(SoapFault $error)
{
if($debug)
{
echo $error."<br/>";
}
}
}
public long createVXMLCampaignObject(VxmlCampaignObject vxmlObject)
{
//LOG.Info("Entered createVXMLCampaignObject(VxmlCampaignObject vxmlObject)");
try
{
long response = this.callPeerService.createVXMLCampaignObject(vxmlObject);
return response;
}
catch (Exception e)
{
string msg = "unable to create vxml object";
LOG.Error(msg);
throw new CallPeerServiceException(msg, e);
}
finally
{
//LOG.Info("Exited createVXMLCampaignObject(VxmlCampaignObject vxmlObject)");
}
}
| Customizing Voice Broadcast | Detecting Input |
| Voice XML Input Termination | |
| Voice XML Default Properties | |
| Multi Question Poll |
When referencing audio files, make sure to end the file name with ".wav". Audio files are cached by Callfire.
