[asterisk-scf-commits] asterisk-scf/integration/test_channel.git branch "party-id" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Nov 22 15:11:48 CST 2011


branch "party-id" has been created
        at  0117d4b9d993671d0eb84b38df579f7a55c6aa61 (commit)

- Log -----------------------------------------------------------------
commit 0117d4b9d993671d0eb84b38df579f7a55c6aa61
Author: Mark Michelson <mmichelson at digium.com>
Date:   Mon Oct 17 09:17:32 2011 -0500

    Adjust for party id changes.

diff --git a/src/TestEndpoint.cpp b/src/TestEndpoint.cpp
index 0b0315c..5c9c7bc 100644
--- a/src/TestEndpoint.cpp
+++ b/src/TestEndpoint.cpp
@@ -231,7 +231,8 @@ public:
 
         NamePtr name = new Name("bar");
         NumberPtr number = new Number("100");
-        IdPtr testId = new Id(name, number);
+        PrivacyPtr privacy = new Privacy(false);
+        IdPtr testId = new Id(name, number, privacy);
         IdSeq idSeq;
         idSeq.push_back(testId);
         mCaller = new Caller(idSeq);
@@ -240,20 +241,23 @@ public:
 
         NamePtr dialedName = new Name("foo");
         NumberPtr dialedNumber = new Number("104");
-        IdPtr dialedId = new Id(dialedName, dialedNumber);
+        PrivacyPtr dialedPrivacy = new Privacy(false);
+        IdPtr dialedId = new Id(dialedName, dialedNumber, dialedPrivacy);
         IdSeq dialedSeq;
         dialedSeq.push_back(dialedId);
         mDialed = new Dialed(dialedNumber);
 
         NamePtr redirName = new Name("scud");
         NumberPtr redirNumber = new Number("666");
-        IdPtr connectedId = new Id(redirName, redirNumber);
+        PrivacyPtr redirPrivacy = new Privacy(false);
+        IdPtr connectedId = new Id(redirName, redirNumber, redirPrivacy);
         IdSeq idSeq2;
         idSeq2.push_back(connectedId);
         mConnectedLine = new ConnectedLine(idSeq2);
 
         RedirectionSeq redirects;
-        RedirectionPtr redirect = new Redirection(dialedId, connectedId);
+        RedirectionReasonPtr reason = new RedirectionReason(Unknown);
+        RedirectionPtr redirect = new Redirection(dialedId, connectedId, reason);
         redirects.push_back(redirect);
         mRedirections = new Redirections(redirects);
 

commit ecdc524619fb486d95d9aded350f935344f434e0
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Sun Oct 2 18:11:11 2011 -0500

    Added Telephony Event sink and source support.

diff --git a/src/TestEndpoint.cpp b/src/TestEndpoint.cpp
index 18fd07c..0b0315c 100644
--- a/src/TestEndpoint.cpp
+++ b/src/TestEndpoint.cpp
@@ -20,6 +20,7 @@
 #include <Ice/Ice.h>
 #include <IceUtil/UUID.h>
 
+#include <AsteriskSCF/Helpers/ProxyHelper.h>
 #include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>
 
 #include <boost/thread/locks.hpp>
@@ -131,15 +132,95 @@ protected:
 
 typedef IceUtil::Handle<SessionListenerMgr> SessionListenerMgrPtr;
 
