Exemplo n.º 1
0
        /// <summary>
        /// Loads from json.
        /// </summary>
        /// <param name="jsonProperty">The json property.</param>
        /// <param name="service"></param>
        internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service)
        {
            foreach (string key in jsonProperty.Keys)
            {
                switch (key)
                {
                case XmlElementNames.PhoneCallState:
                    this.state = jsonProperty.ReadEnumValue <PhoneCallState>(key);
                    break;

                case XmlElementNames.ConnectionFailureCause:
                    this.connectionFailureCause = jsonProperty.ReadEnumValue <ConnectionFailureCause>(key);
                    break;

                case XmlElementNames.SIPResponseText:
                    this.sipResponseText = jsonProperty.ReadAsString(key);
                    break;

                case XmlElementNames.SIPResponseCode:
                    this.sipResponseCode = jsonProperty.ReadAsInt(key);
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Refreshes the state of this phone call.
 /// </summary>
 public void Refresh()
 {
     PhoneCall phoneCall = service.UnifiedMessaging.GetPhoneCallInformation(this.id);
     this.state = phoneCall.State;
     this.connectionFailureCause = phoneCall.ConnectionFailureCause;
     this.sipResponseText = phoneCall.SIPResponseText;
     this.sipResponseCode = phoneCall.SIPResponseCode;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Refreshes the state of this phone call.
        /// </summary>
        public async System.Threading.Tasks.Task Refresh()
        {
            PhoneCall phoneCall = await service.UnifiedMessaging.GetPhoneCallInformation(this.id).ConfigureAwait(false);

            this.state = phoneCall.State;
            this.connectionFailureCause = phoneCall.ConnectionFailureCause;
            this.sipResponseText        = phoneCall.SIPResponseText;
            this.sipResponseCode        = phoneCall.SIPResponseCode;
        }
Exemplo n.º 4
0
    /// <summary>
    /// Refreshes the state of this phone call.
    /// </summary>
    void Refresh()
    {
        PhoneCall phoneCall = service.UnifiedMessaging.GetPhoneCallInformation(this.id);

        this.state = phoneCall.State;
        this.connectionFailureCause = phoneCall.ConnectionFailureCause;
        this.sipResponseText        = phoneCall.SIPResponseText;
        this.sipResponseCode        = phoneCall.SIPResponseCode;
    }
Exemplo n.º 5
0
        /// <summary>
        /// Disconnects this phone call.
        /// </summary>
        public void Disconnect()
        {
            // If call is already disconnected, throw exception
            //
            if (this.state == PhoneCallState.Disconnected)
            {
                throw new ServiceLocalException(Strings.PhoneCallAlreadyDisconnected);
            }

            this.service.UnifiedMessaging.DisconnectPhoneCall(this.id);
            this.state = PhoneCallState.Disconnected;
        }
Exemplo n.º 6
0
        public void ChangeCallState(PhoneCallState state)
        {
            System.Diagnostics.Debug.WriteLine(state);
            if (state == PhoneCallState.STATE_WAITING_INCOMING)
            {
                Status = AppResources.VoipIncoming;
            }
            else if (state == PhoneCallState.STATE_WAIT_INIT || state == PhoneCallState.STATE_WAIT_INIT_ACK)
            {
                Status    = AppResources.VoipConnecting;
                ViewState = CallViewState.CallConnecting;
            }
            else if (state == PhoneCallState.STATE_EXCHANGING_KEYS)
            {
                Status    = AppResources.VoipExchangingKeys;
                ViewState = CallViewState.CallConnecting;
            }
            else if (state == PhoneCallState.STATE_WAITING)
            {
                Status = AppResources.VoipWaiting;
            }
            else if (state == PhoneCallState.STATE_RINGING)
            {
                Status = AppResources.VoipRinging;
            }
            else if (state == PhoneCallState.STATE_REQUESTING)
            {
                Status = AppResources.VoipRequesting;
            }
            else if (state == PhoneCallState.STATE_HANGING_UP)
            {
                Status = AppResources.VoipHangingUp;
            }
            else if (state == PhoneCallState.STATE_ENDED)
            {
                Status = AppResources.VoipEnded;
            }
            else if (state == PhoneCallState.STATE_BUSY)
            {
                Status = AppResources.VoipBusy;
            }
            else if (state == PhoneCallState.STATE_ESTABLISHED)
            {
                StartTimer();
                ViewState = CallViewState.Call;
            }
            else if (state == PhoneCallState.STATE_FAILED)
            {
                Status = AppResources.VoipFailed;
            }

            NotifyOfPropertyChange(() => Status);
        }
Exemplo n.º 7
0
        /// <summary>
        /// PhoneCall Constructor.
        /// </summary>
        /// <param name="service">EWS service to which this object belongs.</param>
        internal PhoneCall(ExchangeService service)
        {
            EwsUtilities.Assert(
                service != null,
                "PhoneCall.ctor",
                "service is null");

            this.service = service;
            this.state   = PhoneCallState.Connecting;
            this.connectionFailureCause = ConnectionFailureCause.None;
            this.sipResponseText        = PhoneCall.SuccessfulResponseText;
            this.sipResponseCode        = PhoneCall.SuccessfulResponseCode;
        }
        /// <summary>
        /// Disconnects this phone call.
        /// </summary>
        public async System.Threading.Tasks.Task Disconnect(CancellationToken token = default(CancellationToken))
        {
            // If call is already disconnected, throw exception
            //
            if (this.state == PhoneCallState.Disconnected)
            {
                throw new ServiceLocalException(Strings.PhoneCallAlreadyDisconnected);
            }

            await this.service.UnifiedMessaging.DisconnectPhoneCall(this.id, token);

            this.state = PhoneCallState.Disconnected;
        }
Exemplo n.º 9
0
        /// <summary>
        /// PhoneCall Constructor.
        /// </summary>
        /// <param name="service">EWS service to which this object belongs.</param>
        internal PhoneCall(ExchangeService service)
        {
            EwsUtilities.Assert(
                service != null,
                "PhoneCall.ctor",
                "service is null");

            this.service = service;
            this.state = PhoneCallState.Connecting;
            this.connectionFailureCause = ConnectionFailureCause.None;
            this.sipResponseText = PhoneCall.SuccessfulResponseText;
            this.sipResponseCode = PhoneCall.SuccessfulResponseCode;          
        }
Exemplo n.º 10
0
 public override void OnReceive(Context context, Intent intent)
 {
     if (intent.Extras != null)
     {
         string state = intent.GetStringExtra(TelephonyManager.ExtraState);
         if (state == TelephonyManager.ExtraStateRinging)
         {
             currentState = currentState.Ring();
         }
         else if (state == TelephonyManager.ExtraStateOffhook)
         {
             currentState = currentState.Offhook();
         }
         else if (state == TelephonyManager.ExtraStateIdle)
         {
             currentState = currentState.Idle();
         }
     }
 }
        private string StateToLabel(PhoneCallState state)
        {
            switch (state)
            {
            case PhoneCallState.WaitingIncoming:
                return(Strings.Resources.VoipIncoming);

            case PhoneCallState.WaitInit:
            case PhoneCallState.WaitInitAck:
                return(Strings.Resources.VoipConnecting);

            case PhoneCallState.ExchangingKeys:
                return(Strings.Resources.VoipExchangingKeys);

            case PhoneCallState.Waiting:
                return(Strings.Resources.VoipWaiting);

            case PhoneCallState.Ringing:
                return(Strings.Resources.VoipRinging);

            case PhoneCallState.Requesting:
                return(Strings.Resources.VoipRequesting);

            case PhoneCallState.HangingUp:
                return(Strings.Resources.VoipHangingUp);

            case PhoneCallState.Ended:
                return(Strings.Resources.VoipCallEnded);

            case PhoneCallState.Busy:
                return(Strings.Resources.VoipBusy);

            case PhoneCallState.Failed:
                return(Strings.Resources.VoipFailed);

            case PhoneCallState.Established:
                return("00:00");
            }

            return(null);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Tries to read an element from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>True if element was read.</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            switch (reader.LocalName)
            {
            case XmlElementNames.PhoneCallState:
                this.state = reader.ReadElementValue <PhoneCallState>();
                return(true);

            case XmlElementNames.ConnectionFailureCause:
                this.connectionFailureCause = reader.ReadElementValue <ConnectionFailureCause>();
                return(true);

            case XmlElementNames.SIPResponseText:
                this.sipResponseText = reader.ReadElementValue();
                return(true);

            case XmlElementNames.SIPResponseCode:
                this.sipResponseCode = reader.ReadElementValue <int>();
                return(true);

            default:
                return(false);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Disconnects this phone call.
        /// </summary>
        public void Disconnect()
        {
            // If call is already disconnected, throw exception
            //
            if (this.state == PhoneCallState.Disconnected)
            {
                throw new ServiceLocalException(Strings.PhoneCallAlreadyDisconnected);
            }

            this.service.UnifiedMessaging.DisconnectPhoneCall(this.id);
            this.state = PhoneCallState.Disconnected;
        }
Exemplo n.º 14
0
 /// <summary>
 /// Tries to read an element from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 /// <returns>True if element was read.</returns>
 internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
 {
     switch (reader.LocalName)
     {
         case XmlElementNames.PhoneCallState:
             this.state = reader.ReadElementValue<PhoneCallState>();
             return true;
         case XmlElementNames.ConnectionFailureCause:
             this.connectionFailureCause = reader.ReadElementValue<ConnectionFailureCause>();
             return true;
         case XmlElementNames.SIPResponseText:
             this.sipResponseText = reader.ReadElementValue();
             return true;
         case XmlElementNames.SIPResponseCode:
             this.sipResponseCode = reader.ReadElementValue<int>();
             return true;
         default:
             return false;
     }
 }
Exemplo n.º 15
0
 private void DispatchStateChanged(PhoneCallState phoneCallState)
 {
 }