Exemplo n.º 1
0
 public InviteSession(ICallInternal owner, ICallManagerInternal callManager)
 {
     _callManager = callManager;
     Helper.GuardNotNull(owner);
     Helper.GuardNotNull(callManager);
     _call = new WeakReference(owner);
     _state = owner.IsIncoming ? (AbstractState) new IncomingInviteState(this) : new NullInviteState(this);
 }
Exemplo n.º 2
0
 public InviteSession(ICallInternal owner, ICallManagerInternal callManager)
 {
     _callManager = callManager;
     Helper.GuardNotNull(owner);
     Helper.GuardNotNull(callManager);
     _call  = new WeakReference(owner);
     _state = owner.IsIncoming ? (AbstractState) new IncomingInviteState(this) : new NullInviteState(this);
 }
Exemplo n.º 3
0
 public MediaSession(ICallInternal call, ILocalRegistry localRegistry,
                     ICallManagerInternal callManager, IConferenceBridge conferenceBridge)
 {
     Helper.GuardNotNull(call);
     Helper.GuardNotNull(localRegistry);
     Helper.GuardNotNull(callManager);
     Helper.GuardNotNull(conferenceBridge);
     _call             = new WeakReference(call);
     _state            = new NoneMediaState(this);
     _localRegistry    = localRegistry;
     _callManager      = callManager;
     _conferenceBridge = conferenceBridge;
 }
Exemplo n.º 4
0
 public MediaSession(ICallInternal call, ILocalRegistry localRegistry,
     ICallManagerInternal callManager, IConferenceBridge conferenceBridge)
 {
     Helper.GuardNotNull(call);
     Helper.GuardNotNull(localRegistry);
     Helper.GuardNotNull(callManager);
     Helper.GuardNotNull(conferenceBridge);
     _call = new WeakReference(call);
     _state = new NoneMediaState(this);
     _localRegistry = localRegistry;
     _callManager = callManager;
     _conferenceBridge = conferenceBridge;
 }
Exemplo n.º 5
0
        private void AddCallAndUpdateEaCache(string destinationUri, ICallInternal call)
        {
            _activeCalls.Add(call.Id, call);
            CallStateChangedEventArgs ea;

            if (!_eaCache.TryGetValue(new ValueWrapper <int>(call.Id), out ea))
            {
                ea = new CallStateChangedEventArgs {
                    Id = call.Id
                };
                _eaCache.Add(new ValueWrapper <int>(call.Id), ea);
            }
            ea.DestinationUri = destinationUri;
        }
Exemplo n.º 6
0
 public void RaiseRingEvent(ICallInternal call, bool ringOn)
 {
     //try
     //{
     call.InviteSession.IsRinging = true;
     //    if (_syncContext != null)
     //        _syncContext.Post(s => Ring(this, new RingEventArgs(ringOn, call)), null);
     //    else
     //        Ring(this, new RingEventArgs(ringOn, call));
     //}
     //catch (InvalidOperationException)
     //{
     Ring(this, new RingEventArgs(ringOn, call));
     //}
 }
Exemplo n.º 7
0
        public void RaiseCallStateChanged(ICallInternal call)
        {
            CallStateChangedEventArgs ea;

            if (_eaCache.TryGetValue(new ValueWrapper <int>(call.Id), out ea))
            {
                ea.InviteState = call.InviteState;
                ea.MediaState  = call.MediaState;
                //try
                //{
                //    if (_syncContext != null)
                //        _syncContext.Post(s => CallStateChanged(this, ea), null);
                //    else
                //        CallStateChanged(this, ea);
                //}
                //catch (InvalidOperationException)
                //{
                CallStateChanged(this, ea);
                //}
            }
        }
Exemplo n.º 8
0
        public void TerminateCall(ICallInternal call)
        {
            Helper.GuardNotNull(call);
            lock (_lock)
            {
                if (_activeCalls.ContainsKey(call.Id))
                {
                    _activeCalls.Remove(call.Id);
                }
                else
                {
                    throw new InvalidOperationException("There is no call with id = " + call.Id +
                                                        " in active calls. Can not terminate.");
                }

                call.InternalDispose();
                if (_activeCalls.Count == 0)
                {
                    _barrier.Set();
                }
            }
        }
Exemplo n.º 9
0
 private void AddCallAndUpdateEaCache(string destinationUri, ICallInternal call)
 {
     _activeCalls.Add(call.Id, call);
     CallStateChangedEventArgs ea;
     if (!_eaCache.TryGetValue(new ValueWrapper<int>(call.Id), out ea))
     {
         ea = new CallStateChangedEventArgs {Id = call.Id};
         _eaCache.Add(new ValueWrapper<int>(call.Id), ea);
     }
     ea.DestinationUri = destinationUri;
 }
Exemplo n.º 10
0
 public void RaiseRingEvent(ICallInternal call, bool ringOn)
 {
     //try
     //{
     call.InviteSession.IsRinging = true;
     //    if (_syncContext != null)
     //        _syncContext.Post(s => Ring(this, new RingEventArgs(ringOn, call)), null);
     //    else
     //        Ring(this, new RingEventArgs(ringOn, call));
     //}
     //catch (InvalidOperationException)
     //{
     Ring(this, new RingEventArgs(ringOn, call));
     //}
 }
Exemplo n.º 11
0
 public void RaiseCallStateChanged(ICallInternal call)
 {
     CallStateChangedEventArgs ea;
     if (_eaCache.TryGetValue(new ValueWrapper<int>(call.Id), out ea))
     {
         ea.InviteState = call.InviteState;
         ea.MediaState = call.MediaState;
         //try
         //{
         //    if (_syncContext != null)
         //        _syncContext.Post(s => CallStateChanged(this, ea), null);
         //    else
         //        CallStateChanged(this, ea);
         //}
         //catch (InvalidOperationException)
         //{
         CallStateChanged(this, ea);
         //}
     }
 }
Exemplo n.º 12
0
        public void TerminateCall(ICallInternal call)
        {
            Helper.GuardNotNull(call);
            lock (_lock)
            {
                if (_activeCalls.ContainsKey(call.Id))
                    _activeCalls.Remove(call.Id);
                else
                    throw new InvalidOperationException("There is no call with id = " + call.Id +
                                                        " in active calls. Can not terminate.");

                call.InternalDispose();
                if (_activeCalls.Count == 0)
                    _barrier.Set();
            }
        }