自定义 Twilio 呼叫转发流程

huangapple go评论50阅读模式
英文:

Custom flow for twilio call forwarding

问题

我正在查阅Twilio语音API文档,但无法找到符合以下呼叫流程的解决方案。请推荐是否需要使用多个API组合来实现此流程。

以下是使用情况:

  1. 有一个呼入电话进来。我已设置了传入的Web URL,并在该URL上提供Twiml以使用call.create API拨打呼出电话。问题是,我想要播放一个twiml.play或twiml.say给被转发的接收方,以便他们知道来电者是谁。

  2. 如果接收方(被转发的人)将电话设置为忙线、不接电话或有语音信箱,那么系统应该向拨打传入电话到我的Twilio号码的主要呼叫者播放录音,告知所有代理都忙,请再次拨打,如果代理接听了被转发的电话,那么两者应该连接并进行对话。

请建议如何实现这种组合,因为我尽管阅读了这里的各种问题和答案,仍然找不到答案。

敬上,Aamer

英文:

I'm reviewing Twilio voice API documentation but unable to find a solution as per following call flow. Plz recommend that I have to use a combination of APIs to achieve the flow.

following is the use case.

  1. An inbound call comes in. I have the incoming web url set and on that URL I'm serving twiml to dial outbound call using call.create API. The issue is that I want to play a twiml.play or twiml.say to receiving party to whom call is being forwarded so that they may know who the caller is.

  2. If the receiving person (to whom call is being forwarded) makes the phone busy or don't pick the up phone or has a voice mail then system should play back recording to main call who dialled inbound call to my twilio number that all agents are busy plz call again and if the agent picks the forwarded call then both should connect and convers with each other.

Plz suggest how this combination can be achieved as I'm unable to find any answer despite reading various questions and answers here.

Regards,

Aamer

答案1

得分: 0

在浏览了 Twilio 文档后,我发现可以按以下方式开发此流程:

  1. 在有来电时,将调用分配给特定 Twilio 号码的入站操作 URL 的 Webhook。

  2. 在该特定 URL 中,有两个可用选项。可以选择将来电方加入会议电话,然后以等待音乐的形式将其放入那里,然后使用会议电话 API 来添加与会者。但是,在我的情况下,我需要向来电者2播放特定的问候语,因此,我没有将来电者1带入会议,而是使用 Twilio client.call API 创建了另一个呼叫,并使用了其 twiml 属性。以下是代码示例:

client.calls.create({
   twiml: `<Response><Play>https://abcxyz.com/static/media/agentgreet.mp3</Play></Response>`,
   to: agentId,
   from: calledNumber
)}

这样,当有人接听电话时,会播放自定义的问候语。实施上述操作的另一种方法是使用 twiml.dial() 函数,然后连续使用 dial.number() 函数,这也可以达到相同的效果,但更难处理。

英文:

After exploring the twilio documentation I have found that this flow can be developed in the following manner.

  1. In case of incoming call the webhook is invoked which is assigned to that specific twilio number against the incoming action url.

  2. In that specific url there can be two options which can be used. Either to take the incoming caller in a conference call and place them there with the wait music and then use the conference call Api to add participant in that conference. However, in my case I need to play a certain greeting to caller2 so therefore, instead of taking the caller1 to conference, I have created another call using twilio client.call api and used its twiml attribute. Code is given below:-

    client.calls.create({
    twiml: <Response><Play>https://abcxyz.com/static/media/agentgreet.mp3</Play></Response>,
    to: agentId,
    from: calledNumber
    )}

So in this way when someone pickups the call then a custom greeting is played.
Another way to implement above is to use twiml.dial() function and then dial.number() function subsequently which can also do the same but its more tricky to handle.

huangapple
  • 本文由 发表于 2023年6月12日 23:30:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/76458163.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定