setup an IVR with Asterisk - installation

I need to setup a simple IVR system for a friend's company that will let the caller navigate through the menu by pressing phone keys. Its kind of like a bus schedule.
for today's schedule press '1', for tomorrow's schedule press '2' and
so on.
It is solely an information system, i.e. no navigation route will end up with a real person but only audio messages will be played.
Now, I've never setup anything like this before and did a little digging on Google. Seems like I will be able to achieve this using Asterisk.
What else do I need hardware-wise?
Is a simple Linux server and a VOIP account with a provider in Germany sufficient?
Will a VPS handle the task?
How about multiple concurrent incoming calls?
Are those handled by Asterisk?

It's perfectly possible.
What you need to know:
Asterisk has some problems with H323. If your provider supplies SIP, ask them for SIP instead.
You may build a whole IVR on dial plans in your extensions.conf, but for complex tasks it's better to use AGI. These are Perl or Python or whatever language scripts that implement your IVR logic. Each AGI session spans a child process, use FastAGI and a network daemon if you expect frequent connections.
Multiple concurrent calls are not a problem, my installation of Asterisk on a simple PC handles hundreds sumultaneous calls.
The only things that may really affect performance are sound conversion and tone detection.
To improve performance, you should:
Stick to one codec (µLaw is that I use), force all SIP connections to use that codec, and preconvert all your sound files to it using sox -t ul. As soon as you've done it, all Asterisk operation amounts to reading the file bytes from disk and sending them over network with just basic wrapping. There are no math, nothing except simple read-wrap-send operations.
Ask your provider to detect tones on his side and send them to you out of band, using RFC 2833. Tone detection is quite a CPU consuming operation, let them do it theirselves.
I personally run Asterisk on a 2,66 MHz Celeron IV with 2048 MB RAM, under Fedora 10 X86_64. 150 connections at once work OK, there are no delays.
Overall traffic amounts to about 9.6 KByte/sec per connection. For a modern VPS there should be no problem at all.

Asterisk rocks. For a few lines a simple P3 or better will do. Don't virtualise the PBX; Asterisk relies on pretty accurate timing.
FreePBX makes it really easy to set up an IVR - got a decent web-based front end and supports some cool Asterisk tools out of the box.
EDIT: FreePBX isn't Asterisk - it is a pretty interface that generates the configs for you. Trixbox includes it by default if you want a simple point and shoot solution.
If your VoIP account supports multiple incoming lines then Asterisk will use them just fine. You also need sufficient Internet bandwidth and decent QoS. For more than one line on a business system I would insist on a dedicated connection so you don't experience dropouts when users are accessing the net.

