public async void InboundModeTest() { const string address = "10.0.75.2"; const string password = "******"; const int port = 8021; const int ServerPort = 10000; var client = new OutboundSession(address, port, password); await client.ConnectAsync(); Thread.Sleep(100); // this is due to the asynchronous pattern of the framework var inboundServer = new InboundServer(ServerPort, new DefaultInboundSession()); await inboundServer.StartAsync(); var callCommand = "{ignore_early_media=false,originate_timeout=120}sofia/gateway/smsghlocalsip/233247063817 &socket(192.168.74.1:10000 async full)"; var jobId = await client.SendBgApiAsync(new BgApiCommand("originate", callCommand)); Assert.True(jobId != Guid.Empty); }
private static void Main(string[] args) { const string address = "10.0.75.2"; const string password = "******"; const int port = 8021; const int ServerPort = 10000; try { //LogManager.Configuration = new XmlLoggingConfiguration(System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "\\NLog.config"); var client = new OutboundSession(address, port, password); client.ConnectAsync().ConfigureAwait(false); Thread.Sleep(1000); _logger.Info("Connected and Authenticated {0}", client.CanSend()); var @event = "plain CHANNEL_HANGUP CHANNEL_HANGP_COMPLETE"; var subscribed = client.SubscribeAsync(@event).ConfigureAwait(true); System.Console.WriteLine("Api Response {0}", subscribed.GetAwaiter().GetResult()); _logger.Warn("Api Response {0}", subscribed.GetAwaiter().GetResult()); var commandString = "sofia profile external gwlist up"; var response = client.SendApiAsync(new ApiCommand(commandString)).ConfigureAwait(false); System.Console.WriteLine("hello test"); _logger.Warn("Api Response {0}", response.GetAwaiter().GetResult().ReplyText); var inboundServer = new InboundServer(ServerPort, new DefaultInboundSession()); inboundServer.StartAsync().Wait(500); var callCommand = "{ignore_early_media=false,originate_timeout=120}sofia/gateway/smsghlocalsip/233247063817 &socket(192.168.74.1:10000 async full)"; client.SendBgApiAsync(new BgApiCommand("originate", callCommand)).Wait(500); System.Console.ReadKey(); } catch (Exception e) { System.Console.WriteLine(e); System.Console.ReadLine(); return; } }
public async void SendBgApiTest() { const string address = "192.168.74.128"; const string password = "******"; const int port = 8021; var client = new OutboundSession(address, port, password); await client.ConnectAsync(); Thread.Sleep(100); // this is due to the asynchronous pattern of the framework var jobId = await client.SendBgApiAsync(new BgApiCommand("status", string.Empty)); Assert.True(jobId != Guid.Empty); }
public async void SendApiTest() { const string address = "192.168.74.128"; const string password = "******"; const int port = 8021; var client = new OutboundSession(address, port, password); await client.ConnectAsync(); Thread.Sleep(100); // this is due to the asynchronous pattern of the framework const string commandString = "sofia profile external gwlist up"; var response = await client.SendApiAsync(new ApiCommand(commandString)); Assert.Contains("smsghlocalsip", response.ReplyText); }
public async void SendCommandTest() { const string address = "192.168.74.128"; const string password = "******"; const int port = 8021; var client = new OutboundSession(address, port, password); await client.ConnectAsync(); Thread.Sleep(100); // this is due to the asynchronous pattern of the framework var cmd = new BgApiCommand("fsctl", "debug_level 7"); var reply = await client.SendCommandAsync(cmd); Assert.True(reply.IsOk); }
public async void SubscribeToEventsTest() { const string address = "192.168.74.128"; const string password = "******"; const int port = 8021; var client = new OutboundSession(address, port, password); await client.ConnectAsync(); Thread.Sleep(100); // this is due to the asynchronous pattern of the framework var @event = "plain ALL"; var subscribed = await client.SubscribeAsync(@event); Assert.Equal(true, subscribed); }
public async void ConnectToFreeSwitchTest() { var address = "192.168.74.128"; var password = "******"; var port = 8021; var client = new OutboundSession(address, port, password); await client.ConnectAsync(); Assert.Equal(true, client.IsActive()); Thread.Sleep(100); // this is due to the asynchronous pattern of the framework Assert.Equal(true, client.CanSend()); Assert.Equal(true, client.CanSend()); Assert.Equal(true, client.CanSend()); Assert.Equal(true, client.CanSend()); Assert.Equal(true, client.CanSend()); Assert.Equal(true, client.CanSend()); Assert.Equal(true, client.CanSend()); Assert.Equal(true, client.CanSend()); }
private static void Main(string[] args) { const string address = "192.168.74.128"; const string password = "******"; const int port = 8021; const int ServerPort = 10000; var client = new OutboundSession(address, port, password); client.ConnectAsync().ConfigureAwait(false); Thread.Sleep(1000); _logger.Info("Connected and Authenticated {0}", client.CanSend()); var @event = "plain CHANNEL_HANGUP CHANNEL_HANGP_COMPLETE"; var subscribed = client.SubscribeAsync(@event).ConfigureAwait(false); var commandString = "sofia profile external gwlist up"; var response = client.SendApiAsync(new ApiCommand(commandString)).ConfigureAwait(false); _logger.Warn("Api Response {0}", response.GetAwaiter().GetResult().ReplyText); var inboundServer = new InboundServer(ServerPort, new DefaultInboundSession()); inboundServer.StartAsync().Wait(500); var callCommand = "{ignore_early_media=false,originate_timeout=120}sofia/gateway/smsghlocalsip/233247063817 &socket(192.168.74.1:10000 async full)"; client.SendBgApiAsync(new BgApiCommand("originate", callCommand)).Wait(500); System.Console.ReadKey(); }