示例#1
0
        public void RecordUnifiedMessagingGreeting()
        {
            ExTraceGlobals.UserOptionsCallTracer.TraceDebug((long)this.GetHashCode(), "OptionsEventHandler.RecordUnifiedMessagingGreeting");
            bool   flag         = (bool)base.GetParameter("vGr");
            string dialString   = (string)base.GetParameter("tpNum");
            string lastUMCallId = base.UserContext.LastUMCallId;

            using (UMClientCommon umclientCommon = new UMClientCommon(base.UserContext.ExchangePrincipal))
            {
                if (!umclientCommon.IsPlayOnPhoneEnabled())
                {
                    throw new OwaEventHandlerException("Failed to record greeting because user doesn't have Play On Phone Enabled", LocalizedStrings.GetNonEncoded(1385527863));
                }
                if (!string.IsNullOrEmpty(lastUMCallId))
                {
                    UMCallState umcallState = UMCallState.Disconnected;
                    try
                    {
                        UMCallInfo callInfo = umclientCommon.GetCallInfo(lastUMCallId);
                        umcallState = callInfo.CallState;
                    }
                    catch (InvalidCallIdException)
                    {
                        ExTraceGlobals.UnifiedMessagingTracer.TraceDebug((long)this.GetHashCode(), "Failed to get call status from Unified Messaging");
                    }
                    catch (Exception exception)
                    {
                        if (!OptionsEventHandler.HandleUMException(exception))
                        {
                            throw;
                        }
                    }
                    if (umcallState != UMCallState.Disconnected)
                    {
                        throw new OwaEventHandlerException(LocalizedStrings.GetNonEncoded(460647110), LocalizedStrings.GetNonEncoded(460647110));
                    }
                    base.UserContext.LastUMCallId = null;
                }
                UMGreetingType greetingType = flag ? UMGreetingType.NormalCustom : UMGreetingType.OofCustom;
                try
                {
                    base.UserContext.LastUMCallId = umclientCommon.PlayOnPhoneGreeting(greetingType, dialString);
                }
                catch (Exception exception2)
                {
                    if (!OptionsEventHandler.HandleUMException(exception2))
                    {
                        throw;
                    }
                }
            }
        }
示例#2
0
        public void GetUMCallStatus()
        {
            ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "ReadVoiceMessageEventHandler.GetUMCallStatus");
            string      lastUMCallId = base.UserContext.LastUMCallId;
            UMCallState umcallState  = UMCallState.Disconnected;

            using (UMClientCommon umclientCommon = new UMClientCommon(base.UserContext.ExchangePrincipal))
            {
                if (!umclientCommon.IsPlayOnPhoneEnabled())
                {
                    throw new OwaEventHandlerException("User is not enabled for Play on Phone", LocalizedStrings.GetNonEncoded(1385527863));
                }
                if (!string.IsNullOrEmpty(lastUMCallId))
                {
                    try
                    {
                        UMCallInfo callInfo = umclientCommon.GetCallInfo(lastUMCallId);
                        umcallState = callInfo.CallState;
                    }
                    catch (InvalidCallIdException)
                    {
                        ExTraceGlobals.UnifiedMessagingTracer.TraceDebug((long)this.GetHashCode(), "Failed to get call status from Unified Messaging");
                    }
                    catch (Exception exception)
                    {
                        if (this.HandleUMException(exception))
                        {
                            return;
                        }
                        throw;
                    }
                    if (umcallState == UMCallState.Disconnected || umcallState == UMCallState.Idle)
                    {
                        base.UserContext.LastUMCallId = null;
                    }
                }
            }
            TextWriter writer = this.Writer;
            int        num    = (int)umcallState;

            writer.Write(num.ToString());
        }
