[Freeswitch-dev] taking a decision upon session:playAndGetDigits returns

Anthony Minessale anthony.minessale at gmail.com
Fri Nov 27 13:06:43 PST 2009


session:getDigits is a whole different function that uses the callback
functions for you to control what happens yourself you set an input callback
call session:getDigits and catch the input yourself.


On Fri, Nov 27, 2009 at 2:12 PM, Peter Volchek
<pvolchek at voicemobility.com>wrote:

>  No,
> I am playing a prompt, which I do not want to interrupt. Once prompt done
> playing I flush the digits and start collecting.
>
> Here is the simple scenario:
>
> play ("Enter your credit card# or hit * to return to the previous menu")
> -- not interruptable
> session:flushDigits()
> digits=session:getDigits(16, "[#*]", 3000)
>
> At this point I need to take the decision to continue processing.
>
> Choices
> 1. All digits are entered -> go process
> 2. Some digits were entered  and terminated by #  -> go process
> 3. Some digits were entered but timeout occurred -> go process
> 4. Some or none digits were entered terminated by * -> go previous menu
> 5. No digits were entered and timeout occurred -> play prompt (are you
> still there and start over, 3 times)
> 6. No digits were entered and # was pressed -> play error prompt and start
> over (3 times)
>
> Unfortunately, I cannot implement all these scenarios as the result
> variables are not set (as it is done at playAndGetDigits).
> I also noticed that session:read might not set these variables too
>
>
> Anthony Minessale wrote:
>
> are you mixing getDigits with playAndGetDigits?
>
>
> On Fri, Nov 27, 2009 at 11:52 AM, Peter Volchek <
> pvolchek at voicemobility.com> wrote:
>
>>  Hi,
>> Now I am using lua's session:getDigits function, and it seems that
>> "read_result" and "read_terminator_used" are not set at all.
>> Besides, lua's implementation of this function accept only three
>> parameters( lenght, terminator and timeout),
>> however, some other modules allow more parameters  (
>> http://wiki.freeswitch.org/wiki/Session_getDigits)
>> Why is that?
>>
>>
>> Cheers,
>> Peter
>>
>>
>>
>> Anthony Minessale wrote:
>>
>>  We have such a variable called "read_result"
>> possible vals: success, timeout, failure
>>
>> "read_terminator_used" contains the terminator
>>
>>
>> On Tue, Nov 3, 2009 at 2:20 PM, Peter Volchek <pvolchek at voicemobility.com
>> > wrote:
>>
>>> Hi,
>>> I am having some troubles adopting [session:playAndGetDigits] function
>>> to my application needs.
>>>
>>> There are three possible outcomes that the function should report on:
>>> 1. Success. The required number of of digits was collected and they
>>> match the mask.
>>> 2. Fail 1.The entered digits do not match the mask
>>> 3. Fail2. Timeout failure
>>>
>>> Right now, I cannot distinguish between 2 & 3. In both cases, an empty
>>> string is returned, so I have no idea what was the real failure.
>>>
>>> 4. Success upon termination
>>> That is a tricky one, and I believe, there is a bug in this function.
>>> This function accept the terminators, which should stop digits
>>> collection.
>>> Consider the following function call:
>>>
>>> digits = session:playAndGetDigits(
>>>    0, 5, 1, 3000, "#",
>>>    "enter_mailbox_number_or_hit_pound_to_login.wav",
>>>    "error.wav",
>>>    "\\d*"
>>>    );
>>>
>>>
>>> Here, I want to collect up to 5 digits, that represent a mailbox number.
>>> Note that I set the minimum value to be 0, as I want "#" itself to be
>>> the sign, that I want to login to my system.
>>> However, when I execute this code and hit "#" immediately, the system
>>> play me an error message. Oops! Well, I changed my digits mask to be
>>> "#", and it did not help either.
>>> BTW, about the last case. If I my digits mask contains the symbol used
>>> in the terminators, then it has to be collected and returned. The
>>> current implementation just uses terminates the collection and does not
>>> include the terminator to the returned string.
>>>
>>> Possible solutions to determine the function's outcome:
>>> 1. Return multiple values (state, digits). That may break tons of the
>>> existing code
>>> 2. Set a channel (or session) variable. Similar to C's errno and define
>>> some variables defining the outcome. Below is a summary table that
>>> covers all the cases:
>>>
>>> ------------------------------------------------------
>>> ERRNO       | Description
>>> ------------------------------------------------------
>>> RET_OK      | Maximum number of digits was collected or
>>>            | terminated when in range [min_digits..max_digits-1]
>>>            | or timeout triggered after collecting enough digits
>>> [min_digits..max_digits-1].
>>>            | The collected digits match digits_regex
>>>            | Returns the collected digits
>>>
>>> RET_TERM    | Terminating before collecting enough digits or when
>>>            | the collected digits do not match digits_regex
>>>            | Return whatever was collected (for logging)
>>>
>>>
>>> RET_TIMEOUT | Did not collect enough digits for the time specified or
>>> when
>>>            | the collected digits do not match digits_regex
>>>            | Return whatever was collected (for logging)
>>>
>>>
>>> Does it all make sense?
>>> Cheers,
>>> PV
>>>
>>>
>>>
>>> _______________________________________________
>>> FreeSWITCH-dev mailing list
>>> FreeSWITCH-dev at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>>> http://www.freeswitch.org
>>>
>>
>>
>>
>> --
>> Anthony Minessale II
>>
>> FreeSWITCH http://www.freeswitch.org/
>> ClueCon http://www.cluecon.com/
>> Twitter: http://twitter.com/FreeSWITCH_wire
>>
>> AIM: anthm
>> MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
>> IRC: irc.freenode.net #freeswitch
>>
>> FreeSWITCH Developer Conference
>> sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
>> iax:guest at conference.freeswitch.org/888
>> googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
>> pstn:213-799-1400
>>
>> ------------------------------
>>
>> _______________________________________________
>> FreeSWITCH-dev mailing listFreeSWITCH-dev at lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-devhttp://www.freeswitch.org
>>
>>
>> _______________________________________________
>> FreeSWITCH-dev mailing list
>> FreeSWITCH-dev at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> http://www.freeswitch.org
>>
>>
>
>
> --
> Anthony Minessale II
>
> FreeSWITCH http://www.freeswitch.org/
> ClueCon http://www.cluecon.com/
> Twitter: http://twitter.com/FreeSWITCH_wire
>
> AIM: anthm
> MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
> IRC: irc.freenode.net #freeswitch
>
> FreeSWITCH Developer Conference
> sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
> iax:guest at conference.freeswitch.org/888
> googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
> pstn:213-799-1400
>
> ------------------------------
>
> _______________________________________________
> FreeSWITCH-dev mailing listFreeSWITCH-dev at lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-devhttp://www.freeswitch.org
>
>
> _______________________________________________
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>


-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:213-799-1400
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20091127/0b5ea6fa/attachment.html 


More information about the FreeSWITCH-dev mailing list