[asterisk-scf-commits] asterisk-scf/examples.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Jun 24 11:16:34 CDT 2011


branch "master" has been updated
       via  6baae00265c8b26c8d6b51b60a21f8cc06390741 (commit)
      from  046cd0f7e7d692991f9e99fd048575f5f23b34a5 (commit)

Summary of changes:
 Bridge_SessionListener.py |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)


- Log -----------------------------------------------------------------
commit 6baae00265c8b26c8d6b51b60a21f8cc06390741
Author: Mark Michelson <mmichelson at digium.com>
Date:   Fri Jun 24 11:16:17 2011 -0500

    Make names of identifiers more clear.

diff --git a/Bridge_SessionListener.py b/Bridge_SessionListener.py
index d6f540d..6dc890d 100755
--- a/Bridge_SessionListener.py
+++ b/Bridge_SessionListener.py
@@ -22,9 +22,9 @@ Ice.loadSlice("-I" + Ice.getSliceDir() + " -I" + os.environ["ASTSCF_HOME"] + " -
 
 import AsteriskSCF.SessionCommunications.V1
 
-SListenerID = "SListener"
+SessionListenerID = "SessionListener"
 
-class SListener(AsteriskSCF.SessionCommunications.V1.SessionListener):
+class SessionListener(AsteriskSCF.SessionCommunications.V1.SessionListener):
     def __init__(self, adapter):
         self.adapter = adapter
     def indicated(self, source, event, cookies, current = None):
@@ -55,19 +55,19 @@ class SListener(AsteriskSCF.SessionCommunications.V1.SessionListener):
         if isinstance(event, AsteriskSCF.SessionCommunications.V1.ProgressIndication):
             print "Session %s received Progress indication: %d" % (source.ice_getIdentity().name, event.response.isdnCode)
 
-BListenerID = "BListener"
+BridgeListenerID = "BridgeListener"
 
-class BListener(AsteriskSCF.SessionCommunications.V1.BridgeListener):
+class BridgeListener(AsteriskSCF.SessionCommunications.V1.BridgeListener):
     def __init__(self, adapter):
         self.adapter = adapter
     def sessionsAdded(self, sessionBridge, sessions, current = None):
         print "Sessions added to bridge %s" % (sessionBridge.ice_getIdentity().name)
         for s in sessions:
             try:
-                s.addListener(AsteriskSCF.SessionCommunications.V1.SessionListenerPrx.uncheckedCast(self.adapter.createDirectProxy(self.adapter.getCommunicator().stringToIdentity(SListenerID))))
+                s.addListener(AsteriskSCF.SessionCommunications.V1.SessionListenerPrx.uncheckedCast(self.adapter.createDirectProxy(self.adapter.getCommunicator().stringToIdentity(SessionListenerID))))
                 print "Added ourselves as a listener to session %s with endpoint %s" % (s.ice_getIdentity().name, s.getEndpoint().getId())
             except Ice.Exception as ex:
-                pritn "Exception caught while attempting to add ourselves as a SessionListener: " + ex.what()
+                print "Exception caught while attempting to add ourselves as a SessionListener: " + ex.what()
     def sessionsRemoved(self, sessionBridge, sessions, current = None):
         print "Sessions removed from bridge %s" % (sessionBridge.ice_getIdentity().name)
     def stopped(self, sessionBridge, current = None):
@@ -75,9 +75,9 @@ class BListener(AsteriskSCF.SessionCommunications.V1.BridgeListener):
     def stopping(self, sessionBridge, current = None):
         print "Bridge %s stopping" % (sessionBridge.ice_getIdentity().name)
 
-BMListenerID = "BMListener"
+BridgeManagerListenerID = "BridgeManagerListener"
 
-class BMListener(AsteriskSCF.SessionCommunications.V1.BridgeManagerListener):
+class BridgeManagerListener(AsteriskSCF.SessionCommunications.V1.BridgeManagerListener):
     def __init__(self, adapter):
         self.adapter = adapter
     def bridgeCreated(self, manager, newBridge, current = None):
@@ -86,7 +86,7 @@ class BMListener(AsteriskSCF.SessionCommunications.V1.BridgeManagerListener):
         print "Bridge Manager has stopped"
     def stopping(self, manager, current = None):
         print "Bridge Manager is stopping"
-        self.adapter.remove(self.communicator().stringToIdentity(BMListenerId))
+        self.adapter.remove(self.communicator().stringToIdentity(BridgeManagerListenerId))
 
 class ListenerApp(Ice.Application):
     def run(self, args):
@@ -97,9 +97,9 @@ class ListenerApp(Ice.Application):
         # Now we add instances of our listeners to the object adapter. This will allow
         # us to create proxies to the objects when we want to add ourselves as a listener
         # to sessions, bridges, etc.
-        adapter.add(BMListener(adapter), self.communicator().stringToIdentity(BMListenerID))
-        adapter.add(BListener(adapter), self.communicator().stringToIdentity(BListenerID))
-        adapter.add(SListener(adapter), self.communicator().stringToIdentity(SListenerID))
+        adapter.add(BridgeManagerListener(adapter), self.communicator().stringToIdentity(BridgeManagerListenerID))
+        adapter.add(BridgeListener(adapter), self.communicator().stringToIdentity(BridgeListenerID))
+        adapter.add(SessionListener(adapter), self.communicator().stringToIdentity(SessionListenerID))
 
         adapter.activate()
 
@@ -124,17 +124,17 @@ class ListenerApp(Ice.Application):
         self.bridgeManager = AsteriskSCF.SessionCommunications.V1.BridgeManagerPrx.checkedCast(service)
 
         # We add ourselves as a listener to the bridge manager.
-        self.BMListenerPrx = AsteriskSCF.SessionCommunications.V1.BridgeManagerListenerPrx.uncheckedCast(adapter.createDirectProxy(self.communicator().stringToIdentity(BMListenerID)))
+        self.BridgeManagerListenerPrx = AsteriskSCF.SessionCommunications.V1.BridgeManagerListenerPrx.uncheckedCast(adapter.createDirectProxy(self.communicator().stringToIdentity(BridgeManagerListenerID)))
         try:
-            self.bridgeManager.addListener(self.BMListenerPrx)
+            self.bridgeManager.addListener(self.BridgeManagerListenerPrx)
         except Ice.Exception as ex:
             print "Exception while attempting to add ourselves as a BridgeManagerListener: " + ex.what()
 
         # We also add ourselves as a default bridge listener. This means that we will automatically
         # have ourselves added as a listener to any bridge that gets created.
-        self.BListenerPrx = AsteriskSCF.SessionCommunications.V1.BridgeListenerPrx.uncheckedCast(adapter.createDirectProxy(self.communicator().stringToIdentity(BListenerID)))
+        self.BridgeListenerPrx = AsteriskSCF.SessionCommunications.V1.BridgeListenerPrx.uncheckedCast(adapter.createDirectProxy(self.communicator().stringToIdentity(BridgeListenerID)))
         try:
-            self.bridgeManager.addDefaultBridgeListener(self.BListenerPrx)
+            self.bridgeManager.addDefaultBridgeListener(self.BridgeListenerPrx)
         except Ice.Exception as ex:
             print "Exception while attempting to add ourselves as a DefaultBridgeListener: " + ex.what()
 
@@ -152,13 +152,13 @@ class ListenerApp(Ice.Application):
     def interruptCallback(self, sig):
         print "Removing ourself as a default bridge listener"
         try:
-            self.bridgeManager.removeDefaultBridgeListener(self.BListenerPrx)
+            self.bridgeManager.removeDefaultBridgeListener(self.BridgeListenerPrx)
         except Ice.Exception as ex:
             print "Error trying to remove ourselves as a default bridge listener: " + ex.what()
 
         print "Removing ourself as a bridge manager listener"
         try:
-            self.bridgeManager.removeListener(self.BMListenerPrx)
+            self.bridgeManager.removeListener(self.BridgeManagerListenerPrx)
         except Ice.Exception as ex:
             print "Error tryint to remove ourselves as a bridge manager listener: " + ex.what()
 

-----------------------------------------------------------------------


-- 
asterisk-scf/examples.git



More information about the asterisk-scf-commits mailing list