0

I have vxml file from which I am calling perl script, the perl script is very simple its just write on a text file. I am using voximal in asterisk to call the vxml file below is my vxml file.

<?xml version="1.0"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
<form>
    <block>
        <audio src="./audio/welcome.wav"/>
    </block>
    <record name="message" maxtime="30s" finalsilence="2s" dtmfterm="true">
    </record>

   <block>
        <submit next="test.perl" enctype="multipart/form-data"   method="post"/>
    </block>

</form>

perl file

#! /usr/bin/perl

use strict;
use warnings;
open(my $fh, '>', 'report.txt');
print $fh "My first report generated by perl\n";
close $fh;
print "done\n";

dialplan

[from-twilio]
exten =>  _+1NXXXXXXXXX,1,Answer(200)
exten =>  _+1NXXXXXXXXX,n,Wait(1)
exten =>  _+1NXXXXXXXXX,n,Voximal(file:///home/ubuntu/voximal/test.vxml)
exten =>  _+1NXXXXXXXXX,n,Hangup()

when I dial a number I able to hear the welcome audio after that perl file is not calling, I checked the log inside /var/log/voximal/debug.log & vxml.log it says : Aug 14 09:50:21.56|0x7f37cca62700||0|EVENT|0|2|content=Error: error.badfetch ,test.perl

I tried everything, script, subdialog, submit tag with perl, python, php. I don't know whats happening any help is appreciated please be elaborate as I am beginner to voximal & asterisk.

`

2 Answers2

2

While I have never used anything relating to VXML, it seems to me that you are using <submit> incorrectly:

5.3.8 submit element

The <submit> element is used to submit information to the origin Web server and then transition to the document sent back in the response. (emphasis mine)

I do not think "done\n" is a valid VXML document.

See also this example:

Our second example asks the user for a choice of drink and then submits it to a server script:

<?xml version="1.0" encoding="UTF-8"?>
<vxml xmlns="http://www.w3.org/2001/vxml" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://www.w3.org/2001/vxml 
   http://www.w3.org/TR/voicexml20/vxml.xsd"
   version="2.0">
  <form>
  <field name="drink">
     <prompt>Would you like coffee, tea, milk, or nothing?</prompt>
     <grammar src="drink.grxml" type="application/srgs+xml"/>
  </field>
  <block>
     <submit next="http://www.drink.example.com/drink2.asp"/>
  </block>
 </form>
</vxml>

A field is an input field. The user must provide a value for the field before proceeding to the next element in the form. A sample interaction is:

C (computer): Would you like coffee, tea, milk, or nothing?
H (human): Orange juice.
C: I did not understand what you said. (a platform-specific default message.)
C: Would you like coffee, tea, milk, or nothing?
H: Tea
C: (continues in document drink2.asp)
                 ^^^^^^^^

That is, invoking drink2.asp is expected to return a valid VXML document. It seems to me that a response like:

<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1" xmlns="http://www.w3.org/2001/vxml">
  <form>
    <block>
    <prompt>
      Thank you for calling. Goodbye.
    </prompt>
    </block>
    <exit/>
  </form>
</vxml>

might be what you need your Perl script to output.

For example, looking at this example, the server side script ends by sending a VXML document:

readfile("goodbye.vxml");

With absolutely no familiarity with VXML, Asterisk, or Voximal, I am 99% certain that your problem has nothing to do with Perl, but it is due to the fact that your script is not outputting a valid VXML document.

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
  • thanks, but i tried everything even though same demo examples given on voximal and other website nothing works. Same error bad.fetch – user3882060 Aug 14 '17 at 18:43
0

You need to capture the content returned by your script.

You can set the option to enable the interpreter debug. You will find in /var/log/voximal/content/files the content of each files.

Have a look to the /var/log/voximal/debug.log, you will find the parsing error of your drink2.asp

To enable the interpreter logs :

CLI> voximal debug interpreter

or

in /etc/asterisk/voximal.conf set debug=interpreter (to enable the file logging you need to restart the Asterisk)

Borja SIXTO
  • 119
  • 6