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. Lua SwxWare v13.10 This function returns the name of the user that transferred the call into current call routing script. local sName = PBXCall.TransferrerName() This function returns a string value. If the call is a direct call and not a transferred call the function returns an empty string. If you are interested in the number of the user who transferred the call you can use the PBXCall.TransferrerNumber() function.
  2. Lua → VBScript SwxWare v13.10 This function skips the "Alert" phase of the current script call, i.e. the caller will not get an alerting sound. local nReturn = PBXCall.SkipAlerting() This function returns a PBXResult value of PBXSuccess, PBXFailure or PBXCallTermOriginatorDisconnected. 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.
  3. Lua → VBScript SwxWare v13.10 This function sends an email via the globally configured email address. local nReturn = PBXCall.SendEMail(sTOAddress, sSubject, sBody, bAttachRecording) This function returns a PBXResult value of PBXSuccess or PBXFailure. 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. You can use the PBXScript.SendEMail() function if you need to specify more standard email fields like CC and BCC. Parameters sTOAddress EMail address. Must be a valid SMTP mail address, e.g. smith@example.com sSubject EMail Subject. sBody 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().
  4. Lua → VBScript SwxWare v13.10 This function returns the secondory calling party number, i.e. the network provided number. local sNumber = 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.
  5. Lua → VBScript SwxWare v13.10 This functions returns all dialed digits *after* the script user was identified by his number/extension. local sDigits = 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
  6. Lua → VBScript SwxWare v13.10 This function plays a given wav file. local nReturn = PBXCall.PlayMessage(sAnnouncement, nSkipFirstSeconds, bRepeatAfterHoldOrTransfer, nFileOwnerId, sFileOwnerName) This function returns a PBXResult value of PBXSuccess, PBXFailure, PBXCallTermNormalCallClearing or PBXCallTermOriginatorDisconnected. Parameters: sAnnouncement Name of soundfile. local nReturn = 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. local nReturn = 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. nFileOwnerId Optional. Default: 0 Defines user whose file should be played by the SwyxWare internal unser id. If 0 sAnnouncement of the current script user will be played. Note that only non-private files of other users can be accessed. local nReturn = PBXCall.PlayMessage("Weclome.wav", 0, True, 15) sFileOwnerName Optional. Default: "" Defines user whose file should be played by his SwyxWare user name. If "" sAnnouncement of the current script user will be played. Note that only non-private files of other users can be accessed. local nReturn = PBXCall.PlayMessage("Weclome.wav", 0, True, 0, "Erika Mustermann")
  7. Lua SwxWare v13.10 This function returns the original unmodified calling party number. local sNumber = PBXCall.OriginalCallingPartyNumber() This function returns a string value. By using the function PBXCall.CallingPartyNumber() it is possible to modify the calling party number before a call is connected to a destination. The modified number will then be displayed in the destinations display. The PBXCall.OriginalCallingPartyNumber() function will always return the original and unmodified calling party number.
  8. Lua SwxWare v13.10 This function returns the original unmodified calling party name. local sName = PBXCall.OriginalCallingPartyName() This function returns a string value. By using the function PBXCall.CallingPartyName() it is possible to modify the calling party name before a call is connected to a destination. The modified name will then be displayed in the destinations display. The PBXCall.OriginalCallingPartyName() function will always return the original and unmodified calling party name.
  9. Lua → VBScript SwxWare v13.10 This function returns the length of the last recorded message in seconds. local nLength = PBXCall.LastRecordedMessageLength() The property takes or returns a number 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.
  10. Lua → VBScript SwxWare v13.10 This function returns the name (incl. path) of the last recorded message (by the Record Message block). local sFileName = 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.
  11. Lua → VBScript SwxWare v13.10 This function returns true if the originator of the current call has disconnected it. if PBXCall.IsOriginatorDisconnected() then -- do something end This function 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.
  12. Lua → VBScript SwxWare v13.10 This function returns true if the current call is currently on hold. if PBXCall.IsOnHold() then PBXCall.Activate() end 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.
  13. Lua → VBScript SwxWare v13.10 This function returns true if the current call has an SwyxWare internal initiator. if PBXCall.IsInternal() then -- do something end This function returns a boolean value.
  14. Lua → VBScript SwxWare v13.10 This function returns true, if a fax tone was detected in the current call. local bFaxTone = 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.
  15. Lua → VBScript SwxWare v13.10 This function sets the current call on hold, meaning it starts playing the given music on hold file (wav) and returns. local nReturn = PBXCall.Hold(sMusicOnHold) This function returns a PBXResult value of PBXSuccess or PBXFailure. 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. local nReturn = PBXCall.Hold("C:\Announcements\MyMusicOnHold.wav") There is one magic string as parameter available: local nReturn = 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().
  16. Lua → VBScript SwxWare v13.10 This functions disconnects the current call. local nReturn = PBXCall.Disconnect(nCause) This function returns a PBXResult value of PBXSuccess or PBXFailure. 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 after the call was connected. Parameter nCause 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 To prevent any misunderstanding on the callder side (due to not predictable behaviour of the callers' provider) it is recommended to use PBXCallTermNormalCallClearing or PBXCallTermDestinationBusy only.
  17. Lua → VBScript SwxWare v13.10 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. local sNumber = 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
  18. Lua SwxWare v13.10 This function deletes the phone call list entry of the current call. local nReturn = PBXCall.DeletePhoneCallListEntry() This function return a PBXResult value of PBXSuccess or PBXFailure. By calling this function you can prevent that an entry in the phone call list will appear for the current call. This comes in handy when creating a blacklist call routing for unwanted calls.
  19. Lua → VBScript SwxWare v13.10 This function returns the intenal extension of the user a call was connected to right after a Connect To GSE block. local sNumber = PBXCall.ConnectedNumber() This function returns a string value. It returns an empty string once the call was 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.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. UseExit = 0 if (sConnectedName ~= PBXCall.ConnectedName()) then sConnectedName = PBXCall.ConnectedName() sCallStatus = sCallStatus .. CurDateTime() .. " : Call connected to " .. sConnectedName .. ".\n" end
  20. Lua → VBScript SwxWare v13.10 This function returns the name of the user a call was connected to right after a Connect To GSE block. local sName = 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 .. CurDateTime() .. " : Call connected to " .. sConnectedName .. ".\n" end
  21. Lua → VBScript SwxWare v13.10 This function returns the charges of the current call. local nCharges = PBXCall.Charges() This function returns a number value. The returned number (e.g. 1,73) does not contain any currency information.
  22. Lua SwxWare v13.10 This funtion returns the type of the current call. local sType = PBXCall.CallType() This function returns a string value. The returned value can be any of the following: "Normal" "Group" "Direct" "Supervisor" "Notification" "unknown"
  23. Lua → VBScript SwxWare v13.10 This function sents a "Call Proceeding" message to the originator of the current call. local nReturn = PBXCall.CallProceeding() This function returns a PBXResult value of PBXSuccess, PBXFailure or PBXCallTermOriginatorDisconnected. 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.
  24. Lua → VBScript SwxWare v13.10 This function sets or returns the name of the current caller. -- get the calling party name local sName = PBXCall.CallingPartyName() -- set new calling party name PBXCall.CallingPartyName("Erika Mustermann") This function sets or returns a string value. This function can be used to modify the name being displayed on a client (SwyxIt!, SwyxPhone). It does not modify the caller list entry. Additionally you can also modify the number being displayed using the PBXCall.CallingPartyNumber() function or the GSE build-in function IpPbx.CallingNumber(). Please note that you have to modify this value before actually connecting the call to a user using the Connect To block. This function is identical to the GSE build-in function IpPbx.CallingName().
  25. Lua → VBScript SwxWare v13.10 This function returns the name of the calling device type. local sType = PBXCall.CallingDeviceType() This function returns a string value. This is a list of possible return strings: String Type ------------- ------------------------------------------------------- COMClient SwyxIt! (<v6.1x) Conference Conferunce User MobileApp Swyx Mobile App DesktopApp Swyx macOS Desktop App Gateway SwyxGate or third party gateway (via H.323) SIPGateway Third party gateway (via SIP) Phone SwyxPhone (Lxxx) Link SwyxLink (via H.323) SIPClient SwyxIt! (>= v6.1x) and other SIP devices PhoneDCF IP phone connected via DCF (i.e. Yealink phone) MobileSIP Mobile App (via SP, other than Swyx Mobile App) SIPLink SwyxLink (via SIP) SIPLinkNoReg SwyxLink (via registerless SIP, e.g. to a SIP provider) PublicSIPLink SwyxLink (via SIP, e.g. to a SIP provider) unkonwn something else If you need to know the name of the calling device, i.g. the name of the trunk as shown in SwyxWare Administration, you can use the PBXCall.CallingDeviceName() property. So with the combination of PBXCall.CallingDeviceType() and PBXCall.CallingDeviceName() you can easily identify a specifc trunk a call came into your SwyxWare, be it an external trunk or a trunk to another linked SwyxWare.
×
×
  • 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.