Re: [asterisk-users] Re: Rewriting caller ID from database?

2006-11-26 Thread Tom Lynn

Vincent,
I do something similar to what you're doing.  However, I use the CID number
as the astdb family, allowing me to assign multiple attributes as the keys.
It requires some maintenance, so I also wrote a php script for the
management.  You can find it here:
http://voip-info.org/wiki/view/Web+based+Asterisk+Database+maintenance

Family:   206-456-7890
Privilige:  1
Family:   206-456-7890
Music:jazz
Family:   206-456-7890
Recording:  No

By inverting the relationship, I found it easier to focus on the source of
the call and the treatments I want to apply.  I can also wipe out entries by
family name and remove all attributes in one operation using database
deltree.


On 11/25/06, Time Bandit [EMAIL PROTECTED] wrote:


 I use some custom scripts to do database lookups and rewrite CallerID
 information.  Everything works fine with regard to the CID name, however
 my Cisco 7960 and Linksys SPA-942 phones do not display the calling
 number. Instead, they display the called number.  This makes the phone's
 call return feature not work. The calling number and name are both
 properly displayed on all of the softphone clients that I've tried.

 Here's the format I'm using to set the CallerID.

 SET CALLERID JONES DARYL A6508701826
If you're using Asterisk 1.2, see this page :
http://www.voip-info.org/wiki/view/Setting+Callerid

hth
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

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

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] Re: Rewriting caller ID from database?

2006-11-26 Thread Vincent Delporte

At 12:00 25/11/2006 -0700, Tom Lynn [EMAIL PROTECTED] wrote:
 I like a challenge.  I'll let you know if I come up with anything.

My eternal gratitude if you find something :-) And don't forget to update 
the VoIP wiki so others can benefit too.


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

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] Re: Rewriting caller ID from database?

2006-11-26 Thread Vincent Delporte
At 12:00 25/11/2006 -0700, Anselm Martin Hoffmeister 
[EMAIL PROTECTED] wrote:

Do try
asterisk -rx database put cidname 12345676 \Me - cellular\
or
asterisk -rx 'database put cidname 3871263 Me - home'
These quotations seem to work.


Yup, I should have tried before posting. Thanks.

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

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] Re: Rewriting caller ID from database?

2006-11-26 Thread Vincent Delporte

At 12:00 25/11/2006 -0700,  Michelle Dupuis [EMAIL PROTECTED] wrote:
Try using smartCID (www.generationd.com).  You'll get the benefit of 
ranges of numbers mapping to single ID's (good for corporate blocks), 
action field for blocking/accepting calls, etc).


Neat, although 411.com won't do as we're not located in the US: smartCID - 
A php script to replace callerid information with lookup from a local mysql 
table, and if that fails then reverse phone number lookup from 411.com. 
This script links to Asterisk PBX.

http://www.ocg.ca/clientfiles/gss/downloads.htm

Thanks.

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

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


RE: [asterisk-users] Re: Rewriting caller ID from database?

2006-11-25 Thread Michelle Dupuis
Anselm:

Try using smartCID (www.generationd.com).  You'll get the benefit of ranges
of numbers mapping to single ID's (good for corporate blocks), action field
for blocking/accepting calls, etc).  

MD

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Anselm Martin
Hoffmeister
Sent: Friday, November 24, 2006 4:46 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Re: Rewriting caller ID from database?

Am Freitag, den 24.11.2006, 22:22 +0100 schrieb Vincent Delporte:
 At 22:07 22/11/2006 -0700, Marco Mouta wrote:
 You can do it using AstDB, just load the database with callerid names and

 numbers and then include a lookup on database in all incoming calls, so 
 you can override whatever you wanted:)
 
 Thanks everyone. Indeed, it seems like using the embedded BerkeleyDB-based

 AstDB is good enough for what I'm trying to do. However, asterisk barfs on

 the following script that I used to import data:
 
 #/bin/bash
 asterisk -rx database put cidname 1234567 'Me - cellular'
 asterisk -rx database put cidname 1234567 'Me - home'
 etc.

Do try 
asterisk -rx database put cidname 12345676 \Me - cellular\
or 
asterisk -rx 'database put cidname 3871263 Me - home'

These quotations seem to work.

Hth
Anselm

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

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


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

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Re: Rewriting caller ID from database?

2006-11-25 Thread Time Bandit

I use some custom scripts to do database lookups and rewrite CallerID
information.  Everything works fine with regard to the CID name, however
my Cisco 7960 and Linksys SPA-942 phones do not display the calling
number. Instead, they display the called number.  This makes the phone's
call return feature not work. The calling number and name are both
properly displayed on all of the softphone clients that I've tried.

