<div class="gmail_quote">2011/6/2 Antonio Modesto <span dir="ltr"><<a href="mailto:modesto@isimples.com.br">modesto@isimples.com.br</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>
Good afternoon,<br>
<br>
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.<br>
<br clear="all"></div></blockquote><div><br>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:<br><br>[rec-call-back-in]<br>exten => new,1,Answer()<br>
exten => new,n,Wait(1)<br>exten => new,n,Playback(vm-intro)<br>exten => new,n,Playback(beep)<br>exten => new,n,Set(timestamp=${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})<br>exten => new,n,Set(FILENAME=reccallback/${CALLERID(num)}-${timestamp})<br>
exten => new,n,Record(${FILENAME}.gsm,,,q)<br>exten => new,n,Playback(vm-goodbye)<br>exten => new,n,Hangup()<br><br>exten => h,1,Verbose(Hangup after recording)<br>exten => h,n,DeadAGI(reccallback.agi,${FILENAME},${TIMESTAMP})<br>
<br>[rec-call-back-out]<br>exten => out,1,Wait(2)<br>exten => out,n,Playback(${playbackfile})<br>exten => out,n,Hangup()<br><br>reccallback.agi:<br>#!/usr/bin/perl<br><br>use Asterisk::AGI;<br>use File::Copy;<br>
<br>$AGI = new Asterisk::AGI;<br><br>my %input = $AGI->ReadParse();<br>my $callerid = $input{'callerid'};<br><br>my $recfile = $ARGV[0];<br>my $timestamp = $ARGV[1];<br><br>open CALLFILE, ">/var/spool/asterisk/tmp/$callerid-$timestamp.call";<br>
if (length($callerid) > 4) {<br> print CALLFILE "Channel: SIP/external-sip-provider/+1$callerid\n";<br>} else {<br> print CALLFILE "Channel: SIP/$callerid\n";<br>}<br>print CALLFILE "CallerID: \"CUSTOMER\" <XXXXXXXXXX>\n";<br>
print CALLFILE "MaxRetries: 2\n";<br>print CALLFILE "RetryTime: 60\n";<br>print CALLFILE "WaitTime: 20\n";<br>print CALLFILE "Context: rec-call-back-out\n";<br>print CALLFILE "Extension: out\n";<br>
print CALLFILE "Priority: 1\n";<br>print CALLFILE "Set: playbackfile=$recfile\n";<br>close CALLFILE;<br>sleep(5);<br><br>copy("/var/spool/asterisk/tmp/$callerid-$timestamp.call", "/var/spool/asterisk/outgoing/$callerid-$timestamp.call") or die "copy failed: $!";<br>
<br>exit;<br> <br></div></div><br>-- <br>Thanks,<br>--Warren Selby, dCAP<br>Our website just got a facelift! Check it out!<br><a href="http://www.selbytech.com" target="_blank">http://www.SelbyTech.com</a><br><br>