[asterisk-users] Change Termination of Read Command

Mark Michelson mmichelson at digium.com
Mon Apr 27 15:44:36 CDT 2009


Daniel Hazelbaker wrote:
> On Apr 27, 2009, at 10:29 AM, Danny Nicholas wrote:
> 
>> Greetings all,
>>                    This is a “just-for-fun” question.   I was reading 
>> the support forum and a fellow there wanted Read() to stop on * 
>> instead of #.  I thought that changing app_read.c would resolve this
>>  
>> current
>> if (tmp[x-1] == '#') { 
>> tmp[x-1] = '\0'; 
>> break;
>>  
>> new 
>> }if (tmp[x-1] == '*') { 
>> tmp[x-1] = '\0'; 
>> break; 
>> }
>>  
>> He applied and recompiled, but no joy. Any ideas why?
> 
> Without knowing where in the file this came from I can't say for sure, 
> but that code looks to me like the code that would run after the digits 
> are received and is stripping off the # character at the end, if it is 
> there.  Further up (or somewhere else entirely) there is probably a spot 
> that actually terminates the read command when # is pressed.
> 
> Daniel
> 

Daniel is correct in his analysis. If you want app_read to terminate on a '*' 
instead of a '#' then you will need to change the ast_readstring call inside of 
ast_app_getdata (which is called from read_exec in app_read). This will have the 
side effect of making other situations use a * instead of a # as well (like 
entering voicemail mailbox and entering an agent password).

Mark Michelson



More information about the asterisk-users mailing list