Request configuration and user data (incl. user status) within an Extended Call Routing script (kb2910)

Le informazioni contenute nel presente articolo riguardano i seguenti prodotti:

  • from SwyxWare v4.40

[ Riepilogo | Informazioni ]


This article describes the PBXConfig object which can be used to request configuration and user status information from the SwyxServer. Das object is available within the call routing as also for each external application via it's COM/DCOM interface.


The Server Script API (from SwyxWare v4.40) supports an object, PBXConfig, which has to be created in the following way:

dim oPBXConfig
set oPBXConfig = PBXScript.CreateObject("IpPBxSrv.PBXConfig")
oPBXConfig.Initialize PBXUser

Calling the Initialize Method is necessary to allow PBXConfig to provide complete functionality as described below. PBXConfig has the following read-only properties:


These properties correpond to the server properties as configured via SwyxWare Administration. Addionally PBXConfig supports a method GetUserByAddress.

dim oUsers
set oUsers = oPBXConfig.GetUserByAddress("101")

This function returns a list of PBXUser objects which have the given address, 101 in this example. If the address is an internal number, user name. H.323 alias or SIP user ID the returned collection contains the corresponding user object. If the address is a group number or group name the returned list contains PBXUser object of all group members.

The returned list is a common VBScript collection, which can be used in the following way:

dim oUser
for Each oUser in oUsers
' use user object here
PBXUser has the following read-only propertiesUserID

Starting with SwyxWare v6.0 this object additionally offers the following read/write property:


It contains the number of unread voicemails as stored in the SwyxWare database. Note: This value does not change when the user reads his voicemail with an email program directly. It will changed correctly when the voicemail is retrieved via SwyxWare's remote inquiry function or when the SwyxIt or Swyxphone's voicemail key is used.

The first four properties are self-explanatory. State can have one of the following values:

' user state not available
UserStateUnavailable = 0

' user is logged off
UserStateLoggedOff = 1

' user is logged on
UserStateLoggedOn = 2

' user is speaking, at least one call has an external origination
' or destination
UserStateSpeakingExternal = 3

' a call is currently alerting at one of the user's devices
UserStateAlerting = 4

' user is speaking, none of the calls has an external origination
' or destination
UserStateSpeakingInternal = 5

' user is away (from SwyxWare 2011)
UserStateAway = 6

' user has do not disturb status (from SwyxWare 2011)
UserStateDoNotDisturb = 7

Please note that the status signalling between the user the status should be requested from and the user the current script runs under must be configured (just as in SwyxIt!). If the PBXConfig object is instantiated from an external application the windows user under which this application runs must be a member of the "Group of SwyxWare Administrators" on the SwyxServer machine in order to get the status request working.

Numbers is a VBScript collection containing all numbers assigned to the user.

dim n
dim szNumbers
szNumbers = ""
for Each n in oUser.Numbers
   if szNumbers="" then
      szNumbers = n
      szNumbers = szNumbers & ", " & n
   end if
PBXScript.OutputTrace "Numbers: " & szNumbers

From v6.0x on, the SwyxWare differs between internal and external numbers. The numbers collection includes the internal numbers. There is no possibility to request the configured external numbers of a user.

If a number is configured to not being displayed in the global phonebook it will also no added to the numbers collection.


A complete code example for testing, e.g. inside an Insert-Script-Block of a GSE rule:

dim oPBXConfig
set oPBXConfig = PBXScript.CreateObject("IpPBxSrv.PBXConfig")
oPBXConfig.Initialize PBXUser

' server properties
PBXScript.OutputTrace "CountryCode: " & oPBXConfig.CountryCode
PBXScript.OutputTrace "AreaCode: " & oPBXConfig.AreaCode
PBXScript.OutputTrace "PublicAccessPrefix: " & oPBXConfig.PublicAccessPrefix
PBXScript.OutputTrace "LongDistanceCallPrefix: " & oPBXConfig.LongDistanceCallPrefix
PBXScript.OutputTrace "InternationalCallPrefix: " & oPBXConfig.InternationalCallPrefix
PBXScript.OutputTrace "NumberRangeStart: " & oPBXConfig.NumberRangeStart
PBXScript.OutputTrace "NumberRangeEnd: " & oPBXConfig.NumberRangeEnd
PBXScript.OutputTrace "NonDeliverableCallsNumber: " & oPBXConfig.NonDeliverableCallsNumber
PBXScript.OutputTrace "VoicemailFromAddress: " & oPBXConfig.VoicemailFromAddress

