def __init__(self, dialogClass=None): """ Takes a Dialog Class and passes it to a mobilIVR.node, for eventual use by an IncomingCallerIDQueue class when making outgoing calls to a queued caller-ID. @param dialogClass: A class that has a run method with one parameter to receive a mobilIVR.ivr.fastagi.IVRInterface for call interaction. @raises CallBackHandlerError: If the dialog class doesn't have a run method """ if hasattr(dialogClass, "run"): self._dialogClass = dialogClass node = setupNode() node.runApplication(IncomingCallerIDQueue(self._dialogClass)) twisted.internet.reactor.run() cleanup() else: raise CallBackHandlerError("dialog class doesn't have a run method")
def __init__(self, dialogClass=None): """ Takes a Dialog Class and passes it to a mobilIVR.node for eventual use by an IVRHandler class once an incoming call is received. @param dialogClass: A class that has a run method with one parameter to receive a mobilIVR.ivr.fastagi.IVRInterface for call interaction. @raises IncomingCallHandlerException: If the dialog class doesn't have a run method """ if hasattr(dialogClass, "run"): self._dialogClass = dialogClass node = setupNode() node.runApplication(IVRHandler, [self._dialogClass]) twisted.internet.reactor.run() cleanup() else: raise IncomingCallHandlerError("dialog class doesn't have a run method")
import mobilIVR.application from mobilIVR.sms import SMSSender class HelloWorldSMS(mobilIVR.application.Application): """ Example of how to send an SMS. This MobilIVR application sends an SMS, and exits. """ def run(self, node): sms = SMSSender(node) # blocking resource-gathering call print 'finding an available outgoing SMS resource' sms.getResource() print 'resource found; sending message' sms.sendMessage('hello world', '1234567') print 'sms sent, terminating application and node' node.shutdown() if __name__ == '__main__': # Set up our local node node = setupNode() # Publish our test application node.runApplication(HelloWorldSMS()) # Start everything, and clean up afterwards if necessary twisted.internet.reactor.run() cleanup()