Here's the format I'm using to set the CallerID.

SET CALLERID JONES DARYL A6508701826

If you're using Asterisk 1.2, see this page :
http://www.voip-info.org/wiki/view/Setting+Callerid

hth
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] Re: Rewriting caller ID from database?

2006-11-24 Thread Vincent Delporte

At 22:07 22/11/2006 -0700, Marco Mouta wrote:
You can do it using AstDB, just load the database with callerid names and 
numbers and then include a lookup on database in all incoming calls, so 
you can override whatever you wanted:)


Thanks everyone. Indeed, it seems like using the embedded BerkeleyDB-based 
AstDB is good enough for what I'm trying to do. However, asterisk barfs on 
the following script that I used to import data:


#/bin/bash
asterisk -rx database put cidname 1234567 'Me - cellular'
asterisk -rx database put cidname 1234567 'Me - home'
etc.

Any idea why?

Thanks.

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

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Re: Rewriting caller ID from database?

2006-11-24 Thread Anselm Martin Hoffmeister
Am Freitag, den 24.11.2006, 22:22 +0100 schrieb Vincent Delporte:
 At 22:07 22/11/2006 -0700, Marco Mouta wrote:
 You can do it using AstDB, just load the database with callerid names and 
 numbers and then include a lookup on database in all incoming calls, so 
 you can override whatever you wanted:)
 
 Thanks everyone. Indeed, it seems like using the embedded BerkeleyDB-based 
 AstDB is good enough for what I'm trying to do. However, asterisk barfs on 
 the following script that I used to import data:
 
 #/bin/bash
 asterisk -rx database put cidname 1234567 'Me - cellular'
 asterisk -rx database put cidname 1234567 'Me - home'
 etc.

Do try 
asterisk -rx database put cidname 12345676 \Me - cellular\
or 
asterisk -rx 'database put cidname 3871263 Me - home'

These quotations seem to work.

Hth
Anselm

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

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Re: Rewriting caller ID from database?

2006-11-24 Thread Daryl Jones

Steven wrote:

There are two I can think of.
Hoodahek and asterdex (or asteridex)

We used hoodahek at first, but now use asterdex(sp?)
It has a web interface to enter the new names into.

We use it to fixup, corp. cell phones and used to use it for our leagcy PBX 
extensions.
  


I use some custom scripts to do database lookups and rewrite CallerID 
information.  Everything works fine with regard to the CID name, however 
my Cisco 7960 and Linksys SPA-942 phones do not display the calling 
number. Instead, they display the called number.  This makes the phone's 
call return feature not work. The calling number and name are both 
properly displayed on all of the softphone clients that I've tried.


Here's the format I'm using to set the CallerID.

   SET CALLERID JONES DARYL A6508701826


Can anyone help?


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

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] Re: Rewriting caller ID from database?

2006-11-23 Thread David Cook (Canada)
Vincent Delporte wrote:
 Hi

 Most of our customers have generic names like Hospital, so I need
to
 rewrite their caller ID name by looking up the number in a database
on
 the Asterisk server, and rewriting the name such as Reading
Hospital
 so that we know who's calling.

 Any idea if this can be done with Asterisk, and how to do it?

Little C and AGI to the rescue (uses MySQL too). DB schema in the code
comments at the top.

dbc.

extensions.conf:
;; Advantech primary context (Sangoma A200D ports 12);;;
;; Primary telco number (905-xxx-)
;
[advan-primary]
exten = s,1,NoOp(Primary line - ${CALLERID})   ; write log entry
exten = s,n,agi,clid_override|${CALLERID(NUM)} ; CLID agi override
exten = s,n,Goto(cook-main-menu,s,1)   ; Jump to main menu
exten = s,n,Hangup ; end/fallthrough

clid_override.c:
/* clid_override.c
 * (c) Advantech Systems Integration, 2006
 * Author: David B. Cook, [EMAIL PROTECTED], 905/xxx-
 * Initial Delivery: Version 1.0, March 1, 2006
 *
 * Application to set the CLID NAME field from a local database
 * when the field comes in empty from the carrier.
 *
 * Meant to be called from Asterisk as an AGI lookup
 * Connects to MySQL database : CLID_NAME
 *
 * Database definition
 * # Host: localhost
 * # Database: asterisk
 * # Table: 'CLID_NAME'
 * #
 * CREATE TABLE `CLID_NAME` (
 *  `CLID_NUM` varchar,
 *  `CLID_NAME` varchar,
 *  PRIMARY KEY  (`CLID_NUM`)
 * ) TYPE=InnoDB; * CLID_NAME
 *
 * Modification History:
 * XXX 00,00  dbc   - Example modification history format
 */

