コード例 #1
0
        public override void CallBlast(int lineNumber, string[] numbers, string fromCallerID, string fromCallerNumber, WOSI.CallButler.Data.CallButlerDataset.ProvidersRow[] providers)
        {
            string callerID     = null;
            string callerNumber = null;

            if (fromCallerID != null && fromCallerID.Length > 0)
            {
                callerID = fromCallerID;
            }

            if (!providers[0].SupressOutboundUsername && fromCallerNumber != null && fromCallerNumber.Length > 0)
            {
                callerNumber = fromCallerNumber;
            }

            SIPProfile[] sipProfiles = new SIPProfile[numbers.Length];

            for (int index = 0; index < numbers.Length; index++)
            {
                if (providers == null || index >= providers.Length)
                {
                    sipProfiles[index] = defaultProfile;
                }
                else
                {
                    sipProfiles[index] = ConvertProfile(providers[index]);
                }
            }

            ipClient.CallBlast(lineNumber, callerID, callerNumber, sipProfiles, numbers);
        }
コード例 #2
0
        protected override void OnLoadData()
        {
            if (ipClient == null)
            {
                profile = new SIPProfile();

                profile.DomainRealm = "callbutler.com";
                if (Properties.Settings.Default.ManagementInterfaceType == WOSI.CallButler.ManagementInterface.CallButlerManagementInterfaceType.Hosted)
                {
                    ipClient = new inTELIPhoneClient(5060, 1, NATTraversalType.PartialSTUN);
                }
                else
                {
                    ipClient = new inTELIPhoneClient(5060, 1, NATTraversalType.None);
                    ipClient.SetRtpPort(1, 7850);
                }
                ipClient.EnableTracing     = false;
                ipClient.CallEnded        += new CallStateEventHandler(ipClient_CallEnded);
                ipClient.CallFailed       += new CallFailedEventHandler(ipClient_CallFailed);
                ipClient.CallConnected    += new IncomingCallEventHandler(ipClient_CallConnected);
                ipClient.IncomingTransfer += new EventHandler <IncomingTransferEventArgs>(ipClient_IncomingTransfer);

                //ipClient.SipPort = 8996;

                //trkMicVolume.Value = ipClient.GetMicrophoneVolume(1);
                trkSpeakerVolume.Value = ipClient.GetOutputVolume(1);

                sipPort = ManagementInterfaceClient.ManagementInterface.SIPPort;
            }
        }
コード例 #3
0
        private SIPProfile ConvertProfile(WOSI.CallButler.Data.CallButlerDataset.ProvidersRow provider)
        {
            SIPProfile callProfile = new SIPProfile();

            callProfile = new SIPProfile();
            callProfile.AuthPassword       = WOSI.Utilities.CryptoUtils.Decrypt(provider.AuthPassword, WOSI.CallButler.Data.Constants.EncryptionPassword);
            callProfile.AuthUsername       = provider.AuthUsername;
            callProfile.DisplayName        = provider.DisplayName;
            callProfile.DomainRealm        = provider.Domain;
            callProfile.SIPProxyServer     = provider.SIPProxy;
            callProfile.SIPRegistrarServer = provider.SIPRegistrar;
            callProfile.Username           = provider.Username;
            callProfile.AutoDetectAudio    = provider.AutoDetectAudio;

            return(callProfile);
        }
