[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
Sat Sep 11 20:56:09 CDT 2010


branch "master" has been updated
       via  7a61b2e8479f8e98198a7c431f34a1ba3d973942 (commit)
       via  a4a1e9782b0ae1e963f038ee759ee4d97b2a2b8e (commit)
       via  ba91a1bb9c2c5605858286b5c6af800deee60053 (commit)
       via  e4665923a4b1fcb20493fa94e5fd7e7bf6131623 (commit)
       via  408a8a14087dc06fba78ead58b08f0948e23ebe0 (commit)
       via  bb2c13c5fba711fdb3e715c4766650674e910360 (commit)
      from  fae0328173486013b91b7ed81d7e5e7f574ae6e3 (commit)

Summary of changes:
 config/test_sip.conf                     |    8 ++++++++
 slice                                    |    2 +-
 src/CMakeLists.txt                       |    1 +
 src/PJSipSessionModule.cpp               |   21 +++++++--------------
 src/SipChannelServiceApp.cpp             |   30 ++++++++++++++++++++++++++++++
 src/SipChannelServiceDataModel.h         |    1 +
 src/SipChannelServiceEndpointLocator.cpp |    8 ++++++--
 7 files changed, 54 insertions(+), 17 deletions(-)


- Log -----------------------------------------------------------------
commit 7a61b2e8479f8e98198a7c431f34a1ba3d973942
Author: Joshua Colp <jcolp at digium.com>
Date:   Sat Sep 11 23:02:35 2010 -0300

    Make the SIP component aware of session routers and use them for routing sessions.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index d1fb78a..d4da67f 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -156,23 +156,12 @@ static void handle_new_invite(pjsip_rx_data *rdata)
 	(*session)->setInviteSession(inv_session);
 	(*session)->setDialog(dlg);
 
-	LocatorRegistryPrx locator = dataModel.getRoutingService();
-	EndpointSeq endpoints;
-	try
-	{
-		endpoints = locator->lookup(destination);
-	}
-	catch (DestinationNotFoundException &destEx)
-	{
-		std::cerr << "[WARNING] Could not find destination " << destEx.destination << std::endl;
-	}
-	catch (InvalidParamsException &invalEx)
-	{
-		std::cerr << "[WARNING] Invalid parameters in endpoint lookup. " << std::endl;
-	}
 	//Adding the SipEndpoint to the dialog's mod_data makes it easy to
 	//retrieve during signal callbacks.
 	dlg->mod_data[module->id] = (void *)session;
+
+	AsteriskSCF::SessionCommunications::V1::SessionRouterPrx router = dataModel.getSessionRouter();
+	router->routeSession((*session)->getSessionProxy(), destination);
 }
 
 static pj_bool_t sessionOnReceiveRequest(pjsip_rx_data *rdata)
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index f493452..55d33a0 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -69,6 +69,11 @@ public: // Overrides of the  SipChannelServiceDataModel singleton's public inter
       return mRoutingServiceLocatorRegistry;
    }
 
+   virtual AsteriskSCF::SessionCommunications::V1::SessionRouterPrx getSessionRouter() const
+   {
+      return mSessionRouter;
+   }
+
    virtual Bridging::V1::BridgeManagerPrx getBridgeManager() const
    {
       return mBridgeManager;
@@ -104,6 +109,7 @@ public: // Implementation details are visible to this file's classes.
    boost::shared_ptr<SipChannelServiceEventPublisher> mEventPublisher;
    Routing::V1::EndpointLocatorPtr mEndpointLocator;
    Routing::V1::LocatorRegistryPrx mRoutingServiceLocatorRegistry;
+   AsteriskSCF::SessionCommunications::V1::SessionRouterPrx mSessionRouter;
    Bridging::V1::BridgeManagerPrx mBridgeManager;
    boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
    ServiceLocatorPrx mServiceLocator;
@@ -144,6 +150,7 @@ private:
    void deregisterFromServiceLocator();
    void setCategory(Discovery::V1::ServiceManagementPrx serviceManagement, const string &category);
    void locateRoutingService();
+   void locateSessionRouter();
    void locateBridgeService();
    void registerWithRoutingService();
    void deregisterFromRoutingService();
@@ -346,6 +353,26 @@ void SipChannelServiceApp::locateRoutingService()
 }
 
 /**
+ * Get a reference to the Session Routing Service interface that we care about, and cache it in the Data Model.
+ * This will allow us to route sessions.
+ */
+void SipChannelServiceApp::locateSessionRouter()
+{
+   if (mDataModelInstance.mServiceLocator == 0)
+   {
+      mDataModelInstance.mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
+   }
+
+   ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
+   /* TODO: Fill this in
+   genericparams->category = Routing::V1::RoutingServiceLocatorRegistryDiscoveryCategory;
+
+   Ice::ObjectPrx objectPrx = mDataModelInstance.mServiceLocator->locate(genericparams);
+   mDataModelInstance.mRoutingServiceLocatorRegistry = Routing::V1::LocatorRegistryPrx::checkedCast(objectPrx);
+   */
+}
+
+/**
  * Get a reference to the Bridge Service interface and cache it in the Data Model.
  * This will allow us to create bridges as needed.
  */
@@ -472,6 +499,9 @@ int SipChannelServiceApp::run(int argc, char* argv[])
    // Locate the Routing Service so that we can do routing.
    locateRoutingService();
 
+   // Locate the Session Router so we can REALLY do routing.
+   locateSessionRouter();
+
    // Register our Endpoint Locator so that we can provide endpoints to the
    // Routing Service for the endpoints we manage.
    registerWithRoutingService();
