呼叫者未连接到会议

发布于 2025-01-17 19:06:33 字数 1589 浏览 0 评论 0原文

我正在尝试使用 Twilio 通过一种对讲机连接工作人员(所有工作人员都获得 JWT 以使用 Javascript SDK 进行浏览器调用),为此我使用 Twiml 动词会议,当工作人员按下会议按钮时它向浏览器发送活动工作人员列表(除了发起会议的工作人员之外),我使用 callSid 作为会议的名称以使其唯一,并使用 CallResource 将每个工作人员放入会议中。

但是,列表中的工作人员开始听会议室的等待音乐,但呼叫者在连接打开后立即自动结束连接,甚至没有结束会议,我不知道代码有什么问题,我正在关注 https://www.twilio.com/docs/voice/twiml/conference

这是需要创建会议时调用的方法:

public VoiceResponse ConferenceTalk(List<string> recipients, string caller, string callSid)
{
    TwilioClient.Init(my_account_sid, my_auth_token);
    var confName = $"wt_{callSid}";

    foreach (var recipient in recipients)
    {
        CallResource.Create(
            url: new Uri($"{this.publicUrl}/Conference/WtConference/{confName}"),
            to: new Twilio.Types.Client($"client:{recipient}"),
            from: new Twilio.Types.Client(caller));
    }

    var response = new VoiceResponse();

    var dial = new Dial();
    dial.Conference(confName,
        startConferenceOnEnter: true,
        endConferenceOnExit: true);

    response.Append(dial);

    return response;
}

这是端点 CallResource 具有 url 属性的目标:

[HttpPost]
public TwiMLResult WtConference()
{
    var confName = Request.Url.Segments[Request.Url.Segments.Length - 1];
    var response = new VoiceResponse();
    var dial = new Dial();
    dial.Conference(confName);
    response.Append(dial);
    return TwiML(response);
}

I'm trying to use Twilio to connect workers through a kind of Walkie Talkie (all the workers get a JWT to make browser calls using the Javascript SDK), for this I use the Twiml verb conference, when the worker press the conference button in the browser it sends a list of the active workers (except for the one who started the conference), I use the callSid as the name of the conference to make it unique and the CallResource to put every worker into the conference.

However, the workers in the list start listening the wait music for a conference room, but the caller automatically end the connection as soon as it is open, it doesn't even ends the conference, I don't know what's wrong with the code, I'm following the documentation for conferences in https://www.twilio.com/docs/voice/twiml/conference

Here is the method that's called when a conference needs to be created:

public VoiceResponse ConferenceTalk(List<string> recipients, string caller, string callSid)
{
    TwilioClient.Init(my_account_sid, my_auth_token);
    var confName = 
quot;wt_{callSid}";

    foreach (var recipient in recipients)
    {
        CallResource.Create(
            url: new Uri(
quot;{this.publicUrl}/Conference/WtConference/{confName}"),
            to: new Twilio.Types.Client(
quot;client:{recipient}"),
            from: new Twilio.Types.Client(caller));
    }

    var response = new VoiceResponse();

    var dial = new Dial();
    dial.Conference(confName,
        startConferenceOnEnter: true,
        endConferenceOnExit: true);

    response.Append(dial);

    return response;
}

Here is the endpoint the CallResource target with the url attribute:

[HttpPost]
public TwiMLResult WtConference()
{
    var confName = Request.Url.Segments[Request.Url.Segments.Length - 1];
    var response = new VoiceResponse();
    var dial = new Dial();
    dial.Conference(confName);
    response.Append(dial);
    return TwiML(response);
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌︼了一个春 2025-01-24 19:06:33

我觉得发生这一切所花费的时间可能会导致您出现问题。 Twilio Voice SDK 可能不是这方面的最佳产品。我可能需要观看一段展示交互如何工作的视频才能完全致力于这一点。

与此同时,我可能会尝试通过在 API 调用中发送会议的 TwiML 来加快人们加入会议的速度,而不是等待 Webhook。例如:

        public VoiceResponse ConferenceTalk(List<string> recipients, string caller, string callSid)
        {
            TwilioClient.Init(my_account_sid, my_auth_token);
            var confName = $"wt_{callSid}";

            var outboundResponse = new VoiceResponse();
            var outboundDial = new Dial();
            outboundDial.Conference(confName);
            outboundResponse.Append(outboudDial);

            foreach (var recipient in recipients)
            {
                CallResource.Create(
                    twiml: outboundResponse,
                    to: new Twilio.Types.Client($"client:{recipient}"),
                    from: new Twilio.Types.Client(caller));
            }

            var response = new VoiceResponse();

            var dial = new Dial();
            dial.Conference(confName,
                startConferenceOnEnter: true,
                endConferenceOnExit: true);

            response.Append(dial);

            return response;
        }

我说 Twilio Voice 可能不是最适合此操作的,因为在 Twilio 后端,这会经历为拨打电话而构建的整个堆栈。出站呼叫的速率为每秒 1 个呼叫,因此这可能会减慢列表中的呼叫速度。

您可以考虑使用 Twilio Video SDK(您可以使用 Twilio 进行仅音频通话)视频产品)。为此,您需要能够触发每个工作人员加入一个房间,然后用于分发音频。每秒的通话次数没有限制,工作人员只需要连接到一个房间,您的应用程序就能够控制谁可以在任何时候通话。

I feel like the time all of this takes to happen might be causing your issues here. And the Twilio Voice SDK may not be the best product for this. I'd have to see maybe a video showing how the interaction works to fully commit to this.

In the meantime, I might try to speed up people joining the conference by sending the TwiML for the conference in the API call, not waiting for the webhook. e.g.:

        public VoiceResponse ConferenceTalk(List<string> recipients, string caller, string callSid)
        {
            TwilioClient.Init(my_account_sid, my_auth_token);
            var confName = 
quot;wt_{callSid}";

            var outboundResponse = new VoiceResponse();
            var outboundDial = new Dial();
            outboundDial.Conference(confName);
            outboundResponse.Append(outboudDial);

            foreach (var recipient in recipients)
            {
                CallResource.Create(
                    twiml: outboundResponse,
                    to: new Twilio.Types.Client(
quot;client:{recipient}"),
                    from: new Twilio.Types.Client(caller));
            }

            var response = new VoiceResponse();

            var dial = new Dial();
            dial.Conference(confName,
                startConferenceOnEnter: true,
                endConferenceOnExit: true);

            response.Append(dial);

            return response;
        }

I say that Twilio Voice might not be best for this because on the Twilio back end, this is going through a whole stack that is built for making phone calls. Outbound calls are made at a rate of 1 call per second, so that might be slowing the calling of your list down.

You could consider the Twilio Video SDK for this instead (you can make audio only calls with the Twilio Video product). For this you would need to be able to trigger each of workers joining a room that was then used to distribute the audio. There aren't limits on calls per second, workers would just need to connect to a room and your application would be able to control who could talk at any one time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文