ColdFusion - Vonage Inboud 语音 API 调用 答案 Webhook CURL - ncco 对象的问题无法将多个响应发送到文本到语音

ColdFusion - Vonage Inboud voice api call Answer Webhook CURL - issue with ncco object can't send multiple response to text to speech

提问人:user3215061 提问时间:10/21/2023 更新时间:10/21/2023 访问量:40

问:

我成功地能够在我的 webhook 上接收 inboud 调用,它运行良好,我得到了以下文本的自动语音,它运行良好。但是我收到“意外的内容类型:文本/html;charset=UTF-8“。

<cfset ncco = '
{
        "action": "talk",
        "text": "Press 1, for maybe, and 2, for not sure, followed by the hash key.",
        "language": "en-US",
        "style": 6,
        "bargeIn": true
}'>
<cfhttp method="PUT" url="https://api.nexmo.com/v1/calls/#responsetxt.uuid#/talk" result="httpResponse">
        <cfhttpparam type="header" name="Content-Type" value="application/json" />
        <cfhttpparam type="header" name="Authorization" value="Bearer #jwtToken#" />        
        <cfhttpparam type="body" value='#ncco#' />
</cfhttp>

当我收到 inboud 并通过以下 ncco 时,它不起作用并且呼叫断开连接。但这适用于记录和转录的出站呼叫语音。

<cfset ncco = [
        {
            "action": "record",
            "eventUrl": ["https://example.com/virrtualcall/input.cfm"],
            "transcription":
            {
                    "eventMethod": "POST",
                    "eventUrl":["https://example.com.com/virrtualcall/input.cfm"],
                    "language": "en-US",
                    "sentimentAnalysis": "true"
            }
        },          
        {
                "action": "talk",
                "text": "Please let us know what is your problem",
                "language": "en-US",
                "style": 6,
                "premium": true,
                "bargeIn": true
        },
        {
                "action": "input",
                "type": [
                        "dtmf"
                ],
                "dtmf": {
                        "submitOnHash": true,
                        "timeOut": 10
                }
        },
        {
                "action": "talk",
                "text": "Thanks for your response, goodbye.",
                "language": "en-US",
                "style": 2
        }
]>

这是 oubound 呼叫与上面的 NCCO 配合得很好,我希望这个 NCCO 应该适用于入站呼叫。有人可以帮我解决这个问题吗?

<cfhttp method="POST" url="https://api.nexmo.com/v1/calls" result="httpResponse">
        <cfhttpparam type="header" name="Content-Type" value="application/json" />
        <cfhttpparam type="header" name="Authorization" value="Bearer #jwtToken#" />        
        <cfhttpparam type="body" value='{"to":[{"type":"phone","number":"#toNumber#"}],"from":{"type":"phone","number":"#fromNumber#"},"ncco":#serializeJSON(ncco)#}' />
</cfhttp>

谢谢

curl coldfusion 语音 coldfusion-8 vonage

评论

0赞 AndreasRu 10/22/2023
您将手动创建 json 刺痛,并将带有 serializeJSON 的对象注入到这些变量中。尝试仅创建和使用一个 cfml 结构,并使用 serializeJSON(myStruct) 将其输出到正文一次。
0赞 user3215061 10/23/2023
我之前已经尝试过这个选项。你能为我创建一个,以便我可以测试它吗?也许你的那个对我有用。提前致谢。

答: 暂无答案