diff --git a/engine/NamedList.cpp b/engine/NamedList.cpp index 4dcb660e..663639ac 100644 --- a/engine/NamedList.cpp +++ b/engine/NamedList.cpp @@ -216,6 +216,19 @@ NamedList& NamedList::copySubParams(const NamedList& original, const String& pre return *this; } +bool NamedList::hasSubParams(const char* prefix) const +{ + XDebug(DebugInfo,"NamedList::hasSubParams(\"%s\") [%p]",prefix,this); + if (!TelEngine::null(prefix)) { + for (const ObjList* l = m_params.skipNull(); l; l = l->skipNext()) { + const NamedString* s = static_cast(l->get()); + if (s->name().startsWith(prefix)) + return true; + } + } + return false; +} + void NamedList::dump(String& str, const char* separator, char quote, bool force) const { if (force && str.null()) diff --git a/yateclass.h b/yateclass.h index 47394a3f..52482cae 100644 --- a/yateclass.h +++ b/yateclass.h @@ -3799,6 +3799,13 @@ public: */ NamedList& copySubParams(const NamedList& original, const String& prefix, bool skipPrefix = true); + /** + * Check if we have a parameter that starts with prefix + * @param prefix Prefix to match in parameter name, must not be NULL + * @return True if a parameter starts with prefix + */ + bool hasSubParams(const char* prefix) const; + /** * Get the index of a named string in the parameter list. * @param param Pointer to the parameter to locate