Re: [Asterisk-Users] AGI.pm wait_for_digit() not working for me!!!

2004-05-11 Thread Andy Powell
Ok,

the first think to do is check the permissions on the conf-background.agi ..asterisk 
needs to be able to run it ...

The code I've listed below works fine for me:

#!/usr/bin/perl

use Asterisk::AGI;

$AGI = new Asterisk::AGI;
%input = $AGI-ReadParse();

$soundpath = /var/lib/asterisk/sounds/;
$timeout = 10;


while(1)
{
$input = chr($AGI-wait_for_digit($timeout));

if ($input eq *)
{
$AGI-stream_file($soundpath/banana-phone-song);
}

if ($input eq 1)
{
exit 0;
}

}




*** REPLY SEPARATOR  ***

On 11/05/2004 at 10:52 Atif wrote:

Hello everybody!!!



I really need your help guys, I am using the AGI mode in meetme
application,
and  I want that AGI should wait for an input from the client/user i.e. a
digit and then proceed, but I have used that AGI function
agi-wait_for_digit(), but no usemy agi just passes, or ignores this
function,

where AGI should stop here and wait for the input



.my extension in my dialplan.

exten = 21,1,answer

exten = 21,2,meetme(21|pb)



..and here is my AGI...

#!/usr/bin/perl -w

#use strict;



$aginame=conf-background.agi;

use File::Copy cp;

use Asterisk::AGI;

$AGI = new Asterisk::AGI;

my %input = $AGI-ReadParse();



$char=0;



#while(1)

{



#$AGI-exec('WaitExten','25000');

#$char = $AGI-receive_char('600');

$char=chr($AGI-wait_for_digit('600'));



print STDERR input form rec char : $char\n;



if($char eq *)

{

print STDERR Dialing your number\n;

$srcfile=/tmp/mycall;

$dstfile=/var/spool/asterisk/outgoing/mycall;

open(MYCALL,$srcfile) || die Cant't open file :$srcfile
$!\n;

print MYCALL Channel:IAX2/bali:[EMAIL PROTECTED]/[EMAIL PROTECTED];

print MYCALL MaxRetries:2\n;

print MYCALL RetryTime:60\n;

print MYCALL WaitTime:30\n;

print MYCALL Context:atif\n;

print MYCALL Extension:22\n;

print MYCALL Priority:1\n;

close MYCALL;

#   cp($srcfile,$dstfile);

print STDERR dialing complete...\n;

}


___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


___
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[Asterisk-Users] AGI.pm wait_for_digit() not working for me!!!

2004-05-10 Thread Atif








Hello everybody!!!



I really need your help guys, I am using the AGI mode in
meetme application, and I want that AGI should wait for an input from the
client/user i.e. a digit and then proceed, but I have used that AGI function
agi-wait_for_digit(), but no usemy agi just passes, or ignores this
function,

where AGI should stop here and wait for the input



.my extension in my dialplan.

exten = 21,1,answer

exten = 21,2,meetme(21|pb)



..and here is my AGI...

#!/usr/bin/perl -w

#use strict;



$aginame=conf-background.agi;

use File::Copy cp;

use Asterisk::AGI;

$AGI = new Asterisk::AGI;

my %input = $AGI-ReadParse();



$char=0;



#while(1)

{




#$AGI-exec('WaitExten','25000');

 #$char =
$AGI-receive_char('600');


$char=chr($AGI-wait_for_digit('600'));



 print STDERR
input form rec char : $char\n;



 if($char eq
*)

 {


print STDERR Dialing your number\n;


$srcfile=/tmp/mycall;


$dstfile=/var/spool/asterisk/outgoing/mycall;


open(MYCALL,$srcfile) || die Cant't open file :$srcfile
$!\n;


print MYCALL Channel:IAX2/bali:[EMAIL PROTECTED]/[EMAIL PROTECTED];


print MYCALL MaxRetries:2\n;


print MYCALL RetryTime:60\n;


print MYCALL WaitTime:30\n;


print MYCALL Context:atif\n;


print MYCALL Extension:22\n;


print MYCALL Priority:1\n;


close MYCALL;

#
cp($srcfile,$dstfile);


print STDERR dialing complete...\n;

 }