[asterisk-scf-commits] asterisk-scf/release/sip.git branch "ami" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon Jan 3 20:15:07 UTC 2011
branch "ami" has been updated
via 2c23158b5f9480270b1dcfa7f44f7d73abc255f2 (commit)
from 7ef7882aa2d9a601b84d3a8650ad780ce5af7218 (commit)
Summary of changes:
src/PJSipSessionModule.cpp | 52 +++++++++++++++----------------------------
1 files changed, 18 insertions(+), 34 deletions(-)
- Log -----------------------------------------------------------------
commit 2c23158b5f9480270b1dcfa7f44f7d73abc255f2
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Jan 3 14:21:42 2011 -0600
Combine various session listener callback classes into a single one.
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 1be5376..22fd4b5 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -33,6 +33,12 @@ using namespace AsteriskSCF::System::Logging;
namespace
{
Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.SipSessionManager");
+
+//Constants used for AMI callback class construction when calling
+//SessionListenerPrx methods.
+const std::string ringingCallbackName("ringing");
+const std::string progressingCallbackName("progressing");
+const std::string connectedCallbackName("connected");
}
namespace AsteriskSCF
@@ -150,41 +156,19 @@ private:
typedef IceUtil::Handle<ConnectBridgedSessionsWithDestinationCallback> ConnectBridgedSessionsWithDestinationCallbackPtr;
-class RingingCallback : public IceUtil::Shared
-{
-public:
- RingingCallback() {}
- void failure(const Ice::Exception &ex)
- {
- lg(Error) << "Ice exception when attempting to relate ringing state: " << ex.what() << std::endl;
- }
-};
-
-typedef IceUtil::Handle<RingingCallback> RingingCallbackPtr;
-
-class ProgressingCallback : public IceUtil::Shared
+class ListenerCallback : public IceUtil::Shared
{
public:
- ProgressingCallback() {}
+ ListenerCallback(const std::string name) : mCallbackName(name) {}
void failure(const Ice::Exception &ex)
{
- lg(Error) << "Ice exception when attempting to relate progressing state: " << ex.what() << std::endl;
- }
-};
-
-typedef IceUtil::Handle<ProgressingCallback> ProgressingCallbackPtr;
-
-class ConnectedCallback : public IceUtil::Shared
-{
-public:
- ConnectedCallback() {}
- void failure(const Ice::Exception &ex)
- {
- lg(Error) << "Ice exception when attempting to relate connected state: " << ex.what() << std::endl;
+ lg(Error) << "Ice exception when attempting to relate " << mCallbackName << " state: " << ex.what() << std::endl;
}
+private:
+ const std::string mCallbackName;
};
-typedef IceUtil::Handle<ConnectedCallback> ConnectedCallbackPtr;
+typedef IceUtil::Handle<ListenerCallback> ListenerCallbackPtr;
PJSipSessionModInfo::PJSipSessionModInfo(pjsip_inv_session *inv_session,
SipSessionPtr session)
@@ -828,9 +812,9 @@ void PJSipSessionModule::handleInviteResponse(pjsip_inv_session *inv,
{
try
{
- RingingCallbackPtr cb(new RingingCallback());
+ ListenerCallbackPtr cb(new ListenerCallback(ringingCallbackName));
Callback_SessionListener_ringingPtr ringingCB =
- newCallback_SessionListener_ringing(cb, &RingingCallback::failure);
+ newCallback_SessionListener_ringing(cb, &ListenerCallback::failure);
(*listener)->begin_ringing(session->getSessionProxy(), ringingCB);
}
catch (const Ice::Exception &ex)
@@ -851,9 +835,9 @@ void PJSipSessionModule::handleInviteResponse(pjsip_inv_session *inv,
{
try
{
- ProgressingCallbackPtr cb(new ProgressingCallback());
+ ListenerCallbackPtr cb(new ListenerCallback(progressingCallbackName));
Callback_SessionListener_progressingPtr progressingCB =
- newCallback_SessionListener_progressing(cb, &ProgressingCallback::failure);
+ newCallback_SessionListener_progressing(cb, &ListenerCallback::failure);
(*listener)->begin_progressing(session->getSessionProxy(), response, progressingCB);
}
catch (const Ice::Exception &ex)
@@ -874,9 +858,9 @@ void PJSipSessionModule::handleInviteResponse(pjsip_inv_session *inv,
{
try
{
- ConnectedCallbackPtr cb(new ConnectedCallback());
+ ListenerCallbackPtr cb(new ListenerCallback(connectedCallbackName));
Callback_SessionListener_connectedPtr connectedCB =
- newCallback_SessionListener_connected(cb, &ConnectedCallback::failure);
+ newCallback_SessionListener_connected(cb, &ListenerCallback::failure);
(*listener)->begin_connected(session->getSessionProxy(), connectedCB);
}
catch (const Ice::Exception &ex)
-----------------------------------------------------------------------
--
asterisk-scf/release/sip.git
More information about the asterisk-scf-commits
mailing list