1 year ago

#360476

test-img

STF

Twilio two way voice from Browser Connect callee into active video room after navigating phone tree

I have an in-progress room where I would like one user on the browser to make an outbound two-way call to a third party. The user must navigate the third party's phone tree and once they have reached a live person transfer the call into the room. I'm currently having an issue because I can't seem to connect the callee into the video room. I am only able to connect the caller which is creating a duplicated participant in the video room. Is it possible to do this kind of functionality with Twilio?

I have tried several different Twiml combinations but all of them end up with the call getting hung up. or the wrong party transferred into the room

This is the initial response returned to the

var response = new VoiceResponse();
var dial = new Dial
{
    CallerId = _settings.FromNumber,
};
    var number = new Number
{
    PhoneNumber = model.PhoneNumber,
    StatusCallbackEvent = new []{Number
        .EventEnum.Initiated, Number.EventEnum.Ringing,Number.EventEnum
        .Answered, Number.EventEnum.Completed}.ToList(),
    StatusCallback = new Uri($"VoiceCallStatusCallBack"),
    StatusCallbackMethod = HttpMethod.Post
};
dial.Append(number);
response.Append(dial);

This works as expected; however, if I Add the Connect verb in the above time it will only connect the one the caller to the video room and disconnect the caller. Where I set up an action URL or just make it the next verb.

I also tried adding the party to the room through rest API. This just disconnects both calls. I have tried to redirect from here and just add it directly to the room, neither work

public async Task<string> AddThirdPartyToVideoRoom(VoiceCallTransfer model)
{
    TwilioClient.Init(_settings.ApiKey, _settings.ApiSecret, 
    _settings.AccountSid)
    var response = new VoiceResponse();
    var redirect = new Redirect();
    redirect.Url = new  
        Uri($"RedirectCallIntoRoomroomName={model.RoomName})");
    redirect.Method = HttpMethod.Post;
    response.Append(redirect);
    var twiMlResult = TwiML(response);
    var call = await CallResource.UpdateAsync(
        twiml: twiMlResult.Data,
        pathSid: model.CallSid);

    return call.Sid;
}
public TwiMLResult RedirectCallIntoRoom(string roomName)
{
    var response = new VoiceResponse();
    var connect = new Connect();
    connect.Room(roomName);
    response.Append(connect);
    var twiMlResult = TwiML(response);
    return twiMlResult;
}

c#

.net-core

twilio

twilio-click-to-call

twilio-video

0 Answers

Your Answer

Accepted video resources