<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Brush Script MT";
        panose-1:3 6 8 2 4 4 6 7 3 4;}
@font-face
        {font-family:"Bradley Hand ITC";
        panose-1:3 7 4 2 5 3 2 3 2 3;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='color:#1F497D'>Actually I feel like an idiot. I
had forgotten to put asterisk as an allowed sender in the server that those
emails are going out of. (different from what * normally uses to email us)<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<p class=MsoNormal><span style='font-size:18.0pt;font-family:"Brush Script MT";
color:#1F497D'>James Shigley<o:p></o:p></span></p>

<p class=MsoNormal><b><span style='font-size:18.0pt;font-family:"Bradley Hand ITC";
color:#1F497D'>Monroe Telephone Answering Service<o:p></o:p></span></b></p>

<p class=MsoNormal><span style='color:#1F497D'>409-981-9213</span><b><span
style='font-size:18.0pt;font-family:"Bradley Hand ITC";color:#1F497D'><o:p></o:p></span></b></p>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Arial","sans-serif";
color:#1F497D'>Infinity 5.5,UC 4.02.3803, Blink 3.0.104<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Arial","sans-serif";
color:#1F497D'>Ecreator:2.21, eResponse 1.1.7<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Arial","sans-serif";
color:#1F497D'>Webportal,WebApps,<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>&nbsp;</span><span
style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#1F497D'><o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>CONFIDENTIALITY NOTICE: </span><span
style='font-size:7.5pt;color:#1F497D'>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><span
style='color:#1F497D'> <o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas;
color:#1F497D'>&quot;Common sense is the collection of prejudices acquired by
age eighteen.&quot; -- Albert Einstein <o:p></o:p></span></p>

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

<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas;
color:#1F497D'>&quot;I know a little of everything, but a lot of nothing&quot;<o:p></o:p></span></p>

</div>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] <b>On Behalf Of </b>Ruddy
Gbaguidi<br>
<b>Sent:</b> Thursday, April 23, 2009 11:57 AM<br>
<b>To:</b> 'Asterisk Users Mailing List - Non-Commercial Discussion'<br>
<b>Subject:</b> Re: [asterisk-users] AGI PHP script<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span lang=EN-CA style='color:#1F497D'>First run <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New"'>/var/lib/asterisk/agi-bin/newhire.php<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-CA style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-CA style='color:#1F497D'>From linux command
line to see if you don&#8217;t have any error and that your AGI is executable.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-CA style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-CA style='color:#1F497D'>Then run &#8216;agi debug&#8217;
from the asterisk cli, place a call and see what was send and receive from your
agi<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-CA style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com]
<b>On Behalf Of </b>James A. Shigley<br>
<b>Sent:</b> April-23-09 12:26 PM<br>
<b>To:</b> asterisk-users@lists.digium.com<br>
<b>Subject:</b> [asterisk-users] AGI PHP script<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><span lang=EN-CA><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>I have the below script that doesn&#8217;t seem to be
working. I don&#8217;t know if I have something in the script wrong that I am just
missing. Or if I don&#8217;t have the php.ini set correctly for emailing<o:p></o:p></span></p>

<div style='border:none;border-bottom:solid windowtext 1.0pt;padding:0in 0in 1.0pt 0in'>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

</div>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>This is the CLI output<o:p></o:p></span></p>

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

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>new stack<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp; -- Goto (newhire,s,1)<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp; -- Executing [s@newhire:1] Ringing(&quot;DAHDI/50-1&quot;,
&quot;&quot;) in new stack<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp; -- Executing [s@newhire:2]
Answer(&quot;DAHDI/50-1&quot;, &quot;&quot;) in new stack<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp; -- Executing [s@newhire:3]
Monitor(&quot;DAHDI/50-1&quot;, &quot;wav,/var/lib/asterisk/soun<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>ds/NewHire/Newhire-1240503071.15148-4099819213-s,o&quot;)
in new stack<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp; -- Executing [s@newhire:4]
AGI(&quot;DAHDI/50-1&quot;, &quot;newhire.php&quot;) in new stack<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp; -- Launched AGI Script
/var/lib/asterisk/agi-bin/newhire.php<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp; -- &lt;DAHDI/50-1&gt;AGI Script
newhire.php completed, returning 0<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp; -- Auto fallthrough, channel
'DAHDI/50-1' status is 'UNKNOWN'<o:p></o:p></span></p>

<div style='border:none;border-bottom:solid windowtext 1.0pt;padding:0in 0in 1.0pt 0in'>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp; -- Hungup 'DAHDI/50-1'<o:p></o:p></span></p>

</div>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>Here is the script<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>#!/usr/bin/php5 <o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&lt;?php<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>// Get AGI vars from *<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;$agivars = array();<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;while (!feof(STDIN)) {<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp; $agivar =
trim(fgets(STDIN));<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp; if ($agivar === '') {<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
break;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp; $agivar = explode(':',
$agivar);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp; $agivars[$agivar[0]] =
trim($agivar[1]);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;}<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>&nbsp;extract($agivars);<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>// Variable Declarations<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>$agi_uniqueid;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>$agi_callerid;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>$agi_calleridname;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>$agi_extension;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>$agi_uniqueid;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>$UNIQUEID = $agi_uniqueid;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>$CALLERID = $agi_callerid;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>$EXTEN = $agi_extension;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>$attachment =
&quot;/var/lib/asterisk/sounds/NewHire/Newhire-$UNIQUEID-$CALLERID-$EXTEN.wav&quot;;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>$from = &quot;&#8230;@xxx.com&quot;; <o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>$to =&quot;jas@answeringserv.com &quot;;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>$subject=&quot;New Applicant&quot;;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>$headers = &quot;From: $from&quot;;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>$message =&quot;$UNIQUEID , $CALLERID , $EXTEN ,
$attachment&quot;;<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:9.0pt;
font-family:"Courier New"'>mail($to,$subject,$message,$headers);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New"'>?&gt;<o:p></o:p></span></p>

<div style='border:none;border-bottom:solid windowtext 1.0pt;padding:0in 0in 1.0pt 0in'>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

</div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New"'>So
is it anything obviously wrong with the script I&#8217;m missing?<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Courier New"'>Besides
something not being configured in php.ini correctly any other ideas?<o:p></o:p></span></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span style='font-size:18.0pt;font-family:"Brush Script MT";
color:#1F497D'>James Shigley<o:p></o:p></span></p>

<p class=MsoNormal><b><span style='font-size:18.0pt;font-family:"Bradley Hand ITC";
color:#1F497D'>Monroe Telephone Answering Service<o:p></o:p></span></b></p>

<p class=MsoNormal>409-981-9213<b><span style='font-size:18.0pt;font-family:
"Bradley Hand ITC";color:#1F497D'><o:p></o:p></span></b></p>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Arial","sans-serif"'>Infinity
5.5,UC 4.02.3803, Blink 3.0.104<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Arial","sans-serif"'>Ecreator:2.21,
eResponse 1.1.7<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:8.0pt;font-family:"Arial","sans-serif"'>Webportal,WebApps,<o:p></o:p></span></p>

<p class=MsoNormal>&nbsp;<span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p>

<p class=MsoNormal>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> <o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

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

<p class=MsoNormal><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<o:p></o:p></span></p>

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

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>