I am having 2 issues using PHP script with VXML. Below is the PHP section of the code.
Issues
[1] the "VXML Validator" tool complains at line "echo "<?xml version=\"1.0\"?>\n";". However this line I had copied from one of the examples I found on plum voice forum.
Error ->
"This document is not valid VoiceXML!
Error on line 43: Start tag expected, '<' not found. "
[2] Later in vxml code I am using below 2 lines to use the variables assigned in PHP section. However getting an error which says that "<" is not allowed within "expr". Can you please check and confirm?
<assign name="IVR_Name" expr="'<?= $name_db ?>'"/>
<assign name="environmentType" expr="'<?= $env_db ?>'"/>
Code: Select all
<?php
header('Content-type: text/xml');
require '/home/ec2-user/vendor/autoload.php';
date_default_timezone_set('UTC');
use Aws\DynamoDb\Exception\DynamoDbException;
use Aws\DynamoDb\Marshaler;
$sdk = new Aws\Sdk([
'endpoint' => 'https://dynamodb.us-west-1.amazonaws.com',
'region' => 'us-west-1',
'version' => 'latest'
]);
$dynamodb = $sdk->createDynamoDb();
$marshaler = new Marshaler();
$tableName = 'IVR';
$DNIS = '8332866732';
$key = $marshaler->marshalJson('
{
"DNIS": "' . $DNIS . '"
}
');
$params = [
'TableName' => $tableName,
'Key' => $key
];
try {
$result = $dynamodb->getItem($params);
print_r($result["Item"]);
$env_db = $result["Item"]["env"]["S"];
$name_db = $result["Item"]["name"]["S"];
} catch (DynamoDbException $e) {
echo "Unable to get item:\n";
echo $e->getMessage() . "\n";
}
echo "<?xml version=\"1.0\"?>\n";
?>
<vxml version="2.0">
<property name="inputmodes" value="dtmf"/>
<property name="interdigittimeout" value="6s"/>
<property name="termtimeout" value="5s"/>