示例#1
0
        internal static async Task <Channel> Create(OutboundSocket outboundSocket)
        {
            var channel = new Channel(outboundSocket);

            channel.ExitOnHangup = true;

            await outboundSocket.Linger().ConfigureAwait(false);


            await outboundSocket.SubscribeEvents(
                EventName.ChannelProgress,
                EventName.ChannelBridge,
                EventName.ChannelUnbridge,
                EventName.ChannelAnswer,
                EventName.ChannelHangup,
                EventName.ChannelHangupComplete,
                EventName.Dtmf).ConfigureAwait(false);                                                                           //subscribe to minimum events

            await outboundSocket.Filter(HeaderNames.UniqueId, outboundSocket.ChannelData.UUID).ConfigureAwait(false);            //filter for our unique id (in case using full socket mode)

            await outboundSocket.Filter(HeaderNames.OtherLegUniqueId, outboundSocket.ChannelData.UUID).ConfigureAwait(false);    //filter for channels bridging to our unique id

            await outboundSocket.Filter(HeaderNames.ChannelCallUniqueId, outboundSocket.ChannelData.UUID).ConfigureAwait(false); //filter for channels bridging to our unique id

            channel.InitializeSubscriptions();
            return(channel);
        }
        public static void Main(string[] args)
        {
            Console.WriteLine("Starting up listener socket to test PIN obtainment...");
            InboundListener list = new InboundListener(IPAddress.Any, 8084,
                                                       new InboundListener.delProcessConnection(ProcessConnection));

            list.DisposeInvalidMessage = new ASocket.delDisposeInvalidMessage(DisposeInvalidMessage);
            OutboundSocket os = new OutboundSocket(IPAddress.Loopback, 8021, "ClueCon", new ASocket.delProcessEventMessage(ProcessEvent),
                                                   null, null, null);

            os.DisposeInvalidMessage += new ASocket.delDisposeInvalidMessage(DisposeInvalidMessage);
            os.RegisterEvent("all");
            Console.WriteLine("Hit Enter to exit...");
            Console.ReadLine();
            os.Close();
        }
示例#3
0
 protected internal Channel(OutboundSocket outboundSocket) : this(outboundSocket.ChannelData, outboundSocket)
 {
 }
示例#4
0
 public Channel(OutboundSocket outboundSocket) : this(outboundSocket.ChannelData, outboundSocket)
 {
     outboundSocket.Linger().Wait();
 }
示例#5
0
 public Channel(OutboundSocket outboundSocket) : this(outboundSocket.ChannelData, outboundSocket)
 {
     outboundSocket.Linger().Wait();
 }