Jump to content

Do Not Connect To Group If At Least One User Is Busy

Tom Wellige

Recommended Posts

Today's first question of the Presales department:


Is it possible to check if one user in a goup is busy and if so not to connect the call to the group but instead disconnect the call with busy?


Of course!


Copy the following code into the Start block:


Function IsAtLeastOneAgentBusy(ByVal sNumber)

    PBXScript.OutputTrace("-------> IsAtLeastOneAgentBusy ( sNumber = " & sNumber & " )")

    Dim bReturn
    bReturn = False

    Dim PBXConfig
    Set PBXConfig = PBXScript.CreateObject("IpPbxSrv.PBXConfig")

    Dim Users
    Set Users = PBXConfig.GetUserByAddress(sNumber)

    Dim User
    For Each User In Users

        PBXScript.OutputTrace("Found user " & User.Name & " with current state " & User.State)

        ' does the server recognize this user a busy ?
        If (User.State = 3) or (User.State = 5) Then
            PBXScript.OutputTrace("User is busy!")
            bReturn = True
        End If


    IsAtLeastOneAgentBusy = bReturn

    PBXScript.OutputTrace("bReturn = " & bReturn)
    PBXScript.OutputTrace("<------- IsAtLeastOneAgentBusy")

End Function

Afterwards use an Evaluate block to call the function. Let's assume the group number is 200:


The result is then directly on one of the two exits of this block. 


Then just either use a Connect To block to connect the call to the group or a Disconnect block (with "busy" configured as reason) to disconnect it.



Link to comment
Share on other sites


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.