Command Read

Good Morning to All!

I have a problem when using the Read command.

For I know the Read command is terminated with the # key but I need to change so that it understands the end of the command with the * key

My need is because my client already has a digital service in which all the talk was asked to be entered * the end.

Example: Enter your registration and the final type *

I do not know if it is possible a change in source code control Read

Or other place of the Read command within my dial plan to capture what is being typed and display the end of the command with *

Someone has been there?

It’s possible for sure, as you should have the sources and shouldn’t be difficult, look in apps/app_read.c, around line 183 (Asterisk 1.4.21.1) , you should find what you’re looking for, just change the “#” with an “*”, rebuild Asterisk, restart it, didn’t try but should work.

Cheers.

Marco Bruni
www.marcobruni.net

Use at your own risk:

In app_read.c line 183-186 is the code that checks for #. Change
if (tmp[x-1] == ‘#’) {
tmp[x-1] = ‘\0’;
break;
}

to
if (tmp[x-1] == ‘*’) {
tmp[x-1] = ‘\0’;
break;
}
and re-make your asterisk
(make && make install)

Thank you for your attention
I run the test and I will post anything.

Change the line as indicated by sethsdad0627

Then type make clean and then make & & make install (with the asterisk stopped)

After I started compiling the Asterisk but is still the # as end of command, I think I jumped something

Could you help me?

Shouldn’t have done make clean. you’ll need to do make menuselect then make install now. BTW, the change I indicated is for 1.4.21.2. If you are using another version, the segment could be earlier or later in the code.

You could also duplicate the segment to make read stop on both * and #.

Was really missing the menuselect, I will try and post something again.
Thank you.

Good morning!

Come on:

Enter /usr/lib/asterisk/modules and deleted the app_read.so
App_read.c changed the line indicated.
Typed make clean
Typed ./configure
Typed make menuselect
Typed make
Typed make install

This for Asterisk and he stopped.

I started the Asterisk and I try the command Read still identifying as the order #

Do you have somewhere else to change?

My version is 1.4.22

Regards

Gonçalo Ereno

post your dialplan snippet please.

My extensions.conf the part where it asks for registration is this:

[Cash]
exten => 0004,1,Wait(1)
exten => 0004,n,Set(TIMEOUT(digit)=5)
exten => 0004,n,Set(TIMEOUT(response)=5)
exten => 0004,n(keycode),PlayBack(enterkeycode)
exten => 0004,n,Read(MATRICULA,beep)

At this point I want to end with the * and it is only ending with #

exten => 0004,n,SayDigits(${MATRICULA})

My app_read.c was well after amendment.

if (tmp[x-1] == ‘*’) {
tmp[x-1] = ‘\0’;
break;
}

Ps. I got the module to read and is the date I re-compiled.

Thank you.

I tried this and found no joy either. Here is a work-around:

after the read, do this AGI
exten => 0004,n,AGI(stripcode.agi, ${MATRICULA})

Here is the code for stripcode.agi

#!/usr/local/bin/perl -w
################################################################################

stripcode.agi value

################################################################################
use strict;
use warnings;
use Asterisk::AGI;

the AGI object

my $agi = new Asterisk::AGI;
my %input = $agi->ReadParse();
my $matval = $ARGV[0];
($matval,undef) = split(/*/x, $matval);

print STDOUT “SET VARIABLE MATRICULA “$matval”\n”;
exit;

The split will just trash anything entered after the * and return the clean value to the dialplan.

another suggestion

voip-info.org/wiki/index.php … k+func+cut

exten => 0004,n,Set(MATRICULA=${CUT(MATRICULA,*,1)})

Save some CPU time

I do the script and test.

Anything post again.

Thanks

Hello friend,

My problem would not only get what you have to *, but do follow the asterisk to the next extension.

People will call the URA are old people so I want to increase the timeout and terminate the command read with the *

The need for the * is because the old URA (which was not Asterisk) already used as the * end of input.

I believe the only way would be changing the source of the command read and re-compiling.

But I do not know why it did not work here.

Regards,
Gonçalo Ereno

Sorry to report the answer is not quite as simple as I originally thought. After inquiring to the email list, the actual answer is that you should create a custom Read function for this URA, since modifying app_read would result in changes to voice mail handling and other functions.

The actual change would be in the ast_readstring command. The way I would approach this would be to copy app_read.c to app_readura.c and change the readstring routine to readstring_ura. This would allow you to do Readura instead of Read and have an autonomous function.

Thanks to Mark Michelson for pointing this out.

Thank you for your attention.

We have several developers here in the company and I will try to create this function ReadURA and modify the readstring.

One more question I can not help me, you said to copy the app_readURA.c ai app_read.c to modify the readstring to readstring_ura.

Where do I find the readstring? I can duplicate your content keeping that has to Read and creating the new ReadURA for?

You could pass me correct what the relationship should I follow? Who calls who or who depends on whom?

Atencisoamente
Gonçalo Ereno