예제 #1
1
        static void Main(string[] args)
        {
            try
            {
                // Create a message actionClient to receive events on
                ActionClient = new AriClient(new StasisEndpoint("192.168.3.16", 8088, "username", "test"), AppName);

                ActionClient.OnStasisStartEvent += c_OnStasisStartEvent;
                ActionClient.OnStasisEndEvent += c_OnStasisEndEvent;

                ActionClient.Connect();

                // Create simple bridge
                SimpleBridge = ActionClient.Bridges.Create("mixing", Guid.NewGuid().ToString(), AppName);

                // subscribe to bridge events
                ActionClient.Applications.Subscribe(AppName, "bridge:" + SimpleBridge.Id);

                // start MOH on bridge
                ActionClient.Bridges.StartMoh(SimpleBridge.Id, "default");

                var done = false;
                while (!done)
                {
                    var lastKey = Console.ReadKey();
                    switch(lastKey.KeyChar.ToString())
                    {
                        case "*":
                            done = true;
                            break;
                        case "1":
                            ActionClient.Bridges.StopMoh(SimpleBridge.Id);
                            break;
                        case "2":
                            ActionClient.Bridges.StartMoh(SimpleBridge.Id, "default");
                            break;
                        case "3":
                            // Mute all channels on bridge
                            var bridgeMute = ActionClient.Bridges.Get(SimpleBridge.Id);
                            foreach (var chan in bridgeMute.Channels)
                                ActionClient.Channels.Mute(chan, "in");
                            break;
                        case "4":
                            // Unmute all channels on bridge
                            var bridgeUnmute = ActionClient.Bridges.Get(SimpleBridge.Id);
                            foreach (var chan in bridgeUnmute.Channels)
                                ActionClient.Channels.Unmute(chan, "in");
                            break;
                    }
                }

                ActionClient.Bridges.Destroy(SimpleBridge.Id);
                ActionClient.Disconnect();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Console.ReadKey();
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            try
            {
                endPoint = new StasisEndpoint("ipaddress", 8088, "username", "password");

                // Create a message actionClient to receive events on
                actionClient = new AriClient(endPoint, "playrec_test");

                actionClient.OnStasisStartEvent       += c_OnStasisStartEvent;
                actionClient.OnStasisEndEvent         += c_OnStasisEndEvent;
                actionClient.OnRecordingFinishedEvent += ActionClientOnRecordingFinishedEvent;

                actionClient.Connect();

                bool done = false;
                while (!done)
                {
                    var lastKey = Console.ReadKey();
                    switch (lastKey.KeyChar.ToString())
                    {
                    case "*":
                        done = true;
                        break;
                    }
                }

                actionClient.Disconnect();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Console.ReadKey();
            }
        }
예제 #3
0
 public void Stop()
 {
     Logger.LogInformation("Disconnecting proxy from {0}", AppName);
     if (_client.ConnectionState == Middleware.ConnectionState.Open)
     {
         _client.Disconnect();
     }
 }
예제 #4
0
 public void Disconnect()
 {
     foreach (Bridge b in bridgesList.Bridges)
     {
         try
         {
             lock (_locker)
             {
                 pbx.Bridges.Destroy(b.Id);
             }
         }
         catch (Exception ex)
         {
             Log.Logger.Debug("Error al remover un bridge: " + ex.Message);
         }
     }
     callTimeOutHandler.Stop();
     actorPbxProxy.Stop();
     pbx.Disconnect();
 }
예제 #5
0
        static void Main(string[] args)
        {
            try
            {
                // Create a message actionClient to receive events on
                ActionClient = new AriClient(new StasisEndpoint("192.168.3.16", 8088, "username", "test"), AppName);

                ActionClient.OnStasisStartEvent += c_OnStasisStartEvent;
                ActionClient.OnStasisEndEvent   += c_OnStasisEndEvent;

                ActionClient.Connect();

                // Create simple bridge
                SimpleBridge = ActionClient.Bridges.Create("mixing", Guid.NewGuid().ToString(), AppName);

                // subscribe to bridge events
                ActionClient.Applications.Subscribe(AppName, "bridge:" + SimpleBridge.Id);

                // start MOH on bridge
                ActionClient.Bridges.StartMoh(SimpleBridge.Id, "default");

                var done = false;
                while (!done)
                {
                    var lastKey = Console.ReadKey();
                    switch (lastKey.KeyChar.ToString())
                    {
                    case "*":
                        done = true;
                        break;

                    case "1":
                        ActionClient.Bridges.StopMoh(SimpleBridge.Id);
                        break;

                    case "2":
                        ActionClient.Bridges.StartMoh(SimpleBridge.Id, "default");
                        break;

                    case "3":
                        // Mute all channels on bridge
                        var bridgeMute = ActionClient.Bridges.Get(SimpleBridge.Id);
                        foreach (var chan in bridgeMute.Channels)
                        {
                            ActionClient.Channels.Mute(chan, "in");
                        }
                        break;

                    case "4":
                        // Unmute all channels on bridge
                        var bridgeUnmute = ActionClient.Bridges.Get(SimpleBridge.Id);
                        foreach (var chan in bridgeUnmute.Channels)
                        {
                            ActionClient.Channels.Unmute(chan, "in");
                        }
                        break;
                    }
                }

                ActionClient.Bridges.Destroy(SimpleBridge.Id);
                ActionClient.Disconnect();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Console.ReadKey();
            }
        }
예제 #6
0
 public void Disconnect()
 {
     actorLoginProxy.Stop();
     pbx.Disconnect();
 }
예제 #7
0
 public void Disconnect()
 {
     actorStateProxy.Diconnect();
     pbx.Disconnect();
 }