I installed the AGI perl library then put the following script in a file called /var/lib/asterisk/agi-bin/send_clid.agi, updated my [incoming] context with exten => s,1,AGI(send_clid.agi) and did a restart now. use Asterisk::AGI; my $agi = Asterisk::AGI->new(); my %input = $agi->ReadParse(); my $clid = $input{callerid}; my $dnid = $input{dnid}; open(CS, ">>call_id_test"); print CS "INCOMING CALL FROM " . $clid . "\n"; print CS $dnid . "\n"; close(CS) || die "can't close\n"; system("wall $clid"); The >cli seems to indicate it worked: Launched agi script /var/lib/asterisk/agi-bin/send_clid.agi AGI script send_clid.agi completed, returning 0 however I see no output from wall and if I do a cat call_id_test it's empty. call_id_test has permission set to 777. Any idea what I'm doing wrong? Thanks, again for all the help thus far. Richard __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/
Richard Reina wrote:>I installed the AGI perl library then put the >following script in a file called >/var/lib/asterisk/agi-bin/send_clid.agi, >updated my [incoming] context with exten => >s,1,AGI(send_clid.agi) and did a restart now. > >use Asterisk::AGI; >my $agi = Asterisk::AGI->new(); >my %input = $agi->ReadParse(); > >my $clid = $input{callerid}; >my $dnid = $input{dnid}; > >1st rule with Perl scripts: use strict; 2nd rule: use warnings; Then. Are you sure about the capitalization? I.e. if the variable is ${CALLERID} in asterisk, You should use $agi->get_variable ('CALLERID') I think.>open(CS, ">>call_id_test"); > >You should use an absolute path, i.e. /tmp/call_id_test>print CS "INCOMING CALL FROM " . $clid . "\n"; >print CS $dnid . "\n"; >close(CS) || die "can't close\n"; >system("wall $clid"); > >On my system, wall takes input from STDIN. So open FP, "|wall"; print FP "CLID: $clid"; close FP; Might work better. Regards, Jean-Michel. -- Ykoz Un Max - La VoIP en pr?-pay?! Essayez gratuitement - 5 cr?dits offerts. ---> http://ykoz.net/voip/max <---
Thanks very much for the suggestions. I've implemented them, but the main problem seems to be that the program send_clid.agi is not executing despite the cli> saying that it is. If you have other ideas let me know. Thanks again, Richard --- Jean-Michel Hiver <jhiver@ykoz.net> wrote:> Richard Reina wrote: > > >I installed the AGI perl library then put the > >following script in a file called > >/var/lib/asterisk/agi-bin/send_clid.agi, > >updated my [incoming] context with exten => > >s,1,AGI(send_clid.agi) and did a restart now. > > > >use Asterisk::AGI; > >my $agi = Asterisk::AGI->new(); > >my %input = $agi->ReadParse(); > > > >my $clid = $input{callerid}; > >my $dnid = $input{dnid}; > > > > > 1st rule with Perl scripts: use strict; > 2nd rule: use warnings; > > Then. > > Are you sure about the capitalization? > > I.e. if the variable is ${CALLERID} in asterisk, > > You should use $agi->get_variable ('CALLERID') I > think. > > > >open(CS, ">>call_id_test"); > > > > > You should use an absolute path, i.e. > > /tmp/call_id_test > > > >print CS "INCOMING CALL FROM " . $clid . "\n"; > >print CS $dnid . "\n"; > >close(CS) || die "can't close\n"; > >system("wall $clid"); > > > > > On my system, wall takes input from STDIN. So > > open FP, "|wall"; > print FP "CLID: $clid"; > close FP; > > Might work better. > > Regards, > Jean-Michel. > > -- > Ykoz Un Max - La VoIP en pré-payé! > Essayez gratuitement - 5 crédits offerts. > ---> http://ykoz.net/voip/max <--- > > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com >http://lists.digium.com/mailman/listinfo/asterisk-users> To UNSUBSCRIBE or update options visit: > >http://lists.digium.com/mailman/listinfo/asterisk-users>__________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/
Anyway, you should have this as your> first line in the > script. > > #!/usr/bin/perl > _______________________________________________ >I had #!/usr/bin/perl5 -w I changed it to #!/usr/bin/perl and now it works. Thanks for the help __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/