[asterisk-scf-commits] asterisk-scf/examples.git branch "decorator" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Thu Jun 30 10:10:11 CDT 2011
branch "decorator" has been updated
via 2bf8c5517e9b8502c4d8a078909ee8b7a724ef5e (commit)
via 57bf1f01c9cf422825c63ca34136834f28128561 (commit)
from 44084ae72a6535ca26c1ede98c8a26fb7647a309 (commit)
Summary of changes:
Session_Decorator.py | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
- Log -----------------------------------------------------------------
commit 2bf8c5517e9b8502c4d8a078909ee8b7a724ef5e
Author: Mark Michelson <mmichelson at digium.com>
Date: Thu Jun 30 10:10:09 2011 -0500
Print the identity of the proxy to return.
diff --git a/Session_Decorator.py b/Session_Decorator.py
index 1c96b97..c61b62f 100755
--- a/Session_Decorator.py
+++ b/Session_Decorator.py
@@ -137,7 +137,7 @@ class SessionDecoratorHook(AsteriskSCF.SessionCommunications.ExtensionPoints.V1.
decorator.setProxy(decoratorObjPrx.ice_getIdentity())
print "I am the god of hellfire and I bring you fire"
result = AsteriskSCF.System.Hook.V1.HookResult(AsteriskSCF.System.Hook.V1.HookStatus.Succeeded, "cool")
- print "I'll take you to burn"
+ print "The proxy we're going to send to AsteriskSCF is " + decoratorObjPrx.ice_getIdentity().name
return (result, AsteriskSCF.SessionCommunications.V1.SessionPrx.uncheckedCast(decoratorObjPrx))
class DecoratorApp(Ice.Application):
commit 57bf1f01c9cf422825c63ca34136834f28128561
Author: Mark Michelson <mmichelson at digium.com>
Date: Wed Jun 29 17:25:05 2011 -0500
Fix bugs and make things work a tad better.
diff --git a/Session_Decorator.py b/Session_Decorator.py
index 8174253..1c96b97 100755
--- a/Session_Decorator.py
+++ b/Session_Decorator.py
@@ -37,7 +37,7 @@ class SessionDecorator(AsteriskSCF.SessionCommunications.V1.Session):
def __init__(self, session, adapter):
self.session = session
self.adapter = adapter
- self.sessionPrxID = None
+ self.sessionPrxID = None;
self.cookies = []
def __del__(self):
@@ -51,6 +51,7 @@ class SessionDecorator(AsteriskSCF.SessionCommunications.V1.Session):
print "setProxy"
self.sessionPrxID = sessionPrxID
+
def addListener(self, listener, current = None):
print "addListener"
return self.session.addListener(listener)
@@ -131,8 +132,13 @@ class SessionDecoratorHook(AsteriskSCF.SessionCommunications.ExtensionPoints.V1.
self.adapter = adapter
def decorateSession(self, realSession, current = None):
# XXX When is it appropriate to remove the decorator from the adapter?
- decoratorObjPrx = self.adapter.addWithUUID(SessionDecorator(realSession))
- return AsteriskSCF.SessionCommunications.V1.SessionPrx.uncheckedCast(decoratorObjPrx)
+ decorator = SessionDecorator(realSession, self.adapter)
+ decoratorObjPrx = self.adapter.addWithUUID(decorator)
+ decorator.setProxy(decoratorObjPrx.ice_getIdentity())
+ print "I am the god of hellfire and I bring you fire"
+ result = AsteriskSCF.System.Hook.V1.HookResult(AsteriskSCF.System.Hook.V1.HookStatus.Succeeded, "cool")
+ print "I'll take you to burn"
+ return (result, AsteriskSCF.SessionCommunications.V1.SessionPrx.uncheckedCast(decoratorObjPrx))
class DecoratorApp(Ice.Application):
def usage(self):
@@ -184,7 +190,7 @@ class DecoratorApp(Ice.Application):
print "Activated our object adapter"
locatorObj = self.communicator().stringToProxy(serviceLocatorString)
- locator = AsteriskSCF.Core.Discovery.V1.ServiceLocatorManagementPrx.checkedCast(locatorObj)
+ locator = AsteriskSCF.Core.Discovery.V1.ServiceLocatorPrx.checkedCast(locatorObj)
if not locator:
print "Couldn't get the service locator"
@@ -193,7 +199,12 @@ class DecoratorApp(Ice.Application):
# XXX Once changes have been merged for Service discovery to use names without registering a custom
# comparator, we'll actually use the passed-in decoratorName here.
params = AsteriskSCF.Core.Discovery.V1.ServiceLocatorParams(AsteriskSCF.SessionCommunications.ExtensionPoints.V1.SessionDecoratorLocatorCategory)
- extensionPointObj = locator.locate(params)
+ try:
+ extensionPointObj = locator.locate(params)
+ except AsteriskSCF.Core.Discovery.V1.ServiceNotFound:
+ print "No session decorator service found"
+ return -1
+
self.extensionPoint = AsteriskSCF.SessionCommunications.ExtensionPoints.V1.SessionDecoratorExtensionPointPrx.checkedCast(extensionPointObj)
if not self.extensionPoint:
@@ -218,11 +229,11 @@ class DecoratorApp(Ice.Application):
# currently set up as listeners on and remove ourselves as listeners.
# For the sake of clarity and efficiency, we simply remove ourselves
# as a default bridge listener and a bridge manager listener.
- print "Removing ourself as a default bridge listener"
+ print "Removing ourself as a session decorator"
try:
self.extensionPoint.removeDecorator(self.hookPrx)
except Ice.Exception as ex:
- print "Error trying to remove decorator: " + ex.what()
+ print "Error trying to remove decorator"
Ice.Application._destroyOnInterruptCallback(sig)
-----------------------------------------------------------------------
--
asterisk-scf/examples.git
More information about the asterisk-scf-commits
mailing list