Error from PHP file

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

  • Author
  • Message
Offline

vikas

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

Error from PHP file

PostTue Jul 31, 2018 12:22 pm

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

support

  • Posts: 3628
  • Joined: Mon Jun 02, 2003 3:47 pm
  • Location: Boston, MA

Re: Error from PHP file

PostTue Jul 31, 2018 2:37 pm

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
Offline

vikas

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

Re: Error from PHP file

PostTue Jul 31, 2018 3:27 pm

Sure, I have emailed the URL. Thanks.

Return to Plum DEV Q&A

Who is online

Users browsing this forum: No registered users and 1 guest

cron