Twilio call transfer from in-call

前端 未结 2 1042
一生所求
一生所求 2021-01-06 07:36

I\'m not finding a definite answer from the Twilio docs on this. I\'m trying to build a phone system that can place the other party on hold while in-call and only from the p

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-06 07:45

    Twilio evangelist here.

    This sounds like it might be a good place to use some s.

    Lets define the actors in your scenario: Agent1, Agent2, Field.

    Lets say that Field calls Agent1. Instead of connecting the two directly with a you could Field into a (lets call it ConferenceA), then use the REST API to initiate an outbound call to Agent1. When they answer them into the same . The system will need to grab the CallSid's of both Agent1 and Field, as well as the Sid of the , persist them in some type of storage to use later.

    Using in this scenario gives you more flexibility to manipulate each leg of the call independent of the other than you would have if you use to connect Field and Agent1.

    So now Agent2 calls Field. Agent2 would go through the same process, just in reverse. Agent2 would get dialed into a (lets call it ConferenceB) and your system would use the REST API to call Field. When Field answers they get ed into the same conference as Agent2. Again, the system will need to grab the CallSid's of both Agent2 and Field, as well as the Sid of the , persist them in some type of storage to use later.

    Now, Field needs a way to tell the system to connect Agent2 with Agent1. To do that you can utilize the s hangupOnStar attribute in the TwiML you hand Twilio when you dial Field into the ConferenceB. The verb would look something like:

    
        ConferenceB
    
    

    hangupOnStar tells Twilio to disconnect the caller (Field) from whoever they ed (the conference), but still makes a request to the URL defined in the verbs action attribute. That is important because when Field needs to tell the system to redirect Agent2 into the ConferenceA with Agent1, and the request to the URL in s action attribute gives the system the opportunity to prompt Field to see if thats what he wants to do. So you might have Twilio execute some TwiML like this:

    
        
            Press 1 to connect this caller to another
        
    
    

    If Field presses one, the system (who knows all of the CallSids for all of the parties involved here, and the conference sids), can use the REST API to redirect Agent2 out of the ConferenceB and into ConferenceA.

    It makes for a bit more complicated of a system, but it should work for you.

    Hope that helps

提交回复
热议问题