+class TelephonyEventSinkI : public AsteriskSCF::SessionCommunications::V1::TelephonyEventSink
+{
+public:
+    TelephonyEventSinkI() {}
+
+    void write_async(
+            const AsteriskSCF::SessionCommunications::V1::AMD_TelephonyEventSink_writePtr& cb,
+            const AsteriskSCF::SessionCommunications::V1::TelephonyEventPtr& telephonyEvent,
+            const Ice::Current&)
+    {
+        mEvents.push_back(telephonyEvent);
+        cb->ice_response();
+    }
+
+    void setSource_async(
+            const AsteriskSCF::SessionCommunications::V1::AMD_TelephonyEventSink_setSourcePtr& cb,
+            const AsteriskSCF::SessionCommunications::V1::TelephonyEventSourcePrx& source,
+            const Ice::Current&)
+    {
+        mSource = source;
+        cb->ice_response();
+    }
+
+
+    void getSource_async(
+            const AsteriskSCF::SessionCommunications::V1::AMD_TelephonyEventSink_getSourcePtr& cb,
+            const Ice::Current&)
+    {
+        cb->ice_response(mSource);
+    }
+
+private:
+
+    AsteriskSCF::SessionCommunications::V1::TelephonyEventSourcePrx mSource;
+    std::vector<AsteriskSCF::SessionCommunications::V1::TelephonyEventPtr> mEvents;
+};
+typedef IceUtil::Handle<TelephonyEventSinkI> TelephonyEventSinkIPtr;
+
+class TelephonyEventSourceI : public AsteriskSCF::SessionCommunications::V1::TelephonyEventSource
+{
+public:
+
+    TelephonyEventSourceI() {}
+
+    // TelephonyEventSource API implementation...
+
+    void addSinks_async(
+            const AsteriskSCF::SessionCommunications::V1::AMD_TelephonyEventSource_addSinksPtr& cb,
+            const AsteriskSCF::SessionCommunications::V1::TelephonyEventSinkSeq& sinks,
+            const Ice::Current&)
+    {
+        mSinks.insert(mSinks.end(), sinks.begin(), sinks.end());
+        cb->ice_response();
+    }
+
+    void removeSinks_async(
+            const AsteriskSCF::SessionCommunications::V1::AMD_TelephonyEventSource_removeSinksPtr& cb,
+            const AsteriskSCF::SessionCommunications::V1::TelephonyEventSinkSeq& sinks,
+            const Ice::Current&)
+    {
+        for (TelephonyEventSinkSeq::const_iterator i = sinks.begin(); i != sinks.end(); ++i)
+        {
+            mSinks.erase(std::remove_if(mSinks.begin(), mSinks.end(), AsteriskSCF::IdentityComparePredicate<TelephonyEventSinkPrx>(*i)), mSinks.end());
+        }
+        cb->ice_response();
+    }
+
+    void getSinks_async(
+            const AsteriskSCF::SessionCommunications::V1::AMD_TelephonyEventSource_getSinksPtr& cb,
+            const Ice::Current&)
+    {
+        cb->ice_response(mSinks);
+    }
+
+private:
+    AsteriskSCF::SessionCommunications::V1::TelephonyEventSinkSeq mSinks;
+};
+typedef IceUtil::Handle<TelephonyEventSourceI> TelephonyEventSourceIPtr;
+
 //
 // Needs some intelligence:
 //   - scheduled ringing
 //   - etc.
-class SessionI : public AsteriskSCF::SessionCommunications::V1::Session
+class SessionI : public AsteriskSCF::SessionCommunications::V1::TelephonySession
 {
 public:
     SessionI(const InternalManagerPtr& m, const AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx& prx,  const std::string& id,
         const Ice::ObjectAdapterPtr& adapter) :
+        mAdapter(adapter),
         mEndpointManager(m),
         mEndpointPrx(prx),
         mId(id),
@@ -175,6 +256,15 @@ public:
         RedirectionPtr redirect = new Redirection(dialedId, connectedId);
         redirects.push_back(redirect);
         mRedirections = new Redirections(redirects);
+
+        mTelephonyEventSinkPtr = new TelephonyEventSinkI();
+        TelephonyEventSinkPrx sinkPrx = TelephonyEventSinkPrx::uncheckedCast(mAdapter->addWithUUID(mTelephonyEventSinkPtr));
+        mTelephonyEventSinks.push_back(sinkPrx);
+
+        mTelephonyEventSourcePtr = new TelephonyEventSourceI();
+        TelephonyEventSourcePrx sourcePrx = TelephonyEventSourcePrx::uncheckedCast(mAdapter->addWithUUID(mTelephonyEventSourcePtr));
+        mTelephonyEventSources.push_back(sourcePrx);
+
     }
 
     void addListener_async(
@@ -419,8 +509,36 @@ public:
         cb->ice_response(mRedirections);
     }
 
