I'm writing an AGI script and want it to dial a number on a channel
connected to the PSTN. It would look something like this (pseudo-code
follows):
if ($a){
  dial("8005551212");
}else{
  dial("8665550000");
}
The part I can't seem to get right is the "dial" function. I tried
to
mimic the dial plan like so
sub dial($number){
  print "Dial(\"Zap/1-1\", \"Zap/g2/$number\")\n";
}
but I get the error
handle_exec: Could not find application (Dial(Zap/1-1,Zap/g2/8665550000)
Anyone have any suggestions?
Thanks,
Roy
>From: "Roy Kidder" <asterisk@jehster.net> >Date: Sat, 10 Feb 2007 23:15:07 -0500 (EST) > >I'm writing an AGI script and want it to dial a number on a channel >connected to the PSTN. It would look something like this (pseudo-code >follows): > >if ($a){ > dial("8005551212"); >}else{ > dial("8665550000"); >} > >The part I can't seem to get right is the "dial" function. I tried to >mimic the dial plan like so > >sub dial($number){ > print "Dial(\"Zap/1-1\", \"Zap/g2/$number\")\n"; >} > >but I get the error > >handle_exec: Could not find application (Dial(Zap/1-1,Zap/g2/8665550000)Because Dial(Zap/1-1,Zap/g2/8665550000) is not a valid command in your environment; instead, print "Dial(\"Zap/g2/$number\")\n" will do;. Any particular reason you need to specify Zap/1-1? One way to make sure you have the correct syntax in AGI is to place the commands in extensions.conf with all variables replaced with a fixed value (or a dial plan variable). This can save you time in the long run. Yuan Liu>Anyone have any suggestions? > >Thanks, >Roy >_______________________________________________ >--Bandwidth and Colocation provided by Easynews.com -- > >asterisk-users mailing list >To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users
Hi Roy,
Look I dont know why u specify 'zap/1-1', but i do things like this on 
my agi scripts a lot of times:
...
$stdin        = fopen('php://stdin', 'r');
$stdout     = fopen('php://stdout', 'w');
$stdlog      = fopen('/tmp/outPUT.log', 'a');
...
fwrite($stdout,"EXEC DIAL \"Zap/g2/18092203555\" \n");
fflush($stdout);
////////////// to see result //////////////  
$msg  = fgets($stdin);
fwrite($stdlog,$msg. "\n");
Try it out if u want...
J. Espinal,
Roy Kidder wrote:> I'm writing an AGI script and want it to dial a number on a channel
> connected to the PSTN. It would look something like this (pseudo-code
> follows):
>
> if ($a){
>   dial("8005551212");
> }else{
>   dial("8665550000");
> }
>
> The part I can't seem to get right is the "dial" function. I
tried to
> mimic the dial plan like so
>
> sub dial($number){
>   print "Dial(\"Zap/1-1\",
\"Zap/g2/$number\")\n";
> }
>
> but I get the error
>
> handle_exec: Could not find application (Dial(Zap/1-1,Zap/g2/8665550000)
>
> Anyone have any suggestions?
>
> Thanks,
> Roy
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.digium.com/pipermail/asterisk-users/attachments/20070211/fda45114/attachment.htm
Hi Roy,
If its perl script,you can try this.
use Asterisk::AGI;
our $AGI = new Asterisk::AGI;
$AGI->EXEC('Dial', 'Zap/g2/8005551212');
On 2/11/07, Roy Kidder <asterisk@jehster.net>
wrote:>
> I'm writing an AGI script and want it to dial a number on a channel
> connected to the PSTN. It would look something like this (pseudo-code
> follows):
>
> if ($a){
>   dial("8005551212");
> }else{
>   dial("8665550000");
> }
>
> The part I can't seem to get right is the "dial" function. I
tried to
> mimic the dial plan like so
>
> sub dial($number){
>   print "Dial(\"Zap/1-1\",
\"Zap/g2/$number\")\n";
> }
>
> but I get the error
>
> handle_exec: Could not find application (Dial(Zap/1-1,Zap/g2/8665550000)
>
> Anyone have any suggestions?
>
> Thanks,
> Roy
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.digium.com/pipermail/asterisk-users/attachments/20070214/d13b5c4d/attachment.htm