英文:
making a direct phone call using Twilio on Node.js
问题
我在使用Node.js上的Twilio时遇到了一个直接拨打电话的问题,以下是我尝试过的代码:
...
client.calls
.create({
twiml: '<Response><Dial><+122*********</Dial></Response>',
to: '+122*********',
from: '+144444*******'
})
...
使用上述代码后,我发送请求后,接收者会收到来自发送者(+14444****)的电话,一旦接收者接听电话,他会接到来自不同号码的另一个电话,所以我有点困惑发生了什么情况。
英文:
i am having an issue making a direct phone call using twilio on Node.js,
bellow is what i have tried
...
client.calls
.create({
twiml: '<Response><Dial><+122*********</Dial></Response>',
to: '+122*********',
from: '+144444*******'
})
...
with the above code, after i sent the request, the receiver will get a phone call from the sender(+14444****) and once he picked up the call, he will then receive another call from different number so i am a bit confused on what is happening,
答案1
得分: 1
这是因为您两次发起呼叫,第一次是通过 calls.create()
,然后是通过 TwiML 节点 <Dial>
。您可以完全移除 Dial 节点,直接从 TwiML 指令开始:
client.calls
.create({
twiml: '<Response> <Say>你好</Say><Pause length="60" /></Response>',
to: '+122*********',
from: '+144444*******'
})
英文:
This happens because you create the call twice, the first time via the calls.create()
and then via the TwiML node <Dial>
. You can remove the Dial node entirely and start right away with the TwiML instructions:
client.calls
.create({
twiml: '<Response> <Say>Hi</Say><Pause length="60" /></Response>',
to: '+122*********',
from: '+144444*******'
})
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论