<b>I have been testing this for a week now, and I am still struggling to make it work. Here is the output from extension 11 just to show that permissions are correct and asterisk can access faxnotify.php</b><br><br>    -- Executing [11@outb2:1] Verbose(&quot;SIP/616818xxxx-000002f6&quot;, &quot;Testing....&quot;) in new stack<br>
Testing....<br>    -- Executing [11@outb2:2] Set(&quot;SIP/616818xxxx-000002f6&quot;, &quot;FNAME=/var/lib/asterisk/bin/faxnotify.php&quot;) in new stack<br>    -- Executing [11@outb2:3] Verbose(&quot;SIP/616818xxxx-000002f6&quot;, &quot;Size: 2553&quot;) in new stack<br>
Size: 2553<br>    -- Executing [11@outb2:4] Verbose(&quot;SIP/616818xxxx-000002f6&quot;, &quot;Mode: 100777&quot;) in new stack<br>Mode: 100777<br>    -- Executing [11@outb2:5] Verbose(&quot;SIP/616818xxxx-000002f6&quot;, &quot;#!/usr/bin/php<br>
&lt;?php<br><br>// set some global variables here<br>$SUCCESS_STATUS = &quot;FAX_SUCCESS&quot;;<br>$FROM_EMA&quot;) in new stack<br>#!/usr/bin/php<br>&lt;?php<br><br>// set some global variables here<br>$SUCCESS_STATUS = FAX_SUCCESS;<br>
$FROM_EMA<br>    -- Executing [11@outb2:6] TrySystem(&quot;SIP/616818xxxx-000002f6&quot;, &quot;/var/lib/asterisk/bin/faxnotify.php&quot;) in new stack<br>    -- Executing [11@outb2:7] Verbose(&quot;SIP/616818xxxx-000002f6&quot;, &quot;SUCCESS&quot;) in new stack<br>
SUCCESS<br>    -- Executing [11@outb2:8] Hangup(&quot;SIP/616818xxxx-000002f6&quot;, &quot;&quot;) in new stack<br>  == Spawn extension (outb2, 11, 8) exited non-zero on &#39;SIP/616818xxxx-000002f6&#39;<br><br>If I execute from the command line as user asterisk the script works correctly. If i execute extension 777 test.php is called and works correctly. The only thing I wonder is if asterisk is somehow not correctly passing the variables to faxnotify.php causing it to fail. Can someone please test this configuration on their system and let me know if they see what I am doing wrong?<br>
<br>This works as user asterisk.<br><b>/var/lib/asterisk/bin/faxnotify.php NOTIFY &quot;<a href="mailto:tim.compnetwork@gmail.com">tim.compnetwork@gmail.com</a>&quot; &quot;6165550000&quot; &quot;24/08/11 : 09:00:00&quot; &quot;FAX_SUCCESS&quot; &quot;1&quot;</b><br>
<b><br>Here are the permissions of the folder.<br></b>drwxr-xr-x  2 asterisk asterisk 4.0K Aug 24 13:19 .<br>drwxr-xr-x 13 asterisk asterisk 4.0K Aug 22 12:38 ..<br>-rwxrwxrwx  1 asterisk asterisk 2.5K Aug 24 11:43 faxnotify.php<br>
-rwxr-xr-x  1 asterisk asterisk 6.4K Aug 20 10:26 <a href="http://fax-process.pl">fax-process.pl</a><br>-rwxrwxrwx  1 asterisk asterisk   73 Aug 24 12:52 test.php<br>-rwxrwxrwx  1 asterisk asterisk   60 Aug 24 11:40 test.sh<br>
<b><br>[outbound]</b><br>exten =&gt; 11,1,Verbose(Testing....)<br>exten =&gt; 11,n,Set(FNAME=/var/lib/asterisk/bin/faxnotify.php)<br>exten =&gt; 11,n,Verbose(Size: ${STAT(s,${FNAME})})<br>exten =&gt; 11,n,Verbose(Mode: ${STAT(m,${FNAME})})<br>
exten =&gt; 11,n,Verbose(${FILE(${FNAME},,100)})<br>exten =&gt; 11,n,TrySystem(${FNAME})<br>exten =&gt; 11,n,Verbose(${SYSTEMSTATUS})<br>exten =&gt; 11,n,Hangup()<br><br>exten =&gt; 777,1,System(/var/lib/asterisk/bin/test.php)<br>
exten =&gt; 777,n,Playback(vm-goodbye)<br>exten =&gt; 777,n,Hangup()<br><br><b>[ext-fax]</b><br>exten =&gt; s,1,Noop(Receiving Fax for: ${FAX_RX_EMAIL} , From: ${CALLERID(all)})<br>exten =&gt; s,n(receivefax),StopPlaytones<br>
exten =&gt; s,n,ReceiveFAX(${ASTSPOOLDIR}/fax/${UNIQUEID}.tif,f)<br>exten =&gt; s,n,ExecIf($[&quot;${FAXOPT(error)}&quot;=&quot;&quot;]?Set(FAXSTATUS=FAILED LICENSE EXCEEDED))<br>exten =&gt; s,n,ExecIf($[&quot;${FAXOPT(error)}&quot;!=&quot;&quot; &amp;&amp; &quot;${FAXOPT(error)}&quot;!=&quot;NO_ERROR&quot;]?Set(FAXSTATUS=&quot;FAILED FAXOPT: error: ${FAXOPT(error)} status: ${FAXOPT(status)} statusstr: ${FAX<br>
exten =&gt; s,n,Hangup<br>exten =&gt; h,1,GotoIf($[&quot;${FAXSTATUS:0:6}&quot; = &quot;FAILED&quot;]?failed)<br>exten =&gt; h,n(process),GotoIf($[${LEN(${FAX_RX_EMAIL})} = 0]?end)<br>exten =&gt; h,n,System(${ASTVARLIBDIR}/bin/<a href="http://fax-process.pl">fax-process.pl</a> --to &quot;${FAX_RX_EMAIL}&quot; --from &quot;<a href="mailto:noreply@mydomain.com">noreply@mydomain.com</a>&quot; --dest &quot;${FROM_DID}&quot; --subject &quot;New fax from ${URIENCODE(${CALLERI<br>
exten =&gt; h,n(end),Macro(hangupcall,)<br>exten =&gt; h,process+101(failed),Noop(FAX ${FAXSTATUS} for: ${FAX_RX_EMAIL} , From: ${CALLERID(all)})<br>exten =&gt; h,n,Macro(hangupcall,)<br><br><b>[app-fax]</b><br>include =&gt; app-fax-custom<br>
exten =&gt; 6169804602,1,Set(FAX_RX_EMAIL=<a href="mailto:tim.compnetwork@gmail.com">tim.compnetwork@gmail.com</a>)<br>exten =&gt; 6169804602,n,Goto(ext-fax,s,1)<br>exten =&gt; h,1,Macro(hangupcall,)<br><br><br><b>test.php</b><br>
<br>&lt;?php<br>exec(&quot;touch /var/lib/asterisk/bin/testfile.txt&quot;);<br><br><b>faxnotify.php</b><br><br>#!/usr/bin/php<br>&lt;?php<br><br>// set some global variables here<br>$SUCCESS_STATUS = &quot;FAX_SUCCESS&quot;;<br>
$FROM_EMAIL = &quot;<a href="mailto:fax@mydomain.com">fax@mydomain.com</a>&quot;;<br>$FROM_NAME = &quot;mydomain Fax&quot;;<br>$CONTACT_EMAIL = &quot;<a href="mailto:support@mydomain.com">support@mydomain.com</a>&quot;;<br>
<br>if ($argc != 7) {<br> echo &quot;Usage faxnotify.php messagetype email destination timestamp status_string pages \n &quot;;<br> echo &quot;message type can be one of INIT or NOTIFY &quot;;<br>}<br>echo &quot;Starting faxnotify.php \n&quot;;<br>
<br><br>// setting up<br>$messtype   = $argv[1];<br>$email      = $argv[2];<br>$dest       = $argv[3];<br>$timestamp  = $argv[4];<br>$status     = $argv[5];<br>$numpages   = $argv[6];<br><br>$headers = &quot;From:  $FROM_NAME &lt;$FROM_EMAIL&gt;&quot;;<br>
<br>// end setting up<br><br>if ($messtype == &quot;INIT&quot;) { // SendFAX called successfully in the dialplan...<br>        $emailSubject = &quot;Your fax to $dest has been initiated&quot;;<br>        $notice = &quot;Your fax to $dest sent on $timestamp has been initiated. You will get a notification &quot; .<br>
                          &quot;email when the transmission is complete. &quot;;<br>    $emailBody = &quot;Hi!  \n\n&quot; .  $notice . &quot; \n\n &quot; .<br>                                 &quot;If you have any queries, please contact us at:  $CONTACT_EMAIL&quot;;<br>
        mail($email, $emailSubject, $emailBody, $headers);<br>}<br>else {  // meaning $messtype = &quot;NOTIFY&quot; ... sending of fax is complete. Need to check if SUCCEEDED<br>        $tech_details = &quot;------------------------------ \n&quot;.<br>
                        &quot;DESTINATION = $dest            \n&quot;.<br>                                        &quot;TIMESTAMP = $timestamp         \n&quot;.<br>                                        &quot;FAXOPTS_STATUSSTRING = $status \n&quot;.<br>
                                        &quot;NUM_PAGES = $numpages          \n&quot;.<br>                                        &quot;------------------------------ \n&quot;;<br><br><br>        echo &quot;Sending fax notification email to: $email from $FROM_EMAIL \n&quot;;<br>
<br>        if($status == $SUCCESS_STATUS) {<br>          $emailSubject = &quot;Your fax to $dest was delivered successfully&quot;;<br>          $notice = &quot;This is an automated response to let you know that your fax to &quot; .<br>
                                &quot;$dest sent on $timestamp was delivered successfully. \n&quot;;<br>        } else {<br>          $emailSubject = &quot;Your fax to $dest could not be sent&quot;;<br>          $notice = &quot;This is an automated response to let you know that your fax to &quot; .<br>
                                &quot;$dest sent on $timestamp could not be delivered. \n&quot;;<br>        }<br><br>        $emailBody = &quot;Hi!  \n\n&quot; .  $notice . &quot;\n\n&quot; . $tech_details . &quot; \n\n &quot; .<br>
                                 &quot;If you beleive there was an error please contact:  $CONTACT_EMAIL&quot;;<br><br>        // echo $emailSubject . &quot;\n&quot;;<br>        // echo $emailBody . &quot;\n&quot;;<br><br>
        // mail<br>        mail($email, $emailSubject, $emailBody, $headers );<br>        // exec(&quot;echo $email $timestamp $emailSubject &gt;&gt; /var/log/asterisk/webfax.log&quot;);<br>        // exec(&quot;echo $emailBody &gt;&gt; /var/log/asterisk/webfax.log&quot;);<br>
        // exec(&quot;echo -------------------------------- &gt;&gt; /var/log/asterisk/webfax.log&quot;);<br>}<br>?&gt;<br><br><br><br>