[Asterisk-Users] pass caller ID to another application or machine.

Richard Reina rf_reina at yahoo.com
Mon Mar 28 06:14:09 MST 2005


Michiel,

Thanks very much for the resonse.  I am confused
however by "fopen("/var/log/asterisk/my_agi.log""

my * system has not such log file only the Master.cvs
which only seems to log a call one its teminated?

--- Michiel van Baak <michiel at vanbaak.info> wrote:
> On 04:07, Mon 28 Mar 05, Richard Reina wrote:
> > DO you happen to rember the name of the agi
> command
> > that thansfers the record into the table? Or do
> you
> > know where I can find some sample sripts to look
> at?
> 
> Hi,
> 
> Here are some snippets from my php-based agi:
> 
> #!/usr/bin/php4 -q
> <?php
> ob_implicit_flush(true);
> set_time_limit(6);
> $in = fopen("php://stdin","r");
> $stdlog = fopen("/var/log/asterisk/my_agi.log",
> "w");
> // toggle debugging output (more verbose)
> $debug = false;
> // Do function definitions before we start the main
> loop
> function read() {
> 	global $in, $debug, $stdlog;
> 	$input = str_replace("\n", "", fgets($in, 4096));
> 	if ($debug) fputs($stdlog, "read: $input\n");
> 	return $input;
> }
> 				
> // parse agi headers into array
> while ($env=read()) {
> 	$s = split(": ",$env);
> 	$agi[str_replace("agi_","",$s[0])] = trim($s[1]);
> 	if (($env == "") || ($env == "\n")) {
> 		break;
> 	}
> }
> .........<snip>........
> // lookup id and name
> $sql = "SELECT a.id,a.bedrijfsnaam FROM adres as
> a,bcards as b WHERE a.id=b.bedrijfs_id AND
> (replace(replace(a.telnr,'-',''), ' ','') ILIKE
> '%".$agi["callerid"]."')"; 
> .........<snip>........
> // put the stuff into our table
> $sql = "INSERT INTO active_calls VALUES
>
('".$row["bedrijfsnaam"]."',".$row["id"].",".mktime().")";
> .........<snip>........
> ?>
> 
> 
> 
> have fun!
> -- 
> Michiel van Baak
> http://lunteren.vanbaak.info
> michiel at vanbaak.info
> GnuPG key:
>
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7E0B9A2D
> 
> "Two of the most famous products of Berkeley are LSD
> and BSD. I don't think that this is a coincidence."
> 
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
>
http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
>   
>
http://lists.digium.com/mailman/listinfo/asterisk-users
> 


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 



More information about the asterisk-users mailing list