[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
Mon Sep 20 15:29:51 CDT 2010
branch "master" has been updated
via 6322f04d160ed4654b9dbf7faa32dc69d5eeb4c6 (commit)
from edaa4a16245eec1f43e0304e1230861e9018f902 (commit)
Summary of changes:
src/PJSipManager.cpp | 13 ++++++-------
src/PJSipManager.h | 6 ++++--
src/SipChannelServiceApp.cpp | 2 +-
3 files changed, 11 insertions(+), 10 deletions(-)
- Log -----------------------------------------------------------------
commit 6322f04d160ed4654b9dbf7faa32dc69d5eeb4c6
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Sep 20 15:30:17 2010 -0500
Add configurable UDP bind address.
That was easy.
diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index e64af83..5afb5a6 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -28,7 +28,7 @@ static void *monitorThread(void *endpt)
return NULL;
}
-PJSipManager::PJSipManager()
+PJSipManager::PJSipManager(Ice::PropertiesPtr props)
{
pj_status_t status = pj_init();
if (status != PJ_SUCCESS)
@@ -40,7 +40,7 @@ PJSipManager::PJSipManager()
// if necessary.
pj_caching_pool_init(&mCachingPool, NULL, 1024 * 1024);
pjsip_endpt_create(&mCachingPool.factory, "SIP", &mEndpoint);
- setTransports(mEndpoint);
+ setTransports(mEndpoint, props);
mMemoryPool = pj_pool_create(&mCachingPool.factory, "SIP", 1024, 1024, NULL);
if (!mMemoryPool)
{
@@ -70,16 +70,15 @@ pjsip_module *PJSipManager::getSessionModule()
return mSessionModule->getModule();
}
-bool PJSipManager::setTransports(pjsip_endpoint *endpoint)
+bool PJSipManager::setTransports(pjsip_endpoint *endpoint, Ice::PropertiesPtr props)
{
//XXX We'll also want to allow for TCP and TLS-specific
//addresses to be specified.
pj_sockaddr udpAddr;
pj_status_t status;
- //XXX Hard-coded local addr for the time being. This will be a variable
- //to read from a config at some point
- char ip[] = "0.0.0.0:5060";
- pj_str_t udpString = pj_str(ip);
+ std::string udpBindAddr = props->getPropertyWithDefault("Sip.Transport.UdpBindAddr", "0.0.0.0:5060");
+ pj_str_t udpString;
+ pj_cstr(&udpString, udpBindAddr.c_str());
//UNSPEC family means "you figure out the address family, pjlib!"
pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &udpString, &udpAddr);
if (udpAddr.addr.sa_family == pj_AF_INET())
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index 35a8146..c6d7ec7 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -10,6 +10,8 @@
#include <vector>
+#include <Ice/Ice.h>
+
#include <pjlib.h>
#include <pjsip.h>
@@ -33,7 +35,7 @@ namespace SipChannelService
class PJSipManager
{
public:
- PJSipManager();
+ PJSipManager(Ice::PropertiesPtr props);
/**
* Get a handle to the PJSipEndpoint for operations
* that may require it
@@ -58,7 +60,7 @@ private:
pj_pool_t *mMemoryPool;
pjsip_transport *mUdpTransport;
- bool setTransports(pjsip_endpoint *endpoint);
+ bool setTransports(pjsip_endpoint *endpoint, Ice::PropertiesPtr props);
};
}; //End namespace SipChannelService
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index 78a4cea..5a6bb95 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -482,7 +482,7 @@ void SipChannelServiceApp::initialize(const std::string appName)
mDataModelInstance.mEventPublisher = eventPublisherPtr;
// Initialize PJSIP
- mPJSipManager = new PJSipManager();
+ mPJSipManager = new PJSipManager(communicator()->getProperties());
mDataModelInstance.mPJSipManager = mPJSipManager;
// Create the adapter.
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list