简体   繁体   English

在 FreePbx 上没有从 Asternet.Ari 获取任何事件

[英]Not getting Any Events From Asternet.Ari On FreePbx

I have set up FreePbx and it is working I can make calls into the pbx and out of the pbx.我已经设置了 FreePbx,它正在工作,我可以调用 pbx 和 pbx。 I have enabled the REST API and added a user and password.我启用了 REST API 并添加了用户和密码。 I cloned the Asternet.Ari https://github.com/skrusty/AsterNET.ARI .我克隆了 Asternet.Ari https://github.com/skrusty/AsterNET.ARI

The program runs and I get the connected event:程序运行,我得到连接的事件:

            // Create a new Ari Connection
            ActionClient = new AriClient(
                new StasisEndpoint("192.168.1.14", 8088, "userId", "password"),
                "HelloWorld");

            // Hook into required events
            ActionClient.OnStasisStartEvent += c_OnStasisStartEvent;
            ActionClient.OnChannelDtmfReceivedEvent += ActionClientOnChannelDtmfReceivedEvent;
            ActionClient.OnConnectionStateChanged += ActionClientOnConnectionStateChanged;
            ActionClient.OnChannelCallerIdEvent += ActionClient_OnChannelCallerIdEvent;

            ActionClient.Connect();
  ........

    private static void ActionClientOnConnectionStateChanged(object sender)
    {
        Console.WriteLine("Connection state is now {0}", ActionClient.Connected);
    }

The ActionClient is connected. ActionClient 已连接。 I then call in to a extension but nothing happens.然后我拨通分机但没有任何反应。 I do not get any other events.我没有收到任何其他事件。 Should an event fire when any extension is called?调用任何扩展时是否应该触发事件? Not sure if I have set the pbx up correctly.不确定我是否正确设置了 pbx。 I do not get any calling events when I call in from soft phone or from outside Lan on a cell phone.当我从软电话或从局域网外的手机上拨入时,我没有收到任何呼叫事件。

Long time have passed but maybe useful yet.很长一段时间过去了,但也许有用。 Just set subscribeAllEvents argument to true.只需将 subscribeAllEvents 参数设置为 true。

        ActionClient = new AriClient(
            new StasisEndpoint("voip", 8088, "root", "password"),
            "HelloWorld",
            true);

Well your Asterisk Ari is connecting, but to get anything in it, you have to create Extension so your call go to Stasis application.好吧,您的 Asterisk Ari 正在连接,但要在其中获取任何内容,您必须创建扩展,以便您的呼叫转到 Stasis 应用程序。

Please edit your extensions.conf file with following information请使用以下信息编辑您的 extensions.conf 文件

exten => _1XX,1,NoOp()
same => n,Stasis(HelloWorld,PJSIP/${EXTEN}, 45)
same => n,Hangup()

This script first check any incoming number which starts with 1 will be forawarded to your ARI script.此脚本首先检查任何以 1 开头的传入号码将被转发到您的 ARI 脚本。 HelloWorld is name of app so you alread have it in your script. HelloWorld 是应用程序的名称,因此您已经将其包含在脚本中。 Now any call come it will show whole information on your socket.现在任何来电都会在您的套接字上显示全部信息。 Now you have to handle this information to any specific task.现在您必须处理此信息以执行任何特定任务。 \ \

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

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