Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Am I on the right track? (receive a call, attempt to forward to two other numbers simultaneously, if that fails, take a message) #2

Closed
balupton opened this issue Mar 10, 2012 · 2 comments
Labels

Comments

@balupton
Copy link

Hey Blake,

I've been trying to build the following:
http://forum.twilio.com/twilio/topics/is_this_possible_receive_a_call_attempt_to_forward_to_two_other_numbers_simultaneously_if_that_fails_take_a_message

And came up with the following code:
https://gist.github.com/2011413

Can you give it a quick skim and tell me if I am even on the right track, and provide any advice at all. No need to take longer than a few seconds if you don't want to, just want to know if I'm wasting my time or whether I'm rocking it up. Thanks mate :)

@bminer
Copy link
Owner

bminer commented Mar 10, 2012

Let me look through your code. :) I'll post back here shortly.

@bminer bminer closed this as completed Mar 10, 2012
@bminer
Copy link
Owner

bminer commented Mar 10, 2012

You are definitely on the right track here, but there are a few issues. Most of them are due to the fact that my documentation isn't all that great. :-/ So... thanks for bringing this to my attention.

A couple of things:

  • I clarified the documentation for the 'connected' and 'ended' call events. See issue docs: Clarify possible call status values #3 and updated README.md.
  • Checkout the documentation for Call.reject(). You cannot Call.say() and then Call.reject()
  • Once a call is done executing TwiML, it will hangup automatically. Your userCall will automatically hang-up since you did not put it on hold. To do this, just put it into an empty conference room and use waitURL for your hold music. When testing, be sure to set a time limit on your conference room just in case things go awry.
  • Also, BEWARE that you cannot do userCall.say() on line 73 of your Gist because of the async nature of your program. All TwiML generating functions simply queue TwiML for the Call object. What you actually need to do here is use the liveCb() function. This is a pretty common pitfall of this library, and I will provide additional documentation on this shortly. See issue docs: Clarify the use of TwiML-generating functions #4. Basically, whenever you call an async function inside of your 'connected' event, it is too late to call any TwiML functions on the Call object. If you want to execute TwiML later, you have to put the call on hold. Then, modify the live call using the liveCb() function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants