Tomaz Izanc
2003-Apr-29 08:40 UTC
[Asterisk-Users] callerid send to shell script with system command
hi! anyone has a idea how to send caller id (incoming number) to shell script like: exten => s,1,wait,2 exten => s,2,System(/bin/script callerid-number) exten =>s,3,answer i need to run script in shell with command line like "/bin/script -a 123456789 " this 123456789 must be callerid (incoming call) number. tnx, Thomas
Karl Putland
2003-Apr-29 09:00 UTC
[Asterisk-Users] callerid send to shell script with system command
On Tue, 2003-04-29 at 09:40, Tomaz Izanc wrote:> hi! > > > anyone has a idea how to send caller id (incoming number) > to shell script like: > > exten => s,1,wait,2 > exten => s,2,System(/bin/script callerid-number) > exten =>s,3,answer > > i need to run script in shell with command line like "/bin/script -a > 123456789 " > this 123456789 must be callerid (incoming call) number. >README.variables --Karl> tnx, > Thomas > > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users-- Karl Putland <karl@putland.linux-site.net>
Eric Wieling
2003-Apr-29 09:06 UTC
[Asterisk-Users] callerid send to shell script with system command
Should be able to use exten => s,2,System(/bin/script ${CALLERIDNUM}) On Tue, 2003-04-29 at 10:40, Tomaz Izanc wrote:> hi! > > > anyone has a idea how to send caller id (incoming number) > to shell script like: > > exten => s,1,wait,2 > exten => s,2,System(/bin/script callerid-number) > exten =>s,3,answer > > i need to run script in shell with command line like "/bin/script -a > 123456789 " > this 123456789 must be callerid (incoming call) number. > > tnx, > Thomas > > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users-- BTEL Consulting 850-484-4535 x2111 (Office) 504-595-3916 x2111 (Experimental) 877-552-0838 (Backup Phone)
Mike Reiling
2003-Apr-29 09:26 UTC
[Asterisk-Users] callerid send to shell script with system command
Why not just write an agi? --Mike On Tuesday, April 29, 2003, at 08:40 AM, Tomaz Izanc wrote:> hi! > > > anyone has a idea how to send caller id (incoming number) > to shell script like: > > exten => s,1,wait,2 > exten => s,2,System(/bin/script callerid-number) > exten =>s,3,answer > > i need to run script in shell with command line like "/bin/script -a > 123456789 " > this 123456789 must be callerid (incoming call) number. > > tnx, > Thomas > > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users >
James Golovich
2003-Apr-29 11:30 UTC
[Asterisk-Users] callerid send to shell script with system command
Tomaz, exten => s,2,System(/bin/script ${CALLERIDNUM}) would do what you want James On Tue, 29 Apr 2003, Tomaz Izanc wrote:> hi! > > > anyone has a idea how to send caller id (incoming number) > to shell script like: > > exten => s,1,wait,2 > exten => s,2,System(/bin/script callerid-number) > exten =>s,3,answer > > i need to run script in shell with command line like "/bin/script -a > 123456789 " > this 123456789 must be callerid (incoming call) number.
duncan
2003-Apr-29 15:30 UTC
[Asterisk-Users] callerid send to shell script with system command
>anyone has a idea how to send caller id (incoming number) >to shell script like: > >exten => s,1,wait,2 >exten => s,2,System(/bin/script callerid-number) >exten =>s,3,answer > >i need to run script in shell with command line like "/bin/script -a >123456789 " >this 123456789 must be callerid (incoming call) number.well no, but i know how to do it in AGI exten => s,1,wait,2 exten => s,2,AGI,shell.agi then create a file called shell.agi in the /var/lib/asterisk/agi-bin/ directory (make sure it has the right permissions - chmod 774 shell.agi i think) containing this (again i think - not tested code): #!/usr/bin/perl use Asterisk::AGI; $AGI = new Asterisk::AGI; my %input = $AGI->ReadParse(); my $callerid = $input{'callerid'}; system(/bin/script $callerid); hope this helps duncan
duncan
2003-Apr-30 04:35 UTC
[Asterisk-Users] callerid send to shell script with system command
>then create a file called shell.agi in the /var/lib/asterisk/agi-bin/ >directory (make sure it has the right permissions - chmod 774 shell.agi i >think) containing this (again i think - not tested code): > >#!/usr/bin/perl >use Asterisk::AGI; >$AGI = new Asterisk::AGI; >my %input = $AGI->ReadParse(); >my $callerid = $input{'callerid'}; > >system(/bin/script $callerid);ok let me modify this script to take into account malicious input on $input{'callerid'} - which up until now i thought could only contain numerical characters (or at least thats all its returned when ive used it). can anyone clarify this point for me? callerid has always been set from the switch connected to my asterisk server, and i wasnt aware that it could contain characters rather than digits. so i've just added a regex to only allow digits. i guess you could escape all non-aphabetical characters but im not sure how that would output... which would be $callerid =~ s/(W)/\$1/g; (i think) #!/usr/bin/perl use Asterisk::AGI; $AGI = new Asterisk::AGI; my %input = $AGI->ReadParse(); my $callerid = $input{'callerid'}; $callerid =~ s/[^0-9]//g; system(/bin/script $callerid); and let me add to my disclaimer, this is not tested code - it hasnt been run on an asterisk system and has only been written within this email client, so may not even be formatted correctly. use at your own risk, and in probability this is way overkill for what you want to do as exten => s,2,System(/bin/script ${CALLERIDNUM}) works just as well and doesnt mean you have to load up an AGI instance. duncan