I have set up FreePbx and it is working I can make calls into the pbx and out of the pbx. I have enabled the REST API and added a user and password. I cloned the 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. 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. 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.
ActionClient = new AriClient(
new StasisEndpoint("voip", 8088, "root", "password"),
"HelloWorld",
true);