Jump to content
Gold Sponsor: Data-Way IT-Consulting, Austria

  • PBXScript.GetUserByAddress()

    PBXScript.GetUserByAddress()

    Lua   → VBScript   SwxWare v13.10

     

    This function searches for a user or multiple users and returns its results as list (indexed table).

     

    local oUsers = PBXScript.GetUserByAddress(sNumber)

     

     

    This function returns an indexed table with PBXConfigUser elements.

     

     

    Parameter

     

    sNumber

     

    string. An internal number of a user or group, user name, group name, H.323 alias or SIP user ID to search for.

     

     

    The result PBXConfigUser element contains a number of information regarding the found user:

     

    :UserID()                      : number
    :Name()                        : string
    :EMailAddress()                : string
    :State()                       : number, PBXUserState (see PBXConfigUser)
    :DataFolder()                  : string (***obsolete***)
    :Numbers()                     : indexed table of strings
    :MobileIdentificationNumbers() : indexed table of strings (***obsolete***)
    :IsMobileExtensionEnabled()    : boolean (***obsolete***)
    :MobilePhoneNumber()           : string (***obsolete***)
    :NumberOfNewVoicemails()       : number
    :FreeStatusText()              : string

     

     

    The following is an example making use of the PBXScript.GetUserByAddress() function to return the current status of a given user:

     

    ------------------------------------------------------------------  
    -- GetUserStatus
    --  
    -- Returns the status of the given user.
    -- If being used on a user group it returns the status of the last user in the group.
    --  
    -- Parameter:
    --      sNumber     extension of user or user group
    --  
    -- Return:
    --      number - PBXUserStateValue
    --
    --      PBXUserStateUnavailable      = 0
    --      PBXUserStateLoggedOff        = 1
    --      PBXUserStateLoggedOn         = 2
    --      PBXUserStateSpeakingExternal = 3
    --      PBXUserStateAlerting         = 4
    --      PBXUserStateSpeakingInternal = 5
    --      PBXUserStateAway             = 6
    --      PBXUserStateDoNotDisturb     = 7
    --      PBXUserStateActive3rdParty   = 8
    ------------------------------------------------------------------  
    function GetUserStatus(sNumber) 
        PBXScript.OutputTrace ("-------------> GetUserStatus(sNumber = " .. sNumber .. ")")
    
        local nReturn = 0
        local oUsers  = nil
    
        oUsers = PBXScript.GetUserByAddress(sNumber)
        if (oUsers ~= nil) then
    
            for i = 1, #oUsers do
    
                PBXScript.OutputTrace ("Found user " .. oUsers[i]:Name() .. " with current state " .. oUsers[i]:State())
    
                nReturn = oUsers[i]:State()
    
            end
    
        end
    
        PBXScript.OutputTrace ("nReturn = " .. nReturn)
        PBXScript.OutputTrace ("<------------- GetUserStatus")
    
        return nReturn
    end

     

     

    Examples from the Function Collection

     

    :Name()

     

    :State()

     

    :NumberOfNewVoicemails()

     

     


    Tom Wellige
     Share


     Share




×
×
  • 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.