The best way to build an IVR applications is to use VoiceXML designed by W3C.org (http://www.w3.org/TR/voicexml21/) . Asterisk does not come with VoiceXML browser but there are companies that provide that for Asterisk such as SoftSyl Technologies (http://www.softsyl.com).
Companies like Cisco and Avaya also provide VoiceXML browser but they are not for Asterisk.

If you're completely fresh, I would suggest studying FreeSWITCH instead of Asterisk. It's much better structured, and also comes with some pre-built examples, including an IVR menu, and the IVR syntax is pretty simple: http://wiki.freeswitch.org/wiki/IVR_Menu
I'm running a FreeSWITCH instance on a Xen virtual server, and it runs perfectly with multiple simultaneous calls.

IVR design in Asterisk is not difficult, but there is a bit of a "learning cliff" associated with getting your first Asterisk server up and running.
As stated by someone else, call quality is everything. Pay to have professional grade recordings done for your IVR prompts and your announcements. Ensure that you're using 64k codes such as uLaw and aLaw; GSM (cellphone) might be cheap on bandwith, but it breaks your customer expectations about quality.
I strongly suggest that you put the IVR into it's own dial plan context and then direct calls into it. That makes managing things like menu choices much easier. For each sub-set of options, use a different dial plan context.
Try and keep your menu "shallow". If it takes more than three menu options to get the information your customer is looking for, they are very likely to hang up, or just press "0" to talk to a human. That defeats the point of your IVR.
If you are going to do something fairly cool with database look-ups, or account authentication or the like, I'd recommend using an "AGI" - Asterisk Gateway Interface - application. My personal favorite is "Adhearsion", which blends well with Ruby/Rails on the DB/Web side.
If you need help or more info, let me know.

For more complex IVR's you can try Astive Toolkit, especially if you need databases or webservices iteration.

I've worked with IVR in the past but mainly with large systems and have never used Asterisk. I took a quick look at their website (http://www.asterisk.org/) though and it seems very informative, have you checked there?

Its not programing related but...
Take a look at trixbox.org, It supports configuration from cisco to... snom phones
Its Asterisk/Freepbx mod and everything under a nice ui!
i have a provider in australia added them as a gsm trunk, took 3hrs to setup 4phones. IVR is supported
The only problems would possibly being... voice quality of recording

Its quite simple. I'm using sipgate.de as provider for my asterisk.
you need to setup a dialplan.
this is also quite simple. take a look here.
you sould also take a look into the extensions.conf.
there a some samples inside.
the is also a sample which fits on your problem.
to connect to sipgate, take a look into their knowlogebase.
there are some samples for asterisk configuration.
sipgate is free, except you are doing outgoing calls.

You can do this in the dial plan...
[menu-main]
exten => s,1,Noop()
exten => s,n(msg),Background(ForTodayPress1TomorrPress2)
exten => s,1,Goto(menu-today)
exten => s,2,Goto(menu-tomorrow)
exten => i,1,Playback(invalid)
exten => i,n,Goto(msg)
exten => t,1,Goto(msg)
[menu-today]
etc...
[menu-tomorrow]
etc...
Or as someone else has suggested you can do it in any language that can write to stdin and read from stdout. The phpagi implementation is my particular favorite flavor. It might fit in to this example like so where the PHP is being run on a separate box so it does not effect the PBX under any kind of load.
[menu-main]
exten => s,1,Noop()
exten => s,n(msg),Background(ForTodayPress1TomorrPress2)
exten => s,1,Goto(menu-today,s,1)
exten => s,2,Goto(menu-tomorrow,s,1)
exten => i,1,Playback(invalid)
exten => i,n,Goto(msg)
exten => t,1,Goto(msg)
[menu-today]
exten => s,1,Noop()
exten => s,n,agi(http://myapache/agi/readschedule.php)
exten => s,n,Hangup()

If you want to setup an Asterisk IVR, you can also use some Drag and Drop web based tool in order to make simple auto-attendant (like in your example) or complex IVR (managing scripting or data base driven IVR).
One option is Cally Square. Have a look here:
http://www.callysquare.com/

Related

Performance logging/monitoring API/product

I'm not sure how to categorize this question, so let me just explain what I would like and hopefully it will make sense.
I'm after a product (with an API) which I can send different numbers to with tags, and it will take care of all the monitoring/logging stuff.
So for example, say I have a program that downloads a file from a website every 10 seconds. I would like to monitor how long each of these downloads is taking. It is quite easy in my application to time how long it takes. I would now like to send this number and tag (e.g., tag='download time', value = '1.234') to a 3rd party product. The 3rd party product will now store this value/tag for me. The product will have a website I can go to, and configure a bunch of things. So in this example, I could setup an alert like "if 'download time' > 5 send me an email". I could also visit a website, and view a graph of the logged values and maybe some random statistics (e.g., how often the value has been in the warning/error zone).
I think that's about it. Sure it wouldn't be too hard to do this myself, but I'm no web designer and it'd end up looking pretty ugly. The more user friendly this kind of product is the more willing users will be to look at the data and actually monitor stuff.
Does such a service exist?
EDIT: Products similar to this: http://dashboard.kpilibrary.com/. This is pretty much exactly what I was after, but am still searching around.
There are many monitoring tools out there. Nagios or RHQ (http://rhq-project.org/) come to mind. Most of the tools work a little different: rather than throwing stuff at them, they have plugins that actively go out and do something to do the measuring. In your example, the plugin would download the file and then report the measurement data to the central server, which can then show you graphs or run alerts on it.
On Windows, you can use this:
http://technet.microsoft.com/en-us/library/cc771692%28WS.10%29.aspx
(Windows Performance Monitor)
It pretty much does what you are looking for:
Passively collects performance data (E.g. CPU Usage)
Can be fed App specific performance metrics (E.g. download time)
Can alert you on various thresholds
Has a reporting interface for analyzing metrics
EDIT : http://technet.microsoft.com/en-us/library/cc749249.aspx , more documentation on this.
This answer is specific to Windows.
If you are looking to analyze events from various systems and you also what the opportunity to create your own events you should consider ETW.
The ETW system allows you to consume data events from any number of sub-systems. You can look at an exhaustive list of built in providers by running the following command:
logman query providers
The beauty of ETW is that you also have the opportunity to create your own providers and push your own data into the resulting report. This is a high-performance logging mechanism and is used by Windows itself for many performance investigations.
The resulting report will be an ETL file. This is a standard file that can be viewed using xPerf, ships with Windows SDK, or the build-in ETL analyzer, tracerpt.exe.

Personal Internet use monitoring

How could a (Windows) desktop application be created to monitor the amount of time spent on a particular website?
My first idea was to play with the Host file to intercept requests, log, and proxy. This feels a bit clunky; and I suspect my program would look like malware.
I feel like there is a smarter way? Any ideas?
There is a tool similar to what you are looking for called K-9 Web Protection. It is more used for parents to monitor what their kids are up to when hooked up to the internet. I have installed this for my niece's computer with good results and praises as it blocks, content filter, restrict internet times. This may be OTT for your needs but worth a shot as you can see what sites were visited.
The other, is to use a dedicated firewall monitoring solution such as IPCOP which is a Linux based distribution with a sole purpose in providing a proxy, stateful packet inspection (SPI) firewall, Intrusion Detection System (IDS).
Hope this helps,
Best regards,
Tom.
You could do this by monitoring active connections via netstat, or if you need more advanced data you can install The Windows Packet Capture Library and get any data about network use, and inside your desktop app, find network traffic that relates to 'spending time' on a website (which might just be GET requests for you, but I don't know), and record various statistics as required.
Route the traffic through a scriptable proxy and change the browser settings to point to that proxy.

is it reasonable to protect drm'd content client side

Update: this question is specifically about protecting (encipher / obfuscate) the content client side vs. doing it before transmission from the server. What are the pros / cons on going in an approach like itune's one - in which the files aren't ciphered / obfuscated before transmission.
As I added in my note in the original question, there are contracts in place that we need to comply to (as its the case for most services that implement drm). We push for drm free, and most content providers deals are on it, but that doesn't free us of obligations already in place.
I recently read some information regarding how itunes / fairplay approaches drm, and didn't expect to see the server actually serves the files without any protection.
The quote in this answer seems to capture the spirit of the issue.
The goal should simply be to "keep
honest people honest". If we go
further than this, only two things
happen:
We fight a battle we cannot win. Those who want to cheat will succeed.
We hurt the honest users of our product by making it more difficult to use.
I don't see any impact on the honest users in here, files would be tied to the user - regardless if this happens client or server side. This does gives another chance to those in 1.
An extra bit of info: client environment is adobe air, multiple content types involved (music, video, flash apps, images).
So, is it reasonable to do like itune's fairplay and protect the media client side.
Note: I think unbreakable DRM is an unsolvable problem and as most looking for an answer to this, the need for it relates to it already being in a contract with content providers ... in the likes of reasonable best effort.
I think you might be missing something here. Users hate, hate, hate, HATE DRM. That's why no media company ever gets any traction when they try to use it.
The kicker here is that the contract says "reasonable best effort", and I haven't the faintest idea of what that will mean in a court of law.
What you want to do is make your client happy with the DRM you put on. I don't know what your client thinks DRM is, can do, costs in resources, or if your client is actually aware that DRM can be really annoying. You would have to answer that. You can try to educate the client, but that could be seen as trying to explain away substandard work.
If the client is not happy, the next fallback position is to get paid without litigation, and for that to happen, the contract has to be reasonably clear. Unfortunately, "reasonable best effort" isn't clear, so you might wind up in court. You may be able to renegotiate parts of the contract in the client's favor, or you may not.
If all else fails, you hope to win the court case.
I am not a lawyer, and this is not legal advice. I do see this as more of a question of expectations and possible legal interpretation than a technical question. I don't think we can help you here. You should consult with a lawyer who specializes in this sort of thing, and I don't even know what speciality to recommend. If you're in the US, call your local Bar Association and ask for a referral.
I don't see any impact on the honest users in here, files would be tied to the user - regardless if this happens client or server side. This does gives another chance to those in 1.
Files being tied to the user requires some method of verifying that there is a user. What happens when your verification server goes down (or is discontinued, as Wal-Mart did)?
There is no level of DRM that doesn't affect at least some "honest users".
Data can be copied
As long as client hardware, standalone, can not distinguish between a "good" and a "bad" copy, you will end up limiting all general copies, and copy mechanisms. Most DRM companies deal with this fact by a telling me how much this technology sets me free. Almost as if people would start to believe when they hear the same thing often enough...
Code can't be protected on the client. Protecting code on the server is a largely solved problem. Protecting code on the client isn't. All current approaches come with stingy restrictions.
Impact works in subtle ways. At the very least, you have the additional cost of implementing client-side-DRM (and all follow-up cost, including the horde of "DMCA"-shouting lawyer gorillas) It is hard to prove that you will offset this cost with the increased revenue.
It's not just about code and crypto. Once you implement client-side DRM, you unleash a chain of events in Marketing, Public Relations and Legal. A long as they don't stop to alienate users, you don't need to bother.
To answer the question "is it reasonable", you have to be clear when you use the word "protect" what you're trying to protect against...
For example, are you trying to:
authorized users from using their downloaded content via your app under certain circumstances (e.g. rental period expiry, copied to a different computer, etc)?
authorized users from using their downloaded content via any app under certain circumstances (e.g. rental period expiry, copied to a different computer, etc)?
unauthorized users from using content received from authorized users via your app?
unauthorized users from using content received from authorized users via any app?
known users from accessing unpurchased/unauthorized content from the media library on your server via your app?
known users from accessing unpurchased/unauthorized content from the media library on your server via any app?
unknown users from accessing the media library on your server via your app?
unknown users from accessing the media library on your server via any app?
etc...
"Any app" in the above can include things like:
other player programs designed to interoperate/cooperate with your site (e.g. for flickr)
programs designed to convert content to other formats, possibly non-DRM formats
hostile programs designed to
From the article you linked, you can start to see some of the possible limitations of applying the DRM client-side...
The third, originally used in PyMusique, a Linux client for the iTunes Store, pretends to be iTunes. It requested songs from Apple's servers and then downloaded the purchased songs without locking them, as iTunes would.
The fourth, used in FairKeys, also pretends to be iTunes; it requests a user's keys from Apple's servers and then uses these keys to unlock existing purchased songs.
Neither of these approaches required breaking the DRM being applied, or even hacking any of the products involved; they could be done simply by passively observing the protocols involved, and then imitating them.
So the question becomes: are you trying to protect against these kinds of attack?
If yes, then client-applied DRM is not reasonable.
If no (for example, you're only concerned about people using your app, like Apple/iTunes does), then it might be.
(repeat this process for every situation you can think of. If the adig nswer is always either "client-applied DRM will protect me" or "I'm not trying to protect against this situation", then using client-applied DRM is resonable.)
Note that for the last four of my examples, while DRM would protect against those situations as a side-effect, it's not the best place to enforce those restrictions. Those kinds of restrictions are best applied on the server in the login/authorization process.
If the server serves the content without protection, it's because the encryption is per-client.
That being said, wireshark will foil your best-laid plans.
Encryption alone is usually just as good as sending a boolean telling you if you're allowed to use the content, since the bypass is usually just changing the input/output to one encryption API call...
You want to use heavy binary obfuscation on the client side if you want the protection to literally hold for more than 5 minutes. Using decryption on the client side, make sure the data cannot be replayed and that the only way to bypass the system is to reverse engineer the entire binary protection scheme. Properly done, this will stop all the kids.
On another note, if this is a product to be run on an operating system, don't use processor specific or operating system specific anomalies such as the Windows PEB/TEB/syscalls and processor bugs, those will only make the program even less portable than DRM already is.
Oh and to answer the question title: No. It's a waste of time and money, and will make your product not work on my hardened Linux system.

Ajax instant messaging (web-based)

Just wondering: Would it be acceptable to start some simple Ajax instant messaging (web-based) for a large social network service (considering thousands of registered users)? I am new to this, so I'm just wondering. What if to check for a new message every two or three seconds?
Edited: Could a plain shared server handle so many requests every so often? And yes, I would roll my own program.
There're many web im client based on standard XMPP protocol. You could try iJab or JWChat.
It doesn't make sense to write your own, unless you have some unique requirements, but whether the server can handle this largely depends on the server language and webserver setup, as to how well it scales.
You will need to do some heavy load testing, to ensure that the high load that is expected will work, as your traffic will be very heavy. For example, if your social networking site is soccer related, then during the World Cup you may expect to see more traffic than Wed mornings.
If you asked the question with:
I want to use language X.
I want to use webserver Y.
I am using this framework for the
webservice.
I would like to accept voice
recordings and webcam recordings
over IM, as well as text.
How well will this scale on my one 1GHz server?
If you manage to make a peer-to-peer (P2P) browser-embedded chat, than even a shared hosting will do for dozens of thousands of simultaneous users :) :)

Free streaming server for Voip server

I need an open-source application which streams on demand (RTSP?) the prerecorded files. It should support all major codecs (G.711,g729...), and must be reasonably efficient.
Up until now Ive found only VLAN player suitable for this task. Any advice?
Well, I have an asterisk machine with all major codecs. Get g729/g723 on: asterisk.hosting.lv. Don't forget that in some countries it is illegal to use g729/g723 without paying for them.
Anyway back to your question. In your Asterisk dial plan you could playback the prerecorded file like:
exten => _X.,1,Answer()
exten => _X.,n,Playback(/path/to/file)
exten => _X.,n,Hangup()
When I make a call going to that context I get to hear the file. Is that what it is you want to do?
Also have a look on voip-info.org. There is lots of knowledge there.
edit:
Also note that asterisk has a MusicOnHold diaplan utility which you can use to stream FM-radio streams. You might want to have a look on a blog post I wrote last year. So in a sense you could have VLAN player or something else to act as a streaming server and use asterisk to VoIP it.
mediastremer2 sdk was good enough for me.
But live555 media server did the job as simple RTSP servers
You can try SIPp. Version 3.4 onward supports RTP streaming for PCMA, PCMU and G729. You can enable G723 codec in the source as well.
We have used rtpplay to send audio files to a specified ip/port. That's at least a good place to start

Resources