Jump to content

Abfrage ob Leitungstaste eines Benutzers gesperrt ist


SimonSchmitt

Recommended Posts

Hallo zusammen,

 

ich versuche gerade eine VB-Skript für das CallRouting zu schreiben, das abfragt wieviele Benutzer aus einer Gruppe die Leitung 2 gesperrt bzw. nicht gesperrt haben. Leider habe ich keine Möglichkeit gefunden,  den Status der Leitungen eines Benutzer abzufragen. Die Abfrage der Benutzer inkl. Abfrage des Status usw. einer Gruppe funktioniert auch wunderbar. Gibt es eine Möglichkeit mit einem VB-Skript die Leitungen eines Benutzers direkt abzufragen?

 

Vielen Dank für eure Hilfe.

Simon Schmitt

Link to comment
Share on other sites


  • 1 month later...
  • Most Valued User

ich habe mir ein Kommandozeilentool geschrieben, welches den Leitungsstatus eines Users prüft und dann 0 oder 1 als Exitcode zurück liefert.

 

 class Program
    {
        static private LibManager m_LibManager;
        static void Main(string[] args)
        {
            bool bIsAvailable = false;
            

            int iUserId = 0;
            string sExtension = "";

            if (Int32.TryParse(args[0], out iUserId) && !String.IsNullOrWhiteSpace(args[1]))
            {
                sExtension = args[1];
                m_LibManager = new LibManager();


                m_LibManager.Username = "ippbx:" + "swyxUsername";
                m_LibManager.Password = "passwd";
                m_LibManager.WSBaseUrl = "server-ip/dns";
                m_LibManager.AuthenticationMode = SProxyObject.AuthenticationMode.UsernamePassword;
                m_LibManager.BaseProtocol = SProxyObject.BaseProtocol.TCP;

                UserEnum userEnum = m_LibManager.GetUserEnum();
                userEnum.ExecuteIDFilter(iUserId);

                if (userEnum.PrimaryCollection.Count == 1)
                {
                    foreach (SWConfigDataClientLib.Proxies.Users.UserEntry userEntry in userEnum.PrimaryCollection)
                    {

                        IpPbxBLOB.UserSettings userSettings = new IpPbxBLOB.UserSettings();
                        userSettings.SetBLOB(userEntry.GetUserConfigData());
                        foreach (CLineKeySetting cLineKeySetting in userSettings.m_LineKeySettings)
                        {
                            if (cLineKeySetting.ExtensionInComing == sExtension)
                            {
                                if (cLineKeySetting.LineDisabled == 0)
                                {
                                    bIsAvailable = true;
                                    break;
                                }

                            }
                        }
                    }
                }

            }
            if (bIsAvailable)
            {
                File.AppendAllText(@"c:\programdata\T-Com\Traces\GetUserLineKeyState.log", (DateTime.Now.ToString() + " - iUserId=" + iUserId.ToString() + @" - Exitcode=1 "+ Environment.NewLine));
                Environment.Exit(1);
            }
            else
            {
                File.AppendAllText(@"c:\programdata\T-Com\Traces\GetUserLineKeyState.log", (DateTime.Now.ToString() + " - iUserId=" + iUserId.ToString() + @" - Exitcode=0 "+ Environment.NewLine));
                Environment.Exit(0);
            }
                
            
        }
    }

 

Achtung: das Tool prüft auf die exakte Extension, die zulässigen Anruftypen "Alle, Durchwahl, Gruppenrufe" werden nicht berücksichtigt.

Wenn du die Anzahl der verfügbaren Teilnehmer willst, müsstest du das Tool so anpassen, dass du eine GruppenID/Durchwahl übergibst und das Tool durchläuft per foreach alle Gruppenmitglieder.

 

Link to comment
Share on other sites


  • 1 year later...
  • Most Valued User

Update, inzwischen gibt es keine performantere Lösung:

foreach (SWConfigDataClientLib.WSPhoneClientFacade.LineKeyConfiguration lineKeyConfiguration in phoneClientFacade.GetLineKeyConfiguration(iUserId))
                        {
                            if (lineKeyConfiguration.ExtensionsIncomming == sExtension)
                            {
                                if (lineKeyConfiguration.Disabled == false)
                                {
                                    bIsAvailable = true;
                                    GroupName = "Userid:" + iUserId.ToString();
                                    break;
                                }
                            }
                        }

 

Link to comment
Share on other sites


Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.