예제 #1
0
        static void Main(string[] args)
        {
            try
            {
                IList <string> inputArr = new List <string>();
                Console.WriteLine(@"Please enter full path file location containing talks. \n e.g. C:\Personal\Talks.txt and press enter");
                string filePath = Console.ReadLine();
                ReadFileContents(filePath, ref inputArr);

                IConferenceCreator conferenceCreator = new ConferenceCreator();
                IConference        conference        = new ConferenceType(conferenceCreator, inputArr, new TimeSpan(9, 0, 0));
                foreach (ITrack item in conference.Track)
                {
                    foreach (KeyValuePair <SessionEnum, ITalkList> talkList in item)
                    {
                        foreach (ITalk talk in talkList.Value)
                        {
                            Console.WriteLine(talk.ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.LogInfo(ex.Message);
            }


            Console.ReadLine();
        }
예제 #2
0
        /// <summary>
        /// ���ӵ�ָ��ͨ��
        /// </summary>
        /// <param name="channelID">ͨ����ʶ</param>
        /// <param name="channelType">ͨ������</param>
        /// <param name="mode">�������ͣ���ϸ��Ϣ��ο�<seealso cref="ConferenceType"/></param>
        /// <returns>���ӳɹ����ش����Ļ������ţ����򷵻�-1</returns>
        private int LinkToChannel(int channelID, ChannelType channelType, ConferenceType mode)
        {
            if (channelType != ChannelType.TRUNK && channelType != ChannelType.USER)
            {
                ArgumentException ex = new ArgumentException("ϵͳ��֧�����ӵ�����Ϊ " + Enum.GetName(typeof(ChannelType), channelType) + " ��ͨ����");
                Logger.Error("���ܽ������Ӳ���", ex);
                throw ex;
            }

            // �Ի���ģʽ����ͨ��֮�������
            DB160XChannel chnl = Driver.GetChannel(channelID, ChannelType, ChannelStatus.IDLE) as DB160XChannel;
            if (chnl == null) return -1;
            LinkingToChannelEventArgs linkingArgs = new LinkingToChannelEventArgs(chnl, true); // ͨ������ǰ�¼�����

            // �����Ѿ������Ļ���
            if (chnl.ConfResource.Confgroup != -1)
            {
                OnLinkingToChannel(this, linkingArgs);
                if (linkingArgs.AllowLink == false)
                {
                    Logger.Info(String.Format("�ͻ�Ӧ�ó�����ֹ��ͨ�� {0} ��ͨ�� {1} �����Ӳ���", ChannelID, chnl.ChannelID));
                    return -1;
                }

                Logger.Debug(String.Format("ͨ�� {0} Ϊ��������� {1} ��׼��ֹͣ��ǰ�ķ����������", ChannelID, chnl.ConfResource.Confgroup));
                if (CurrentStatus == ChannelStatus.PLAY) StopPlaying();
                lock (D160X.SyncObj)
                {
                    if (CurrentStatus == ChannelStatus.RECORD) D160X.StopRecordFile(ChannelID);
                }
                if (JoinConf(this, new ConferenceResource(mode, chnl.ConfResource.Confgroup)))
                {
                    OnLinkedToChannel(this, new EventArgs<IChannel>(chnl)); // ����ͨ�������¼�
                }
            }
            else
            {
                // ���ӿ��е�����ͨ�������������һ��Ϊҵ��ϵͳת�˹����񡣴˴������˶Կ�������ͨ���ļ������ܣ��ƺ�Ҳû���ⷽ��Ĺ�������:)
                if (chnl.ChannelType == ChannelType.USER && chnl.CurrentStatus == ChannelStatus.IDLE)
                {
                    Logger.Debug(String.Format("ͨ�� {0} Ϊ׼������������ֹͣ��ǰ�ķ����������", ChannelID));
                    StopPlaying();

                    OnLinkingToChannel(this, linkingArgs);
                    if (linkingArgs.AllowLink == false)
                    {
                        Logger.Info(String.Format("�ͻ�Ӧ�ó�����ֹ��ͨ�� {0} ��ͨ�� {1} �����Ӳ���", ChannelID, chnl.ChannelID));
                        return -1;
                    }

                    lock (D160X.SyncObj)
                    {
                        Logger.Debug(String.Format("ͨ�� {0} Ϊ��������ͨ�� {1} �����ڸ�����ͨ�����塭��", ChannelID, chnl.ChannelID));
                        D160X.FeedRealRing(chnl.ChannelID); // ������ͨ������

                        long T = Environment.TickCount;
                        while ((Environment.TickCount - T < Driver.Timeout * Onesecond))
                        {
                            D160X.FeedSigFunc();
                            Thread.Sleep(Defaultdelay); // �����Ա�����ͨ�����Եõ���Ҫ�Ĵ�����ʱ��

                            Logger.Debug(String.Format("�������ͨ�� {0} �Ƿ�ժ��", chnl.ChannelID));
                            if (chnl.OffHookDetect())
                            {
                                Logger.Debug(String.Format("����ͨ�� {0} ժ��׼���������顭��", chnl.ChannelID));
                                D160X.StartHangUpDetect(chnl.ChannelID);
                                int confGroup = Driver.ConfCount + 1;

                                // ����Է�����򴴽����鲢��ͨ��ͨ��
                                if (JoinConf(this, new ConferenceResource(ConferenceType.JOIN, confGroup)))
                                {
                                    // �������������
                                    if (JoinConf(chnl, new ConferenceResource(ConferenceType.JOIN, confGroup)))
                                    {
                                        D160X.StartPlaySignal(chnl.ChannelID, D160X.SIG_STOP);
                                        OnLinkedToChannel(this, new EventArgs<IChannel>(chnl)); // ����ͨ�������¼�
                                        return confGroup;
                                    }
                                    else
                                    {
                                        UnLink(); // ����ʧ�ܲ������
                                        Logger.Info(String.Format("������ {0} ��������� {1} ʧ�ܶ��޷���������", chnl.ChannelID, confGroup));
                                        return -1;
                                    }
                                }
                            }
                        }

                        // ���ӵ����߳�ʱ
                        if (Environment.TickCount - T > Driver.Timeout * Onesecond)
                        {
                            Logger.Info(String.Format("�������� {0} ʱ�����˽�����ʱ", chnl.ChannelID));
                            OnProcessTimeout(this, null);
                            return -1;
                        }
                    }
                }
                else
                {
                    // ����ͨ��ֱ�Ӵ�������
                    if (CurrentStatus == ChannelStatus.PLAY) StopPlaying();
                    if (chnl.CurrentStatus == ChannelStatus.PLAY) StopPlaying();

                    OnLinkingToChannel(this, linkingArgs);
                    if (linkingArgs.AllowLink == false)
                    {
                        Logger.Info(String.Format("�ͻ�Ӧ�ó�����ֹ��ͨ�� {0} ��ͨ�� {1} �����Ӳ���", ChannelID, chnl.ChannelID));
                        return -1;
                    }

                    lock (D160X.SyncObj)
                    {
                        Logger.Debug(String.Format("ͨ�� {0} Ϊ׼������������ֹͣ��ǰ�ķ����������", ChannelID));
                        if (CurrentStatus == ChannelStatus.RECORD) D160X.StopRecordFile(ChannelID);
                        if (chnl.CurrentStatus == ChannelStatus.RECORD) D160X.StopRecordFile(chnl.ChannelID);
                    }

                    int confGroup = Driver.ConfCount + 1;

                    switch (mode)
                    {
                        case ConferenceType.JOIN: // �������
                            if (JoinConf(this, new ConferenceResource(ConferenceType.JOIN, confGroup)))
                            {
                                if (JoinConf(chnl, new ConferenceResource(ConferenceType.JOIN, confGroup)))
                                {
                                    OnLinkedToChannel(this, new EventArgs<IChannel>(chnl)); // ����ͨ�������¼�
                                    return confGroup;
                                }
                                else
                                {
                                    UnLink();
                                    Logger.Info(String.Format("������ͨ�� {0} ������������뵽�� {1} �����ʧ�ܶ�δ�ܳɹ�", chnl.ChannelID, confGroup));
                                }
                            }
                            break;

                        case ConferenceType.LISTEN: // ��������
                            if (JoinConf(chnl, new ConferenceResource(ConferenceType.JOIN, confGroup)))
                            {
                                if (JoinConf(this, new ConferenceResource(ConferenceType.LISTEN, confGroup)))
                                {
                                    OnLinkedToChannel(this, new EventArgs<IChannel>(chnl));
                                    return confGroup;
                                }
                                else
                                {
                                    UnLink();
                                    Logger.Info(String.Format("������ͨ�� {0} ������������뵽�� {1} �����ʧ�ܶ�δ�ܳɹ�", chnl.ChannelID, confGroup));
                                }
                            }
                            break;

                        default:
                            Logger.Info("δָ����Ч������ģʽ");
                            return -1;
                    }
                }
            }
            return -1;
        }
예제 #3
0
 public ConferenceResource(ConferenceType mode, int confGroup)
 {
     this.confmode  = mode;
     this.confgroup = confGroup;
 }
예제 #4
0
 public void AddConferencingSub(ConferenceType conferenceType, SubscriberType subscriberType)
 {
     _odConferencingService.AddConferenceSub(_loginInformation.LoginToken, conferenceType, subscriberType);
 }
예제 #5
0
 public ConferenceResource(ConferenceType mode, int confGroup)
 {
     this.confmode = mode;
     this.confgroup = confGroup;
 }