コード例 #4
0
        public override void Register(Guid registrationID, object registrationParams)
        {
            // If this profile exists already, unregsiter it
            if (currentProfiles.ContainsKey(registrationID))
            {
                Unregister(registrationID);
            }

            WOSI.CallButler.Data.CallButlerDataset.ProvidersRow provider = registrationParams as WOSI.CallButler.Data.CallButlerDataset.ProvidersRow;

            if (provider != null && provider.IsEnabled)
            {
                // Create a new SIP Profile
                SIPProfile profile = new SIPProfile();

                profile.DisplayName  = provider.DisplayName;
                profile.Username     = provider.Username;
                profile.AuthUsername = provider.AuthUsername;

                if (provider.AuthPassword.Length > 0)
                {
                    profile.AuthPassword = WOSI.Utilities.CryptoUtils.Decrypt(provider.AuthPassword, WOSI.CallButler.Data.Constants.EncryptionPassword);
                }

                profile.DomainRealm        = provider.Domain;
                profile.SIPProxyServer     = provider.SIPProxy;
                profile.SIPRegistrarServer = provider.SIPRegistrar;

                if (provider.EnableRegistration)
                {
                    ipClient.RegisterProfile(profile, provider.Expires);
                }

                lock (profileLock)
                {
                    currentProfiles.Add(registrationID, profile);
                }

                if (provider.IsDefault)
                {
                    defaultProfile = profile;
                }
            }
        }
コード例 #5
0
        public override void Unregister(Guid registrationID)
        {
            if (currentProfiles.ContainsKey(registrationID))
            {
                SIPProfile profile = currentProfiles[registrationID];

                if (profile == defaultProfile)
                {
                    defaultProfile = null;
                }

                ipClient.UnregisterProfile(profile);

                lock (profileLock)
                {
                    currentProfiles.Remove(registrationID);
                }
            }
        }
コード例 #6
0
        public override void Call(int lineNumber, string number, string fromCallerID, string fromCallerNumber, string replacesID, string referredBy, bool requestAutoAnswer, WOSI.CallButler.Data.CallButlerDataset.ProvidersRow provider)
        {
            string callerID     = null;
            string callerNumber = null;

            SIPProfile callProfile = defaultProfile;

            if (provider != null)
            {
                callProfile = ConvertProfile(provider);
            }

            if (fromCallerID != null && fromCallerID.Length > 0)
            {
                callerID = fromCallerID;
            }

            if (provider != null && !provider.SupressOutboundUsername && fromCallerNumber != null && fromCallerNumber.Length > 0)
            {
                callerNumber = fromCallerNumber;
            }

            // Make the call
            if (callProfile != null)
            {
                try
                {
                    ipClient.Call(lineNumber, callerID, callerNumber, callProfile, number, replacesID, referredBy, requestAutoAnswer);

                    return;
                }
                catch (Exception e)
                {
                }
            }

            RaiseCallFailed(new CallFailureEventArgs(lineNumber, 0, "No profile defined"));
        }
コード例 #7
0
        public override string GetRegistrationState(Guid registrationID)
        {
            if (currentProfiles.ContainsKey(registrationID))
            {
                SIPProfile profile = currentProfiles[registrationID];

                switch (profile.ProfileState)
                {
                case SIPProfileState.Registered:
                    return("Registered");

                case SIPProfileState.RegistrationError:
                {
                    return(string.Format("Registration Error - {0}", profile.ProfileStateDescription));
                }

                case SIPProfileState.Unregistered:
                    return("Unregistered");
                }
            }

            return("Disabled");
        }
コード例 #8
0
        private SIPProfile ConvertProfile(WOSI.CallButler.Data.CallButlerDataset.ProvidersRow provider)
        {
            SIPProfile callProfile = new SIPProfile();

            callProfile = new SIPProfile();
            callProfile.AuthPassword = WOSI.Utilities.CryptoUtils.Decrypt(provider.AuthPassword, WOSI.CallButler.Data.Constants.EncryptionPassword);
            callProfile.AuthUsername = provider.AuthUsername;
            callProfile.DisplayName = provider.DisplayName;
            callProfile.DomainRealm = provider.Domain;
            callProfile.SIPProxyServer = provider.SIPProxy;
            callProfile.SIPRegistrarServer = provider.SIPRegistrar;
            callProfile.Username = provider.Username;
            callProfile.AutoDetectAudio = provider.AutoDetectAudio;

            return callProfile;
        }
コード例 #9
0
        public override void Unregister(Guid registrationID)
        {
            if (currentProfiles.ContainsKey(registrationID))
            {
                SIPProfile profile = currentProfiles[registrationID];

                if (profile == defaultProfile)
                    defaultProfile = null;

                ipClient.UnregisterProfile(profile);

                lock (profileLock)
                {
                    currentProfiles.Remove(registrationID);
                }
            }
        }
