Jump to content

- References

- # PostDialingDigits()

  Followers 0

  Lua → VBScript SwxWare v13.10

  This function returns the digits that where dialed by the caller after the current script was already reached.

      local sPostDialingDigits = PostDialingDigits()

  This function returns a string value.

  This function must be called before connecting the call to a device by using the Connect To block.

  Post dialing digits are the digits the caller has dialed after the user was already unambiguously identified, i.e. his extension was dialed. These numbers might already be completely dialed when the call reaches the script, but even digits being dialed later on can be requested by this function (see example below).

  The current post dialing digits will be requested making use of the Server Script API function PBXCall.PostDialingDigits().

  To figure the number that has been dialed to reach the current script (i.e. the user extension, excluding the post dialing digits) one can use CalledNumber(), which is identical to the Server Script API function PBXCall.CalledPartyNumber().

  To figure all dialed digits, the user extension plus the post dialing digits, one can use the Server Script API function 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
  - PostDialingDigits() returns 123
  - External caller dialed +492314447
  - PBXCall.CalledPartyNumberCanonical() returns +4923147770

  It is not unlikely that the caller hasn't dialed already all post dialing digits at the moment when the call reaches the script. It is therefore necessary for the script to wait for all needed post dialing digits (if they are of interest). The following is an example code that waits 3 seconds at most for 3 post dialing digits:

      local MAXWAITFORPDD     = 3  -- seconds
      local NUMOFEXPECTEDPDDS = 3  -- digits

      local nWait = 0
      while ((StringLen(PostDialingDigits()) < NUMOFEXPECTEDPDDS) and (nWait < MAXWAITFORPDD)) do
        PBXScript.Sleep(1000)
        nWait = nWait + 1
      end

      local bDigitsComplete = (StringLen(PostDialingDigits()) == NUMOFEXPECTEDPDDS)

  This example makes use of the string helper function StringLen().

  Please note that you should not wait too long for such post dialing digits as the caller experience would suffer from a too long waiting time within a script if he doesn't want to dial any additional numbers.

  By Tom Wellige

  - May 21, 2022
  Share
  Share
  Followers 0
  Previous Page OneWayConferenceSuffix()
  Next Page RecordLen()

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