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