We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Error from PHP file

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
vikas
Posts: 53
Joined: Wed May 13, 2015 7:46 pm

Error from PHP file

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

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: Error from PHP file

Post 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

vikas
Posts: 53
Joined: Wed May 13, 2015 7:46 pm

Re: Error from PHP file

Post by vikas »

Sure, I have emailed the URL. Thanks.

Post Reply