[asterisk-dev] [Code Review] app_read does not break from prompt loop with empty string

Russell Bryant russell at digium.com
Tue Mar 3 00:07:09 CST 2009



> On 2009-02-27 13:50:27, Matthew Nicholson wrote:
> > This change makes sense, and the code looks fine to me, though all of these magic return codes (-1, 0, 1, 2, 3) make me nervous.  The documentation for ast_readstring() needs to be updated.  Also the docs for ast_app_getdata() should probably include information about the return codes too.  Strangely enough, ast_app_getdata() is documented twice, neither of which mentions any return codes.
> 
> David Vossel wrote:
>     yea, they make me a little nervous too.   I searched through the code base and it looks like app_read is the only file that actually cares what the return code is if its > 0.

Actually, I think it would be worth it to go ahead and convert these to an enum while you're in this code, anyway.


- Russell


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.digium.com/r/177/#review490
-----------------------------------------------------------


On 2009-02-27 10:49:49, David Vossel wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.digium.com/r/177/
> -----------------------------------------------------------
> 
> (Updated 2009-02-27 10:49:49)
> 
> 
> Review request for Asterisk Developers and Russell Bryant.
> 
> 
> Summary
> -------
> 
> ignore the last description parts of it were wrong.
> 
> When multiple ampersand-delimited prompts are passed to app_read, pressing # (without pressing other DTMF keys) merely cycles through the prompts until it reaches the last one. Then it will *finally* skip that prompt and return to the dialplan.  It would be nice if # returned to the dialplan immediately without cycling through the rest of the prompts.  
> 
> In app.c, ast_app_getdata is called to stream the prompts and receive DTMF input.  If ast_app_getdata() receives an empty string caused by the user inputing the end of string character, in this case '#', it should break from the prompt loop and return to app_read, but instead it cycles through all the prompts.  I've added a return value for this special case in ast_readstring().   
> 
> 
> This addresses bug 0014279.
>     http://bugs.digium.com/view.php?id=0014279
> 
> 
> Diffs
> -----
> 
>   /trunk/main/app.c 178900 
>   /trunk/apps/app_read.c 178900 
>   /trunk/main/channel.c 178900 
> 
> Diff: http://reviewboard.digium.com/r/177/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> David
> 
>




More information about the asterisk-dev mailing list