/// <summary> /// This constructor sets user defined values to connect to FreeSwitch using in-built message encoder/decoders /// </summary> /// <param name="address">FreeSwitch mod_event_socket IP address or hostname</param> /// <param name="port">FreeSwitch mod_event_socket Port number</param> /// <param name="connectionTimeout">Connection Timeout</param> /// <param name="password">FreeSwitch mod_event_socket Password</param> public OutboundChannelSession(string address, int port, TimeSpan connectionTimeout, string password) { Address = address; Port = port; ConnectionTimeout = connectionTimeout; Password = password; MessageEncoder = new FreeSwitchEncoder(); MessageDecoder = new FreeSwitchDecoder(); FreeSwitchEventFilter = "plain ALL"; _authenticated = false; _requestsQueue = new ConcurrentQueue <CommandAsyncEvent>(); _channel = new TcpChannel(new BufferSlice(new byte[65535], 0, 65535), MessageEncoder, MessageDecoder); _channel.MessageReceived += OnMessageReceived; _channel.Disconnected += OnDisconnect; _channel.MessageSent += OnSendCompleted; _args.Completed += OnConnect; OnAuthentication += SendAuthentication; }
/// <summary> /// Default constructor. It uses the default FreeSwitch mod_event_socket settings for connectivity /// </summary> public OutboundChannelSession() { Address = "127.0.0.1"; Port = 8021; ConnectionTimeout = TimeSpan.Zero; Password = "******"; MessageEncoder = new FreeSwitchEncoder(); MessageDecoder = new FreeSwitchDecoder(); FreeSwitchEventFilter = "plain ALL"; _authenticated = false; _requestsQueue = new ConcurrentQueue <CommandAsyncEvent>(); _channel = new TcpChannel(new BufferSlice(new byte[65535], 0, 65535), MessageEncoder, MessageDecoder); _channel.MessageReceived += OnMessageReceived; _channel.Disconnected += OnDisconnect; _channel.MessageSent += OnSendCompleted; _args.Completed += OnConnect; OnAuthentication += SendAuthentication; }