2011-09-08 15:59
浏览 50

Twilio REST api顺序调用可能吗?

After a while of writing REST api and TwiML apps I had been trying to write a sequential Dialing app in REST api but after much errors and issues I am stumped. I had written a sequential dialing app in TwiML but writing the same app in REST is hell....

What I have been trying to do in REST api is create this program where a person A has a list of people B C D E F G H I J K, person A wants to send an SMS to a twilio number, Twilio would then call using REST api to the list of people one by one until one of them pick up. The Process goes like this:

    1) Person A text's Twilio number
    2) Twilio gathers its array of phone numbers of persons B C D E F G H I J K
    3) Twilio's REST api calls person B
    4) Person B does **NOT** pick up (busy or doesn't pick up so answering machine) so then REST api calls person C next
    5) Person C does **NOT** pick up (busy or doesn't pick up so answering machine) so then the REST api calls person D
    6) Person D **DOES** pick up and twilio **reads the SMS sent by person A and then hangs up**
    7) application ends, so person E F G H I J K are not called because one person picked up so **not everyone** had to be called

I am trying to make this in REST api but after hours of trying I have given up...My only question is: is this possible with REST api? if so how?

I have been able to make an app where I sms twilio, twilio calls back with REST api and reads me the SMS but sequential dialling is so different...

I have tried talking to Twilio staff but I have not been able to figure out a way to make the sequential calling work as I don't know what else to do....I have tried using StatusCallback and much more but now I am out of ideas.

图片转代码服务由CSDN问答提供 功能建议

经过一段时间编写REST api和TwiML应用程序后,我一直在尝试在REST api中编写顺序拨号应用程序但是 在经历了很多错误和问题后,我感到难过。 我在TwiML中编写了一个顺序拨号应用程序,但在REST中编写相同的应用程序是地狱....

我在REST api中尝试做的是创建一个人的程序 A有一个人BCDEFGHIJK列表,A人想要发送短信到twilio号码,然后Twilio会一个接一个地使用REST api调用人员列表,直到其中一人接听。 过程如下:

  1)Person A文本的Twilio编号
 3)Twilio的REST api呼叫人 B 
 4)B人确实**不**接听(忙或不接听这样的应答机)所以然后REST api呼叫C接下来
 5)C人确实**不**接听( 忙着或者没有接听这样的应答机)所以然后REST api呼叫人D 
 6)人D ** DOES **接听和twilio **读取A发送的短信然后挂断**  n 7)申请结束,所以没有人叫EFGHIJK,因为有一个人接受了**所以不是每个人都必须被称为

我试图制作 这在REST api中,但经过几个小时的尝试后我放弃了...我唯一的问题是:这是否可能与 REST api ? 如果是这样的话?

我已经能够创建一个应用程序,我发短信twilio,twilio用REST api回拨并读取我的短信,但顺序拨号是如此不同......

我曾尝试与Twilio工作人员交谈,但我无法找到一种方法来进行顺序调用工作,因为我不知道还能做什么....我尝试过使用StatusCallback 更多,但现在我没有想法。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • doufu5521 2011-09-09 14:30

    Yes, it is possible.

    Here's a rough outline of what needs to be done:

    SMS Script

    This is what you point the Twilio number's SMS to. It should take the Body parameter and store it to a database (because somehow you'll need to persist this over multiple requests). It will also need to grab the list of numbers that should be calls (presumably from a database or a common config file).

    Once the body is stored, the SMS script should initiate a call to the first number on the list with the 'Redial Script' as the StatusCallback, and the 'Message' script as the Url.

    Add an id parameter to the StatusCallback and the Url (using the query string should be fine), so those scripts can identify the message that should be played.

    Redial Script

    This handles working through the list, it should check the CallStatus to see if the call was answered. If it was, then simply exit. If not, it works through the list of numbers (again, pulled from a database or common config file) until it matches the To parameter to a nubmer in the list.

    Once that match is made, the script should initiate a call to the next number on the list, again using the 'Redial Script' as the StatusCallback, and the 'Message' script as the Url passing the message id to both scripts as a parameter.

    Message Script

    This is the script Twilio requests when the call is answered, it simply checks the id parameter, pulls the message from the database, and reads it.

    Note that using a database isn't necessary you could pass the full message instead of an id. You could also replace the message script with a Twimlet.

    解决 无用
    打赏 举报

相关推荐 更多相似问题