[Asterisk-Users] SetVar on sample.call

Richard Lyman pchammer at dynx.net
Mon Aug 25 09:58:57 MST 2003


as far as i know only the extension/context/priority (NOT
application/data side) has SetVar code.  meaning you can't use
whats not there.

look in ..asterisk/pbx/pbx_spool.c  line 189, notice that
ast_pbx_outgoing_app isn't passing 0->variable like line 192,
ast_pbx_outgoing_exten does.

(this was cvs as of last friday)

DUSTIN WILDES wrote:
> 
> Hi all!!
> 
> Does anyone have a short example or even better - a working AGI script that uses "GET VARIABLE' from a /var/spool/asterisk/outgoing call that uses "SetVar"?
> Here's what I've tried with no luck so far:
> 
> sample.call
> =================
> 
> Channel:  SIP/1000
> MaxRetries: 2
> RetryTime: 60
> WaitTime: 30
> 
> Application: Agi
> Data:  playTasks.agi
> 
> Callerid:  Nightly Processor <(999) 888-777>
> 
> SetVar:  taskID=300   //This ID is queried from my mysql database so the playTasks.agi should be able to retreive this value to do another query to play information
> 
> playTasks.agi  (Derived from the agi-test.agi)
> ======================================
> #!/usr/bin/perl
> 
> $|=1;
> while(<STDIN>) {
>         chomp;
>         last unless length($_);
>         if (/^agi_(\w+)\:\s+(.*)$/) {
>                 $AGI{$1} = $2;
>         }
> }
> 
> sub checkresult {
>         my ($res) = @_;
>         my $retval;
>         $tests++;
>         chomp $res;
>         if ($res =~ /^200/) {
>                 $res =~ /result=(-?\d+)/;
>                 if (!length($1)) {
>                         print STDERR "FAIL ($res)\n";
>                         $fail++;
>                 } else {
>                         print STDERR "PASS ($1)\n";
>                         $pass++;
>                 }
>         } else {
>                 print STDERR "FAIL (unexpected result '$res')\n";
>                 $fail++;
>         }
> }
> 
> print "GET VARIABLE taskID\n";
>         $result = <STDIN>;
>         $taskID = checkresult($result);
>         print STDERR "TaskID:  $taskID\n";
>         print STDERR "Result:  $result\n";
> 
> print "SAY NUMBER $taskID \"\"\n";
>         $result = <STDIN>;
>         checkresult($result);
> ======================================
> 
> I always get 'zero' played back at the prompt & the result(s) don't display my $taskID.
> Anyone got any recommendations or how to fix it?
> 
> Thanks!!
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users



More information about the asterisk-users mailing list