diff --git a/src/SipChannelServiceDataModel.h b/src/SipChannelServiceDataModel.h
index d3508fa..4e8a6d0 100644
--- a/src/SipChannelServiceDataModel.h
+++ b/src/SipChannelServiceDataModel.h
@@ -37,6 +37,7 @@ public:
    virtual const  SipChannelServiceEventPublisher& getEventPublisher() const = 0;
    virtual AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr getEndpointLocator() const = 0;
    virtual AsteriskSCF::Core::Routing::V1::LocatorRegistryPrx getRoutingService() const = 0;
+   virtual AsteriskSCF::SessionCommunications::V1::SessionRouterPrx getSessionRouter() const = 0;
    virtual AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerPrx getBridgeManager() const = 0;
    virtual boost::shared_ptr<SipEndpointFactory> getEndpointFactory() const = 0;
    virtual AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx getServiceLocator() const = 0;

commit a4a1e9782b0ae1e963f038ee759ee4d97b2a2b8e
Author: Joshua Colp <jcolp at digium.com>
Date:   Sat Sep 11 22:46:59 2010 -0300

    Return an endpoint proxy if our endpoint locator finds the endpoint.

diff --git a/src/SipChannelServiceEndpointLocator.cpp b/src/SipChannelServiceEndpointLocator.cpp
index c4dd3ff..49cc8a4 100644
--- a/src/SipChannelServiceEndpointLocator.cpp
+++ b/src/SipChannelServiceEndpointLocator.cpp
@@ -22,8 +22,12 @@ AsteriskSCF::Core::Endpoint::V1::EndpointSeq SipChannelServiceEndpointLocator::l
 {
 	AsteriskSCF::Core::Endpoint::V1::EndpointSeq endpoints;
 	SipEndpointPtr endpoint = mEndpointFactory->findByName(destination);
-	// TODO: Pass back an endpoint whatever
-//	endpoints.push_back(endpoint->getSessionEndpoint());
+
+	if (endpoint != 0)
+	{
+	   endpoints.push_back(endpoint->getEndpointProxy());
+	}
+
 	return endpoints;
 }
 

commit ba91a1bb9c2c5605858286b5c6af800deee60053
Author: Joshua Colp <jcolp at digium.com>
Date:   Sat Sep 11 22:42:14 2010 -0300

    Add a missing dependency.

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2fbd687..024f343 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -49,6 +49,7 @@ hydra_component_add_slice(SipStateReplicator ServiceLocatorIf)
 hydra_component_add_slice(SipStateReplicator ComponentServiceIf)
 hydra_component_add_slice(SipStateReplicator SipIf)
 hydra_component_add_slice(SipStateReplicator SipStateReplicationIf)
+hydra_component_add_slice(SipStateReplicator RoutingIf)
 
 hydra_component_add_file(SipStateReplicator SipStateReplicator.cpp)
 

commit e4665923a4b1fcb20493fa94e5fd7e7bf6131623
Author: Joshua Colp <jcolp at digium.com>
Date:   Sat Sep 11 22:37:04 2010 -0300

    Update to latest slice, and extend configuration file with an endpoint for Josh's phone.

diff --git a/config/test_sip.conf b/config/test_sip.conf
index 8075dd7..e0f0240 100644
--- a/config/test_sip.conf
+++ b/config/test_sip.conf
@@ -15,3 +15,9 @@ LocatorService.Proxy=LocatorService:tcp -p 4411
 
 # PJSIP Modules to register
 Sip.Modules=Session
+
+# Endpoints that we know about
+Sip.Endpoints=cisco
+
+# This is Josh's phone
+Sip.Endpointcisco.Session.CallDirection=Both
diff --git a/slice b/slice
index 9774fbe..200c642 160000
--- a/slice
+++ b/slice
@@ -1 +1 @@
-Subproject commit 9774fbe91da9a6e5c8f1d5cb1f1d372c72973037
+Subproject commit 200c642ce49b3daabeabe2d8ad105bfa980fec02

commit 408a8a14087dc06fba78ead58b08f0948e23ebe0
Author: Joshua Colp <jcolp at digium.com>
Date:   Sat Sep 11 22:13:19 2010 -0300

    Don't assume a session will always be present when handling a state change, it's possible it won't be.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 5f16069..d1fb78a 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -366,6 +366,10 @@ static void invOnStateChanged(pjsip_inv_session *inv, pjsip_event *event)
    if (inv->state == PJSIP_INV_STATE_DISCONNECTED)
    {
       SipSessionPtr *session = (SipSessionPtr*)inv->dlg->mod_data[pjsip_ua_instance()->id];
+      if (session == 0)
+      {
+	 return;
+      }
       AsteriskSCF::SessionCommunications::V1::ResponseCodePtr response = new AsteriskSCF::SessionCommunications::V1::ResponseCode();
       if (inv->cause == 486)
       {

commit bb2c13c5fba711fdb3e715c4766650674e910360
Author: Joshua Colp <jcolp at digium.com>
Date:   Sat Sep 11 22:10:35 2010 -0300

    Get our session module registering.

diff --git a/config/test_sip.conf b/config/test_sip.conf
index 24146a2..8075dd7 100644
--- a/config/test_sip.conf
+++ b/config/test_sip.conf
@@ -13,3 +13,5 @@ LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -p 4422
 # A proxy to the service locator service
 LocatorService.Proxy=LocatorService:tcp -p 4411
 
+# PJSIP Modules to register
+Sip.Modules=Session

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list