From 989d22fc5f4d4a8cadb01dc1fc731caff4959d73 Mon Sep 17 00:00:00 2001 From: marian Date: Mon, 31 May 2010 13:14:43 +0000 Subject: [PATCH] The jingle module is now handling all resources if none is given in config. git-svn-id: http://voip.null.ro/svn/yate@3354 acf43c95-373e-0410-b603-e72c3f656dc1 --- conf.d/yjinglechan.conf.sample | 1 + modules/yjinglechan.cpp | 27 +++++++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/conf.d/yjinglechan.conf.sample b/conf.d/yjinglechan.conf.sample index 6ae54dc6..93b749df 100644 --- a/conf.d/yjinglechan.conf.sample +++ b/conf.d/yjinglechan.conf.sample @@ -16,6 +16,7 @@ ; resources: string: Comma separated list of resources serviced by the jingle channel ; The parameter is not used in client mode ; The first resource will be the default one (for outgoing calls) +; If this parameter is empty the module will handle all resources ;resources= ; jingle_version: integer: Jingle session version to use for outgoing calls diff --git a/modules/yjinglechan.cpp b/modules/yjinglechan.cpp index fb73aa5b..8792f57a 100644 --- a/modules/yjinglechan.cpp +++ b/modules/yjinglechan.cpp @@ -417,6 +417,8 @@ public: } // Check if a resource can be handled by the module inline bool handleResource(const String& name) { + if (m_handleAllRes) + return true; Lock lock(this); return !m_resources.skipNull() || m_resources.find(name); } @@ -472,6 +474,7 @@ private: JGStreamHost* m_ftProxy; // Default file transfer proxy ObjList m_handlers; // Message handlers list ObjList m_domains; // Domains handled by the module + bool m_handleAllRes; // Handle all resources (ignore the list) ObjList m_resources; // Resources handled by the module XMPPFeatureList m_features; // Domain or resource features to advertise XmlElement* m_entityCaps; // ntity capabilities element built from features @@ -3027,7 +3030,7 @@ bool YJGMessageHandler::received(Message& msg) * YJGDriver */ YJGDriver::YJGDriver() - : Driver("jingle","varchans"), m_init(false), m_ftProxy(0), + : Driver("jingle","varchans"), m_init(false), m_ftProxy(0), m_handleAllRes(false), m_entityCaps(0) { Output("Loaded module YJingle"); @@ -3132,14 +3135,22 @@ void YJGDriver::initialize() s_requestSubscribe = sect->getBoolValue("request_subscribe",true); s_autoSubscribe = sect->getBoolValue("auto_subscribe",false); m_resources.clear(); - String resList(sect->getValue("resources","yate")); - ObjList* list = resList.split(',',false); - for (ObjList* o = list->skipNull(); o; o = o->skipNext()) { - String* tmp = static_cast(o->get()); - if (!m_resources.find(*tmp)) - m_resources.append(new String(*tmp)); + m_handleAllRes = false; + const char* resources = sect->getValue("resources"); + if (resources) { + String resList(resources); + ObjList* list = resList.split(',',false); + for (ObjList* o = list->skipNull(); o; o = o->skipNext()) { + String* tmp = static_cast(o->get()); + if (!m_resources.find(*tmp)) + m_resources.append(new String(*tmp)); + } + TelEngine::destruct(list); + } + else { + m_handleAllRes = true; + m_resources.append(new String("yate")); } - TelEngine::destruct(list); } else { s_requestSubscribe = false;