This page contains a list of all official pycall documentation. It lists exactly what features pycall provides you.
classes
pycall contains a single class, CallFile. To use the CallFile class, it must be imported from pycall.callfile:
from pycall.callfile import CallFile
The fields that CallFile contains can be specified when a CallFile object is created, or at any other time. Fields listed in bold may be required.
The type of trunk to use (SIP / Local / DAHDI / etc.) When pycall generates the actual call file, this will show up in the The name of the trunk to use (flowroute, g0, etc.) When pycall generates the actual call file, this will show up in the The number we are going to call. Must be presented as it should be dialed, you cannot rely on the PBX rules to format it correctly. The textual name to show on caller ID (if your provider supports it). The numerical caller ID to show (if your provider supports it). The maximum amount of times to retry the call if it is not answered. Default is 0. The amount of seconds between retry attempts. Default is 300 (5 minutes). The amount of seconds to ring the number while waiting for an answer. Default is 45. The account code associated with the call. Account codes are used in Asterisk CDR logs. The context to go to once the call has been answered. Standard Asterisk dial plan references contexts in this form: The extension to go to once the call has been answered. Standard Asterisk dial plan references extensions in this form: The priority to go to once the call has been answered. Standard Asterisk dial plan references priorities in this form: The dial plan application to run once the call has been answered. Standard Asterisk dial plan references applications (actions) in this form: The options to be passed to the application. Standard Asterisk dial plan references data in this form: A python dictionary containing any channel variables that should be set, and their values. If the file's modification time is in the future, the call will not be deleted. Can be either Move the completed call file to the sub-spooling directory Can be either The user to schedule the call file as. If none is specified, then the user who is running the script will own the call file. The temporary directory where the call file will be generated before finally being moved to the Asterisk spooling directory. The default location is determined by your host operating system (usually /tmp/). It is generally recommended that this directory be on the same filesystem as the spooling directory.
trunk_type
Channel directive.Channel directive.[context].exten => extension,priority,action.exten => extension,priority,action.exten => extension,priority,action.exten => extension,priority,action(data).True or False.outgoing_done and append a new line reading Status: value, where value is Completed, Expired, or Failed.True or False.
Note that either context, extension, and priority must be specified -- OR application and data, but not both.
functions
The CallFile class provides a single function:
CallFile.run([time])
Create an actual call file and schedule it with Asterisk. The call file is generated based on the parameters specified in the CallFile object. If time is specified, the call file will be created, and its access time will be set to time. This way, Asterisk will not execute the call file until the the designated time is reached.
This function may raise exceptions (specified below).
exceptions
pycall includes its own exceptions which may be raised when calling the function, run. To use any of the exceptions below, they must be imported from pycall.callfileexceptions:
from pycall.callfileexceptions import NoTrunkTypeDefined
The exceptions are:
This exception is raised if there is no This exception is raised if there is no This exception is raised if there is no This exception is raised if there is no action defined. In order to successfully generate a call file, either This exception is raised if the function This exception is raised if your script does not have permission to move the call file to the Asterisk spooling directory. This exception is raised if the This exception is raised if the
NoTrunkTypeDefined
trunk_type field defined.trunk_name field defined.number field defined.context, extension, and priority must be specified, or application and data must be specified.run is called with the optional parameter time, and time is not a valid datetime object.user field is specified, but your script does not have permission to change ownership of the generated call file to the specified user.user field is specified, but the user specified does not exist on the system.
If you would like to see code examples demonstrating pycall usage, you can visit the examples page.
pycall