[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Wed Sep 8 08:26:09 CDT 2010
branch "master" has been updated
via aa3ae183837de715d52bf7eb91f3803fc066f8e9 (commit)
via 0c20395f1a684a2cc7a4688c4686a38a4ac1920b (commit)
via 6f7fabf0da6ef45935c63f9776220d959dd00f70 (commit)
from e3db50eb22955dd4a886b253a807eea9120ec277 (commit)
Summary of changes:
src/PJSipSessionModule.cpp | 10 +++++-----
src/SipEndpoint.cpp | 25 +++++++++++++++++++++++++
src/SipEndpoint.h | 13 +++++++++++++
src/SipSession.cpp | 5 ++---
4 files changed, 45 insertions(+), 8 deletions(-)
- Log -----------------------------------------------------------------
commit aa3ae183837de715d52bf7eb91f3803fc066f8e9
Author: Joshua Colp <jcolp at digium.com>
Date: Wed Sep 8 10:32:51 2010 -0300
Remove the session from the endpoint when it has ceased to be.
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index b7a3189..ed7d671 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -199,6 +199,12 @@ AsteriskSCF::SessionCommunications::V1::SessionPtr SipEndpoint::createSession(co
return session;
}
+void SipEndpoint::removeSession(AsteriskSCF::SessionCommunications::V1::SessionPtr session)
+{
+ SipSessionPtr sipsession = SipSessionPtr::dynamicCast(session);
+ mImplPriv->mSessions.erase(std::remove(mImplPriv->mSessions.begin(), mImplPriv->mSessions.end(), sipsession), mImplPriv->mSessions.end());
+}
+
AsteriskSCF::SessionCommunications::V1::SessionSeq SipEndpoint::getSessions(const Ice::Current&)
{
AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index f774819..3eb1b9c 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -199,18 +199,27 @@ public:
bool operator==(const std::string &name) const;
+ /**
+ * Interface implementation.
+ */
std::string getId(const Ice::Current&);
AsteriskSCF::SessionCommunications::V1::SessionPrx createSession(const std::string&, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, const Ice::Current&);
AsteriskSCF::SessionCommunications::V1::SessionSeq getSessions(const Ice::Current&);
+ /**
+ * Implementation specific.
+ */
SipEndpointConfig &getConfig();
std::string getName();
AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx getEndpointProxy();
+ // TODO: Find a way to use SipSessionPtr here, right now trying to do so results in the world exploding due to dependency insanity
AsteriskSCF::SessionCommunications::V1::SessionPtr createSession(const std::string&);
+ void removeSession(AsteriskSCF::SessionCommunications::V1::SessionPtr);
+
private:
/**
* Private implementation details.
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 51a4152..c15992c 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -372,7 +372,7 @@ void SipSession::destroy()
(*i)->release();
}
- // TODO: Remove ourselves from the endpoint
+ mImplPriv->mEndpoint->removeSession(this);
}
/**
commit 0c20395f1a684a2cc7a4688c4686a38a4ac1920b
Author: Joshua Colp <jcolp at digium.com>
Date: Wed Sep 8 10:27:30 2010 -0300
Have SIP originating calls create sessions on the endpoint.
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 1c1a397..5f16069 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -141,11 +141,6 @@ static void handle_new_invite(pjsip_rx_data *rdata)
return;
}
- // TODO: Create a session here on the endpoint
- SipSessionPtr* session = 0;
- (*session)->setInviteSession(inv_session);
- (*session)->setDialog(dlg);
-
//We've created our calling endpoint. Now we need to look up the destination.
pjsip_uri *ruri = rdata->msg_info.msg->line.req.uri;
std::string destination("");
@@ -156,6 +151,11 @@ static void handle_new_invite(pjsip_rx_data *rdata)
//grab that from the URI to pass to the locator.
destination = std::string(pj_strbuf(&sipRuri->user), pj_strlen(&sipRuri->user));
}
+
+ SipSessionPtr* session = new SipSessionPtr(SipSessionPtr::dynamicCast(caller->createSession(destination)));
+ (*session)->setInviteSession(inv_session);
+ (*session)->setDialog(dlg);
+
LocatorRegistryPrx locator = dataModel.getRoutingService();
EndpointSeq endpoints;
try
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 301e25a..b7a3189 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -192,6 +192,13 @@ AsteriskSCF::SessionCommunications::V1::SessionPrx SipEndpoint::createSession(co
return session->getSessionProxy();
}
+AsteriskSCF::SessionCommunications::V1::SessionPtr SipEndpoint::createSession(const std::string& destination)
+{
+ SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, 0);
+ mImplPriv->mSessions.push_back(session);
+ return session;
+}
+
AsteriskSCF::SessionCommunications::V1::SessionSeq SipEndpoint::getSessions(const Ice::Current&)
{
AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 965a037..f774819 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -209,6 +209,8 @@ public:
AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx getEndpointProxy();
+ AsteriskSCF::SessionCommunications::V1::SessionPtr createSession(const std::string&);
+
private:
/**
* Private implementation details.
commit 6f7fabf0da6ef45935c63f9776220d959dd00f70
Author: Joshua Colp <jcolp at digium.com>
Date: Wed Sep 8 01:11:48 2010 -0300
Get the SipEndpoint into the ASM and return it when the session is queried.
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index bca9435..301e25a 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -54,6 +54,11 @@ SipEndpointImplPriv(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpoint
* A vector of sessions that exist to or from this endpoint.
*/
std::vector<SipSessionPtr> mSessions;
+
+ /**
+ * A proxy to our endpoint.
+ */
+ AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx mEndpointProxy;
};
/**
@@ -64,6 +69,8 @@ SipEndpoint::SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEnd
{
std::cout << "Constructing SIP endpoint " << name << std::endl;
+ mImplPriv->mEndpointProxy = AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx::uncheckedCast(mImplPriv->mAdapter->addWithUUID(this));
+
setConfiguration(props);
}
@@ -207,5 +214,10 @@ std::string SipEndpoint::getName()
return mImplPriv->mName;
};
+AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx SipEndpoint::getEndpointProxy()
+{
+ return mImplPriv->mEndpointProxy;
+}
+
}; // end SipChannelService
}; // end AsteriskSCF
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index d6db2e9..965a037 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -207,6 +207,8 @@ public:
std::string getName();
+ AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx getEndpointProxy();
+
private:
/**
* Private implementation details.
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 52eb676..51a4152 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -180,8 +180,7 @@ void SipSession::flash(const Ice::Current&)
*/
AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx SipSession::getEndpoint(const Ice::Current&)
{
- AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx endpoint;
- return endpoint;
+ return mImplPriv->mEndpoint->getEndpointProxy();
}
/**
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list