Jump to content

- Functions

- # IsRedirectedFromByNameEx

  Followers 0

  VBScript → Lua SwxWare v13.27

  This function checks if the current call was redirected by a given user or group.

  Please see the Introduction chapter for some usage instructions.

      '----------------------------------------------------------------
      ' IsRedirectedFromByNameEx
      '
      ' Checks if current call is redirected by a given user or group.
      ' The user or group is identified by its name.
      '
      ' Parameter:
      '   sName           name of user or group to check if call is redirected from
      '
      ' Return:
      '   boolean         true  - call was redirected by given user or group
      '                   false - call was not redirected by the given user or group
      '----------------------------------------------------------------
      Function IsRedirectedFromByNameEx(sName)
          PBXScript.OutputTrace "----------> IsRedirectedFromByNameEx ( " & sName & " )"

          Dim bReturn
          bReturn = False

          Dim PrevScripts
          Set PrevScripts = PBXScript.PreviousScripts

          Dim PrevScript
          For Each PrevScript In PrevScripts

              if PrevScript.EntityType = PBXScriptTypeUser then
                  PBXScript.OutputTrace "found user " & PrevScript.EntityName
              else
                  PBXScript.OutputTrace "found group " & PrevScript.EntityName
              end if

              If PrevScript.EntityName = sName Then
                  PBXScript.OutputTrace "this is a redirected call from " & sName
                  bReturn = True
              End If

          Next

          IsRedirectedFromByNameEx = bReturn

          PBXScript.OutputTrace "bReturn = " & bReturn
          PBXScript.OutputTrace "<--------- IsRedirectedFromByNameEx"

      End Function

  This function makes use of the Server script API function PBXScript.PreviousScripts to check if the call has been transferred by the given user (defined by his name) and PBXScript.OutputTrace to write trace information into the SwyxServer trace file.

  Please note: this function makes use of newly introduced functionalitly in SwyxWare v13.27 within the PBXScript.PreviousScripts collection. It is therefore able to check for users and groups the call have been before reaching the current script.

  There is a previous version of this function available, IsRedirectedFromByName, which can check for users only.

  A usage example of this function could be the following:

  Boss redirects all his calls to his secretary. The secretary redirects all her calls to the operator because she has to leave the office. So, when calling the boss directly one would end up at the operator.

  For the operator it would be useful to know if this is such a "boss" call. So, all you have to do is to call this function with the name of the boss user and afterwards e.g. manipulate the text being shown in the SwyxIt! display.

      If IsRedirectedFromByNameEx("Mr. Boss") Then
          PBXCall.CallingPartyName = "BOSS - " & PBXCall.CallingPartyName
      End If

  Another usage of this function can be found in the function IsRedirectedFromByNumber.

  This function was initially posted into this forum topic.

  By Tom Wellige

  - May 21, 2023
  Share
  Share
  Followers 0
  Previous Page IsRedirectedFromByName
  Next Page IsRedirectedFromByNumber

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