First run 

/var/lib/asterisk/agi-bin/newhire.php

 

>From linux command line to see if you don't have any error and that your AGI
is executable.

 

Then run 'agi debug' from the asterisk cli, place a call and see what was
send and receive from your agi

 

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of James A.
Shigley
Sent: April-23-09 12:26 PM
To: asterisk-users@lists.digium.com
Subject: [asterisk-users] AGI PHP script

 

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 [4099xxx...@port3_real:1] Goto("DAHDI/50-1", "newhire,s,1") in

new stack

    -- Goto (newhire,s,1)

    -- Executing [...@newhire:1] Ringing("DAHDI/50-1", "") in new stack

    -- Executing [...@newhire:2] Answer("DAHDI/50-1", "") in new stack

    -- Executing [...@newhire:3] Monitor("DAHDI/50-1",
"wav,/var/lib/asterisk/soun

ds/NewHire/Newhire-1240503071.15148-4099819213-s,o") in new stack

    -- Executing [...@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 ="j...@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

Reply via email to