Check you can run the script from th ecommand line and successfully send email... have you considered using phpagi for your scripts?<br><br><div class="gmail_quote">2009/4/23 James A. Shigley <span dir="ltr">&lt;<a href="mailto:jas@answeringserv.com">jas@answeringserv.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">








<div link="blue" vlink="purple" lang="EN-US">

<div>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">I have the below script that doesn’t seem to
be working. I don’t know if I have something in the script wrong that I
am just missing. Or if I don’t have the php.ini set correctly for
emailing</span></p>

<div style="border-style: none none solid; border-color: -moz-use-text-color -moz-use-text-color windowtext; border-width: medium medium 1pt; padding: 0in 0in 1pt;">

<p style="border: medium none ; padding: 0in;"><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> </span></p>

</div>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> </span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">This is the CLI output</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">-- Executing [4099XXXXXX@port3_real:1]
Goto(&quot;DAHDI/50-1&quot;, &quot;newhire,s,1&quot;) in</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">new stack</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">    -- Goto (newhire,s,1)</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">    -- Executing [s@newhire:1]
Ringing(&quot;DAHDI/50-1&quot;, &quot;&quot;) in new stack</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">    -- Executing [s@newhire:2]
Answer(&quot;DAHDI/50-1&quot;, &quot;&quot;) in new stack</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">    -- Executing [s@newhire:3]
Monitor(&quot;DAHDI/50-1&quot;, &quot;wav,/var/lib/asterisk/soun</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">ds/NewHire/Newhire-1240503071.15148-4099819213-s,o&quot;)
in new stack</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">    -- Executing [s@newhire:4]
AGI(&quot;DAHDI/50-1&quot;, &quot;newhire.php&quot;) in new stack</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">    -- Launched AGI Script
/var/lib/asterisk/agi-bin/newhire.php</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">    -- &lt;DAHDI/50-1&gt;AGI Script
newhire.php completed, returning 0</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">    -- Auto fallthrough, channel
&#39;DAHDI/50-1&#39; status is &#39;UNKNOWN&#39;</span></p>

<div style="border-style: none none solid; border-color: -moz-use-text-color -moz-use-text-color windowtext; border-width: medium medium 1pt; padding: 0in 0in 1pt;">

<p style="border: medium none ; padding: 0in;"><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">    -- Hungup
&#39;DAHDI/50-1&#39;</span></p>

</div>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> </span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">Here is the script</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> </span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> </span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">#!/usr/bin/php5 </span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">&lt;?php</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> </span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">// Get AGI vars from *</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> </span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> $agivars = array();</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> while (!feof(STDIN)) {</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">     $agivar =
trim(fgets(STDIN));</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">     if ($agivar === &#39;&#39;) {</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">        
break;</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">     }</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">     $agivar = explode(&#39;:&#39;,
$agivar);</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">     $agivars[$agivar[0]] =
trim($agivar[1]);</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> }</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> extract($agivars);</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> </span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">// Variable Declarations</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> </span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">$agi_uniqueid;</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">$agi_callerid;</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">$agi_calleridname;</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">$agi_extension;</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">$agi_uniqueid;</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">$UNIQUEID = $agi_uniqueid;</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">$CALLERID = $agi_callerid;</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">$EXTEN = $agi_extension;</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">$attachment =
&quot;/var/lib/asterisk/sounds/NewHire/Newhire-$UNIQUEID-$CALLERID-$EXTEN.wav&quot;;</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">$from = &quot;…@<a href="http://xxx.com" target="_blank">xxx.com</a>&quot;; </span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">$to =&quot;<a href="mailto:jas@answeringserv.com" target="_blank">jas@answeringserv.com</a> &quot;;</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">$subject=&quot;New Applicant&quot;;</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">$headers = &quot;From: $from&quot;;</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">$message =&quot;$UNIQUEID , $CALLERID , $EXTEN , $attachment&quot;;</span></p>

<p style=""><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">mail($to,$subject,$message,$headers);</span></p>

<p><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">?&gt;</span></p>

<div style="border-style: none none solid; border-color: -moz-use-text-color -moz-use-text-color windowtext; border-width: medium medium 1pt; padding: 0in 0in 1pt;">

<p style="border: medium none ; padding: 0in;"><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> </span></p>

</div>

<p><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> </span></p>

<p><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">So
is it anything obviously wrong with the script I’m missing?</span></p>

<p><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> </span></p>

<p><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;">Besides
something not being configured in php.ini correctly any other ideas?</span></p>

<p> </p>

<p><span style="font-size: 18pt; font-family: &quot;Brush Script MT&quot;; color: rgb(31, 73, 125);">James Shigley</span></p>

<p><b><span style="font-size: 18pt; font-family: &quot;Bradley Hand ITC&quot;; color: rgb(31, 73, 125);">Monroe Telephone Answering Service</span></b></p>

<p>409-981-9213<b><span style="font-size: 18pt; font-family: &quot;Bradley Hand ITC&quot;; color: rgb(31, 73, 125);"></span></b></p>

<p><span style="font-size: 8pt;">Infinity
5.5,UC 4.02.3803, Blink 3.0.104</span></p>

<p><span style="font-size: 8pt;">Ecreator:2.21,
eResponse 1.1.7</span></p>

<p><span style="font-size: 8pt;">Webportal,WebApps,</span></p>

<p> <span style="font-size: 12pt; font-family: &quot;Times New Roman&quot;,&quot;serif&quot;;"></span></p>

<p>CONFIDENTIALITY NOTICE: <span style="font-size: 7.5pt;">This
email, including any attachments, contains information which may be
confidential or privileged. The information is intended to be for the use of the
individual or entity named above. If you are not the intended recipient, be
aware that any disclosure, copying, distribution or use of the contents of this
information is prohibited. If you have received this email in error, please
notify the sender immediately by &quot;reply to sender only&quot; message and
destroy all electronic and hard copies of the communication, including
attachments.</span> </p>

<p> </p>

<p><span style="font-size: 10.5pt; font-family: Consolas;">&quot;Common
sense is the collection of prejudices acquired by age eighteen.&quot; -- Albert
Einstein </span></p>

<p><span style="font-size: 10.5pt; font-family: Consolas;">&quot;Once
you can accept the universe as matter expanding into nothing that is
something,wearing stripes with plaid comes easy.&quot; -- Albert Einstein</span></p>

<p><span style="font-size: 10.5pt; font-family: Consolas;">&quot;I
know a little of everything, but a lot of nothing&quot;</span></p>

<p> </p>

</div>

</div>


<br>_______________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</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>