[Home]

Summary:ASTERISK-01254: Enhance app_read to accept a maximum of N digits
Reporter:lancey (lancey)Labels:
Date Opened:2004-03-20 19:13:13.000-0600Date Closed:2008-01-15 14:48:16.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) app_read.diff.3
Description:This patch adds a new parameter to Read() application:
Read(variable[|filename][|maxdigits])

maxdigits   -- maximum acceptable number of digits. Stops reading after maxdigits have been entered (without requiring the user press the '#' key).                Defaults to 0 - no limit - wait for the user press the '#' key. Any value below 0 means the same.
Max accepted value is 255.
Comments:By: Brian West (bkw918) 2004-03-20 20:49:30.000-0600

Added to cvs-head

By: lancey (lancey) 2004-03-21 17:41:47.000-0600

There is a bug in Read():
If we want to specify only maxdigits, but not filename, it will try to play a file with no name and will break.

Example:
Read(var,,10)

Output:
=======
   -- Accepting a maximum of 10 digits.
Mar 22 00:30:43 WARNING[56335]: file.c:462 ast_openstream: File  does not exist in any format
Mar 22 00:30:43 WARNING[56335]: file.c:750 ast_streamfile: Unable to open  (format ILBC): No such file or directory

I'm fixing this and will attach a new app_read.diff soon.

By: lancey (lancey) 2004-03-21 18:55:32.000-0600

OK, bug resolved. I uploaded a patch against current CVS.

By: lancey (lancey) 2004-03-21 19:35:00.000-0600

zigman is gonna clean this up, as the whole app_read :)
Stay tuned....

By: Michael Labuschke (zigman) 2004-03-21 20:40:53.000-0600

so done,
the problem was not really the strsep think but the strncpy of data to tmp was not really \0 terminated ( is that allways true ?-- not good :P)

this is a patch to cvs app_read.c

i cleaned it up a bit ( tmp2[256] is useless and needs just more ram ( i know 256 bytes is nothing ;)

feedback is welcome
zigman

By: lancey (lancey) 2004-03-21 20:58:56.000-0600

"this is a patch to cvs app_read.c"

Nopez, it's not :((

Please make a cvs diff.

By: Michael Labuschke (zigman) 2004-03-21 21:20:30.000-0600

so retry ( this is a patch agains -r1.3) of app_read ( my cvs co is 1.2 only)

By: lancey (lancey) 2004-03-21 21:28:28.000-0600

Roger that!

Patch works FINE :)

By: Michael Labuschke (zigman) 2004-03-21 21:30:20.000-0600

last one is only a code cleanup ;)
if .. if suxx ;)
so app_read.diff.3 is the right one

By: James Golovich (jamesgolovich) 2004-03-21 22:55:20.000-0600

I commited the latest diff to CVS -HEAD.  Hopefully this is the end and we can close this out

By: James Golovich (jamesgolovich) 2004-03-24 03:52:12.000-0600

Haven't heard anything on this so I'm closing it out.  Reopen if there is something else to fix on it

By: Digium Subversion (svnbot) 2008-01-15 14:48:16.000-0600

Repository: asterisk
Revision: 2509

U   trunk/apps/app_read.c

------------------------------------------------------------------------
r2509 | jeremy | 2008-01-15 14:48:15 -0600 (Tue, 15 Jan 2008) | 2 lines

Enhance to accept a maximum of N digits. Bug ASTERISK-1254

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=2509