Re: [asterisk-users] Contact lookup
On Thu, Feb 5, 2009 at 7:22 AM, Geoff Lane ge...@gjctech.co.uk wrote: The nice thing about that is that if I use MySQL I can run the management application on another machine, and so don't need to run a web server on the Asterisk box. However, I wonder whether the overhead necessary to run MySQL on the Asterisk box is more than that required to run Apache to provide a web interface to astdb. I'm not running either at present, which is probably as well since my Asterisk machine is low-spec by todays standards. Regarding system resource usage it is, of course, to you to run the DB engine along with asterisk or on some other system. :-) -- exvito ___ -- 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
Re: [asterisk-users] Contact lookup
On Wednesday, February 4, 2009, D Tucny wrote: I use a slight variant of this... exten = s,n,Set(CALLERID(name)=${IF(${ISNULL(${DB(cidname/${CALLERID(num)})})}?Unknown:${DB(cidname/${CALLERID(num)})})}) exten = s,n,NoOp(Caller ID name mapped to ${CALLERID(name)}) Basically the same as yours above (including substitution of Unknown when not found), but, all on one line... Once I'd got a handle on it, the task seems almost trivial. Here's what I've got: exten = s,1,Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})}) I don't need unknown because all my handsets show something similar (e.g. Unavailable name) by default. I've been looking into changing it recently such that where I don't have the name I can substitute something more useful than Unknown, such as the site, or for external calls, the country/province/state/city/type/telco/etc, though that won't be in astdb due to the current 100s of thousands of rows... That might be a good AGI project... FWIW, I had trouble loading astdb with the contact list. I dumped the caller list from my old PBX to a CSV file and then parsed it to give one line of the following form for each contact: /usr/sbin/asterisk -rx 'database put cidname 01234567 Caller Name' I ran the script and it appeared to go well. However, when did database show cidname at the * CLI prompt, the family and key were in a right mess. For example, the entry above might have appeared as: 34567: Caller Name I suspect that it would still have worked since database show cidname listed these entries but I didn't take chances. There were only thirty or so entries, so I cleared the cidname family and copied each database put command from a terminal window and pasted to the * CLI prompt. So, this is now sorted for me and I've learned a thing or two about astdb in the process. Thanks all. -- Geoff ___ -- 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
Re: [asterisk-users] Contact lookup
For a simple (but flexible) case I would consider ODBC + func_odbc. Here is the idea (in case you aren't aware of how it goes...) - Make a DB available (your choice as long as it is accessible via ODBC) - Create table in it with your contacts (say columns number and name, maybe more) - Setup an ODBC connection for asterisk so that it can connect to that DB (res_odbc.conf) - Setup an ODBC func.This is basically an SQL query which will be mapped into a dialplan function. (func_odbc.conf) It is essentially something that states my function ODBC_LOOKUP(arg) will give me the results of SELECT name FROM contactsTable WHERE number=${arg} into the dialplan. - Then use it in the dialplan exten = _x.,n,Set(CALLERID(name)=${ODBC_LOOKUP(${EXTEN})}) There! Your dialplan is almost directly executing SQL queries. :) Check both the sample asterisk configs + Asterisk TFOT, chapter 12. It may be a bit more work than using the Ast DB or other means, but it has the advantage of allowing the easy setup of any kind of frontend for contact management. Note: Check for the correctness of my filenames/syntax... They're shown just to fill in the idea with something resembing the reality! My 2c, -- exvito ___ -- 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
Re: [asterisk-users] Contact lookup
On Wednesday, February 4, 2009, Ex Vito wrote: For a simple (but flexible) case I would consider ODBC + func_odbc. Here is the idea (in case you aren't aware of how it goes...) [... snip ...] It may be a bit more work than using the Ast DB or other means, but it has the advantage of allowing the easy setup of any kind of frontend for contact management. Thanks for the reply. The nice thing about that is that if I use MySQL I can run the management application on another machine, and so don't need to run a web server on the Asterisk box. However, I wonder whether the overhead necessary to run MySQL on the Asterisk box is more than that required to run Apache to provide a web interface to astdb. I'm not running either at present, which is probably as well since my Asterisk machine is low-spec by todays standards. At the moment it's academic since I don't have a large or extremely dynamic contact list and so can handle it with commands in the * CLI. However, it'll be an interesting exercise when I eventually upgrade the hardware and also move to Asterisk 1.6. Thanks again, -- Geoff ___ -- 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
Re: [asterisk-users] Contact lookup
There are some good examples of this at voip-info.org. Shouldn't this be handled by normal caller-id? Anyhow, here's an AGI (PERL) example: #!/usr/local/bin/perl use Asterisk::AGI; # the AGI object my $agi = new Asterisk::AGI; # send callback reference my $rc = $agi-set_callerid('IM_A_CALLER'); $agi-say_digits('123'); $agi-send_text('call ext 106'); $agi-exec('Dial', 'SIP/102'); $agi-hangup(); exit; This sends the message call ext 106 to the phone display you call from, says 123 on the speaker, then calls SIP/102 and shows IM_A_CALLER on the display (the _ are there because IM A CALLER shows as IM. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Geoff Lane Sent: Tuesday, February 03, 2009 10:05 AM To: Asterisk Users Subject: [asterisk-users] Contact lookup Hi All, Asterisk 1.4.12 on CentOS 5 I'd like to be able to look up each incoming CLI to retrieve an associated name, if available, and then pass that to the extensions so that they can see both the name and number of the caller. I'm not after LDAP or anything else maintained externally, just a contact lookup for my system. I suspect that Astdb could be used for this, as could a relational database like MySQL or postgres (accessed via AGI?) Probably simpler would be to maintain a text configuration file since I'm only concerned about less than a hundred entries initially. I'd appreciate insight into which is the easiest way to do this, and also any pointers to tutorials etc. TIA, -- Geoff ___ -- 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 ___ -- 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
Re: [asterisk-users] Contact lookup
On Tue, 3 Feb 2009, Geoff Lane wrote: Hi All, Asterisk 1.4.12 on CentOS 5 I'd like to be able to look up each incoming CLI to retrieve an associated name, if available, and then pass that to the extensions so that they can see both the name and number of the caller. I'm not after LDAP or anything else maintained externally, just a contact lookup for my system. I suspect that Astdb could be used for this, as could a relational database like MySQL or postgres (accessed via AGI?) Probably simpler would be to maintain a text configuration file since I'm only concerned about less than a hundred entries initially. I'd appreciate insight into which is the easiest way to do this, and also any pointers to tutorials etc. AstDB: At it's very simplest: exten = s,n,Set(CALLERID(name)=Unknown) exten = s,n,Set(name=${DB(cid/${CALLERID(number)})}) exten = s,n,GotoIf($[${name} = ]?endCID) exten = s,n,Set(CALLERID(name)=${name}) exten = s,n(endCID),Noop(fixCallerID - End of processing - returning ${CALLERID(all)}) ... somewhere in the incoming processing. (This is an extract from an overly complcated macro I use) Things to check for - a name already being present - eg. on an incoming SIP call. No name in the astDB - might want to substitute Unknown .. All you need to do now is populate the astDB - I use a web interface and some php to drive the manager interface... My biggest site has just under 300 lookup entries... (Which presents other issues with the web interface, but ...) Gordon ___ -- 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
Re: [asterisk-users] Contact lookup
Have a look at smartCID at www.generationd.com Uses a simple mySQL database, allows for call blocking flag, reverse CID lookup, etc. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Gordon Henderson Sent: February 3, 2009 11:51 AM To: Asterisk Users List Subject: Re: [asterisk-users] Contact lookup On Tue, 3 Feb 2009, Geoff Lane wrote: Hi All, Asterisk 1.4.12 on CentOS 5 I'd like to be able to look up each incoming CLI to retrieve an associated name, if available, and then pass that to the extensions so that they can see both the name and number of the caller. I'm not after LDAP or anything else maintained externally, just a contact lookup for my system. I suspect that Astdb could be used for this, as could a relational database like MySQL or postgres (accessed via AGI?) Probably simpler would be to maintain a text configuration file since I'm only concerned about less than a hundred entries initially. I'd appreciate insight into which is the easiest way to do this, and also any pointers to tutorials etc. AstDB: At it's very simplest: exten = s,n,Set(CALLERID(name)=Unknown) exten = s,n,Set(name=${DB(cid/${CALLERID(number)})}) exten = s,n,GotoIf($[${name} = ]?endCID) exten = s,n,Set(CALLERID(name)=${name}) exten = s,n(endCID),Noop(fixCallerID - End of processing - returning ${CALLERID(all)}) ... somewhere in the incoming processing. (This is an extract from an overly complcated macro I use) Things to check for - a name already being present - eg. on an incoming SIP call. No name in the astDB - might want to substitute Unknown .. All you need to do now is populate the astDB - I use a web interface and some php to drive the manager interface... My biggest site has just under 300 lookup entries... (Which presents other issues with the web interface, but ...) Gordon ___ -- 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 ___ -- 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
Re: [asterisk-users] Contact lookup
2009/2/4 Gordon Henderson gordon+aster...@drogon.netgordon%2baster...@drogon.net On Tue, 3 Feb 2009, Geoff Lane wrote: Hi All, Asterisk 1.4.12 on CentOS 5 I'd like to be able to look up each incoming CLI to retrieve an associated name, if available, and then pass that to the extensions so that they can see both the name and number of the caller. I'm not after LDAP or anything else maintained externally, just a contact lookup for my system. I suspect that Astdb could be used for this, as could a relational database like MySQL or postgres (accessed via AGI?) Probably simpler would be to maintain a text configuration file since I'm only concerned about less than a hundred entries initially. I'd appreciate insight into which is the easiest way to do this, and also any pointers to tutorials etc. AstDB: At it's very simplest: exten = s,n,Set(CALLERID(name)=Unknown) exten = s,n,Set(name=${DB(cid/${CALLERID(number)})}) exten = s,n,GotoIf($[${name} = ]?endCID) exten = s,n,Set(CALLERID(name)=${name}) exten = s,n(endCID),Noop(fixCallerID - End of processing - returning ${CALLERID(all)}) ... somewhere in the incoming processing. (This is an extract from an overly complcated macro I use) Things to check for - a name already being present - eg. on an incoming SIP call. No name in the astDB - might want to substitute Unknown .. All you need to do now is populate the astDB - I use a web interface and some php to drive the manager interface... My biggest site has just under 300 lookup entries... (Which presents other issues with the web interface, but ...) I use a slight variant of this... exten = s,n,Set(CALLERID(name)=${IF(${ISNULL(${DB(cidname/${CALLERID(num)})})}?Unknown:${DB(cidname/${CALLERID(num)})})}) exten = s,n,NoOp(Caller ID name mapped to ${CALLERID(name)}) Basically the same as yours above (including substitution of Unknown when not found), but, all on one line... I've been looking into changing it recently such that where I don't have the name I can substitute something more useful than Unknown, such as the site, or for external calls, the country/province/state/city/type/telco/etc, though that won't be in astdb due to the current 100s of thousands of rows... d ___ -- 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