コード例 #1
0
        public void onRegistrationEvent(object sender, RegistrationEventArgs e)
        {
            switch (e.Type)
            {
            case RegistrationEventTypes.REGISTRATION_OK:
                this.anStatus     = ANStatus.INSERVICE;
                this.isRegistered = true;
                break;

            case RegistrationEventTypes.REGISTRATION_NOK:
                this.anStatus = ANStatus.STACK_STARTED;
                break;

            case RegistrationEventTypes.REGISTRATION_INPROGRESS:
                this.anStatus = ANStatus.REGISTERING;
                break;

            case RegistrationEventTypes.UNREGISTRATION_OK:
                this.anStatus     = ANStatus.UNREGISTERED;
                this.isRegistered = false;
                this.StopHeartbeatDetector();
                break;

            case RegistrationEventTypes.UNREGISTRATION_NOK:
                this.anStatus = ANStatus.INSERVICE;
                break;

            case RegistrationEventTypes.UNREGISTRATION_INPROGRESS:
                this.anStatus = ANStatus.UNREGISTERING;
                break;
            }
            EventHandlerTrigger.TriggerEvent <AccessNetworkEventArgs>(this.onAccessNetworkEvent, this, new AccessNetworkEventArgs(AccessNetworkEventTypes.ANET_LOGIN, this.anStatus, e.Phrase));
        }
コード例 #2
0
 public AccessNetworkService(ServiceManager manager)
 {
     this.serviceManager = manager;
     this.serviceManager.StackService.onStackEvent        += new System.EventHandler <StackEventArgs>(this.OnStackEvent);
     this.serviceManager.StackService.onRegistrationEvent += new System.EventHandler <RegistrationEventArgs>(this.onRegistrationEvent);
     this.anStatus                       = ANStatus.IDLE;
     this.isRegistered                   = false;
     this.keepAliveTimer                 = new Timer();
     this.keepAliveTimer.Interval        = 10000.0;
     this.keepAliveTimer.Elapsed        += new ElapsedEventHandler(this.KeepAliveTimerHandler);
     this.waitKeepAliveRspTimer          = new Timer();
     this.waitKeepAliveRspTimer.Interval = 3000.0;
     this.waitKeepAliveRspTimer.Elapsed += new ElapsedEventHandler(this.WaitKeepAliveRspTimerHandler);
     this.elapsedCount                   = 0;
 }
コード例 #3
0
 public bool Register()
 {
     if (!this.serviceManager.StackService.SipStackStarted)
     {
         this.serviceManager.StackService.StartSipStack();
         this.anStatus = ANStatus.STACK_STARTING;
     }
     else
     {
         this.anStatus = ANStatus.STACK_STARTED;
         if (this.regSession == null)
         {
             this.regSession = new MyRegistrationSession(this.serviceManager.StackService.SipStack);
         }
         this.serviceManager.StackService.SipStackCfg();
         this.regSession.SigCompId = this.serviceManager.StackService.SipStack.SigCompId;
         this.regSession.FromUri   = this.serviceManager.StackService.SipStack.SelfPreferences.impu;
         this.regSession.register();
     }
     return(true);
 }
コード例 #4
0
        public void OnStackEvent(object sender, StackEventArgs e)
        {
            switch (e.Type)
            {
            case StackEventTypes.START_OK:
                if (this.anStatus == ANStatus.STACK_STARTING)
                {
                    this.anStatus = ANStatus.STACK_STARTED;
                    if (this.regSession == null)
                    {
                        this.regSession = new MyRegistrationSession(this.serviceManager.StackService.SipStack);
                    }
                    this.regSession.SigCompId = this.serviceManager.StackService.SipStack.SigCompId;
                    this.regSession.FromUri   = this.serviceManager.StackService.SipStack.SelfPreferences.impu;
                    this.regSession.register();
                }
                break;

            case StackEventTypes.STARING:
                this.anStatus = ANStatus.STACK_STARTING;
                break;

            case StackEventTypes.START_NOK:
                this.anStatus = ANStatus.IDLE;
                break;

            case StackEventTypes.STOP_OK:
                this.anStatus = ANStatus.IDLE;
                break;

            case StackEventTypes.STOPPING:
                this.anStatus = ANStatus.STACK_STOPPING;
                break;

            case StackEventTypes.STOP_NOK:
                this.anStatus = ANStatus.STACK_STOPPING;
                break;
            }
            EventHandlerTrigger.TriggerEvent <AccessNetworkEventArgs>(this.onAccessNetworkEvent, this, new AccessNetworkEventArgs(AccessNetworkEventTypes.ANET_LOGIN, this.anStatus, e.Phrase));
        }
コード例 #5
0
ファイル: ContactService.cs プロジェクト: feimorpheusma/MWS
        public void OnAccessNetworkEvent(object sender, AccessNetworkEventArgs e)
        {
            AccessNetworkEventTypes type = e.Type;

            if (type == AccessNetworkEventTypes.ANET_LOGIN)
            {
                ANStatus status = e.Status;
                if (status == ANStatus.INSERVICE)
                {
                    new System.Threading.Thread(new System.Threading.ThreadStart(delegate
                    {
                        if (this.serviceManager.ConfigurationService.ContactsCfg.ContactStorageType.ToLower().Equals("remote"))
                        {
                            this.GetRemoteContactsAsync();
                        }
                        else
                        {
                            this.LoadLocalContacts();
                        }
                    })).Start();
                }
            }
        }
コード例 #6
0
 public AccessNetworkEventArgs(AccessNetworkEventTypes type, ANStatus status, string phrase)
 {
     this.type   = type;
     this.status = status;
     this.phrase = phrase;
 }