我是voiceXML的新手,正在尝试使用evolution.voxeo.com运行简单的XML代码。根据their website,我们可以按多部分格式发布录制的音频。所以这是我的XML代码,无需记录元素即可正常运行。但是,当我添加记录元素时,我得到了错误。我收到错误的事实很奇怪,因为我在计算机上收到了实际的音频文件。

00089       6c51    02:55:21 AM     (http://65.29.170.122/, 1): Content is not allowed in prolog.
00090       6c51    02:55:21 AM     Exception: error.semantic XML parse error(s) occurred in: http://65.29.170.122/ (http://65.29.170.122/, 1): Content is not allowed in prolog. Dialog stack trace: State (Dialog) URL (Document) -------------- ------------------------------ ___state1 http://webhosting.voxeo.net/196324/www/favorite_color.vxml?session.callerid=dcdac2bd-fa98-4c20-9d8e-69b3080a04fd&session.accountid=196324&session.sessionid=a28b97484d31d027e5bc03b1295d6c51&session.parentsessionid=f75bf363646a3e7a993789c7915829f3&session.virtualplatform=Staging-DTMF&session.calledid=9991483369
00091       6c51    02:55:21 AM     =========================== An error occurred while executing the following dialog. Initial URL1: http://webhosting.voxeo.net/196324/www/favorite_color.vxml Initial URL2: null Initial URL3: null Current URL: http://webhosting.voxeo.net/196324/www/favorite_color.vxml?session.callerid=dcdac2bd-fa98-4c20-9d8e-69b3080a04fd&session.accountid=196324&session.sessionid=a28b97484d31d027e5bc03b1295d6c51&session.parentsessionid=f75bf363646a3e7a993789c7915829f3&session.virtualplatform=Staging-DTMF&session.calledid=9991483369 Calling Number (ANI): dcdac2bd-fa98-4c20-9d8e-69b3080a04fd Called Number (DNIS): 9991483369 Redirecting Number (RDNIS): "" State: ___state1 VoiceXML Browser Version: 14.0.80.83348 Date/Time: 2015/11/28 2:55:21.497 VoiceException: error.badfetch Could not compile document: http://65.29.170.122/ Dialog stack trace: State (Dialog) URL (Document) -------------- ------------------------------ ___state1 http://webhosting.voxeo.net/196324/www/favorite_color.vxml?session.callerid=dcdac2bd-fa98-4c20-9d8e-69b3080a04fd&session.accountid=196324&session.sessionid=a28b97484d31d027e5bc03b1295d6c51&session.parentsessionid=f75bf363646a3e7a993789c7915829f3&session.virtualplatform=Staging-DTMF&session.calledid=9991483369
00092       6c51    02:55:21 AM     TTS: Sorry, that content has an internal error.
00108       6c51    02:55:24 AM     ccxmlResult=event$.values=new Object();event$.values['errorReason']="Could not compile document: http://65.29.170.122/";
00109       29f3    02:55:24 AM     event: DIALOG.EXIT dialog="session.dialogs['6fc2a6164b0409492ec0eb817de5d3ae']" values="new Object()" _OOB="1" _sessionid="0" _vxmlsessionid="a28b97484d31d027e5bc03b1295d6c51" conferenceid=" undefined" connectionid="309bcf33edd83917d745b2fa78113e26" delay="0s" dialogid="6fc2a6164b0409492ec0eb817de5d3ae" eventid="cdff861c55a237ae925bf56c8aa94791" eventsource="6fc2a6164b0409492ec0eb817de5d3ae" eventsourcetype="dialog" hints="" name="dialog.exit" namelist="" sendid="sendid" target="f75bf363646a3e7a993789c7915829f3" targettype="ccxml"
00110       29f3    02:55:24 AM     matched transition at line 64 (start, dialog.exit, ) @ eventhandler (, statevar)
00111       29f3    02:55:24 AM     log: dialog failed to start! Reason=Could not compile document: http://65.29.170.122/
00112       6c51    02:55:24 AM
00113       29f3    02:55:24 AM     event: DIALOG.STARTED dialog="session.dialogs['179d220aeec29f81f359f95572050990']" conferenceid=" undefined" connectionid="309bcf33edd83917d745b2fa78113e26" dialogid="179d220aeec29f81f359f95572050990" eventid="e715debbda2732f83734a89d3f53ef24" eventsource="179d220aeec29f81f359f95572050990" eventsourcetype="dialog" name="dialog.started"
00114       29f3    02:55:24 AM     warning: event was not handled
00115       29f3    02:55:29 AM     Call Summary: status=success direction=in calledid=9991483369 callerid=dcdac2bd-fa98-4c20-9d8e-69b3080a04fd start=2015.11.28.02.55.13.257 end=2015.11.28.02.55.29.580 duration=16322
00116       29f3    02:55:29 AM
00117       29f3    02:55:29 AM     event: DIALOG.EXIT dialog="session.dialogs['179d220aeec29f81f359f95572050990']" values=" undefined" conferenceid=" undefined" connectionid="309bcf33edd83917d745b2fa78113e26" dialogid="179d220aeec29f81f359f95572050990" eventid="97edfbadf5c5298f682e96fc2ddb5685" eventsource="179d220aeec29f81f359f95572050990" eventsourcetype="dialog" name="dialog.exit"
00118       29f3    02:55:29 AM     matched transition at line 134 (vxmlerror, dialog.exit, ) @ eventhandler (, statevar)
00119       29f3    02:55:29 AM     action: EXIT _linenumber="135" expr=" undefined" namelist=""
00121       29f3    02:55:29 AM     SESSION_END: sessionStartTime=1448679313224241 sessionEndTime=1448679329584292 sessionLength=16360 sessionID=f75bf363646a3e7a993789c7915829f3 parentSessionID=0 accountID=196324 appID=514278

favorite_color.vxml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vxml PUBLIC "-//BeVocal Inc//VoiceXML 2.0//EN" "http://cafe.bevocal.com/libraries/dtd/vxml2-0-bevocal.dtd">
<vxml xmlns="http://www.w3.org/2001/vxml" xmlns:bevocal="http://www.bevocal.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0">
    <form scope="dialog">
        <record name="name" maxtime="5s" dtmfterm="true" beep="true">
            <grammar src="colors.grammar#Names"/>
            <prompt>Whats your name?</prompt>
            <filled>
                <if cond="name=='amir'">
                    <prompt>Hello <value expr="name" /> !
                    </prompt>
                </if>
                <submit next="http://65.29.170.122/" method="post" enctype="multipart/form-data" />
            </filled>
        </record>
        <field name="color" modal="false">
            <grammar src="colors.grammar#Colors"/>
            <prompt>Whats your favorite color?</prompt>
            <filled>
                <if cond="color=='blue'">
                    <prompt>Wrong!</prompt>
                    <disconnect />
                    <else />
                    <prompt>
                        <value expr="color" />
                  is fine. Good-bye.
                    </prompt>
                </if>
            </filled>
        </field>
    </form>
</vxml>

颜色语法
Colors [ red green yellow blue white black ]
Names [ amir uwm ]

这是我用来接收记录文件的node.js/express.js/multer代码
var express = require("express");
var bodyParser = require("body-parser");
var fs = require("fs");
var multer = require("multer");
var app = express();
app.set("view engine", "jade");
app.set("views", __dirname + "/views");
app.post("/", multer({
    dest: "./uploads/",
    rename: function (fieldname, filename) {
        return hashCode(filename);
    }
}));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
    extended: true
}));

app.get("/", function (req, res) {
    res.sendStatus(200);
});

app.post("/", function (req, res) {
    res.sendStatus(200);
});

app.listen(80, function(){
    console.log("listening ...");
});

function hashCode(str) {
    var hash = 0;
    if (str.length == 0) return hash;
    for (i = 0; i < str.length; i++) {
        char = str.charCodeAt(i);
        hash = ((hash << 5) - hash) + char;
        hash = hash & hash;
    }
    return hash >= 0 ? hash : -1 * hash;
}

这是我的电脑的屏幕截图
javascript - evolution.voxeo.com中的voiceXML,出现奇怪的错误-LMLPHP

最佳答案

对提交的http响应应该是下一个要处理的VoiceXML内容。我没有在您的内容中发现任何建议VoiceXML响应的内容,并且该错误与无法处理下一个文档有关。

10-07 13:45