To receive calls on Asterisk from PSTN

  1. Can Asterisk receive calls directly from a plain old analog phone? I know SIPphone provides virtual numbers with a monthly charge for non-sip phones to call a softphone. Can Asterisk do the same?

  2. Is it possible to configure Asterisk to save caller IDs and call time to a database? If it can, does Asterisk provide any programming APIs (i.e. in Java) to work with the software?

My organization would like to have workers to call in to a phone system from their work sites upon arrival, and this phone system will automatically record the caller IDs and call time. Then we can have a customized application to retrieve the caller IDs and call time from a database to process the data for some other business purposes.

  1. Yes you can connect asterisk to the PSTN. You will need to buy some hardware for it.
  2. By default asterisk saves the CDR’s to a csv file. If you set up cdr_mysql.conf you can store the CDR’s to MySQL or you can connect to another system via ODBC. Asterisk also has API called the AMI (Asterisk Manager Interface).

It would not be very hard to set up a script (aka AGI)that will ask the users for say a PIN number. You can then record the time of the call, any information you ask of them (e.g. a PIN number), the number they called from etc. into a db. I have done such scripts before. If you know PHP or PERL it should not be hard to do. You can also do it directly from the dial plan.

Hi Dovid,

A few questions for you.

  1. What kind of hardware do we need to buy in order to have asterisk receive calls from regular phones? I checked the digium site, and I saw some “Analog Telephony Devices”. Are those the ones we need? And, how do we get a virtual phone number for workers to call in?

  2. We’re a Linux + Java + Oracle shop. As long as Asterisk allows us to connect to Oracle via ODBC, then we’re OK. Can we interface with Asterisk API via Java instead of Perl?

  3. Our organization is looking for a complete solution, that can include hardware, software, and technical support. The solution that we’re looking for needs to be able to handle hundreds of calls each day. Do you think the Asterisk Business Edition would be a better fit for our case? Do you suggest I should contact Digium for a quote?

  1. What kind of phones lines will you have ? Regular (aka POTS), T1, ISDN ? How many lines ?

  2. I believe you can connect to oracl over ODBC but I never tried it. You can connect to the AMI in any language that you want. You just need to send the proper scripts. As far as the AGI’s (aka Scripting) I do not know if you can use Java (if you want to have custom scripts that run out of your dialplan - This has no relation to the AMI).

  3. I don’t think there is any big advantage of ABE. It may be worth getting for the support side of it. From what I have seen if you know your Asterisk you are good to go. It may take you a bit to learn.

  1. Java works with the fast-agi protocol, see .


Marco Bruni

Thanks, mbruni. The Java site info is good.

Hey Dovid,

  1. Our workers call from residential areas, so the phone lines would be POTS. But, our office uses T1. We expect to have 2 - 3 lines.

  2. As long as we can get technical support from Digium, we can learn how to configure Asterisk to work with our situation.