Re: [Asterisk-Users] AGI and set_callerid for number and name

2005-10-13 Thread Steve Daniels

What version are you using?
Try SetCIDName(Fred)
Check voip-info's wiki

HTH

Steve

- Original Message - 
From: Serge Lhermitte [EMAIL PROTECTED]

To: asterisk-users@lists.digium.com
Sent: Wednesday, October 12, 2005 5:57 PM
Subject: [Asterisk-Users] AGI and set_callerid for number and name



Hi,


I've been trying to use the set_callerid function in the AGI. It sets
the CallerIDname properly but I can't figure out how to set the
CallerIDnumber. 


Is it at at possible ?

Cheers.
SL



___
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
Asterisk-Users@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


___
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
Asterisk-Users@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


RE: [Asterisk-Users] AGI and set_callerid for number and name

2005-10-13 Thread Serge Lhermitte
Thanks a lot.
S.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Pedro
Nunes
Sent: mercredi 12 octobre 2005 19:18
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: RE: [Asterisk-Users] AGI and set_callerid for number and name

Curse,

Look at this php script ...

Contactlookup.agi

#!/usr/local/bin/php -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 = true;

 // 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;
 }

 function errlog($line) {
   global $err;
   echo VERBOSE \$line\\n;
 }

 function write($line) {
   global $debug, $stdlog;
   if ($debug) fputs($stdlog, write: $line\n);
   echo $line.\n;
 }

 // 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;
   }
 }

 // main program
 echo VERBOSE \Here we go!\ 2\n;
 read();
 $session = mssql_connect('mssql server' , 'username' , 'password' );
$result = mssql_query(select * from ContactDB WHERE
extension=.$agi['callerid'],$session );
 $row = mssql_fetch_array($result);
 mssql_close($session);
 if ($row['Name'] == ){
  write('SET VARIABLE NAME Not Found');
  read();
 } else {
  write('SET VARIABLE NAME '.$row['Name'].'');
  read();
 }
 fclose($in);
 fclose($stdlog);


And in extensions.conf

[extensions]
exten = 4501,1,agi,contactlookup.agi
exten = 4501,2,SetCIDName(${Name})
exten = 4501,3,Dial(SIP/421,15)


It looks to an mssql DB, try to find the callerID number in table
extensions, and then sets a variable named Name to the value of
table Name. Cool hah...



Pedro Nunes



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Serge
Lhermitte
Sent: quarta-feira, 12 de Outubro de 2005 17:57
To: asterisk-users@lists.digium.com
Subject: [Asterisk-Users] AGI and set_callerid for number and name


Hi,


I've been trying to use the set_callerid function in the AGI. It sets
the CallerIDname properly but I can't figure out how to set the
CallerIDnumber. 

Is it at at possible ?

Cheers.
SL


 
___
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
Asterisk-Users@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
___
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
Asterisk-Users@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
___
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
Asterisk-Users@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


RE: [Asterisk-Users] AGI and set_callerid for number and name

2005-10-12 Thread Pedro Nunes
Curse,

Look at this php script ...

Contactlookup.agi

#!/usr/local/bin/php -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 = true;

 // 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;
 }

 function errlog($line) {
   global $err;
   echo VERBOSE \$line\\n;
 }

 function write($line) {
   global $debug, $stdlog;
   if ($debug) fputs($stdlog, write: $line\n);
   echo $line.\n;
 }

 // 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;
   }
 }

 // main program
 echo VERBOSE \Here we go!\ 2\n;
 read();
 $session = mssql_connect('mssql server' , 'username' , 'password' );
$result = mssql_query(select * from ContactDB WHERE
extension=.$agi['callerid'],$session );
 $row = mssql_fetch_array($result);
 mssql_close($session);
 if ($row['Name'] == ){
  write('SET VARIABLE NAME Not Found');
  read();
 } else {
  write('SET VARIABLE NAME '.$row['Name'].'');
  read();
 }
 fclose($in);
 fclose($stdlog);


And in extensions.conf

[extensions]
exten = 4501,1,agi,contactlookup.agi
exten = 4501,2,SetCIDName(${Name})
exten = 4501,3,Dial(SIP/421,15)


It looks to an mssql DB, try to find the callerID number in table
extensions, and then sets a variable named Name to the value of
table Name. Cool hah...



Pedro Nunes



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Serge
Lhermitte
Sent: quarta-feira, 12 de Outubro de 2005 17:57
To: asterisk-users@lists.digium.com
Subject: [Asterisk-Users] AGI and set_callerid for number and name


Hi,


I've been trying to use the set_callerid function in the AGI. It sets
the CallerIDname properly but I can't figure out how to set the
CallerIDnumber. 

Is it at at possible ?

Cheers.
SL


 
___
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
Asterisk-Users@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
___
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
Asterisk-Users@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