yep, the problem was in the regular expression (only looks for a number 0-9)<br>
i added a couple of lines that see if its not a number, but is a * it will return that.<br>
thanks, not an asterisk issue, but a python issue.<br>
<br>
shawn<br><br><div><span class="gmail_quote">On 8/14/06, <b class="gmail_sendername">Tzafrir Cohen</b> <<a href="mailto:tzafrir.cohen@xorcom.com">tzafrir.cohen@xorcom.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Mon, Aug 14, 2006 at 10:31:30AM -0400, shawn bright wrote:<br>> lo there,<br>> i am running a python agi script that gets a DTMF number from the user<br>> and passes it back to the script.<br><br>Any reason you're not using Read for this?
<br><br>> It works fine with numbers, but if they<br>> enter a star (*), it doesn't want to play.<br><br>Could you please provide a trace of the run?<br><br>> Is there a difference in how this is handled?<br>> here is the snippit:
<br>><br>> def getNumber (sound, gTimeLimit, digit_count):<br>> """<br>> the asterisk function GET DATA<br>> (filename, timeout, maxdigits)<br>> plays audiofile filename,<br>> gets DTMF digits
<br>> up to timeout or max digits<br>> """<br>> digit_count = int(digit_count)<br>> time_limit = int(gTimeLimit)<br>> sys.stderr.write("GET DATA %s %d %d\n" % (sound, time_limit,
<br>> digit_count))<br>> sys.stderr.flush()<br>> sys.stdout.write("GET DATA %s %d %d\n" % (sound, time_limit,<br>> digit_count))<br>> sys.stdout.flush()<br>> result = sys.stdin.readline
().strip()<br>> result = checkResult(result)<br>> if result:<br>> return result<br>> else:<br>> sys.stderr.write('dead result from IVR')<br>> return 'error'<br>><br>> def checkResult(params):
<br>> """<br>> reads the result of an asterisk command<br>> parses the answer and reports<br>> whether or not the command is successful<br>> """<br>> params =
params.rstrip()<br>> if re.search('^200',params):<br><br>Just a hunch:<br><br>How is '*' considered in a regular expression?<br><br>> result = re.search('result=(\d+)', params)<br>> if (not result):
<br>> sys.stderr.write("FAIL ('%s')\n" % params)<br>> sys.stderr.flush()<br>> return -1<br>> else:<br>> result = result.group(1)<br>>
sys.stderr.write('PASS (%s)\n' % result)<br>> sys.stderr.flush()<br>> return result<br>> else:<br>> sys.stderr.write("FAIL (unexpected result '%s')\n" % params)<br>>
sys.stderr.flush()<br>> return -2<br>><br>> menu_result = getNumber('menu', 5000, 1)<br>><br>> any idea where i may be missing something here ?<br>> some of the code is from an example app that i found on the internet.
<br>> There is something in this code ( i suppose ) that limits me from getting<br>> anything but an integer as a response from here<br>><br>> if you have read this far, thanks for your time.<br>><br>> shawn
<br><br>> _______________________________________________<br>> --Bandwidth and Colocation provided by <a href="http://Easynews.com">Easynews.com</a> --<br>><br>> asterisk-users mailing list<br>> To UNSUBSCRIBE or update options visit:
<br>> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br><br><br>--<br>Tzafrir Cohen <a href="mailto:sip:tzafrir@local.xorcom.com">
sip:tzafrir@local.xorcom.com</a><br>icq#16849755 <a href="mailto:iax:tzafrir@local.xorcom.com">iax:tzafrir@local.xorcom.com</a><br>+972-50-7952406 <a href="mailto:jabber:tzafrir@jabber.org">jabber:tzafrir@jabber.org
</a><br><a href="mailto:tzafrir.cohen@xorcom.com">tzafrir.cohen@xorcom.com</a> <a href="http://www.xorcom.com">http://www.xorcom.com</a><br>_______________________________________________<br>--Bandwidth and Colocation provided by
<a href="http://Easynews.com">Easynews.com</a> --<br><br>asterisk-users mailing list<br>To UNSUBSCRIBE or update options visit:<br> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users
</a><br></blockquote></div><br>