dim oStatus
set oStatus = oPBXConfig.Status
PBXScript.OutputTrace "LoggedInDevicesCOM : " & oStatus.LoggedInDevicesCOM
PBXScript.OutputTrace "LoggedInDevicesPhone : " & oStatus.LoggedInDevicesPhone
PBXScript.OutputTrace "LoggedInDevicesH323 : " & oStatus.LoggedInDevicesH323
PBXScript.OutputTrace "LoggedInDevicesConferenceMgr : " & oStatus.LoggedInDevicesConferenceMgr
PBXScript.OutputTrace "LoggedInDevicesSIP : " & oStatus.LoggedInDevicesSIP
PBXScript.OutputTrace "ActiveInternalCalls : " & oStatus.ActiveInternalCalls
PBXScript.OutputTrace "ActiveExternalCalls : " & oStatus.ActiveExternalCalls
PBXScript.OutputTrace "MaxLoggedInDevicesCOM : " & oStatus.MaxLoggedInDevicesCOM
PBXScript.OutputTrace "MaxLoggedInDevicesPhone : " & oStatus.MaxLoggedInDevicesPhone
PBXScript.OutputTrace "MaxLoggedInDevicesH323 : " & oStatus.MaxLoggedInDevicesH323
PBXScript.OutputTrace "MaxLoggedInDevicesConferenceMgr : " & oStatus.MaxLoggedInDevicesConferenceMgr
PBXScript.OutputTrace "MaxLoggedInDevicesSIP : " & oStatus.MaxLoggedInDevicesSIP
PBXScript.OutputTrace "MaxActiveInternalCalls : " & oStatus.MaxActiveInternalCalls
PBXScript.OutputTrace "MaxActiveExternalCalls : " & oStatus.MaxActiveExternalCalls

PBXScript.OutputTrace "LoggedInUsers : " & oStatus.LoggedInUsers
PBXScript.OutputTrace "MaxLoggedInUsers : " & oStatus.MaxLoggedInUsers

'get users or group members
dim oUSers
' You can use user phone numbers, group numbers, user names or group names as
' parameter here
set oUsers = oPBXConfig.GetUserByAddress("101")

dim oUser
for Each oUser in oUsers
    PBXScript.OutputTrace "User: " & oUser.UserID
    PBXScript.OutputTrace "Name: " & oUser.Name
    PBXScript.OutputTrace "EMailAddress: " & oUser.EMailAddress
    PBXScript.OutputTrace "Folder: " & oUser.DataFolder

    ' The following state values are defined
    ' UserStateUnavailable = 0
    ' UserStateLoggedOff = 1
    ' UserStateLoggedOn = 2
    ' UserStateSpeaking = 3 (external)
    ' UserStateAlerting = 4
    ' UserStateSpeakingInternal = 5 (internal)
    ' UserStateAway = 6 (from SwyxWare 2011)
    ' UserStateDoNotDisturb = 7 (from SwyxWare 2011)
    PBXScript.OutputTrace "State: " & oUser.State
    dim n
    dim szNumbers
    szNumbers = ""
    for Each n in oUser.Numbers
        if szNumbers="" then
         szNumbers = n
         szNumbers = szNumbers & ", " & n
        end if
    PBXScript.OutputTrace "Numbers: " & szNumbers


L'articolo è stato utile? Lasci un commento all'articolo

Come possiamo contattarLa se dal Suo commento dovessero nascere altri quesiti?

Indirizzo e-mail Adresse (facoltativo)


Il campo destinato ai commenti non è ammesso per richieste all'assistenza. Per quesiti inerenti l'assistenza rivolgersi esclusivamente al proprio rivenditore di fiducia o al distributore competente.