示例#3
0
        public void HangupUMPhoneCall()
        {
            ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "ReadVoiceMessageEventHandler.HangupUMPhoneCall");
            string lastUMCallId = base.UserContext.LastUMCallId;

            using (UMClientCommon umclientCommon = new UMClientCommon(base.UserContext.ExchangePrincipal))
            {
                if (!umclientCommon.IsPlayOnPhoneEnabled())
                {
                    throw new OwaEventHandlerException("User is not enabled for Play on Phone", LocalizedStrings.GetNonEncoded(1385527863));
                }
                if (!string.IsNullOrEmpty(lastUMCallId))
                {
                    try
                    {
                        UMCallInfo  callInfo  = umclientCommon.GetCallInfo(lastUMCallId);
                        UMCallState callState = callInfo.CallState;
                        if (callInfo.CallState != UMCallState.Disconnected)
                        {
                            umclientCommon.Disconnect(lastUMCallId);
                            base.UserContext.LastUMCallId = null;
                        }
                    }
                    catch (InvalidCallIdException)
                    {
                        ExTraceGlobals.UnifiedMessagingTracer.TraceDebug((long)this.GetHashCode(), "Failed to get call status from Unified Messaging");
                    }
                    catch (Exception exception)
                    {
                        if (this.HandleUMException(exception))
                        {
                            return;
                        }
                        throw;
                    }
                }
                base.UserContext.LastUMCallId      = null;
                base.UserContext.LastUMPhoneNumber = null;
            }
        }
示例#4
0
        private void PlayOnPhone(bool isPAA)
        {
            string text         = (string)base.GetParameter("phNum");
            string lastUMCallId = base.UserContext.LastUMCallId;

            using (UMClientCommon umclientCommon = new UMClientCommon(base.UserContext.ExchangePrincipal))
            {
                if (!umclientCommon.IsPlayOnPhoneEnabled())
                {
                    throw new OwaEventHandlerException("User is not enabled for Play on Phone", LocalizedStrings.GetNonEncoded(1385527863));
                }
                if (!string.IsNullOrEmpty(lastUMCallId))
                {
                    UMCallState umcallState = UMCallState.Disconnected;
                    try
                    {
                        UMCallInfo callInfo = umclientCommon.GetCallInfo(lastUMCallId);
                        umcallState = callInfo.CallState;
                    }
                    catch (InvalidCallIdException)
                    {
                        ExTraceGlobals.UnifiedMessagingTracer.TraceDebug((long)this.GetHashCode(), "Failed to get call status from Unified Messaging");
                    }
                    catch (Exception exception)
                    {
                        if (this.HandleUMException(exception))
                        {
                            return;
                        }
                        throw;
                    }
                    if (umcallState != UMCallState.Disconnected)
                    {
                        base.RenderPartialFailure(460647110, new Strings.IDs?(-937065163), ButtonDialogIcon.Warning);
                        return;
                    }
                    base.UserContext.LastUMCallId = null;
                }
                try
                {
                    if (isPAA)
                    {
                        string s           = (string)base.GetParameter("paaID");
                        Guid   paaIdentity = new Guid(Convert.FromBase64String(s));
                        base.UserContext.LastUMCallId = umclientCommon.PlayOnPhonePAAGreeting(paaIdentity, text);
                    }
                    else
                    {
                        OwaStoreObjectId  owaStoreObjectId             = (OwaStoreObjectId)base.GetParameter("msgID");
                        ExchangePrincipal playOnPhoneExchangePrincipal = this.GetPlayOnPhoneExchangePrincipal(owaStoreObjectId);
                        using (UMClientCommon umclientCommon2 = new UMClientCommon(playOnPhoneExchangePrincipal))
                        {
                            string base64ObjectId = Utilities.ProviderSpecificIdFromStoreObjectId(owaStoreObjectId.StoreObjectId.ToBase64String());
                            base.UserContext.LastUMCallId = umclientCommon2.PlayOnPhone(base64ObjectId, text);
                        }
                    }
                    base.UserContext.LastUMPhoneNumber = text;
                    if (string.Compare(umclientCommon.GetUMProperties().PlayOnPhoneDialString, text, StringComparison.InvariantCultureIgnoreCase) != 0)
                    {
                        umclientCommon.SetPlayOnPhoneDialString(text);
                    }
                }
                catch (Exception exception2)
                {
                    if (this.HandleUMException(exception2))
                    {
                        return;
                    }
                    throw;
                }
                this.Writer.Write(base.UserContext.LastUMCallId);
            }
        }