Warren, A good example given. Just suggest to use 'Move' instead of 'Copy' for placing callfile in outgoing folder. A J Stiles has explained it in a better way in one of his replies.
http://lists.digium.com/pipermail/asterisk-users/2011-May/262929.html [SATISH] On Fri, Jun 3, 2011 at 1:16 AM, Warren Selby <[email protected]> wrote: > 2011/6/2 Antonio Modesto <[email protected]> > >> Good afternoon, >> >> I'm trying to write a simple callback context, but i need to hangup an >> incoming call and then call the origin number back, the problem is that >> asterisk stops processing the call after Hangup() application then it is not >> able to dial the origin number back. >> >> > The way I did it was to use a DeadAGI from the 'h' exten that created a > call file. This is how I did it for a client on Asterisk 1.4.x: > > [rec-call-back-in] > exten => new,1,Answer() > exten => new,n,Wait(1) > exten => new,n,Playback(vm-intro) > exten => new,n,Playback(beep) > exten => new,n,Set(timestamp=${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}) > exten => new,n,Set(FILENAME=reccallback/${CALLERID(num)}-${timestamp}) > exten => new,n,Record(${FILENAME}.gsm,,,q) > exten => new,n,Playback(vm-goodbye) > exten => new,n,Hangup() > > exten => h,1,Verbose(Hangup after recording) > exten => h,n,DeadAGI(reccallback.agi,${FILENAME},${TIMESTAMP}) > > [rec-call-back-out] > exten => out,1,Wait(2) > exten => out,n,Playback(${playbackfile}) > exten => out,n,Hangup() > > reccallback.agi: > #!/usr/bin/perl > > use Asterisk::AGI; > use File::Copy; > > $AGI = new Asterisk::AGI; > > my %input = $AGI->ReadParse(); > my $callerid = $input{'callerid'}; > > my $recfile = $ARGV[0]; > my $timestamp = $ARGV[1]; > > open CALLFILE, ">/var/spool/asterisk/tmp/$callerid-$timestamp.call"; > if (length($callerid) > 4) { > print CALLFILE "Channel: SIP/external-sip-provider/+1$callerid\n"; > } else { > print CALLFILE "Channel: SIP/$callerid\n"; > } > print CALLFILE "CallerID: \"CUSTOMER\" <XXXXXXXXXX>\n"; > print CALLFILE "MaxRetries: 2\n"; > print CALLFILE "RetryTime: 60\n"; > print CALLFILE "WaitTime: 20\n"; > print CALLFILE "Context: rec-call-back-out\n"; > print CALLFILE "Extension: out\n"; > print CALLFILE "Priority: 1\n"; > print CALLFILE "Set: playbackfile=$recfile\n"; > close CALLFILE; > sleep(5); > > copy("/var/spool/asterisk/tmp/$callerid-$timestamp.call", > "/var/spool/asterisk/outgoing/$callerid-$timestamp.call") or die "copy > failed: $!"; > > exit; > > > -- > Thanks, > --Warren Selby, dCAP > Our website just got a facelift! Check it out! > http://www.SelbyTech.com <http://www.selbytech.com> > > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >
-- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
