コード例 #1
0
ファイル: SIPCall.cs プロジェクト: deveck/Deveck.TAM
		public SIPCall(SIPCallProvider callProvider, SipekResources resources, int sipekCallId, IActionProvider actionProvider)
		{
			_resources = resources;
			_sipekCallId = sipekCallId;
			_callProvider = callProvider;
			_actionProvider = actionProvider;
			_date = DateTime.Now;
		}
コード例 #2
0
ファイル: SIPCall.cs プロジェクト: goupviet/Deveck.TAM
 public SIPCall(SIPCallProvider callProvider, SipekResources resources, int sipekCallId, IActionProvider actionProvider)
 {
     _resources      = resources;
     _sipekCallId    = sipekCallId;
     _callProvider   = callProvider;
     _actionProvider = actionProvider;
     _date           = DateTime.Now;
 }
コード例 #3
0
ファイル: SIPCallProvider.cs プロジェクト: deveck/Deveck.TAM
		public void Initialize()
		{
			if(_resources != null)
				Dispose();
			
			InitThread();
			
			_initialized.WaitOne();
			_dispatcher.Invoke(
				DispatcherPriority.Normal,
				(MethodInvoker)delegate
				{
					_log.Info("Initializing SIPCallProvider");
					_resources = new SipekResources();
					_resources.CallManager.CallStateRefresh += onCallStateChanged;
					_resources.CallManager.IncomingCallNotification += new DIncomingCallNotification(resources_CallManager_IncomingCallNotification);
					_resources.Registrar.AccountStateChanged += new DAccountStateChanged(resources_Registrar_AccountStateChanged);
					
					int status = _resources.CallManager.Initialize();
					_resources.CallManager.CallLogger = _resources.CallLogger;
					
					if (status != 0)
						throw new CallProviderException("Init SIP stack problem! \r\nPlease, check configuration and start again! \r\nStatus code " + status);
					
					// initialize Stack
					_resources.Registrar.registerAccounts();
					
					
					int noOfCodecs = _resources.StackProxy.getNoOfCodecs();
					for (int i = 0; i < noOfCodecs; i++)
					{
						string codecname = _resources.StackProxy.getCodec(i);
						if (_resources.Configurator.CodecList.Contains(codecname))
						{
							// leave default
							_resources.StackProxy.setCodecPriority(codecname, 128);
						}
						else
						{
							// disable
							_resources.StackProxy.setCodecPriority(codecname, 0);
						}
						
					}
					
					pjsipCallProxy.OnWavPlayerCompleted += 
						delegate(int callId) 
						{ 
							_log.Info("Wav playback for call '{0}' ended", callId);
							SIPCall call = FindCallById(callId);
							
							if(call != null)
								call.AudioPlaybackCompleted();
						};
				});
		}
コード例 #4
0
 public void Dispose()
 {
     _log.Info("Shuting down SIPCallProvider");
     if (_resources != null)
     {
         _dispatcher.Invoke(
             DispatcherPriority.Normal,
             (MethodInvoker) delegate
         {
             _resources.StackProxy.shutdown();
             _resources.CallManager.Shutdown();
             _resources = null;
         });
     }
 }
コード例 #5
0
 public SIPIncomingCall(SIPCallProvider callProvider, SipekResources resources, int sipekCallId, String remoteIdentifier, IActionProvider actionProvider)
     : base(callProvider, resources, sipekCallId, actionProvider)
 {
     _remoteIdentifier = remoteIdentifier;
 }
コード例 #6
0
ファイル: SIPIncomingCall.cs プロジェクト: deveck/Deveck.TAM
		public SIPIncomingCall(SIPCallProvider callProvider, SipekResources resources, int sipekCallId, String remoteIdentifier, IActionProvider actionProvider)
			:base(callProvider, resources, sipekCallId, actionProvider)
		{
			_remoteIdentifier = remoteIdentifier;	
			
		}
コード例 #7
0
ファイル: SIPCallProvider.cs プロジェクト: deveck/Deveck.TAM
		public void Dispose()
		{
			_log.Info("Shuting down SIPCallProvider");
			if(_resources != null)
			{
				_dispatcher.Invoke(
					DispatcherPriority.Normal,
					(MethodInvoker)delegate
					{
						_resources.StackProxy.shutdown();
						_resources.CallManager.Shutdown();
						_resources = null;
					});
			}
		}
コード例 #8
0
        public void Initialize()
        {
            if (_resources != null)
            {
                Dispose();
            }

            InitThread();

            _initialized.WaitOne();
            _dispatcher.Invoke(
                DispatcherPriority.Normal,
                (MethodInvoker) delegate
            {
                _log.Info("Initializing SIPCallProvider");
                _resources = new SipekResources();
                _resources.CallManager.CallStateRefresh         += onCallStateChanged;
                _resources.CallManager.IncomingCallNotification += new DIncomingCallNotification(resources_CallManager_IncomingCallNotification);
                _resources.Registrar.AccountStateChanged        += new DAccountStateChanged(resources_Registrar_AccountStateChanged);

                int status = _resources.CallManager.Initialize();
                _resources.CallManager.CallLogger = _resources.CallLogger;

                if (status != 0)
                {
                    throw new CallProviderException("Init SIP stack problem! \r\nPlease, check configuration and start again! \r\nStatus code " + status);
                }

                // initialize Stack
                _resources.Registrar.registerAccounts();


                int noOfCodecs = _resources.StackProxy.getNoOfCodecs();
                for (int i = 0; i < noOfCodecs; i++)
                {
                    string codecname = _resources.StackProxy.getCodec(i);
                    if (_resources.Configurator.CodecList.Contains(codecname))
                    {
                        // leave default
                        _resources.StackProxy.setCodecPriority(codecname, 128);
                    }
                    else
                    {
                        // disable
                        _resources.StackProxy.setCodecPriority(codecname, 0);
                    }
                }

                pjsipCallProxy.OnWavPlayerCompleted +=
                    delegate(int callId)
                {
                    _log.Info("Wav playback for call '{0}' ended", callId);
                    SIPCall call = FindCallById(callId);

                    if (call != null)
                    {
                        call.AudioPlaybackCompleted();
                    }
                };
            });
        }