Summary:
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.
Information:
The Server Script API (from SwyxWare v4.40) supports an object, PBXConfig, which has to be created in the following way:
dim oPBXConfigset 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:
CountryCodeAreaCodePublicAccessPrefixLongDistanceCallPrefixInternationalCallPrefixNumberRangeStartNumberRangeEndNonDeliverableCallsNumber
These properties correpond to the server properties as configured via SwyxWare Administration. Addionally PBXConfigsupports a method GetUserByAddress.
dim oUsersset 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 oUserfor Each oUser in oUsers' use user object herenext
PBXUser has the following read-only propertiesUserIDNameEMailAddressDataFolderStateNumbers
Starting with SwyxWare v6.0 this object additionally offers the following read/write property:
NumberOfNewVoicemails
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 availableUserStateUnavailable = 0' user is logged offUserStateLoggedOff = 1' user is logged onUserStateLoggedOn = 2' user is speaking, at least one call has an external origination' or destinationUserStateSpeakingExternal = 3' a call is currently alerting at one of the user's devicesUserStateAlerting = 4' user is speaking, none of the calls has an external origination' or destinationUserStateSpeakingInternal = 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 ndim szNumbersszNumbers = ""for Each n in oUser.Numbers if szNumbers="" then szNumbers = n else szNumbers = szNumbers & ", " & n end ifnextPBXScript.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 oPBXConfigset oPBXConfig = PBXScript.CreateObject("IpPBxSrv.PBXConfig")oPBXConfig.Initialize PBXUser'' server properties'PBXScript.OutputTrace "CountryCode: " & oPBXConfig.CountryCodePBXScript.OutputTrace "AreaCode: " & oPBXConfig.AreaCodePBXScript.OutputTrace "PublicAccessPrefix: " & oPBXConfig.PublicAccessPrefixPBXScript.OutputTrace "LongDistanceCallPrefix: " & oPBXConfig.LongDistanceCallPrefixPBXScript.OutputTrace "InternationalCallPrefix: " & oPBXConfig.InternationalCallPrefixPBXScript.OutputTrace "NumberRangeStart: " & oPBXConfig.NumberRangeStartPBXScript.OutputTrace "NumberRangeEnd: " & oPBXConfig.NumberRangeEndPBXScript.OutputTrace "NonDeliverableCallsNumber: " & oPBXConfig.NonDeliverableCallsNumberPBXScript.OutputTrace "VoicemailFromAddress: " & oPBXConfig.VoicemailFromAddressdim oStatusset oStatus = oPBXConfig.StatusPBXScript.OutputTrace "LoggedInDevicesCOM : " & oStatus.LoggedInDevicesCOMPBXScript.OutputTrace "LoggedInDevicesPhone : " & oStatus.LoggedInDevicesPhonePBXScript.OutputTrace "LoggedInDevicesH323 : " & oStatus.LoggedInDevicesH323PBXScript.OutputTrace "LoggedInDevicesConferenceMgr : " & oStatus.LoggedInDevicesConferenceMgrPBXScript.OutputTrace "LoggedInDevicesSIP : " & oStatus.LoggedInDevicesSIPPBXScript.OutputTrace "ActiveInternalCalls : " & oStatus.ActiveInternalCallsPBXScript.OutputTrace "ActiveExternalCalls : " & oStatus.ActiveExternalCallsPBXScript.OutputTrace "MaxLoggedInDevicesCOM : " & oStatus.MaxLoggedInDevicesCOMPBXScript.OutputTrace "MaxLoggedInDevicesPhone : " & oStatus.MaxLoggedInDevicesPhonePBXScript.OutputTrace "MaxLoggedInDevicesH323 : " & oStatus.MaxLoggedInDevicesH323PBXScript.OutputTrace "MaxLoggedInDevicesConferenceMgr : " & oStatus.MaxLoggedInDevicesConferenceMgrPBXScript.OutputTrace "MaxLoggedInDevicesSIP : " & oStatus.MaxLoggedInDevicesSIPPBXScript.OutputTrace "MaxActiveInternalCalls : " & oStatus.MaxActiveInternalCallsPBXScript.OutputTrace "MaxActiveExternalCalls : " & oStatus.MaxActiveExternalCallsPBXScript.OutputTrace "LoggedInUsers : " & oStatus.LoggedInUsersPBXScript.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 hereset oUsers = oPBXConfig.GetUserByAddress("101")dim oUserfor 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 else szNumbers = szNumbers & ", " & n end if next PBXScript.OutputTrace "Numbers: " & szNumbersnext
Comments
0 comments
Article is closed for comments.