pycall is simple, flexible python library for creating and using Asterisk call files. It is production ready, and in use on hundreds of servers. Its aim is to provide an extremely easy-to-use API for making phone calls and developing telephony applications.
Why should I use pycall? Among other things, pycall is
simple
pycall uses standard Asterisk call file syntax, and doesn’t add anything special. It assumes no defaults (other than what Asterisk has already done), and adds nothing extra. This is important, because if you know anything about Asterisk call files, then you already know how to use pycall. Our goal is to keep it simple.
object oriented
pycall provides nothing more than an object wrapper for Asterisk call files. And it does it well. This is helpful because it lets you organize and store call files logically in memory. For example, say you are making a wake-up call program which lets multiple hotel guests schedule wake-up calls at certain times. Obviously, you wouldn’t want to design one massive application to keep track of all the times. You’d want to break it up into something easier to work with. pycall lets you do that with CallFile() objects. A good example of how this can be useful is the wake-up program. You could create a single CallFile() object for each guest at the hotel, and this way, you can easily track and manage guests and their wake-up times!
environmentally friendly
Although pycall can't help fix the hole in the ozone layer, it can make it easy for you to integrate into almost any environment. A typical problem a lot of Asterisk coders bump into when working with call files are permissions. For example, let’s say Asterisk runs as the user ‘asterisk’ (this is very common on Asterisk-based PBX systems). This is great because asterisk is limited in what it can do and what it has access to on the system (makes it more secure), but bad in a sense because your code will most likely NOT be running as the asterisk user. It will probably run as ‘tom’, ‘dev’, or something else. This causes a problem, obviously, because when you send call files to Asterisk (move them to the /var/spool/asterisk/outgoing/ directory) Asterisk won’t be able to read them.
To help fix environmental problems, pycall gracefully handles spooling call files by allowing you to choose which user to pass the call file off as, as well as where to spool it. This way, even if your Asterisk environment has a spool directory located at /root/spool/ you can get your program working without any troubles.
secure
pycall goes out of its way to ensure that call files are allocated temporary file space by the target operating system, and created in a secure manner (with read permissions only available to the user who is running your program). This is a much more elgant solution than the typical create-a-temporary-file-in-the-current-directory-then-move-it-to-the-spooling-directory approach. Furthermore, since pycall gets space directly from the operating system, even if you are running your program in an extremely restricted environment, you are always guaranteed to have your call files work.
pycall ensures that all files are written randomly to a 'secure, guaranteed writable file-system location for temporary files', thereby reducing your need to create / name / move / delete call files manually. pycall will take care of everything.
efficient
pycall is efficient. It’ll only create the files when you need them, take care of the clean-up, and ensure that no funny files are left hanging around on your system. It writes files securely and ensures that they are as random as possible.
thoughtless
pycall tries to make call file creation and management thoughtless. Why spend a bunch of time worrying about something so simple? This is the main goal of pycall, to make it as easy as humanly possible for other programmers to use call files in their programs.
thread safe
pycall is thread safe. Feel free to use it in as many concurrent threads as you like! As a matter of fact, we encourage you to. Call file generation is an excellent way to test load on Asterisk servers, and doing it in a multi-threaded environment can really push your system to the limits.
well documented
This website contains a vast amount of documentation that covers every aspect of using pycall from installation, to tutorials, to detailed API documentation, to numerous real-world examples. pycall also has a fairly active IRC community (see the help page for more information) to help you if you get stuck!
pycall