Twilio conferenceSid from callSid - twilio

I have been using Twilio with a node and Angular project to build a call centre. All the incoming and outgoing calls are made to conference call to make it easy to add participants for transfer call etc.
In the Angular project, I have been using Twilio device to initialise a connection to accepts calls. The parameters that I always receive from the clinet are from, to, callSid and accountSid. I need to find the conferenceSid to add a participant to the call. Is there a way I can get the conferenceSid with just the callSid?

You can use conference eventing to capture the ConferenceSID the participants are joining. However, not clear on the call flow of how your are connecting participants into the conference.
TwiML™ Voice: Conference - statusCallbackEvent

Related

How to handle issue with connecting participants in a twilio conference?

Generally when I do direct call via <Dial><Number> Twiml, I used to listen the ringing and network message if the caller is busy or not answering or switched off. Maybe that's because I had used answerOnBridge=true?
Now I am starting a call from web client, putting myself in a conference, then creates a REST call to the caller. At that time, I only get to listen the wait music of the conference since I am alone in the conference. Nothing happens when the caller doesn't pickup or hang up without answering, it just keeps playing the music. I am using REST call with url to link the conference but that only happens when the user picks up.
return client.calls
.create({
from: from,
to: to,
url: callbackUrl,
statusCallback: 'https://xx.m.pipedream.net/',
statusCallbackEvent: ['initiated',
'ringing', 'answered',
'completed']
});
I know I can use the statusCallback to get the status and broadcast a message probably, but is there any other way to make this feel more natural and get the real network message that we usually get when we call via cellphone? Thanks!
Note: I have intention to add or transfer to users, so I need to use conference.
Don't use the /Call resource, use the conference participants end-point (Create A Participant) to be able to listen to the call progress tones (earlyMedia).

Setting statusCallbackEvent on outbound calls with Voice SDK

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.

Is there any way to map a twilio call to the webhook that receives the call?

I am sending a call to a twilio number using twilio api, and in turn recording the sid of the call (e.g. CAb90f709e54017969776d842873311746). While the call is received in the webhook I have a different sid in the receiver end (e.g. CA8d85ac8d8b169de8b0509c8585c6aaed ). Is there any way to map the call sent to the call received ?
Twilio developer evangelist here.
Yes, you can! You should find that the call on the receiver end, which is the second or child leg of the call, has a parameter called ParentCallSid which will point back to the first leg of the call.
In your example, the CallSid will be CA8d85ac8d8b169de8b0509c8585c6aaed and the ParentCallSid will be CAb90f709e54017969776d842873311746.
Let me know if that helps at all.

Incoming Call Recording in Twilio with HOLD option

Suppose for an incoming call to a Twilio Number '+18XXXXXXXXXX' the call is forwarded to a client with name 'CLIENT'. Now there are two legs with Callsids 'CSid1' and 'CSid2'.
If the 'CLIENT' wants to hold the call, the Connection leg with Callsid 'CSid1' is redirected to a Music url. If the 'CLIENT' resumes the call, the call 'CSid1' is again redirected to the 'CLIENT' with new CallSid 'CSid3'.
Now, how to get the single recording url for the whole Incoming call (connection with CallSid 'CSid1').
Note: The recording url for connection with callsid 'CSid2' and 'CSid3' can be obtained by setting record verb in dial tag (Two recording urls).
Any other suggestions to achieve Incoming Call recording in Twilio with hold option is also welcome.
Twilio developer evangelist here.
If you want to record the whole call in one recording, including holds, then you may want to investigate using a <Conference>.
Once your original caller dials in, put them into a <Conference>, using <Dial> with the record attribute set. At the same time, use the REST API to make a phone call to the client which also lands them in the conference.
You can then use the Participants resource to hold and unhold the caller.
This would not redirect the caller, therefore giving you one recording URL.
Let me know if this helps.

how to handle call transfer with twilio?

I'am using twilio to set up a call between 2 people
I'd like to manage call transfer asked from one side (like when a dtmf key is pressed). The other side could listen to a prompt who could be "please wait while your call is being transfered"
Any chance to do that properly with twilio?
When both parties are connected, Twilio blocks execution of further verbs until the caller or called party hangs up. That's why it is not possible in regular way.
But you can hangupOnStar attribute to hangup the caller party. And set an action URL to continue next dial verbs.
Here is a detail answer:
Twilio call transfer from in-call

Resources