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"><<a href="mailto:jas@answeringserv.com">jas@answeringserv.com</a>></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: "Courier New";">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: "Courier New";"> </span></p>
</div>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> </span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">This is the CLI output</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">-- Executing [4099XXXXXX@port3_real:1]
Goto("DAHDI/50-1", "newhire,s,1") in</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">new stack</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> -- Goto (newhire,s,1)</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> -- Executing [s@newhire:1]
Ringing("DAHDI/50-1", "") in new stack</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> -- Executing [s@newhire:2]
Answer("DAHDI/50-1", "") in new stack</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> -- Executing [s@newhire:3]
Monitor("DAHDI/50-1", "wav,/var/lib/asterisk/soun</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">ds/NewHire/Newhire-1240503071.15148-4099819213-s,o")
in new stack</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> -- Executing [s@newhire:4]
AGI("DAHDI/50-1", "newhire.php") in new stack</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> -- Launched AGI Script
/var/lib/asterisk/agi-bin/newhire.php</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> -- <DAHDI/50-1>AGI Script
newhire.php completed, returning 0</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> -- Auto fallthrough, channel
'DAHDI/50-1' status is 'UNKNOWN'</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: "Courier New";"> -- Hungup
'DAHDI/50-1'</span></p>
</div>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> </span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">Here is the script</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> </span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> </span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">#!/usr/bin/php5 </span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"><?php</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> </span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">// Get AGI vars from *</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> </span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> $agivars = array();</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> while (!feof(STDIN)) {</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> $agivar =
trim(fgets(STDIN));</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> if ($agivar === '') {</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">
break;</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> }</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> $agivar = explode(':',
$agivar);</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> $agivars[$agivar[0]] =
trim($agivar[1]);</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> }</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> extract($agivars);</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> </span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">// Variable Declarations</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";"> </span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">$agi_uniqueid;</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">$agi_callerid;</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">$agi_calleridname;</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">$agi_extension;</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">$agi_uniqueid;</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">$UNIQUEID = $agi_uniqueid;</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">$CALLERID = $agi_callerid;</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">$EXTEN = $agi_extension;</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">$attachment =
"/var/lib/asterisk/sounds/NewHire/Newhire-$UNIQUEID-$CALLERID-$EXTEN.wav";</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">$from = "…@<a href="http://xxx.com" target="_blank">xxx.com</a>"; </span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">$to ="<a href="mailto:jas@answeringserv.com" target="_blank">jas@answeringserv.com</a> ";</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">$subject="New Applicant";</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">$headers = "From: $from";</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">$message ="$UNIQUEID , $CALLERID , $EXTEN , $attachment";</span></p>
<p style=""><span style="font-size: 9pt; font-family: "Courier New";">mail($to,$subject,$message,$headers);</span></p>
<p><span style="font-size: 9pt; font-family: "Courier New";">?></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: "Courier New";"> </span></p>
</div>
<p><span style="font-size: 9pt; font-family: "Courier New";"> </span></p>
<p><span style="font-size: 9pt; font-family: "Courier New";">So
is it anything obviously wrong with the script I’m missing?</span></p>
<p><span style="font-size: 9pt; font-family: "Courier New";"> </span></p>
<p><span style="font-size: 9pt; font-family: "Courier New";">Besides
something not being configured in php.ini correctly any other ideas?</span></p>
<p> </p>
<p><span style="font-size: 18pt; font-family: "Brush Script MT"; color: rgb(31, 73, 125);">James Shigley</span></p>
<p><b><span style="font-size: 18pt; font-family: "Bradley Hand ITC"; color: rgb(31, 73, 125);">Monroe Telephone Answering Service</span></b></p>
<p>409-981-9213<b><span style="font-size: 18pt; font-family: "Bradley Hand ITC"; 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: "Times New Roman","serif";"></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 "reply to sender only" 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;">"Common
sense is the collection of prejudices acquired by age eighteen." -- Albert
Einstein </span></p>
<p><span style="font-size: 10.5pt; font-family: Consolas;">"Once
you can accept the universe as matter expanding into nothing that is
something,wearing stripes with plaid comes easy." -- Albert Einstein</span></p>
<p><span style="font-size: 10.5pt; font-family: Consolas;">"I
know a little of everything, but a lot of nothing"</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>