<p>You news to pass fax_document_total_pages to your script. Please read the spandsp page on the wiki (search spandsp). </p>
<p>Also by looking at your script you might be able to polish up your dialplan so that its not so complicated.</p>
<div class="gmail_quote">On May 6, 2012 11:06 AM, &quot;Darcy Primrose&quot; &lt;<a href="mailto:darcyp@voice2net.ca">darcyp@voice2net.ca</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<u></u>





<div bgcolor="#ffffff">
<div><font face="Arial">I am using excute_on_fax_success to call a script 
when a fax is received, the script converts the fax to pdf and emails it,  
Is there a way to pass the number of pages received, ie, a variable created by 
spandsp.  Everything works, but I do not seem to be able to pass the 
variables.</font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial">   &lt;condition 
field=&quot;destination_number&quot; 
expression=&quot;^1(\d{10})$|(\d{10})$&quot;&gt;<br>    
   &lt;action application=&quot;set&quot; 
data=&quot;faxtempdirectory=/faxfiles/${caller_id_number}&quot;/&gt;     <br>    
   &lt;action application=&quot;system&quot; data=&quot;mkdir 
${faxtempdirectory}&quot;/&gt;      <br>       
&lt;action application=&quot;set&quot; 
data=&quot;faxDirection=outbound&quot;/&gt;       <br>       
&lt;action application=&quot;set&quot; data=&quot;<a href="mailto:emailAddress=$1$2@$%7Bfax2net_server%7D%22/" target="_blank">emailAddress=$1$2@${fax2net_server}&quot;/</a>&gt;<br>       
&lt;action application=&quot;set&quot; 
data=&quot;faxFile=$1$2-${caller_id_number}-${strftime(%Y-%m-%d-%H-%M-%S)-Success}&quot;/&gt;<br>       &lt;action 
application=&quot;set&quot; data=&quot;execute_on_fax_success=system 
/./var/mail/sentfaxes/fax2mail.sh ${faxFile} <a href="mailto:$1$2@$%7Bfax2net_server" target="_blank">$1$2@${fax2net_server</a>} 
${fax_security_code} ${fromRc} fax2net_orig=${fax_email}= 
${fax_transfer_rate}&quot;/&gt;   </font></div>
<div><font face="Arial">       &lt;action 
application=&quot;answer&quot;/&gt;<br>       &lt;action 
application=&quot;playback&quot; 
data=&quot;silence_stream://2000&quot;/&gt;<br>      
 &lt;action application=&quot;set&quot; 
data=&quot;fax_enable_t38_request=true&quot;/&gt;<br>       
&lt;action application=&quot;set&quot; 
data=&quot;fax_enable_t38=true&quot;/&gt;<br>      
 &lt;action application=&quot;rxfax&quot; 
data=&quot;${faxFile}.tif&quot;/&gt;<br>       &lt;action 
application=&quot;hangup&quot;/&gt;<br>  &lt;/condition&gt;  
<br></font></div>
<div><font face="Arial">Thanks</font></div>
<div><font face="Arial">Darcy Primrose</font></div></div>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div>