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 Parsing Vxml-Servlet

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

phani2223
Posts: 13
Joined: Tue Aug 23, 2011 10:51 am

Error Parsing Vxml-Servlet

Post by phani2223 »

Hi,

When i submit like below..
The RecordComment is receiving Null value in sessionId..
Please help.
Because i want to save this recording as sessionId.wav....

<?xml version="1.0" encoding="UTF-8" ?>
<vxml version="2.1">
<var name="sessionId" expr="''"/>
<var name="vComment" expr=""/>
<property name="voicename" value="mel"/>
<property name="voicegender" value="male"/>
<form id="record_comment">
<record name="feedback" beep="true" maxtime="120s"
finalsilence="5s" dtmfterm="true" type="audio/x-wav">
<prompt timeout="5s">
Please Give us Comment on this property...Record a message after the beep..Press any key when you are done...
</prompt>
<noinput>
I didn't hear anything, please try again.
</noinput>
</record>

<field name="confirm">
<grammar type="application/srgs+xml" root="ROOTrec" mode="voice">
<rule id="ROOTrec">
<one-of>
<item>Yes</item>
<item>No</item>
</one-of>
</rule>
</grammar>
<!--<grammar>
Yes|No
</grammar>-->
<prompt>
Your message is <audio expr="feedback"/>.
</prompt>
<prompt>
To keep it, say yes. To discard it, say no.
</prompt>
<filled>
<if cond="confirm=='Yes'">
<assign name="sessionId" expr="session.id"/>
<submit next="http://knowtate.servehttp.com/knowtate/ ... ordComment" method="post" namelist="sessionId feedback" enctype= "multipart/form-data"/>
</if>
<clear/>
</filled>
</field>
</form>
</vxml

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

Re: Error Parsing Vxml-Servlet

Post by support »

Hi,

The following example code should help you in saving a recording file with the session ID:

makerecording.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
?>
<vxml version="2.0">
<var name="sessionid" expr="session.id"/>
  <form>
    <record name="msg" beep="true" maxtime="10s"
    finalsilence="4000ms" dtmfterm="true" type="audio/x-wav">
      <prompt timeout="5s">
        Record a message after the beep.
      </prompt>
      <noinput>
        I didn't hear anything, please try again.
      </noinput>
    </record>

  <field name="confirm">
    <grammar>
      Yes|No
    </grammar>
    <prompt>
      Your message is <audio expr="msg"/>.
    </prompt>
    <prompt>
      To keep it, say yes. To discard it, say no.
    </prompt>
    <filled>
      <if cond="confirm=='Yes'">
        <submit next="http://mightyserver.com/saverecording.php" namelist="msg sessionid"
        method="post" enctype="multipart/form-data"/>
      </if>
      <clear/>
    </filled>
  </field>
  </form>
</vxml>
saverecording.php:

Code: Select all

<?php
echo "<?xml version=\"1.0\" encoding=\"latin-1\"?>";
?>

<!DOCTYPE vxml SYSTEM "file:/DTD2304.dtd">

<vxml version="2.0">
  <form id="greeting">
    <block>

<?php
  if (isset($_FILES['msg'])) {
    echo "<prompt bargein=\"false\">found the audio attachment</prompt>\n";
  }
  if (isset($_FILES['msg']) && is_uploaded_file($_FILES['msg']['tmp_name'])) {
    move_uploaded_file($_FILES['msg']['tmp_name'],"temp.ul");
    $tempsessionid = $_POST[sessionid];
    $tempsessionid2 = explode (';', $tempsessionid);
    $sessionid = implode($tempsessionid2);
    $cmdline = `/usr/local/bin/sox -t ul -r 8000 temp.ul $sessionid.wav`;
    unlink("temp.ul");
    echo "<prompt bargein=\"false\">Audio saved as <say-as
    type=\"acronym\">$sessionid</say-as> dot wave.</prompt>\n";
  } else {
    echo "<prompt bargein=\"false\">Audio not saved.</prompt>\n";
  }
?>

     </block>
  </form>
</vxml>
Hope this helps.

Regards,
Plum Support

phani2223
Posts: 13
Joined: Tue Aug 23, 2011 10:51 am

Re: Error Parsing Vxml-Servlet

Post by phani2223 »

Hi,

I am sorry the example you have given not help us..
Becuase we are using java-servlets..
So PHP is again new technology..

As i posted my vxml page call to servlete RecordComment is receiving recording comment(feedback) but not sessionId.It shown as nulll.

I tried several options to send by URL as well ... as below

<var name="clientUrl1"
expr="'http://knowtate.servehttp.com/knowtate/ ... ?feedback=' + feedback + '&sessionId=' + session.id "/>
<goto expr='clientUrl1'/>


Here i am able to see sessionId sending but not feedback the following error it appears..

HTTP/1.1 505 HTTP Version Not Supported - http://knowtate.servehttp.com/knowtate/ ... ?feedback=[object __SBjsiContent]&sessionId=000001;032;1315338672DocumentParser::FetchBuffer - could not open URL: http://knowtate.servehttp.com/knowtate/ ... ?feedback=[object __SBjsiContent]&sessionId=000001;032;1315338672DocumentParser::FetchDocument - exiting with error result 2errno: 203 uri http://knowtate.servehttp.com/knowtate/ ... ?feedback=[object __SBjsiContent]&sessionId=000001;032;1315338672

Please Help

Thanks,
Phani.

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

Re: Error Parsing Vxml-Servlet

Post by support »

Hi phani,

Unfortunately, we're mostly a PHP shop here and aren't as familiar with using java-servlets as you are using for your code.

