【问题标题】:How to list call recordings in Nexmo?如何在 Nexmo 中列出通话录音?
【发布时间】:2020-06-16 23:10:53
【问题描述】:

我正在使用 Nexmo 开发语音助手。 我使用 Node-RED 构建包含记录节点的 NCCO 对象。

在 Nexmo 提供的教程中,例如 Build Your Own Voicemail With Node-RED and the Nexmo Voice API 直接下载录音到本地机器。

就我而言,不想立即通过 node-red 下载音频文件,而是让 Nexmo 存储我的音频并稍后通过例如一个 Python 脚本。

在文档中它说“注意:录制完成后,Nexmo 会将其存储 30 天,然后自动删除”

很遗憾,我找不到任何关于音频在我的 Nexmo 帐户中的存储位置以及如何列出 Nexmo 应用程序的所有录音/录音 url 的参考资料。

感谢您的帮助。

妮娜

【问题讨论】:

    标签: audio node-red recording nexmo


    【解决方案1】:

    目前无法从 Nexmo 获取录音列表。

    您可以改为从recording webhook 捕获 API 响应并记录它。
    稍后,当您准备好下载它们时,将其读回get recording 节点。

    如果您将debug 节点连接到/recording webhook,您可以看到消息对象的结构。

    payload: object
       start_time: "2020-03-04T13:06:40Z"
       recording_url: "https://api.nexmo.com/v1/files/516f74a8-abcd-4270-b553-2582650a2e5a"
       size: 26478
       recording_uuid: "dbd3cb68-0a3a-4c89-bc2d-7c38abd2c497"
       end_time: "2020-03-04T13:06:47Z"
       conversation_uuid: "CON-93ef5eef-gg92-49ae-9e01-f3c782390dd9"
       timestamp: "2020-03-04T13:06:47.733Z"
    

    您需要recording_url 来下载录音,但最好将conversation_uuid 放在手边,因为您可以根据此查找 FROM 和 TO 编号。

    我将在下面使用 Google 表格留下一个可能的解决方案,以替代 /recording 网络挂钩。将其从剪贴板导入您的编辑器,并查看评论节点以获取说明:)

    [{"id":"9198a326.cfb3e","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"49dc7444.625ff4","type":"http in","z":"9198a326.cfb3e","name":"","url":"/record","method":"post","upload":false,"swaggerDoc":"","x":210,"y":380,"wires":[["21594561.f44c1a","47021216.a25afc","dc814f00.17fa7"]]},{"id":"47021216.a25afc","type":"http response","z":"9198a326.cfb3e","name":"","statusCode":"","headers":{},"x":610,"y":380,"wires":[]},{"id":"5371302c.ee3688","type":"getrecording","z":"9198a326.cfb3e","creds":"10de89c6.d1db3e","filename":"recordings/{{msg.payload.from}}_{{msg.payload.timestamp}}.mp3","x":1260,"y":580,"wires":[["6d03a7ed.2a6d7","38dd6acf.b46cae"]]},{"id":"21594561.f44c1a","type":"debug","z":"9198a326.cfb3e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":450,"y":320,"wires":[]},{"id":"bcb08110.c2f7c","type":"e-mail","z":"9198a326.cfb3e","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"","dname":"","x":1690,"y":580,"wires":[]},{"id":"6d03a7ed.2a6d7","type":"debug","z":"9198a326.cfb3e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1490,"y":500,"wires":[]},{"id":"38dd6acf.b46cae","type":"change","z":"9198a326.cfb3e","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"'Voicemail from ' & msg.req.query.from","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1500,"y":580,"wires":[["bcb08110.c2f7c"]]},{"id":"c8fadcb1.13aca","type":"inject","z":"9198a326.cfb3e","name":"Download/Send recordings in email","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":280,"y":580,"wires":[["af254a75.791888"]]},{"id":"f9706ea5.ea66","type":"change","z":"9198a326.cfb3e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t    \"start_time\": (msg.payload)[0],\t    \"recording_url\": (msg.payload)[1],\t    \"size\": (msg.payload)[2],\t    \"recording_uuid\": (msg.payload)[3],\t    \"end_time\": (msg.payload)[4],\t    \"conversation_uuid\": (msg.payload)[5],\t    \"timestamp\": (msg.payload)[6],\t    \"from\": (msg.payload)[7]\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1060,"y":580,"wires":[["5371302c.ee3688"]]},{"id":"9f017b25.db6fe8","type":"debug","z":"9198a326.cfb3e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":970,"y":440,"wires":[]},{"id":"dc814f00.17fa7","type":"change","z":"9198a326.cfb3e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[payload.start_time, payload.recording_url, payload.size, payload.recording_uuid, payload.end_time, payload.conversation_uuid, payload.timestamp, req.query.from]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":440,"wires":[["c8118876.f668e"]]},{"id":"521189f7.2f6d8","type":"debug","z":"9198a326.cfb3e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":830,"y":760,"wires":[]},{"id":"deba2a63.a4f4d","type":"split","z":"9198a326.cfb3e","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":830,"y":580,"wires":[["f9706ea5.ea66"]]},{"id":"c8118876.f668e","type":"GSheet","z":"9198a326.cfb3e","creds":"90e07aa9.34a6","method":"append","action":"","sheet":"1mmXhj40aeSooxmtku3ma4auLyrHhJO8xCSQsklZ1_BU","cells":"Sheet4!A1","name":"","x":730,"y":440,"wires":[["9f017b25.db6fe8"]]},{"id":"af254a75.791888","type":"GSheet","z":"9198a326.cfb3e","creds":"bd7b95fd.c3dee8","method":"get","action":"","sheet":"1mmXhj40aeSooxmtku3ma4auLyrHhJO8xCSQsklZ1_BU","cells":"Sheet4!A:H","name":"","x":610,"y":580,"wires":[["521189f7.2f6d8","deba2a63.a4f4d"]]},{"id":"335f8e96.7242ba","type":"comment","z":"9198a326.cfb3e","name":"? Instructions","info":"1. Install `node-red-contrib-google-sheets` package and restart Node-RED.\n2. Add _creds_, _SpreadsheetID_ and _Cells_ in the **GSheet** nodes \n3. Add your Nexmo credentials in the **Get Recording** node\n4. Configure **email** node or add download functionality","x":220,"y":180,"wires":[]},{"id":"10de89c6.d1db3e","type":"nexmovoiceapp","z":"","name":"New Voice App"},{"id":"90e07aa9.34a6","type":"gauth","z":"9198a326.cfb3e"}]
    

    【讨论】:

    • 感谢您的解释和代码sn-p!
    • 与您的流程类似,我打算将录制信息对象存储到 Cloudant 数据库中,以便稍后下载。现在我看到了问题,记录 URL 中的调试节点在调试控制台中没有显示任何内容。似乎没有任何内容发布到 /record。澄清一下,我没有在 Nexmo 中对对话流进行建模,而是使用“连接”节点将呼叫连接到 SIP 中继。如果我使用 SIP,录制是否无法正常工作?你对此有什么想法吗?
    • 没关系!我们解决了这个问题,不仅将 /record 设置为记录节点的 POST 路由,而且将整个 https://..../record
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-23
    • 2019-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多