[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "jira-astscf-397" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Wed Jan 11 22:14:23 CST 2012
branch "jira-astscf-397" has been created
at 8783c0d5741bd41fd625939d3584058fb3aeb486 (commit)
- Log -----------------------------------------------------------------
commit 8783c0d5741bd41fd625939d3584058fb3aeb486
Author: Brent Eagles <beagles at digium.com>
Date: Thu Jan 12 00:42:50 2012 -0330
- Added some untested code for the supporting multiple keys in the
configuration script.
- Added and removed some comments.
diff --git a/config/SipConfigurator.py b/config/SipConfigurator.py
index c7c9f6f..f10bfa9 100755
--- a/config/SipConfigurator.py
+++ b/config/SipConfigurator.py
@@ -201,22 +201,43 @@ class SipSectionVisitors(Configurator.SectionVisitors):
mapper.map('enableturn', item, 'enableTURN', 'enableRTPICE', config.get, None)
item = AsteriskSCF.Configuration.SipSessionManager.V1.SRTPCryptoItem()
-
+
+ #
+ # Maps key/suite pairs to SRTPCryptoKey configuration
+ # objects. It is a little suboptimal in how it goes about
+ # mapping multiple entries because it requires that the suite
+ # and keys that "belong together" appear right next to each
+ # other in the file. Kind of iffy, but parsing strings on
+ # delimiters might cause problems in that it is not clear what
+ # makes a safe delimiter.
+ #
class CryptoKeyHandler:
- def __init__(self, config, keyItem):
+ def __init__(self, config, keyItemArray):
self.config = config
- self.item = keyItem
+ self.keyArray = keyItemArray
+ self.currentCryptoItem = AsteriskSCF.Configuration.SipSessionManager.V1.SRTPCryptoKey()
def getSuite(self, section, item):
- self.item.suite = self.config.get(section, item)
+ itemData = self.config.get(section, item)
+ self.currentCryptoItem.suite = self.config.get(section, item)
+ self.checkAndAppend()
def getKey(self, section, item):
- self.item.cryptoKey = self.config.get(section, item)
+ itemData = self.config.get(section, item)
+ self.currentCryptoItem.cryptoKey = self.config.get(section, item)
+ self.checkAndAppend()
+
+ def checkAndAppend(self):
+ if len(self.currentCryptoItem.suite) > 0 and len(self.currentCryptoItem.cryptoKey) > 0:
+ self.keyArray.append(self.currentCryptoItem)
+ self.currentCryptoItem = AsteriskSCF.Configuration.SipSessionManager.V1.SRTPCryptoKey()
+
- item.cryptoKeys = [ AsteriskSCF.Configuration.SipSessionManager.V1.SRTPCryptoKey() ]
mapper.map('enableauth', item, 'enableAuthentication', 'srtpCryptoSettings', config.get, None)
mapper.map('enableencryption', item, 'enableEncryption', 'srtpCryptoSettings', config.get, None)
- handler = CryptoKeyHandler(config, item.cryptoKeys[0])
+
+ item.cryptoKeys = []
+ handler = CryptoKeyHandler(config, item.cryptoKeys)
mapper.map('ciphersuite', item, 'suite', 'srtpCryptoSettings', handler.getSuite, None)
mapper.map('cryptokey', item, 'cryptoKey', 'srtpCryptoSettings', handler.getKey, None)
diff --git a/src/Component.cpp b/src/Component.cpp
index 904fd84..a98b85c 100644
--- a/src/Component.cpp
+++ b/src/Component.cpp
@@ -228,6 +228,11 @@ void Component::preparePrimaryServicesForDiscovery()
*/
void Component::prepareBackplaneServicesForDiscovery()
{
+ //
+ // TODO: It would be much nicer if the base component did the default
+ // component intialization in a different method than that would be
+ // normally overridden by a derived class to add features.
+ //
// Insure the default Component services are prepped.
AsteriskSCF::Component::Component::prepareBackplaneServicesForDiscovery();
@@ -384,6 +389,9 @@ void Component::registerPJSIPModules()
//module names to modules to the PJSIP session manager instead.
//Since there's only a single configurable module at the moment,
//we'll just do it here instead.
+ //
+ // TODO: update comment!
+ //
if ((*i) == "Session")
{
mPJSIPManager->registerSessionModule(mEndpointFactory,
@@ -416,9 +424,9 @@ void Component::onPreInitialize()
{
try
{
- //As nice as it is of IceBox to provide us with a communicator,
- //we're going to create our own so that we can provide it with a threadhook.
- //Yes, this could be done via a plugin, but this is easier. Go away.
+ // As nice as it is of IceBox to provide us with a communicator,
+ // we're going to create our own so that we can provide it with a threadhook.
+ // Yes, this could be done via a plugin, but this is easier. Go away.
Ice::InitializationData id;
id.threadHook = new AsteriskSCF::PJLIB::ThreadHook("Ice");
id.properties = getCommunicator()->getProperties();
diff --git a/src/SIPSession.cpp b/src/SIPSession.cpp
index 00ad31d..a4d0849 100755
--- a/src/SIPSession.cpp
+++ b/src/SIPSession.cpp
@@ -2825,11 +2825,6 @@ void SIPSession::addKeys(const SIPEndpointMediaSRTPConfig& config, pjmedia_sdp_m
{
if(!config.cryptoKeys.empty())
{
- //
- // NOTE: AFAICT, we should really be able to supply multiple potential cyphersuites and keys.
- // However, the configuration tool doesn't currently support that so what we'll do for now
- // is provide support in the code and deal with the configuration issue later.
- //
int index = 1;
for (CryptoKeys::const_iterator i = config.cryptoKeys.begin();
i != config.cryptoKeys.end(); ++i)
commit 6095c35ec25ed1b6ac407a8514a266c40b6aa829
Merge: 905620f f9d1cbc
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Jan 9 09:46:29 2012 -0600
Merge branch 'error-handling'
commit 905620fd71c99fe276ebc6ed0922af49ae0a89af
Merge: 40f4ca9 b046455
Author: Mark Michelson <mmichelson at digium.com>
Date: Fri Jan 6 09:50:39 2012 -0600
Merge branch 'master' of git.asterisk.org:asterisk-scf/release/sip
commit 40f4ca9d7b8ef7b9a53bf8f94332080abf1bbe64
Author: Mark Michelson <mmichelson at digium.com>
Date: Fri Jan 6 08:57:24 2012 -0600
Add some missing config options into Sip.config
diff --git a/config/Sip.config b/config/Sip.config
index e72b415..b14323a 100644
--- a/config/Sip.config
+++ b/config/Sip.config
@@ -19,6 +19,10 @@ type=transport-udp
host=::1
port=5061
+# The following two sections are identities. Configuring
+# identities in sections like this allows for you to assign
+# multiple identities to a single endpoint or share the same
+# identity amongst multiple endpoints easily.
[bob-bar-office]
type=identity
name='robert bar (office)'
@@ -71,6 +75,20 @@ tlstimeout=0
# TLS protocol method to use (valid options are unspecified, tlsv1, sslv2, sslv3, sslv23)
#tlsprotocolmethod=tlsv1
+# The following section defines an outbound registration. The parameters
+# can be associated with an endpoint in the endpoint's configuration section.
+[bob-registration]
+type=registration
+# The address of record for which contacts are being bound
+aor=<sip:bob at 10.24.18.244>
+# Contacts to bind to this address of record. The composition is
+# contact/expiration
+# Multiple contacts can be specified by separating with commas
+contacts=<sip:2000 at 10.24.20.249>/60
+# Default expiration value. This is the expiration that will be used for any
+# contacts for which no explicit value was set.
+expiration=60
+
# Example of a SIP endpoint configuration
[bob]
# A type of endpoint specifies this section is for a SIP endpoint
@@ -144,6 +162,14 @@ ids=bob-bar-office,bob-bar-cell
#
# enableturn=false
+# Reference to outbound registrations. Separate multiple registrations with commas
+# registrations = bob-registration
+
+# The type of DTMF to use for this device
+# Allowable types are "info" "rfc4733" or "inband"
+# Note that currently inband is not implemented
+# dtmfmethod=rfc4733
+
#
# Example of configuring a STUN server for NAT handling.
#
commit b046455173036ccce22886697ea423c091323fd9
Author: Joshua Colp <jcolp at digium.com>
Date: Thu Jan 5 12:00:18 2012 -0400
Send back an object not exist exception if the telephony event source or sink are logically destroyed and workqueue items execute afterwards. (issue ASTSCF-290)
diff --git a/src/SIPSession.cpp b/src/SIPSession.cpp
index d8a1f73..f1a4ac8 100755
--- a/src/SIPSession.cpp
+++ b/src/SIPSession.cpp
@@ -2686,10 +2686,12 @@ public:
mSessionPriv->mAdapter->remove(mSessionPriv->mMediaSessionProxy->ice_getIdentity());
if (mSessionPriv->mEventSink)
{
+ mSessionPriv->mEventSink->setDestroyed();
mSessionPriv->mAdapter->remove(mSessionPriv->mEventSinkPrx->ice_getIdentity());
}
if (mSessionPriv->mEventSource)
{
+ mSessionPriv->mEventSource->setDestroyed();
mSessionPriv->mAdapter->remove(mSessionPriv->mEventSourcePrx->ice_getIdentity());
}
mSessionPriv->mMediaSession = 0;
diff --git a/src/SIPTelephonyEventSink.cpp b/src/SIPTelephonyEventSink.cpp
index 6aec733..9dda45b 100644
--- a/src/SIPTelephonyEventSink.cpp
+++ b/src/SIPTelephonyEventSink.cpp
@@ -30,11 +30,18 @@ public:
WriteTelephonyEvent(
const AsteriskSCF::SessionCommunications::V1::AMD_TelephonyEventSink_writePtr& cb,
const AsteriskSCF::SessionCommunications::V1::TelephonyEventPtr& event,
- pjsip_inv_session *inv)
- : mCB(cb), mEvent(event), mInv(inv) { }
+ pjsip_inv_session *inv,
+ const SIPTelephonyEventSinkPtr& sink)
+ : mCB(cb), mEvent(event), mInv(inv), mSink(sink) { }
SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
{
+ if (mSink->isDestroyed() == true)
+ {
+ mCB->ice_exception(Ice::ObjectNotExistException(__FILE__, __LINE__));
+ return Complete;
+ }
+
AsteriskSCF::SessionCommunications::V1::BeginDTMFEventPtr beginDTMF;
AsteriskSCF::SessionCommunications::V1::EndDTMFEventPtr endDTMF;
AsteriskSCF::SessionCommunications::V1::FlashEventPtr flash;
@@ -138,6 +145,7 @@ private:
AsteriskSCF::SessionCommunications::V1::AMD_TelephonyEventSink_writePtr mCB;
AsteriskSCF::SessionCommunications::V1::TelephonyEventPtr mEvent;
pjsip_inv_session *mInv;
+ SIPTelephonyEventSinkPtr mSink;
};
@@ -149,7 +157,7 @@ void SIPTelephonyEventSink::write_async(
const AsteriskSCF::SessionCommunications::V1::TelephonyEventPtr& event,
const Ice::Current&)
{
- mSessionWork->enqueueWork(new WriteTelephonyEvent(cb, event, mInv));
+ mSessionWork->enqueueWork(new WriteTelephonyEvent(cb, event, mInv, this));
}
class SetTelephonyEventSource : public SuspendableWork
@@ -163,8 +171,15 @@ public:
SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
{
- mSink->setSource(mSource);
- mCB->ice_response();
+ if (mSink->isDestroyed() == true)
+ {
+ mCB->ice_exception(Ice::ObjectNotExistException(__FILE__, __LINE__));
+ }
+ else
+ {
+ mSink->setSource(mSource);
+ mCB->ice_response();
+ }
return Complete;
}
private:
@@ -196,7 +211,14 @@ public:
SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
{
- mCB->ice_response(mSink->getSource());
+ if (mSink->isDestroyed() == true)
+ {
+ mCB->ice_exception(Ice::ObjectNotExistException(__FILE__, __LINE__));
+ }
+ else
+ {
+ mCB->ice_response(mSink->getSource());
+ }
return Complete;
}
private:
diff --git a/src/SIPTelephonyEventSink.h b/src/SIPTelephonyEventSink.h
index d1022ee..8b76299 100644
--- a/src/SIPTelephonyEventSink.h
+++ b/src/SIPTelephonyEventSink.h
@@ -16,13 +16,15 @@
#pragma once
#include "SIPSession.h"
+#include <AsteriskSCF/WorkQueue/Dispatched.h>
+
namespace AsteriskSCF
{
namespace SIPSessionManager
{
-class SIPTelephonyEventSink : public AsteriskSCF::SessionCommunications::V1::TelephonyEventSink
+class SIPTelephonyEventSink : public AsteriskSCF::SessionCommunications::V1::TelephonyEventSink, public AsteriskSCF::WorkQueue::Dispatched
{
public:
SIPTelephonyEventSink(const SessionWorkPtr& sessionWork, pjsip_inv_session *inv);
diff --git a/src/SIPTelephonyEventSource.cpp b/src/SIPTelephonyEventSource.cpp
index a2f6c79..08dde41 100644
--- a/src/SIPTelephonyEventSource.cpp
+++ b/src/SIPTelephonyEventSource.cpp
@@ -50,8 +50,15 @@ public:
SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
{
- mSource->addSinks(mSinks);
- mCB->ice_response();
+ if (mSource->isDestroyed() == true)
+ {
+ mCB->ice_exception(Ice::ObjectNotExistException(__FILE__, __LINE__));
+ }
+ else
+ {
+ mSource->addSinks(mSinks);
+ mCB->ice_response();
+ }
return Complete;
}
private:
@@ -71,8 +78,15 @@ public:
SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
{
- mSource->removeSinks(mSinks);
- mCB->ice_response();
+ if (mSource->isDestroyed() == true)
+ {
+ mCB->ice_exception(Ice::ObjectNotExistException(__FILE__, __LINE__));
+ }
+ else
+ {
+ mSource->removeSinks(mSinks);
+ mCB->ice_response();
+ }
return Complete;
}
private:
@@ -126,7 +140,14 @@ public:
SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
{
- mCB->ice_response(mSource->getSinks());
+ if (mSource->isDestroyed() == true)
+ {
+ mCB->ice_exception(Ice::ObjectNotExistException(__FILE__, __LINE__));
+ }
+ else
+ {
+ mCB->ice_response(mSource->getSinks());
+ }
return Complete;
}
private:
diff --git a/src/SIPTelephonyEventSource.h b/src/SIPTelephonyEventSource.h
index 3be3844..91f3612 100644
--- a/src/SIPTelephonyEventSource.h
+++ b/src/SIPTelephonyEventSource.h
@@ -17,13 +17,15 @@
#pragma once
#include "SIPSession.h"
+#include <AsteriskSCF/WorkQueue/Dispatched.h>
+
namespace AsteriskSCF
{
namespace SIPSessionManager
{
-class SIPTelephonyEventSource : public AsteriskSCF::SessionCommunications::V1::TelephonyEventSource
+class SIPTelephonyEventSource : public AsteriskSCF::SessionCommunications::V1::TelephonyEventSource, public AsteriskSCF::WorkQueue::Dispatched
{
public:
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list