简体   繁体   English

Asterisk AsterNET如何从停车到排队?

[英]Asterisk AsterNET How to move from parking to queue?

Im using C# AsterNET to manage my Asterisk commands and events, and now I do have a new feature to work on. 我使用C#AsterNET管理我的Asterisk命令和事件,现在我确实有一个新功能可以使用。

This is simple (I think) but I'm stucked right now. 这很简单(我认为),但我现在仍处于困境。

Scenario 情境

I do have two queues, 8100 and 8300, and 2 extensions being 8101 and 8301. When I do have a call from PSTN it is driven to 8100 queue. 我确实有两个队列8100和8300,​​两个分机分别是8101和8301。当我确实有来自PSTN的呼叫时,它将被驱动到8100队列。 When the 8101 extension become available I do add this extension to the 8100 queue, so the calling PSTN device will be redirected to this 8101 extension. 当8101分机可用时,我确实将此分机添加到8100队列中,因此主叫PSTN设备将被重定向到该8101分机。

Everything is working fine till here. 到这里一切都很好。

Sometimes I do park the calling device and let 8301 knows it using my app, so 8301 user using the same app can send a command asking for that parked channel to be redirect to his SIP Phone. 有时我确实驻留了呼叫设备,并使用我的应用程序让8301知道了它,因此使用同一应用程序的8301用户可以发送命令,要求将该驻留的信道重定向到他的SIP电话。 Also working fine. 还可以。

Scope 范围

Now I want to have some feature to let 8101 transfer this calling device to my other queue, the 8300. So I just tried to reuse my parked method and redirect method 现在,我想要一些功能让8101将此呼叫设备转移到我的另一个队列8300中。因此,我只是尝试重用我的驻留方法和重定向方法

internal void Park(string channel, int parkTimeout)
{
    ParkAction pa = new ParkAction(channel, channel, parkTimeout.ToString());

    ManagerResponse mr = manager.SendAction(pa);
}

internal void RedirectFromParking(string channel, string exten)
{
    RedirectAction ra = new RedirectAction
    {
        Priority = 1,
        Context = "default",
        Channel = channel,
        Exten = exten
    };

    ManagerResponse mr = manager.SendAction(ra);
}

Park("abc123456", 10000);

RedirectFromParking("abc123456", "8300")

Issue 问题

I'm parking fine but when I try to redirect from parking to my queue the calling device is just disconnected and the connection is lost. 我的停车很好,但是当我尝试从停车重定向到我的队列时,呼叫设备刚刚断开,连接断开了。

How can I transfer a parked call to my queue or transfer it directly to the queue (would be better) without needing to originate? 如何将驻留的呼叫转移到我的队列中或直接将其转移到队列中(更好)而无需发起?

只需保持而不是停车,然后自己列出此类通话即可。

To transfer to a queue I can do a blind transfer as documented on Asterisk website. 要转移到队列中,我可以按照Asterisk网站上的说明进行盲目转移。 Links below: 以下链接:

ManagerAction_BlindTransfer ManagerAction_BlindTransfer

ManagerEvent_BlindTransfer ManagerEvent_BlindTransfer

To achieve this using AsterNET, I can use the same RedirectAction I was using but I do need to change the context. 为了使用AsterNET来实现此目的,我可以使用相同的RedirectAction ,但是我确实需要更改上下文。 It can't be default for context, as default we are letting Asterisk manage it and somehow it can't handle as I expetected. 它不是上下文的默认值 ,因为默认情况下,我们让Asterisk对其进行管理,并且在我所期望的情况下它无法处理。 So it need to be clearly specified as internar transfer . 因此,需要将其明确指定为内部传递 The event raised after this context transfer is the Manager_BlindTransfer . 在此上下文传输之后引发的事件是Manager_BlindTransfer

Manager_Action_RedirectAction Manager_Action_RedirectAction

So using my SIP Phone I manage to transfer a call while I was debugging that raised event method, so I could catch the context used in. Using the correct context 因此,使用SIP电话,我可以在调试引发事件的方法时转移呼叫,以便可以捕获所使用的上下文。使用正确的上下文

ManagerConnection manager = new ManagerConnection(address, port, user, password);

manager.BlindTransfer += Manager_BlindTransfer;

private void Manager_BlindTransfer(object sender, BlindTransferEvent e)
{

}

After this I created another method to transfer to directly to a queue using the correct context. 此后,我创建了另一个方法,可以使用正确的上下文直接转移到队列。

internal void TransferToQueue(string channel, string queue)
{
    RedirectAction ma = new RedirectAction
    {
        Priority = priority,
        Context = "from-internal-xfer",
        Channel = channel,
        Exten = queue
    };

    ManagerResponse mr = manager.SendAction(ma);
}

TransferToQueue("abc123456", "8300")

Summary 摘要

Was just a matter of the correct context to be used in. 只是要使用的正确上下文的问题。

from-internal-xfer 来自内部xfer

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM