I have a use case where I want to forward a call from A to C. Here if the call is already forwarded to some number i.e A to B, then I need to disable the current forwarding(i.e A to B) and then enable the new call forwarding(i.e A to C). But the new forwarding should start only if the disable call worked. I am using twilio webhook call to identify the call status. The approach I have followed is, in the method to which webhook sends response, I am checking the status of call. So when its completed, I try to find the Phone A from my apps database using call_Sid. I am storing call_Sid against the phone number that is to be forwarded. But here is the main problem.
Now when I receive status as completed for disabling I need the number to which I need to forward the call to. How should I get this new number to be passed into this method which handled twilio webhook response.
Please let me know how to achieve this.
hey this issue look like previous one on Twilio call forwarding
someone facing issue with twilio call forwarding and got its solution:
It is not possible to forward calls to a Twilio number and have that number call you back if you've set up call forwarding on your phone.
Related
I am working with Twilio Voice JS SDK. Every incoming calls are converted to conferences. I can do this.
If there is a second incoming call, I want a user can answer it.
But if I invoke call.accept(), the first call will disconnect.
So I tried to hold the first call by update ParticipantResource.Update() with hold = true. This doesn't help. I listen hold music from browser and the first call is still active.
Is it possible to answer the 2nd incoming call/conference?
Is there any way to change what events trigger the status callback? Normally you can use statusCallbackEvent but I can't seem to find a way to make this work for the Voice SDK's leg of the call. It works fine on the call leg of the outbound participant, but not the Voice SDK's call leg. I only get completed status event for this leg (and I also can get ringing from the called action url).
Things I tried without success:
Updating the call using the REST api to set statusCallbackEvent to initiated ringing answered completed when the outbound call starts
Setting statusCallbackEvent as an outbound parameter on the Voice SDK's token (in PHP you can set custom parameters using $clientToken->allowClientOutgoing(...) but it seems normal parameters cannot be modified)
I really wish you could set this on the TwiML Application so that any numbers calling out with that application set will just automatically use your set events. That or let me set the parameters on the client's token.
One way to fix this is just to poll for the information but that is an ugly hack and isn't real time.
Twilio developer evangelist here.
I don't think you can do what you're asking for here, but for good reason.
When you are placing the call from the Voice SDK, that call leg is then between the application and Twilio. You know the call was "initiated", because you started it. There is no "ringing" because Twilio is not a phone and won't ring. You know it is "answered" because a request is made to your voice URL defined by the TwiML app. And finally, you do get the "completed" event.
As you say, you do get the events for the outbound leg of the call from Twilio to another phone number.
I have a somewhat peculiar situation for which I can't find documentation: I have an application that will use the Twilio API to initiate a voice call from phone number X (my number) to another one. The problem is that number X could already be in the middle of another call, one that was not initiated with Twilio (so my application wouldn't know about it). Would Twilio detect this, and send an error, or try to initiate the call anyway? If the former, what would the error be? I have found the error code for "callee busy", but nothing similar to "caller busy".
Alternatively, is there an API call I could make before initiating the call to make sure number X is available and not in another call?
Twilio numbers can have multiple calls associated with them, so there would be no error id the Phone X was on an existing call (since phone numbers can be routed however you choose). You can set the outbound CallerID to be another Twilio number or a verified callerID (but if they call that verified callerID back, it wont go back to Twilio but the carrier/business owning that number).
Once the dialed party answers after making the outbound API call, you tell Twilio how to route the other piece (who to connect the answering party to) via the URL parameter hosting the Twilio Markup Language (TwiML).
There is an API call and example for, Read multiple Call resources and filter by call status and phone number (Code Example), you could query before making your outbound call (assuming you always map inbound calls to the same endpoint) or routing your inbound call (which probably makes more sense if you want to re-route to another destination who can answer the call).
The status of this call. Can be: queued, ringing, in-progress, canceled, completed, failed, busy or no-answer.
I'm experimenting with Twilio and I'm confused a bit by the ultimate status of my calls.
Here's what I'm doing. I'm making a call to a Twilio Phone Number which is hooked into an application endpoint. The app makes a database record of the call and then uses Twiml to make a secondary call out to another phone. After the call is complete, the call record is updated with data retrieved from Twilio then a secondary call record is created from the call in my account where its parent_call_sid is my original call's sid.
My issue is, if I call the Twilio Number but let the Twiml Dial timeout, the child call status ends up being 'completed' instead of 'no-answer'.
My question is why is this happening? Do I need to configure how I dial out differently in order to receive the appropriate status for my calls?
UPDATE:
This has been resolved. The issue was voicemail picking up before Twilio's default timeout of 30 seconds ended the call, resulting in a 'completed' status. By reducing the timeout Twilio was able to end the call with 'no-answer' before the voice mail picked up.
The issue was the timeout was long enough for the voice mail to pick up, which does not count as no-answer. Reducing the Timeout so that Twilio ends the call before voice mail answers correctly results in a no-answer status.
I'm running into a problem with an app that I'm building that I'm a little stuck on.
I have an iOS app (handles initiating the call via Twilio SDK) that communicates with a Ruby on Rails back-end (handles the Twilio server side implementation) to enable communication between the iDevice and the phone number being called.
The issue I'm having is that when a call is initiated accidentally (user error or misunderstanding how the app works) and the user goes to terminate the call Twilio has already received the request to create the call and it still goes through.
I've tried disabling the TCConnection and the TCDevice using their respective disconnect methods ("disconnect" and "disconnectAll"), but I'm still seeing the call go through (phone number being called still receives the call from the Twilio side of things). I haven't tried anything on the server side of things because I'd like to avoid building a set of "oh &$^$%" protocols if I can avoid it.
Has anyone experienced this before? Does anyone have any suggestions? Is there anyway to terminate calls made accidentally?
Thanks in advance!
Checking back in to share what I've discovered after reaching out to Twilio support in the event anyone finds this in the future.
From Twilio support:
For canceling a call, you can use the REST API to modify the live call and set the Status to "completed", which will cancel a ringing call and end an established call:
https://www.twilio.com/docs/api/rest/change-call-state
So, in short, build some "oh #^%$*" protocols that you can ping as necessary to actively terminate any call that you need to. Not ideal, but the options are limited.