+
+    //// TelephonySession overrides
+ 
+    void getSources_async(
+            const AsteriskSCF::SessionCommunications::V1::AMD_TelephonySession_getSourcesPtr& cb,
+            const Ice::Current&)
+    {
+        cb->ice_response(mTelephonyEventSources);
+    }
+
+    void getSinks_async(
+            const AsteriskSCF::SessionCommunications::V1::AMD_TelephonySession_getSinksPtr& cb,
+            const Ice::Current&)
+    {
+        cb->ice_response(mTelephonyEventSinks);
+    }
+
+    TelephonyEventSourceIPtr getSource()
+    {
+        return mTelephonyEventSourcePtr;
+    }
+
+    TelephonyEventSinkIPtr getSink()
+    {
+        return mTelephonyEventSinkPtr;
+    }
+
 private:
     boost::shared_mutex mMutex;
+    Ice::ObjectAdapterPtr mAdapter;
     InternalManagerPtr mEndpointManager;
     AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx mEndpointPrx;
     AsteriskSCF::SessionCommunications::V1::SessionInfoPtr mInfo;
@@ -429,11 +547,17 @@ private:
     AsteriskSCF::Media::V1::SessionPrx mMediaSession;
     SessionListenerMgrPtr mListeners;
     AsteriskSCF::SessionCommunications::V1::BridgePrx mCurrentBridge;
+
     SessionOwnerIdPtr mSessionOwnerId;
     CallerPtr mCaller;
     DialedPtr mDialed;
     ConnectedLinePtr mConnectedLine;
     RedirectionsPtr mRedirections;
+
+    TelephonyEventSourceIPtr mTelephonyEventSourcePtr;
+    TelephonyEventSinkIPtr mTelephonyEventSinkPtr;
+    TelephonyEventSourceSeq mTelephonyEventSources;
+    TelephonyEventSinkSeq mTelephonyEventSinks;
 };
 
 typedef IceUtil::Handle<SessionI> SessionIPtr;

commit cd0b4f5a9dc0b7e753f28160eaacb6457fc7477b
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Fri Sep 30 17:29:09 2011 -0500

    Adapt to changes in Party Id API.

diff --git a/src/TestEndpoint.cpp b/src/TestEndpoint.cpp
index 1dec56f..18fd07c 100644
--- a/src/TestEndpoint.cpp
+++ b/src/TestEndpoint.cpp
@@ -171,7 +171,10 @@ public:
         idSeq2.push_back(connectedId);
         mConnectedLine = new ConnectedLine(idSeq2);
 
-        mRedirecting = new Redirecting(dialedId, connectedId, 1);
+        RedirectionSeq redirects;
+        RedirectionPtr redirect = new Redirection(dialedId, connectedId);
+        redirects.push_back(redirect);
+        mRedirections = new Redirections(redirects);
     }
 
     void addListener_async(
@@ -411,9 +414,9 @@ public:
         cb->ice_response(mConnectedLine);
     }
 
-    void getRedirecting_async(const AMD_Session_getRedirectingPtr& cb, const Ice::Current& )
+    void getRedirections_async(const AMD_Session_getRedirectionsPtr& cb, const Ice::Current& )
     {
-        cb->ice_response(mRedirecting);
+        cb->ice_response(mRedirections);
     }
 
 private:
@@ -430,7 +433,7 @@ private:
     CallerPtr mCaller;
     DialedPtr mDialed;
     ConnectedLinePtr mConnectedLine;
-    RedirectingPtr mRedirecting;
+    RedirectionsPtr mRedirections;
 };
 
 typedef IceUtil::Handle<SessionI> SessionIPtr;

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


-- 
asterisk-scf/integration/test_channel.git



More information about the asterisk-scf-commits mailing list