<br>Warren,<br><br>A good example given.<br>Just suggest to use &#39;Move&#39; instead of &#39;Copy&#39; for placing callfile in outgoing folder.<br>A J Stiles has explained it in a better way in one of his replies.  <br><br>
<a href="http://lists.digium.com/pipermail/asterisk-users/2011-May/262929.html">http://lists.digium.com/pipermail/asterisk-users/2011-May/262929.html</a><br><br><br>[SATISH]<br><br><div class="gmail_quote">On Fri, Jun 3, 2011 at 1:16 AM, Warren Selby <span dir="ltr">&lt;<a href="mailto:wcselby@selbytech.com">wcselby@selbytech.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote"><div class="im">2011/6/2 Antonio Modesto <span dir="ltr">&lt;<a href="mailto:modesto@isimples.com.br" target="_blank">modesto@isimples.com.br</a>&gt;</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&#39;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><div><br>The way I did it was to use a DeadAGI from the &#39;h&#39; 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 =&gt; new,1,Answer()<br>
exten =&gt; new,n,Wait(1)<br>exten =&gt; new,n,Playback(vm-intro)<br>exten =&gt; new,n,Playback(beep)<br>exten =&gt; new,n,Set(timestamp=${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})<br>exten =&gt; new,n,Set(FILENAME=reccallback/${CALLERID(num)}-${timestamp})<br>

exten =&gt; new,n,Record(${FILENAME}.gsm,,,q)<br>exten =&gt; new,n,Playback(vm-goodbye)<br>exten =&gt; new,n,Hangup()<br><br>exten =&gt; h,1,Verbose(Hangup after recording)<br>exten =&gt; h,n,DeadAGI(reccallback.agi,${FILENAME},${TIMESTAMP})<br>

<br>[rec-call-back-out]<br>exten =&gt; out,1,Wait(2)<br>exten =&gt; out,n,Playback(${playbackfile})<br>exten =&gt; 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-&gt;ReadParse();<br>my $callerid = $input{&#39;callerid&#39;};<br><br>my $recfile = $ARGV[0];<br>my $timestamp = $ARGV[1];<br><br>open CALLFILE, &quot;&gt;/var/spool/asterisk/tmp/$callerid-$timestamp.call&quot;;<br>

if (length($callerid) &gt; 4) {<br>    print CALLFILE &quot;Channel: SIP/external-sip-provider/+1$callerid\n&quot;;<br>} else {<br>    print CALLFILE &quot;Channel: SIP/$callerid\n&quot;;<br>}<br>print CALLFILE &quot;CallerID: \&quot;CUSTOMER\&quot; &lt;XXXXXXXXXX&gt;\n&quot;;<br>

print CALLFILE &quot;MaxRetries: 2\n&quot;;<br>print CALLFILE &quot;RetryTime: 60\n&quot;;<br>print CALLFILE &quot;WaitTime: 20\n&quot;;<br>print CALLFILE &quot;Context: rec-call-back-out\n&quot;;<br>print CALLFILE &quot;Extension: out\n&quot;;<br>

print CALLFILE &quot;Priority: 1\n&quot;;<br>print CALLFILE &quot;Set: playbackfile=$recfile\n&quot;;<br>close CALLFILE;<br>sleep(5);<br><br>copy(&quot;/var/spool/asterisk/tmp/$callerid-$timestamp.call&quot;, &quot;/var/spool/asterisk/outgoing/$callerid-$timestamp.call&quot;) or die &quot;copy failed: $!&quot;;<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>
<br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
               <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br>