コード例 #10
0
        public override void Register(Guid registrationID, object registrationParams)
        {
            // If this profile exists already, unregsiter it
            if (currentProfiles.ContainsKey(registrationID) && currentProfiles[registrationID].ProfileState == SIPProfileState.Registered)
                Unregister(registrationID);

            WOSI.CallButler.Data.CallButlerDataset.ProvidersRow provider = registrationParams as WOSI.CallButler.Data.CallButlerDataset.ProvidersRow;

            if (provider != null && provider.IsEnabled)
            {
                // Create a new SIP Profile
                SIPProfile profile = new SIPProfile();

                profile.DisplayName = provider.DisplayName;
                profile.Username = provider.Username;
                profile.AuthUsername = provider.AuthUsername;

                if (provider.AuthPassword.Length > 0)
                    profile.AuthPassword = WOSI.Utilities.CryptoUtils.Decrypt(provider.AuthPassword, WOSI.CallButler.Data.Constants.EncryptionPassword);

                profile.DomainRealm = provider.Domain;
                profile.SIPProxyServer = provider.SIPProxy;
                profile.SIPRegistrarServer = provider.SIPRegistrar;

                if (provider.EnableRegistration)
                {
                    ipClient.RegisterProfile(profile, provider.Expires);
                }

                lock (profileLock)
                {
                    currentProfiles.Add(registrationID, profile);
                }

                if(provider.IsDefault)
                    defaultProfile = profile;
            }
        }
コード例 #11
0
        public override void CallBlast(int lineNumber, string[] numbers, string fromCallerID, string fromCallerNumber, WOSI.CallButler.Data.CallButlerDataset.ProvidersRow[] providers)
        {
            string callerID = null;
            string callerNumber = null;

            if (fromCallerID != null && fromCallerID.Length > 0)
                callerID = fromCallerID;

            if (!providers[0].SupressOutboundUsername && fromCallerNumber != null && fromCallerNumber.Length > 0)
                callerNumber = fromCallerNumber;

            SIPProfile[] sipProfiles = new SIPProfile[numbers.Length];

            for(int index = 0; index < numbers.Length; index++)
            {
                if (providers == null || index >= providers.Length)
                    sipProfiles[index] = defaultProfile;
                else
                    sipProfiles[index] = ConvertProfile(providers[index]);
            }

            ipClient.CallBlast(lineNumber, callerID, callerNumber, sipProfiles, numbers);
        }
コード例 #12
0
ファイル: TestDriveView.cs プロジェクト: hostitherepc/Fork-1
        protected override void OnLoadData()
        {
            if (ipClient == null)
            {
                profile = new SIPProfile();

                profile.DomainRealm = "callbutler.com";
                if (Properties.Settings.Default.ManagementInterfaceType == WOSI.CallButler.ManagementInterface.CallButlerManagementInterfaceType.Hosted)
                {
                    ipClient = new inTELIPhoneClient(5060, 1, NATTraversalType.PartialSTUN);
                }
                else
                {
                    ipClient = new inTELIPhoneClient(5060, 1, NATTraversalType.None);
                    ipClient.SetRtpPort(1, 7850);
                }
                ipClient.EnableTracing = false;
                ipClient.CallEnded += new CallStateEventHandler(ipClient_CallEnded);
                ipClient.CallFailed += new CallFailedEventHandler(ipClient_CallFailed);
                ipClient.CallConnected += new IncomingCallEventHandler(ipClient_CallConnected);
                ipClient.IncomingTransfer += new EventHandler<IncomingTransferEventArgs>(ipClient_IncomingTransfer);

                //ipClient.SipPort = 8996;

                //trkMicVolume.Value = ipClient.GetMicrophoneVolume(1);
                trkSpeakerVolume.Value = ipClient.GetOutputVolume(1);

                sipPort = ManagementInterfaceClient.ManagementInterface.SIPPort;
            }
        }