starpy.utilapplication
index
/usr/lib/python2.5/site-packages/starpy/utilapplication.py

Class providing utility applications with common support code

 
Modules
       
basicproperty.basic
basicproperty.common
twisted.internet.defer
starpy.fastagi
logging
starpy.manager
os
basicproperty.propertied
basicproperty.weak

 
Classes
       
Propertied(object)
AGISpecifier
AMISpecifier
UtilApplication

 
class AGISpecifier(Propertied)
    Specifier of where we send the user to connect to our AGI
 
 
Method resolution order:
AGISpecifier
Propertied
object

Methods defined here:
run(self, mainFunction)
Start up the AGI server with the given mainFunction

Data descriptors defined here:
context
Asterisk context to which to connect incoming calls
interface
IP interface on which to listen (local only by default)
port
IP port on which to listen

Methods inherited from Propertied:
__init__(self, *arguments, **namedarguments)
Propertied object initialisation, allows passing in initial values for properties by name
__str__(self)
Get a friendly representation of the object
clone(self, **newValues)
Clone this object, with optional new property values
 
This method calls the __init__ method of your class with
the current property values of your class.  Providing newValues
(a dictionary) overrides property settings with new values.
getCloneProperties(self)
Get properties dictionary (key:value) for use in cloning of the instance
 
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
toString(self, indentation='', alreadyDone=None, indentString=' ')
Get a nicely formatted representation of this object
 
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
 
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
 
XXX Needs a far better API, likely a stand-alone class
        without the automatic inheritance problems here :(

Class methods inherited from Propertied:
getProperties(cls) from type
Get the BasicProperty properties for a particular object's class

Data descriptors inherited from Propertied:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class AMISpecifier(Propertied)
    Manager interface setup/specifier
 
 
Method resolution order:
AMISpecifier
Propertied
object

Methods defined here:
login(self)
Login to the specified manager via the AMI

Data descriptors defined here:
password
Login secret for the manager interface
port
Server IP port to which to connect
secret
Login secret for the manager interface
server
Server IP address to which to connect
timeout
Timeout in seconds for an AMI connection timeout
username
Login username for the manager interface

Methods inherited from Propertied:
__init__(self, *arguments, **namedarguments)
Propertied object initialisation, allows passing in initial values for properties by name
__str__(self)
Get a friendly representation of the object
clone(self, **newValues)
Clone this object, with optional new property values
 
This method calls the __init__ method of your class with
the current property values of your class.  Providing newValues
(a dictionary) overrides property settings with new values.
getCloneProperties(self)
Get properties dictionary (key:value) for use in cloning of the instance
 
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
toString(self, indentation='', alreadyDone=None, indentString=' ')
Get a nicely formatted representation of this object
 
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
 
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
 
XXX Needs a far better API, likely a stand-alone class
        without the automatic inheritance problems here :(

Class methods inherited from Propertied:
getProperties(cls) from type
Get the BasicProperty properties for a particular object's class

Data descriptors inherited from Propertied:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class UtilApplication(Propertied)
    Utility class providing simple application-level operations
 
FastAGI entry points are waitForCallOn and handleCallsFor, which allow
for one-shot and permanant handling of calls for an extension 
(respectively), and agiSpecifier, which is loaded from configuration file 
(as specified in self.configFiles).
 
 
Method resolution order:
UtilApplication
Propertied
object

Methods defined here:
__init__(self)
Initialise the application from options in configFile
dispatchIncomingCall(self, agi)
Handle an incoming call (dispatch to the appropriate registered handler)
handleCallsFor(self, extension, callback)
Register permanant handler for given extension
 
extension -- string extension for which to wait or None to define 
        a default handler (that chosen if there is not explicit handler 
        or waiter)
callback -- callback function to be called for each incoming channel
        to the given extension.
 
Note that waiting callback overrides any registered handler; that is,
if you register one callback with waitForCallOn and another with 
handleCallsFor, the first incoming call will trigger the waitForCallOn
handler.
 
returns None
loadConfigurations(self)
waitForCallOn(self, extension, timeout=15)
Wait for an AGI call on extension given
 
extension -- string extension for which to wait 
timeout -- duration in seconds to wait before defer.TimeoutError is 
        returned to the deferred.
 
Note that waiting callback overrides any registered handler; that is,
if you register one callback with waitForCallOn and another with 
handleCallsFor, the first incoming call will trigger the waitForCallOn
handler.
 
returns deferred returning connected FastAGIProtocol or an error

Data descriptors defined here:
agiSpecifier
FastAGI server specifier for the application see AGISpecifier
amiSpecifier
AMI connection specifier for the application see AMISpecifier
extensionHandlers
Set of permanant callbacks waiting for incoming extensions
extensionWaiters
Set of deferreds waiting for incoming extensions

Data and other attributes defined here:
configFiles = ('starpy.conf', '~/.starpy.conf')

Methods inherited from Propertied:
__str__(self)
Get a friendly representation of the object
clone(self, **newValues)
Clone this object, with optional new property values
 
This method calls the __init__ method of your class with
the current property values of your class.  Providing newValues
(a dictionary) overrides property settings with new values.
getCloneProperties(self)
Get properties dictionary (key:value) for use in cloning of the instance
 
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
toString(self, indentation='', alreadyDone=None, indentString=' ')
Get a nicely formatted representation of this object
 
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
 
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
 
XXX Needs a far better API, likely a stand-alone class
        without the automatic inheritance problems here :(

Class methods inherited from Propertied:
getProperties(cls) from type
Get the BasicProperty properties for a particular object's class

Data descriptors inherited from Propertied:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Data
        reactor = <twisted.internet.selectreactor.SelectReactor object at 0x83fdd0c>