Page 1 of 1

Error from PHP file

Posted: Tue Jul 31, 2018 12:22 pm
by vikas
Hi Plum team

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"/>

Re: Error from PHP file

Posted: Tue Jul 31, 2018 2:37 pm
by support
Hi Vikas,

Can you send us the URL that you are attempting to get the IVR to load? We'll be able to zero in on the issue more easily that way.

Thanks!
Plum Support

Re: Error from PHP file

Posted: Tue Jul 31, 2018 3:27 pm
by vikas
Sure, I have emailed the URL. Thanks.