[asterisk-users] AGI PHP script

Geraint Lee geraint at gmail.com
Thu Apr 23 11:33:54 CDT 2009


Check you can run the script from th ecommand line and successfully send
email... have you considered using phpagi for your scripts?

2009/4/23 James A. Shigley <jas at answeringserv.com>

>  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
>
>
>
>
>
> This is the CLI output
>
> -- Executing [4099XXXXXX at port3_real:1] Goto("DAHDI/50-1", "newhire,s,1")
> in
>
> new stack
>
>     -- Goto (newhire,s,1)
>
>     -- Executing [s at newhire:1] Ringing("DAHDI/50-1", "") in new stack
>
>     -- Executing [s at newhire:2] Answer("DAHDI/50-1", "") in new stack
>
>     -- Executing [s at newhire:3] Monitor("DAHDI/50-1",
> "wav,/var/lib/asterisk/soun
>
> ds/NewHire/Newhire-1240503071.15148-4099819213-s,o") in new stack
>
>     -- Executing [s at newhire:4] AGI("DAHDI/50-1", "newhire.php") in new
> stack
>
>     -- Launched AGI Script /var/lib/asterisk/agi-bin/newhire.php
>
>     -- <DAHDI/50-1>AGI Script newhire.php completed, returning 0
>
>     -- Auto fallthrough, channel 'DAHDI/50-1' status is 'UNKNOWN'
>
>     -- Hungup 'DAHDI/50-1'
>
>
>
> Here is the script
>
>
>
>
>
> #!/usr/bin/php5
>
> <?php
>
>
>
> // Get AGI vars from *
>
>
>
>  $agivars = array();
>
>  while (!feof(STDIN)) {
>
>      $agivar = trim(fgets(STDIN));
>
>      if ($agivar === '') {
>
>          break;
>
>      }
>
>      $agivar = explode(':', $agivar);
>
>      $agivars[$agivar[0]] = trim($agivar[1]);
>
>  }
>
>  extract($agivars);
>
>
>
> // Variable Declarations
>
>
>
> $agi_uniqueid;
>
> $agi_callerid;
>
> $agi_calleridname;
>
> $agi_extension;
>
> $agi_uniqueid;
>
> $UNIQUEID = $agi_uniqueid;
>
> $CALLERID = $agi_callerid;
>
> $EXTEN = $agi_extension;
>
> $attachment =
> "/var/lib/asterisk/sounds/NewHire/Newhire-$UNIQUEID-$CALLERID-$EXTEN.wav";
>
> $from = "…@xxx.com";
>
> $to ="jas at answeringserv.com ";
>
> $subject="New Applicant";
>
> $headers = "From: $from";
>
> $message ="$UNIQUEID , $CALLERID , $EXTEN , $attachment";
>
> mail($to,$subject,$message,$headers);
>
> ?>
>
>
>
>
>
> So is it anything obviously wrong with the script I’m missing?
>
>
>
> Besides something not being configured in php.ini correctly any other
> ideas?
>
>
>
> James Shigley
>
> *Monroe Telephone Answering Service*
>
> 409-981-9213**
>
> Infinity 5.5,UC 4.02.3803, Blink 3.0.104
>
> Ecreator:2.21, eResponse 1.1.7
>
> Webportal,WebApps,
>
>
>
> CONFIDENTIALITY NOTICE: 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.
>
>
>
> "Common sense is the collection of prejudices acquired by age eighteen." --
> Albert Einstein
>
> "Once you can accept the universe as matter expanding into nothing that is
> something,wearing stripes with plaid comes easy." -- Albert Einstein
>
> "I know a little of everything, but a lot of nothing"
>
>
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090423/eb35be9b/attachment.htm 


More information about the asterisk-users mailing list