#include stdio.h
#include stdlib.h
#include mysql/mysql.h
#include string.h

#if !defined(MYSQL_VERSION_ID)||MYSQL_VERSION_ID32224
#define mysql_field_count mysql_num_fields
#endif

#define SELECT1_QUERY select CLID_NAME from CLID_NAME where
CLID_NUM='%s'

int main(int argc, char **argv)
{
  MYSQL mysql,*sock;
  MYSQL_RES *res;
  MYSQL_ROW row;
  char *DBhost=put hostname here;
  char *DBuser=put MySQL username here;
  char *DBpw=put MySQL password here;
  char *DBdb=put MySQL database name here;
  char  qbuf[512];
  int   i=0;
  char  line[80];

  /* use line buffering */
  setlinebuf(stdout);
  setlinebuf(stderr);

  /* read and ignore AGI environment */
  while (1) {
fgets(line,80,stdin);
if (strlen(line) = 1) break;
  }

  sprintf(qbuf,SELECT1_QUERY, argv[1]);
  /* debug: show query formulation */
  /* printf(SQL: %s\n, qbuf); */

  /* Initialize and connect to the server */
  mysql_init(mysql);
  if (!(sock =
mysql_real_connect(mysql,DBhost,DBuser,DBpw,DBdb,0,NULL,0)))
  {
fprintf(stderr,Couldn't connect to
engine!\n%s\n\n,mysql_error(mysql));
perror();
exit(1);
  }

  /* Perform query to determine if a row exists in the database for the
   * CLID in question.
   */
  if(mysql_query(sock,qbuf))
  {
fprintf(stderr,Query 1 failed (%s)\n,mysql_error(sock));
exit(1);
  }

  /* No results - fatal error */
  if (!(res=mysql_store_result(sock)))
  {
fprintf(stderr,Couldn't get result from query failed\n,
mysql_error(sock));
exit(1);
  }

  if(mysql_num_rows(res)=1) {
/* CLID is PK so should only be 1 row, but I'm going to*/
/* say = just so it won't break if no PK and multiple hits.   */
/* If so, will just re-set CLID again but won't break Asterisk */
while(row=mysql_fetch_row(res)) {

  printf( Set VARIABLE CALLERID(name) \%s\ \n, row[0]);

  /* send the output back to Asterisk */
  fgets(line,80,stdin);
  fputs(line,stderr);
}
   }
  /* Clean up memory tables/free resources */
  mysql_free_result(res);

  /* Terminate the database connection */
  mysql_close(sock);
  exit(0);
  return 0;   /* Keep some compilers happy */
}
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] Re: Rewriting caller ID from database?

2006-11-22 Thread Steven
There are two I can think of.

Hoodahek and asterdex (or asteridex)

We used hoodahek at first, but now use asterdex(sp?)
It has a web interface to enter the new names into.

We use it to fixup, corp. cell phones and used to use it for our leagcy PBX 
extensions.

-- 
-- 
Steven

http://www.glimasoutheast.org



Vincent Delporte [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 Hi

 Most of our customers have generic names like Hospital, so I need to 
 rewrite their caller ID name by looking up the number in a 
 database on the Asterisk server, and rewriting the name such as Reading 
 Hospital so that we know who's calling.

 Any idea if this can be done with Asterisk, and how to do it?

 Thank you.

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

 asterisk-users mailing list
 To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users
 



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

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Re: Rewriting caller ID from database?

2006-11-22 Thread Marco Mouta

Hi,

You can do it using AstDB, just load the database with callerid names and
numbers and then include a lookup on database in all incoming calls, so you
can override whatever you wanted:)


On 11/22/06, Steven [EMAIL PROTECTED] wrote:


There are two I can think of.

Hoodahek and asterdex (or asteridex)

We used hoodahek at first, but now use asterdex(sp?)
It has a web interface to enter the new names into.

We use it to fixup, corp. cell phones and used to use it for our leagcy
PBX extensions.

--
--
Steven

http://www.glimasoutheast.org



Vincent Delporte [EMAIL PROTECTED] wrote in message news:
[EMAIL PROTECTED]
 Hi

 Most of our customers have generic names like Hospital, so I need to
rewrite their caller ID name by looking up the number in a
 database on the Asterisk server, and rewriting the name such as Reading
Hospital so that we know who's calling.

 Any idea if this can be done with Asterisk, and how to do it?

 Thank you.

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

 asterisk-users mailing list
 To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users




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

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users





--
Best regards,

Marco Mouta
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users