Antonio Modesto
2011-Jun-02 18:46 UTC
[asterisk-users] How to continue processing a context after a Hangup
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. Sorry for the grammatical erros. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110602/f2c3b433/attachment.htm>
Warren Selby
2011-Jun-02 19:46 UTC
[asterisk-users] How to continue processing a context after a Hangup
2011/6/2 Antonio Modesto <modesto at isimples.com.br>> 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> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110602/637cb057/attachment.htm>
Satish Barot
2011-Jun-03 04:42 UTC
[asterisk-users] How to continue processing a context after a Hangup
Use Asterisk Application 'System()' in h extension to create callfile which will handle your callback. You can also try for 'Originate()' application. [SATISH] 2011/6/3 Antonio Modesto <modesto at isimples.com.br>> 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. > > Sorry for the grammatical erros. > > -- > _____________________________________________________________________ > -- 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 >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110603/d23cbdce/attachment.htm>