Jump to content
Tom Wellige

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

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.



Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


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