Dismiss Notice
We would like to remind you that we’re updating our login process for all 3CX forums whereby you will be able to login with the same credentials you use for the Partner or Customer Portal. Click here to read more.

Press * to transfer to an operator?

Discussion in 'CRM / Helpdesk / App Integration' started by slippyr4, Sep 2, 2014.

Thread Status:
Not open for further replies.
  1. slippyr4

    Joined:
    Aug 18, 2014
    Messages:
    14
    Likes Received:
    0
    Hi,

    I'd like to be able to offer my users the opportunity to abort entering user input and transfer to an operator, by pressing the * key on the keypad.

    My user input component has MinDigits = 5 and MaxDigits=5 and no stop digit, because I'm collecting a 5 digit reference. I want to be able to allow the user to transfer to a human if he doesn't have the reference number, but I can't figure out how to do that.

    If i make the * key the stop digit, then I can't be sure that the user actually entered the * digit because it's not present in the Buffer. If I instead make the * key a valid input then I can't act upon it's press until the user has entered 5 digits.

    there must be a way to do this?
     
  2. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    Hi,

    Currently the way to do that is setting MinDigits to 1, and configure the "*" character as a valid digit.

    That way, into the Valid Input branch, you can add a Conditional component and check what the user has entered, and then decide the path to follow depending on that. For example, the first branch of the Conditional component could check if the Buffer == '*'. Then the second branch could check if there is an asterisk inside the buffer (somewhere else), then a third branch could check if the length is 5, and finally you add a fourth branch to add the logic for invalid length.

    Kind regards.
     
  3. slippyr4

    Joined:
    Aug 18, 2014
    Messages:
    14
    Likes Received:
    0
    How can I check if the branch contains a * somewhere in the string? There's no build in CONTAINS type function, and the idea of using a loop component with LEN and SUBSTRING makes me want to cry.

    I can't figure out how to refer to in scope variables in a javascript expression, and this isn't covered at all in the documentation, and the 3cx.com/blog/docs/javascript-3cx-vad/ article barely mentions javascript and actually explains more about the (non javascript) conditional component.

    I've trying accessing the buffer with "userInputComponent1.Buffer" in a javascript expression but it always ends up with a ECMAScript parse error (suggesting there is no such variable).
     
    #3 slippyr4, Sep 2, 2014
    Last edited by a moderator: Jul 28, 2017
  4. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    I understand it's not straight forward, but currently it's the way to go, as there is no other way to specify a shortcut digit. We may consider adding this feature in a future release, but for now you will have to deal with this.

    In order to check if the asterisk is into the buffer, you need to use javascript. For example, you could use the following function:

    function containsAsterisk(str)
    {
    return str.indexOf("*") >= 0;
    }

    Put that function into a javascript text file, for example "containsAsterisk.js" and put that file into the "Libraries" folder of your project.

    Then, add an External Code Execution component to your callflow, and call that function from there, passing the userInputComponent1.Buffer as a parameter.

    The properties of the VAD components are not directly available from javascript because the VAD makes some changes at compile time. For example, if your callflow name is "Main.flow" the value of the property "userInputComponent1.Buffer" should be into a javascript variable named "Main_userInputComponent1_Buffer". You can check the output VXML files generated when you build your project in order to be sure of the variable name for that property.

    Hope the information helps.

    Kind regards.
     
  5. slippyr4

    Joined:
    Aug 18, 2014
    Messages:
    14
    Likes Received:
    0
    Thanks for the input

    Is the "userInputComponent1.Buffer" -> "Main_userInputComponent1_Buffer" supported, or liable to change in the future?

    The external code call is less desirable because it kind of confuses things.
     
  6. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    Well, the variable name is generated using an undocumented procedure, and it could be changed if we need to. But to be honest, pretty sure it will not change. It has remained as it is for several years, so you should not have problems using it. But we can't give you warranties about this.

    Also, please note that if you change your callflow name, the variable name will change too.

    Kind regards.
     
  7. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    Also, in the unlikely event of changing the way the variable name is generated, you would just have to rename it in your code once... So I would go that way if you feel more confortable.
     
Thread Status:
Not open for further replies.