I used your test script and was not able to reproduce it.  However I
have not found a good "non-production" way to test the actual
circumstances.

Here is what happens in our Application.

1. Client Verifies with a Access Code and SSN last 4.  This gives us a
client ID, call it CODEID from a DB using a
Set(ARRAY(var1,var2,CODEID)=${ODBC_CONTACT(${CODE})})
2. Client moves though a IVR and at some point decides they want to
talk to customer service.
3. This enters them into a Queue where when they are connected to an
agent an AGI script is ran to add information to the database.

In this csrrecord.pl:
use strict;
use warnings;
use Carp;
use DBI;
use Asterisk::AGI;
use File::Basename;

my $AGI = new Asterisk::AGI;

my %input = $AGI->ReadParse();

my $recording = $AGI->get_variable("MIXMONITOR_FILENAME");
my $interface = $AGI->get_variable("MEMBERINTERFACE");
my $accesscode_id = $ARGV[0];
#$AGI->get_variable("CODEID");
my $callerid = $input{callerid};
my $filename = fileparse($recording);
my @agent = split(/\//,$interface);
$AGI->verbose("Recording is $recording", 50);
$AGI->verbose("Interface is $interface", 50);
$AGI->verbose("CallerID is $callerid", 50);
$AGI->verbose("Access Code ID is $accesscode_id", 50);

if (!$accesscode_id) {
        my $csr_insert = $dbh->prepare('INSERT INTO ' . $db_tbl_csr . '
("CSRRecordCallerID", "CSRRecordCSRID",
                                                                
"CSRRecordFileName", "CSRRecordCreatedDate")
                                                                VALUES (?, ?, 
?, GETDATE())');
        $csr_insert->execute($callerid, $agent[1], $filename);
        $csr_insert->finish();
} else {
        my $csr_insert = $dbh->prepare('INSERT INTO ' . $db_tbl_csr . '
("CSRRecordCallerID", "CSRRecordCSRID",
                                                                
"ContactAccessCodeID", "CSRRecordFileName", "CSRRecordCreatedDate")
                                                                VALUES (?, ?, 
?, ?, GETDATE())');
        $csr_insert->execute($callerid, $agent[1], $accesscode_id, $filename);
        $csr_insert->finish();
}
exit 0;

The DB info I removed for security reasons.

This is on Asterisk 1.4.21.2~dfsg--3 Perl Version: 5.10.0 Perl AGI
0.10 all on Debian Lenny.

Thanks,
Shawn


On Thu, Jun 25, 2009 at 10:33 AM, James Golovich<[email protected]> wrote:
> As pointed out by Mikael Ljunglöf this will produce the behavior Shawn
> is getting if the ReadParse is dropped.  I see the problem with that and
> I'll release an updated version of Asterisk-Perl today with this fix
> (and at least one other)
>
> James
>
> James Golovich wrote:
>> I tried to duplicate this and wasn't able to, unless there is something
>> I am missing here.  Can you try this same setup to see how it behaves?
>>
>> extensions.conf:
>> exten => *43,1,Answer
>> exten => *43,n,Playback(beep)
>> exten => *43,n,Set(VAR1=variable1)
>> exten => *43,n,Set(VAR2=variable2)
>> exten => *43,n,Set(VAR3=variable3)
>> exten => *43,n,Set(VAR4=variable4)
>> exten => *43,n,AGI(/tmp/t.pl)
>> exten => *43,n,Playback(beep)
>>
>>
>> script:
>> #!/usr/bin/perl
>>
>> use Asterisk::AGI;
>>
>> $AGI = new Asterisk::AGI;
>>
>> my %input = $AGI->ReadParse();
>>
>> my $var1 = $AGI->get_variable("VAR1");
>> my $var2 = $AGI->get_variable("VAR2");
>> my $var3 = $AGI->get_variable("VAR3");
>> my $var4 = $AGI->get_variable("VAR4");
>>
>> $AGI->verbose("VAR1 = $var1");
>> $AGI->verbose("VAR2 = $var2");
>> $AGI->verbose("VAR3 = $var3");
>> $AGI->verbose("VAR4 = $var4");
>>
>>
>> output:
>>     -- Starting simple switch on 'Zap/18-1'
>>     -- Executing [...@internal:1] Answer("Zap/18-1", "") in new stack
>>     -- Executing [...@internal:2] Playback("Zap/18-1", "beep") in new stack
>>     -- <Zap/18-1> Playing 'beep.gsm' (language 'en')
>>     -- Executing [...@internal:3] Set("Zap/18-1", "VAR1=variable1") in
>> new stack
>>     -- Executing [...@internal:4] Set("Zap/18-1", "VAR2=variable2") in
>> new stack
>>     -- Executing [...@internal:5] Set("Zap/18-1", "VAR3=variable3") in
>> new stack
>>     -- Executing [...@internal:6] Set("Zap/18-1", "VAR4=variable4") in
>> new stack
>>     -- Executing [...@internal:7] AGI("Zap/18-1", "/tmp/t.pl") in new stack
>>     -- Launched AGI Script /tmp/t.pl
>> /tmp/t.pl: VAR1 = variable1
>> /tmp/t.pl: VAR2 = variable2
>> /tmp/t.pl: VAR3 = variable3
>> /tmp/t.pl: VAR4 = variable4
>>     -- <Zap/18-1>AGI Script /tmp/t.pl completed, returning 0
>>     -- Executing [...@internal:8] Playback("Zap/18-1", "beep") in new stack
>>     -- <Zap/18-1> Playing 'beep.gsm' (language 'en')
>>     -- Auto fallthrough, channel 'Zap/18-1' status is 'UNKNOWN'
>>     -- Hungup 'Zap/18-1'
>>     -- Starting simple switch on 'Zap/18-1'
>>     -- Hungup 'Zap/18-1'
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>



-- 
Shawn L. Djernes
SD Consulting
[email protected] | [email protected]
MSN: [email protected]
402.345.7734 | 402.350.6973 Cell

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to