The PHP code examples we have constructed demonstrate how you can send the session ID and the call recording to your script (shown in makerecording.php). In saverecording.php, we demonstrate how you can save your wav file with the session ID within the file name by removing the semicolons in the session ID and then putting it all back together to construct the file name.

Regards,
Plum Support

phani2223
Posts: 13
Joined: Tue Aug 23, 2011 10:51 am

Re: Error Parsing Vxml-Servlet

Post by phani2223 »

Hi,

I am sorry that is not my issue..

My issue is i cannot send sessionId and feedback(recording) to some servlet...

And my last post is different way to request the servlet... and i have posted the plum log error in that.

Please help in that regard.

Phani.

phani2223
Posts: 13
Joined: Tue Aug 23, 2011 10:51 am

Re: Error Parsing Vxml-Servlet

Post by phani2223 »

Hi,

I didn't understand your reply... I am sorry.

Please reply for the request..

Phani...

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

Re: Error Parsing Vxml-Servlet

Post by support »

Hi Phani,

We changed the location of the submit tag to point to a test script.

Code: Select all

<submit next="RecordComment.php" method="post" namelist="sessionId feedback" enctype="multipart/form-data"/>
where the code for RecordComment.php was simply:

Code: Select all

<?php
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
?>

<vxml version="2.0">
  <var name="sessionid" expr="'<?= $_POST['sessionId'] ?>'"/>
  <form>
    <block>
      <prompt>
	The session id is <value expr="sessionid"/>.
      </prompt>
    </block>
  </form>
</vxml>
Putting a test call into the modified script, we found that the session ID was properly sent to RecordComment.php. Looking through the call logs we found:

Code: Select all

VXI::var_element(name="sessionid" expr = "'000025;000;1315406396'")
It appears that the VXML code you posted is properly working for what you are attempting to do.

Regards,
Plum Support

phani2223
Posts: 13
Joined: Tue Aug 23, 2011 10:51 am

Re: Error Parsing Vxml-Servlet

Post by phani2223 »

Hi,

Thanks, for your suggestions...

How can i concatenate session id to feedback(recording)value and send through submit as single argument in name list...

Please help,

Thanks,
Phani.

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

Re: Error Parsing Vxml-Servlet

Post by support »

Hi Phani,

It is not possible to concatenate the session ID to the recording. By doing this concatenation it is possible to pull the session ID from the single variable, however, the audio file will not be properly submitted to your server. When the application fetches your script:

Code: Select all

DocumentParser::FetchDocument(RecordComment.php)
Posting binary content "feedback" of size 30766 and type "audio/x-wav"
Posted form data is multipart encoded
Attempting to fetch http://mightyserver.com/RecordComment.php
it submits the recording. If you attempt this concatenation it will not send the recording.

Code: Select all

DocumentParser::FetchDocument(RecordComment.php)
Posted form data is multipart encoded
Attempting to fetch http://mightyserver.com/RecordComment.php
When attempting to access the recording on the far-end, you will only have a filename similar to:

Code: Select all

[object __SBjsiContent]
Hope this helps.

Regards,
Plum Support

phani2223
Posts: 13
Joined: Tue Aug 23, 2011 10:51 am

Re: Error Parsing Vxml-Servlet

Post by phani2223 »

Hi,

Thanks for suggestions..

When attempting to access the recording on the far-end, you will only have a filename similar to:
Code: Select all
[object __SBjsiContent]


I didnot understand please explain with example..

Thanks,
Phani.

phani2223
Posts: 13
Joined: Tue Aug 23, 2011 10:51 am

Re: Error Parsing Vxml-Servlet

Post by phani2223 »

Hi,

I used to get this error in plum log when try to call servlet as below

Servlet call....
<var name="clientUrl1"
expr="'http://knowtate.servehttp.com/knowtate/ ... ?feedback=' + feedback + '&sessionId=' + session.id "/>
<goto expr='clientUrl1'/>


Here i am able to see sessionId sending but not feedback the following error it appears..

HTTP/1.1 505 HTTP Version Not Supported - http://knowtate.servehttp.com/knowtate/ ... ?feedback=[object __SBjsiContent]&sessionId=000001;032;1315338672DocumentParser::FetchBuffer - could not open URL: http://knowtate.servehttp.com/knowtate/ ... ?feedback=[object __SBjsiContent]&sessionId=000001;032;1315338672DocumentParser::FetchDocument - exiting with error result 2errno: 203 uri http://knowtate.servehttp.com/knowtate/ ... ?feedback=[object __SBjsiContent]&sessionId=000001;032;1315338672

What is this meat for "object __SBjsiContent" if this resolves my job done..

Thanks,
Phani.

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

Re: Error Parsing Vxml-Servlet

Post by support »

Hi Phani,

The "[object __SBjsiContent]" is an indication that you are attempting to access an object as a string. The only way to submit an audio file object is to include it in the namelist attribute of either a submit or subdialog tag.

Regards,
Plum Support

phani2223
Posts: 13
Joined: Tue Aug 23, 2011 10:51 am

Re: Error Parsing Vxml-Servlet

Post by phani2223 »

Hi,

Could you help me out how can i send audio file object through expr URL...
Becuase in this notation i can see the sessionID passing but not feedback(audio content)..

Thanks,
Phani.

phani2223
Posts: 13
Joined: Tue Aug 23, 2011 10:51 am

Re: Error Parsing Vxml-Servlet

Post by phani2223 »

Hi,

I am getting lots of SPAM messages in reply..I thought i am getting suggestions from support...

Phani.

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

Re: Error Parsing Vxml-Servlet

Post by support »

Hi Phani,

The only way to submit an audio file object is to include it in the namelist attribute of either a submit or subdialog tag. It cannot be passed via the expr attribute.

Regards,
Plum Support

Post Reply