Jump to content

Tom Wellige

Root Moderator
  • Posts

    4,310
  • Joined

  • Last visited

  • Days Won

    117

 Content Type 

Profiles

SwyxPEDIA Wiki

Zendesk Integration

Persistent Variables

Longest Waiting

VBScript build in functions

GSE build in functions (VBScript)

Server Script API (VBScript)

GSE build in functions (Lua)

Server Script API (Lua)

Function Collection (VBScript)

Function Collection (Lua)

IPS Integration

Jira Service Integration

Forums

Blogs

Downloads

Everything posted by Tom Wellige

  1. VBScript → Lua This property returns or sets the state of the script users' (for whom the current script is running) own busy redirection setting. If PBXUser.BusyRedirect Then '... End If ' enable on busy redirection PBXUser.BusyRedirect = True ' disable on busy redirection PBXUser.BusyRedirect = False This property takes or returns a boolean value. Please note, that you need to set the number to which should be redirected using the PBXUser.BusyRedirectNumber function. If your script should check how the users' redirection is configured, make sure it is placed above the Busy Redirection rule in the Call Routing Manager list of rules. Otherwise your script will never be reached if the user has enabled his redirection.
  2. VBScript → Lua SwxWare 2011 This property takes or returns the current away status of the script user. ' Getting the script users current away state Dim bAway bAway = PBXUser.Away ' Setting the script users away state PBXUser.Away = True This property takes or returns a boolean value. This property is identical to the GSE build-in property IpPbx.Away.
  3. VBScript → Lua This function returns if the current call is disconnected or a given timeout is reached. PBXCall.WaitForDisconnect ([iTimeout]) This function returns an integer value of PBXSuccess (0) on success. See list of defined return values. Parameter iTimeout Optional. Default: 0 Time in seconds to wait for the call to disconnect. A zero timeout waits infinitely, i.e. until the call is disconnected. If the timeout is reached the function returns with the return value PBXTimeout. This function can be used after a call has been connected to a user to keep the script running until the call is finally disconnected. This might be useful if some sort of work has to be done at that point (releasing used memory, writing call details, a.s.o.). Please refer to PBXCall.ConnectedName or PBXCall.ConnectedNumber for another usage example of this function.
  4. VBScript → Lua This function skips the "Alert" phase of the current script call, i.e. the caller will not get an alerting sound. PBXCall.SkipAlerting This function returns an integer value of PBXSuccess (0) on success. See list of defined return values. Please keep the timeouts of the pstn / provider in mind when dealing with this messag directly. Beside skiping the alerting you can also sent a call proceeding message using the PBXCall.CallProceeding function. You can also start the alerting phase for the current call by using the PBXCall.Alerting function.
  5. VBScript → Lua This function sends an email via the globally configured email address. PBXCall.SendEMail bstrAddress, bstrSubject, bstrBody, bAttachRecording This function returns an integer value of PBXSuccess (0) on success. See list of defined return values. The "from" field of the email with be populated with the globally configured email address. The globally configured mail server will be used to sent this email via SMTP. Parameters bstrAddress EMail address. Must be a valid SMTP mail address, e.g. smith@example.com bstrSubject EMail Subject. bstrBody EMail Body. bAttachRecording If True the last recorded message will be attached, i.e. the .wav file which was created by last PBXCall.RecordMessage call or by the lat Record Message block before this PBXCall.SendEMail. Please note: Even if unicode characters are possible within VBScript strings, use only SMTP compatible characters.
  6. VBScript → Lua SwxWare 2011 This function returns the secondory calling party number, i.e. the network provided number. PBXCall.SecondaryCallingPartyNumber This function returns a string value. The functions PBXCall.CalledPartyNumber and PBXCall.CalledPartyNumberCanonical provide the so called user provided number. This number can either be suppressed or manipulated (via "clip no screening") by the caller. The network provided number can't be manipulated by the caller. Usually it is not getting signalled by the provider. On special lines/trunks, e.g. emergency services (police, fire brigade), it will be signalled by the provider. If the SwyxWare is connected to such special line/trunk the PBXCall.SecondaryCallingPartyNumber provides the network provided number. Otherwise it is empty.
  7. VBScript → Lua This function records a message as a temporary .wav file on the server. PBXCall.RecordMessage ( nTimeout ) This function returns an integer value of PBXSuccess (0) on success or PBXTimeout (2) on reaching the given timeout. See list of defined return values. Parameter nTimeout Maximum number of seconds until recording will be stopped. Valid values are 3 to 600. After the recording as finished the recorded file can be accessed via PBXCall.LastRecordedMessage and its length (in seconds) can be obtain via PBXCall.LastRecordedMessageLength. Dim nReturn nReturn = PBXCall.RecordMessage (180) If (nReturn = PBXSuccess) Or (nReturn = PBXTimeout) Then ' simply replay the recorded message PBXCall.PlayMessage (PBXCall.LastRecordedMessage) End If
  8. VBScript → Lua This functions returns all dialed digits *after* the script user was identified by his number/extension. PBXCall.PostDialingDigits This function returns a string value. There is another function available PBXCall.CalledPartyNumber which returns just the *first* digits to correctly identify the script user. If you need to know *all* dialed digits you can use the property PBXCall.DialedNumber. Example: Script user has internal number 200 and external number +4923147770 Internal caller dialed 200123 PBXCall.CalledPartyNumber returns 200 PBXCall.DialedNumber returns 200123 PBXCall.PostDialingDigits returns 123 External caller dialed +492314447 PBXCall.CalledPartyNumberCanonical returns +4923147770
  9. VBScript This object can be used to manipulate the phone call list entry which is written for the current call into the user's phone call list. This object defines the following properties and functions: Name Number State CallbackState Delete PBXCall.PhoneCallListEntry.Name = "Erika Mustermann" The Name property takes or returns the name to be set in the phone call list entry as string value. PBXCall.PhoneCallListEntry.Number = "4923147770" The Number property takes or returns the number to be set in the phone call list entry as string value. PBXCall.PhoneCallListEntry.State = PhoneCallStateCallAccepted The State property takes or returns the state of the call as PhoneCallState value. This is a list of all possible/available phone call states: PhoneCallStateCallAccepted PhoneCallStateCallNotAccepted PhoneCallStateCallDiverted PhoneCallStateCallDivertedToVoicemail PhoneCallStateAcceptedByTransfer PhoneCallListEntry.CallbackState The CallbackState propery takes or returns the state of a possibly request callback. When calling a busy user it is possible to leave a callback request. This is a list of all possible/available callback request states: PhoneCallbackStateNoCallback PhoneCallbackStateCallbackRequested PhoneCallbackStateCallbackCompleted PBXCall.PhoneCallListEntry.Delete The Delete function prevents any phone call list entry to be written for this call. This object does not manipulate the number and name to be displayed directly in the client (SwyxIt!, SwyxPhone). You can use the functions PBXCall.CallingPartyName and PBXCall.CallingPartyNumber to achieve this. Do not mistake the user's phone call list with the Call Detail Records. Please not that there is just one caller list entry written for the current script user. If you connect the call to some other user or user group those destinations will not get this caller list entry written.
  10. VBScript → Lua This function plays a given wav file. PBXCall.PlayMessage (bstrSoundfile, [nSkipFirstSeconds], [bRepeatAfterHoldOrTransfer], [FileOwner]) This function returns an integer value of PBXSuccess (0) on success. See list of defined return values. Parameters: bstrSoundfile Name of soundfile. PBXCall.PlayMessage "Welcome.wav" If no explicit path is given in the filename, SwyxServer searches this file in the database, in the following scopes in that order: User User Default Global System Default It is also possible to play a local file from the SwyxServer machine. In this case it is necessary, that the Windows user account the SwyxServer service is running under (usually the SwyxServiceAccount), has read privileges on that file. PBXCall.PlayMessage "C:\Announcements\MyMessage.wav" The .wav file must be in 16kHz, 16bit, PCM, mono format. The GetFilesInFolder function from the Function Collection shows an example that plays all .wav files in a given folder. nSkipFirstSeconds Optional. Default: 0 Skip the first n seconds of the given sound file. If value is 0 then file will be played completely. bRepeatAfterHoldOrTransfer Optional. Default: True False: sound file will NOT be repeated after current playback was interruppted by a 'hold' or 'transfer' user action. True: sound file will be repeated after current playback was interruppted by a 'hold' or 'transfer' user action. FileOwner Optional. Default: 0 Defines user whose file should be played. Can be a user ID or a user name. If 0 bstrSoundfile of the current script user will be played. Note that only non-private files of other users can be accessed. PBXCall.PlayMessage "Weclome.wav", 10, True, "Operator"
  11. VBScript → Lua This function returns the length of the last recorded message in seconds. PBXCall.LastRecordedMessageLength The property takes or returns a long value. When using either the PBXCall.RecordMessage function of the Record Message block a wav file is getting recorded. This function returns the length of this recording in seconds.
  12. VBScript → Lua This property returns the name (incl. path) of the last recorded message (by the Record Message block). PBXCall.LastRecordedMessage This function returns a string value. When making use of the Record Message functionality the SwyxServer defines the unique name of the WAV file to take the recording. After a recording this name can be requested from the server i.e. by this property. The Record Message block also provides a variable the name will be written in. If you need to know how many seconds were recorded in that WAV file you can use the PBXCall.LastRecordedMessageLength function. The file is named Rec_yyyyMMddhhmmss.wav where yyyMMddhhmmss is the time and date of the recording. The file name remains valid until the script is finished. After that the file will be deleted by the server. Hint: the PBXCall.SendEmail function deletes the last recording as well. So handle the file if needed beforehand. The following example copies the last recorded message to a given file server and renames it. Copy the first code snippet into the Start block of your script. The second code snippet can be used afterwards in a Script Code block. function Get2Digits ( s ) if Len(s) > 1 then Get2Digits = s else Get2Digits = "0" & s end if end function Dim sRecording, sTarget sTarget = "\\fileserver\recordings\%callid%_%date%_%time%.wav" sTarget = Replace(sTarget, "%callid%", PBXCall.CallID) sTarget = Replace(sTarget, "%date%", Year(Now) & Get2Digits(Month(Now)) & Get2Digits(Day(Now))) sTarget = Replace(sTarget, "%time%", Get2Digits(Hour(Now)) & Get2Digits(Minute(Now)) & Get2Digits(Second(Now))) sRecording = PBXCall.LastRecordedMessage if sRecording <> "" then Dim fso Set fso = CreateObject("Scripting.FileSystemObject") fso.CopyFile sRecording, sTarget Set fso = Nothing end if An even better solution would be to create a VBScript function from the second code snippet, place it also into the Start block and then call this function e.g. with an Evaluate block from with your GSE script. By doing so, you could add some proper error handling and tracing into your code.
  13. VBScript → Lua Returns True if the originator of the current call has disconnected it. If PBXCall.IsOriginatorDisconnected Then ' do something End If This property returns a boolean value. An example would be to put a call on hold with PBXCall.Hold and then to wait for an avaible agent within a loop. Don't miss to use the PBXScript.Sleep function when looping while waiting for something to prevent 100% cpu load. While being in such a loop it is also recommended to check regularly with PBXCall.IsOriginatorDisconnected if the caller has disconnected the call in the meantime.
  14. VBScript → Lua This function returns True if the current call is currently on hold. If PBXCall.IsOnHold Then PBXCall.Activate End If This function returns a boolean value. You can use the PBXCall.Hold function to put a call on hold, and the PBXCall.Activate function to activate a call again.
  15. VBScript → Lua This function returns True if the current call has an SwyxWare internal initiator. If PBXCall.IsInternal Then ' do something End If This function returns a boolean value.
  16. VBScript → Lua This function sets the current call on hold, meaning it starts playing the given music on hold file (wav) and returns. PBXCall.Hold "musiconhold.wav" This function returns an integer value of PBXSuccess (0) on success. See list of defined return values. In opposite to the GSE block Play Message which plays a wav file completely before returning, the hold function/block returns immediately. The one parameter of this function is the name of the wav file to be played. If no explicit path is given in the filename, SwyxServer searches this file in the database, in the following scopes in that order: User User Default Global System Default It is also possible to play a local file from the SwyxServer machine. In this case it is necessary, that the Windows user account the SwyxServer service is running under (usually the SwyxServiceAccount), has read privileges on that file. PBXCall.Hold "C:\Announcements\MyMusicOnHold.wav" There is one magic string as parameter available: PBXCall.Hold "*hold*" Using this magic string uses the configured system music on hold. Putting a call on hold can be used to start a waiting music and then waiting within a loop for an avaible agent. Don't miss to use the PBXScript.Sleep function when looping while waiting for something to prevent 100% cpu load. While being in such a loop it is also recommended to check regularly with PBXCall.IsOriginatorDisconnected if the caller has disconnected the call in the meantime. A call currently being set on hold can be activated by using the PBXCall.Activate function, i.e. stop playing music on hold. Alternatively all Play Sound blocks and all "Connect" blocks (Connect To, Follow Me and Loop) will automatically activate a call being on hold. Once a call is on hold you can use the PBXCall.PlayMessage function to play some additional announcements. In this special case, by using the api function directly instead of a gse block, the music on hold will be faded down, the announcement will be played and afterwards the music on hold fades up. Please note the difference of using this api function instead of the standard gse blocks which would activate the call and stop the music on hold. You can check at any time if the current call is on hold by using the function PBXCall.IsOnHold.
  17. VBScript → Lua SwxWare 2011 This property returns true, if a fax tone was detected in the current call. PBXCall.FaxToneDetected This function returns an boolean value. If a fax tone has beend detected the call can then be connected to an extension a fax machine or SwyxFax is connected to.
  18. VBScript → Lua This functions disconnects the current call. PBXCall.Disconnect ([cause]) This function returns an integer value of PBXSuccess (0) on success. See list of defined return values. This function can be called before the call is connected to a user (by using e.g. the Connect To block in the GSE) or even after the call was connected. Parameter cause Optional. Default: PBXCallTermNormalCallClearing This parameter takes the cause that is signalled to the other side (pstn/sip provider) and can be any of the following values: PBXCallTermNormalCallClearing PBXCallTermDestinationBusy PBXCallTermReject PBXCallTermCancelled PBXCallTermTransferred PBXCallTermJoinedConference PBXCallTermNoAnswer PBXCallTermToLate PBXCallTermDirectCallImpossible PBXCallTermWrongNumber PBXCallTermIgnoreCall
  19. VBScript → Lua This function returns the dialed number that has leaded the call to reach the current script. It returns *all* digit, not just the first digits to correctly identify the script user but also the so called post dialing digits. PBXCall.DialedNumber This function returns a string value. There is another function available PBXCall.CalledPartyNumber which returns just the first digits to correctly identify the script user. If you are interested in the post dialing digits you can use the property PBXCall.PostDialingDigits or the GSE build in function PostDialingDigits(). Example: Script user has internal number 200 and external number +4923147770 Internal caller dialed 200123 PBXCall.CalledPartyNumber returns 200 PBXCall.DialedNumber returns 200123 PBXCall.PostDialingDigits returns 123 External caller dialed +492314447 PBXCall.CalledPartyNumberCanonical returns +4923147770
  20. VBScript → Lua This property returns the intenal extension of the user a call was connected to right after a Connect To GSE block. PBXCall.ConnectedNumber This function returns a string value. If you connect a call to a group and need to know which user of this group has taken the call, this property can be requested right after leaving the Connected exit of the Connect To block. There is another function PBXCall.ConnectedName which returns the name of the user who took the call. The return value of this function is getting updated if after the call got connected initially and then transferred from there to another user. This of course requires the call routing script not to be left immediately after the Connect To block. This can be achieved by using the Timeout parameter of the Wait for Disconnect block to check the PBXCall.ConnectedNumber value e.g. every second for changes. An example for exactly this functionality can be found in the A.2 - Check Status and Update Ticket example of the Zendesk Integration, an Open ECR Extensions open source project. This example gathers all relevant information of a call and stores them into a Zendesk support ticket. Once a call was connect, a Wait For Disconnect block with a 1 second Timout is used, to check regularly if, the call is getting transferred any further, and if so updates the information which is getting written into the ticket. if sConnectedName <> PBXCall.ConnectedName then sConnectedName = PBXCall.ConnectedName sCallStatus = sCallStatus & _ FormatDateTime(Now) & " : Call connected to " & sConnectedName & "." & vbCrLF end if Please note, that this functions returns an empty string, once the call was disconnected.
  21. VBScript → Lua This property returns the name of the user a call was connected to right after a Connect To GSE block. PBXCall.ConnectedName This function returns a string value. It returns an empty string once the call is disconnected. If you connect a call to a group and need to know which user of this group has taken the call, this property can be requested right after leaving the Connected exit of the Connect To block. There is another function PBXCall.ConnectedNumber which returns the internal extension of the user who took the call. The return value of this function is also updated if the call is getting transferred later on in the call. This of course requires the call routing script not to be left immediately after the Connect To block. This can be achieved by using the Timeout parameter of the Wait for Disconnect block to check the PBXCall.ConnectedName value regularly for changes. An example for exactly this functionality can be found in the A.2 - Check Status and Update Ticket example of the Zendesk Integration, an Open ECR Extensions open source project. This example gathers all relevant information of a call and stores them into a Zendesk support ticket. Once a call is connect, a Wait For Disconnect block with a 1 second Timout is used, to check regularly if, the call is getting transferred any further, and if so, updates the information which is getting written into the ticket. if sConnectedName <> PBXCall.ConnectedName then sConnectedName = PBXCall.ConnectedName sCallStatus = sCallStatus & _ FormatDateTime(Now) & " : Call connected to " & sConnectedName & "." & vbCrLF end if
  22. VBScript Returns or sets the mode to handle calling party number and redirecting number on outgoing calls from a script, i.e. the script connects the call to an external destination. PBXCall.CLIMode = 0 The property takes or returns an integer value. The most common usage of this property is to set it within the PreProcessing rule which will be called for every incoming call to make sure to display the correct number. The SwyxECR manual (chapter 2.1.2.1, Preprocessing and Postprocessing) explains the functionality of the pre- and post- processing system within the call routing. Within the Enreach Partner Net there is a webinar available (English and German) which also describes functionality and usage of the PreProcessing in detail: Global Rules via PreProcessing (EN/DE) The following is a list of all possible values for the CLI mode: Name Value PBXCLIModePreferOriginatingNumer 0 PBXCLIModePreferRedirectingNumber 1 PBXCLIModeUseOriginatingNumerOnly 2 PBXCLIModeUseRedirectingNumberOnly 3
  23. VBScript → Lua SwxWare 2011 Returns the charges of the current call. PBXCall.Charges This function returns a double value. The returned number (e.g. 1,73) does not contain any currency information.
  24. VBScript → Lua This function sents a "Call Proceeding" message to the originator of the current call. PBXCall.CallProceeding This function returns an integer value of PBXSuccess (0) on success. See list of defined return values. If the current call is already in state Proceeding, Alerting or Connected the function call will be ignored. Common usage of this function is to signal call proceeding to the pstn, to state the fact that the script "is still working" on the delivery of the current call. While a call is in proceeding state, no tones will be played in the direction of the caller. The call is not connected and therefore consumes not costs. Beside sending call proceeding you can also sent an alerting message using the PBXCall.Alerting function.
  25. VBScript → Lua This property takes or returns the number of the current caller. PBXCall.CallingPartyNumber = "123456789" This property takes or returns a string value. This property can be used to modify the number being displayed on a client (SwyxIt!, SwyxPhone). It does not modify the caller list entry. This can be achieved using the PBXCall.PhoneCallListEntry object. Additionally you can also modify the name being displayed using the PBXCall.CallingPartyName property. Please note that you have to modify this value before actually connecting the call to a user using the Connect To block. This forum topic explains how to modify the displayed name and number using the GSE build-in function build IpPbx.CallingNumber.
×
×
  • 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.