mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-08 05:54:45 +00:00
indent pass 1
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8686 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
49ff246b7c
commit
3c349c274e
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo -n "-brs -npsl -di0 -br -ce -d0 -cli0 -npcs -nfc1 -ut -i4 -ts4 -l155 -cs -T size_t " > ./.indent.pro
|
echo -n "-brs -npsl -di0 -br -ce -d0 -cli0 -npcs -nfc1 -ut -i4 -ts4 -l155 -cs -T size_t " > ./.indent.pro
|
||||||
grep typedef ./src/include/*.h | grep switch_ | grep -v "\*\|{" | sed -e s/struct// | perl -ne '@l = split; $l[2] =~ s/;//g ; print "-T $l[2] "' >> ./.indent.pro
|
grep typedef `find ./src/include/ -name \*.h` | grep apr_ | grep -v "\*\|{" | sed -e s/struct// | perl -ne '@l = split; $l[2] =~ s/;//g ; print "-T $l[2] "' >> ./.indent.pro
|
||||||
|
grep typedef `find ./src/include/ -name \*.h` | grep switch_ | grep -v "\*\|{" | sed -e s/struct// | perl -ne '@l = split; $l[2] =~ s/;//g ; print "-T $l[2] "' >> ./.indent.pro
|
||||||
grep "} switch_" ./src/include/*.h | perl -ne '@l = split; $l[1] =~ s/;//g ; print " -T $l[1] "' >> ./.indent.pro
|
grep "} switch_" ./src/include/*.h | perl -ne '@l = split; $l[1] =~ s/;//g ; print " -T $l[1] "' >> ./.indent.pro
|
||||||
|
@ -196,13 +196,11 @@ enum SG_Error {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*! @brief String manipulation functions. */
|
/*! @brief String manipulation functions. */
|
||||||
class SimpleGlobUtil
|
class SimpleGlobUtil {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
static const char *strchr(const char *s, char c) {
|
static const char *strchr(const char *s, char c) {
|
||||||
return (char *) sg_strchr((const SOCHAR_T *) s, c);
|
return (char *) sg_strchr((const SOCHAR_T *) s, c);
|
||||||
}
|
} static const wchar_t *strchr(const wchar_t *s, wchar_t c) {
|
||||||
static const wchar_t * strchr(const wchar_t *s, wchar_t c) {
|
|
||||||
return::wcschr(s, c);
|
return::wcschr(s, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,8 +212,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Note: char strlen returns number of bytes, not characters
|
// Note: char strlen returns number of bytes, not characters
|
||||||
static size_t strlen(const char *s) { return ::strlen(s); }
|
static size_t strlen(const char *s) {
|
||||||
static size_t strlen(const wchar_t *s) { return ::wcslen(s); }
|
return::strlen(s);
|
||||||
|
}
|
||||||
|
static size_t strlen(const wchar_t *s) {
|
||||||
|
return::wcslen(s);
|
||||||
|
}
|
||||||
|
|
||||||
static void strcpy_s(char *dst, size_t n, const char *src) {
|
static void strcpy_s(char *dst, size_t n, const char *src) {
|
||||||
(void) n;
|
(void) n;
|
||||||
@ -262,12 +264,9 @@ enum SG_FileType {
|
|||||||
#define SG_PATH_CHAR '\\'
|
#define SG_PATH_CHAR '\\'
|
||||||
|
|
||||||
/*! @brief Windows glob implementation. */
|
/*! @brief Windows glob implementation. */
|
||||||
template<class SOCHAR>
|
template < class SOCHAR > struct SimpleGlobBase {
|
||||||
struct SimpleGlobBase
|
SimpleGlobBase():m_hFind(INVALID_HANDLE_VALUE) {
|
||||||
{
|
} int FindFirstFileS(const char *a_pszFileSpec, unsigned int) {
|
||||||
SimpleGlobBase() : m_hFind(INVALID_HANDLE_VALUE) { }
|
|
||||||
|
|
||||||
int FindFirstFileS(const char * a_pszFileSpec, unsigned int) {
|
|
||||||
m_hFind = FindFirstFileA(a_pszFileSpec, &m_oFindDataA);
|
m_hFind = FindFirstFileA(a_pszFileSpec, &m_oFindDataA);
|
||||||
if (m_hFind != INVALID_HANDLE_VALUE) {
|
if (m_hFind != INVALID_HANDLE_VALUE) {
|
||||||
return SG_SUCCESS;
|
return SG_SUCCESS;
|
||||||
@ -303,19 +302,13 @@ struct SimpleGlobBase
|
|||||||
|
|
||||||
const char *GetFileNameS(char) const {
|
const char *GetFileNameS(char) const {
|
||||||
return m_oFindDataA.cFileName;
|
return m_oFindDataA.cFileName;
|
||||||
}
|
} const wchar_t *GetFileNameS(wchar_t) const {
|
||||||
const wchar_t * GetFileNameS(wchar_t) const {
|
|
||||||
return m_oFindDataW.cFileName;
|
return m_oFindDataW.cFileName;
|
||||||
}
|
} bool IsDirS(char) const {
|
||||||
|
|
||||||
bool IsDirS(char) const {
|
|
||||||
return GetFileTypeS(m_oFindDataA.dwFileAttributes) == SG_FILETYPE_DIR;
|
return GetFileTypeS(m_oFindDataA.dwFileAttributes) == SG_FILETYPE_DIR;
|
||||||
}
|
} bool IsDirS(wchar_t) const {
|
||||||
bool IsDirS(wchar_t) const {
|
|
||||||
return GetFileTypeS(m_oFindDataW.dwFileAttributes) == SG_FILETYPE_DIR;
|
return GetFileTypeS(m_oFindDataW.dwFileAttributes) == SG_FILETYPE_DIR;
|
||||||
}
|
} SG_FileType GetFileTypeS(const char *a_pszPath) {
|
||||||
|
|
||||||
SG_FileType GetFileTypeS(const char * a_pszPath) {
|
|
||||||
return GetFileTypeS(GetFileAttributesA(a_pszPath));
|
return GetFileTypeS(GetFileAttributesA(a_pszPath));
|
||||||
}
|
}
|
||||||
SG_FileType GetFileTypeS(const wchar_t *a_pszPath) {
|
SG_FileType GetFileTypeS(const wchar_t *a_pszPath) {
|
||||||
@ -342,15 +335,11 @@ private:
|
|||||||
#define SG_PATH_CHAR '/'
|
#define SG_PATH_CHAR '/'
|
||||||
|
|
||||||
/*! @brief Unix glob implementation. */
|
/*! @brief Unix glob implementation. */
|
||||||
template<class SOCHAR>
|
template < class SOCHAR > struct SimpleGlobBase {
|
||||||
struct SimpleGlobBase
|
|
||||||
{
|
|
||||||
SimpleGlobBase() {
|
SimpleGlobBase() {
|
||||||
memset(&m_glob, 0, sizeof(m_glob));
|
memset(&m_glob, 0, sizeof(m_glob));
|
||||||
m_uiCurr = (size_t) -1;
|
m_uiCurr = (size_t) -1;
|
||||||
}
|
} ~SimpleGlobBase() {
|
||||||
|
|
||||||
~SimpleGlobBase() {
|
|
||||||
globfree(&m_glob);
|
globfree(&m_glob);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,14 +354,19 @@ struct SimpleGlobBase
|
|||||||
|
|
||||||
int FindFirstFileS(const char *a_pszFileSpec, unsigned int a_uiFlags) {
|
int FindFirstFileS(const char *a_pszFileSpec, unsigned int a_uiFlags) {
|
||||||
int nFlags = GLOB_MARK | GLOB_NOSORT;
|
int nFlags = GLOB_MARK | GLOB_NOSORT;
|
||||||
if (a_uiFlags & SG_GLOB_ERR) nFlags |= GLOB_ERR;
|
if (a_uiFlags & SG_GLOB_ERR)
|
||||||
|
nFlags |= GLOB_ERR;
|
||||||
#ifdef GLOB_TILDE
|
#ifdef GLOB_TILDE
|
||||||
if (a_uiFlags & SG_GLOB_TILDE) nFlags |= GLOB_TILDE;
|
if (a_uiFlags & SG_GLOB_TILDE)
|
||||||
|
nFlags |= GLOB_TILDE;
|
||||||
#endif
|
#endif
|
||||||
int rc = glob(a_pszFileSpec, nFlags, NULL, &m_glob);
|
int rc = glob(a_pszFileSpec, nFlags, NULL, &m_glob);
|
||||||
if (rc == GLOB_NOSPACE) return SG_ERR_MEMORY;
|
if (rc == GLOB_NOSPACE)
|
||||||
if (rc == GLOB_ABORTED) return SG_ERR_FAILURE;
|
return SG_ERR_MEMORY;
|
||||||
if (rc == GLOB_NOMATCH) return SG_ERR_NOMATCH;
|
if (rc == GLOB_ABORTED)
|
||||||
|
return SG_ERR_FAILURE;
|
||||||
|
if (rc == GLOB_NOMATCH)
|
||||||
|
return SG_ERR_NOMATCH;
|
||||||
m_uiCurr = 0;
|
m_uiCurr = 0;
|
||||||
FilePrep();
|
FilePrep();
|
||||||
return SG_SUCCESS;
|
return SG_SUCCESS;
|
||||||
@ -396,14 +390,10 @@ struct SimpleGlobBase
|
|||||||
const char *GetFileNameS(char) const {
|
const char *GetFileNameS(char) const {
|
||||||
SG_ASSERT(m_uiCurr != (size_t) -1);
|
SG_ASSERT(m_uiCurr != (size_t) -1);
|
||||||
return m_glob.gl_pathv[m_uiCurr];
|
return m_glob.gl_pathv[m_uiCurr];
|
||||||
}
|
} bool IsDirS(char) const {
|
||||||
|
|
||||||
bool IsDirS(char) const {
|
|
||||||
SG_ASSERT(m_uiCurr != (size_t) -1);
|
SG_ASSERT(m_uiCurr != (size_t) -1);
|
||||||
return m_bIsDir;
|
return m_bIsDir;
|
||||||
}
|
} SG_FileType GetFileTypeS(const char *a_pszPath) const {
|
||||||
|
|
||||||
SG_FileType GetFileTypeS(const char * a_pszPath) const {
|
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
if (0 != stat(a_pszPath, &sb)) {
|
if (0 != stat(a_pszPath, &sb)) {
|
||||||
return SG_FILETYPE_INVALID;
|
return SG_FILETYPE_INVALID;
|
||||||
@ -432,9 +422,7 @@ private:
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
/*! @brief Implementation of the SimpleGlob class */
|
/*! @brief Implementation of the SimpleGlob class */
|
||||||
template<class SOCHAR>
|
template < class SOCHAR > class CSimpleGlobTempl:private SimpleGlobBase < SOCHAR > {
|
||||||
class CSimpleGlobTempl : private SimpleGlobBase<SOCHAR>
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
/*! @brief Initialize the class.
|
/*! @brief Initialize the class.
|
||||||
|
|
||||||
@ -496,10 +484,10 @@ public:
|
|||||||
|
|
||||||
/*! @brief Return the number of files in the argv array.
|
/*! @brief Return the number of files in the argv array.
|
||||||
*/
|
*/
|
||||||
inline int FileCount() const { return m_nArgsLen; }
|
inline int FileCount() const {
|
||||||
|
return m_nArgsLen;
|
||||||
/*! @brief Return the full argv array. */
|
}
|
||||||
inline SOCHAR ** Files() {
|
/*! @brief Return the full argv array. */ inline SOCHAR **Files() {
|
||||||
SetArgvArrayType(POINTERS);
|
SetArgvArrayType(POINTERS);
|
||||||
return m_rgpArgs;
|
return m_rgpArgs;
|
||||||
}
|
}
|
||||||
@ -550,11 +538,7 @@ private:
|
|||||||
// IMPLEMENTATION
|
// IMPLEMENTATION
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
template<class SOCHAR>
|
template < class SOCHAR > CSimpleGlobTempl < SOCHAR >::CSimpleGlobTempl(unsigned int a_uiFlags, int a_nReservedSlots)
|
||||||
CSimpleGlobTempl<SOCHAR>::CSimpleGlobTempl(
|
|
||||||
unsigned int a_uiFlags,
|
|
||||||
int a_nReservedSlots
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
m_rgpArgs = NULL;
|
m_rgpArgs = NULL;
|
||||||
m_nArgsSize = 0;
|
m_nArgsSize = 0;
|
||||||
@ -564,19 +548,15 @@ CSimpleGlobTempl<SOCHAR>::CSimpleGlobTempl(
|
|||||||
Init(a_uiFlags, a_nReservedSlots);
|
Init(a_uiFlags, a_nReservedSlots);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SOCHAR>
|
template < class SOCHAR > CSimpleGlobTempl < SOCHAR >::~CSimpleGlobTempl()
|
||||||
CSimpleGlobTempl<SOCHAR>::~CSimpleGlobTempl()
|
|
||||||
{
|
{
|
||||||
if (m_rgpArgs) free(m_rgpArgs);
|
if (m_rgpArgs)
|
||||||
if (m_pBuffer) free(m_pBuffer);
|
free(m_rgpArgs);
|
||||||
|
if (m_pBuffer)
|
||||||
|
free(m_pBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SOCHAR>
|
template < class SOCHAR > int CSimpleGlobTempl < SOCHAR >::Init(unsigned int a_uiFlags, int a_nReservedSlots)
|
||||||
int
|
|
||||||
CSimpleGlobTempl<SOCHAR>::Init(
|
|
||||||
unsigned int a_uiFlags,
|
|
||||||
int a_nReservedSlots
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
m_nArgArrayType = POINTERS;
|
m_nArgArrayType = POINTERS;
|
||||||
m_uiFlags = a_uiFlags;
|
m_uiFlags = a_uiFlags;
|
||||||
@ -596,11 +576,7 @@ CSimpleGlobTempl<SOCHAR>::Init(
|
|||||||
return SG_SUCCESS;
|
return SG_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SOCHAR>
|
template < class SOCHAR > int CSimpleGlobTempl < SOCHAR >::Add(const SOCHAR * a_pszFileSpec)
|
||||||
int
|
|
||||||
CSimpleGlobTempl<SOCHAR>::Add(
|
|
||||||
const SOCHAR *a_pszFileSpec
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Windows FindFirst/FindNext recognizes forward slash as the same as backward slash
|
// Windows FindFirst/FindNext recognizes forward slash as the same as backward slash
|
||||||
@ -618,9 +594,7 @@ CSimpleGlobTempl<SOCHAR>::Add(
|
|||||||
|
|
||||||
// if this doesn't contain wildcards then we can just add it directly
|
// if this doesn't contain wildcards then we can just add it directly
|
||||||
m_szPathPrefix[0] = 0;
|
m_szPathPrefix[0] = 0;
|
||||||
if (!SimpleGlobUtil::strchr(a_pszFileSpec, '*') &&
|
if (!SimpleGlobUtil::strchr(a_pszFileSpec, '*') && !SimpleGlobUtil::strchr(a_pszFileSpec, '?')) {
|
||||||
!SimpleGlobUtil::strchr(a_pszFileSpec, '?'))
|
|
||||||
{
|
|
||||||
SG_FileType nType = GetFileTypeS(a_pszFileSpec);
|
SG_FileType nType = GetFileTypeS(a_pszFileSpec);
|
||||||
if (nType == SG_FILETYPE_INVALID) {
|
if (nType == SG_FILETYPE_INVALID) {
|
||||||
if (m_uiFlags & SG_GLOB_NOCHECK) {
|
if (m_uiFlags & SG_GLOB_NOCHECK) {
|
||||||
@ -630,7 +604,6 @@ CSimpleGlobTempl<SOCHAR>::Add(
|
|||||||
}
|
}
|
||||||
return AppendName(a_pszFileSpec, nType == SG_FILETYPE_DIR);
|
return AppendName(a_pszFileSpec, nType == SG_FILETYPE_DIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Windows doesn't return the directory with the filename, so we need to extract the
|
// Windows doesn't return the directory with the filename, so we need to extract the
|
||||||
// path from the search string ourselves and prefix it to the filename we get back.
|
// path from the search string ourselves and prefix it to the filename we get back.
|
||||||
@ -646,11 +619,11 @@ CSimpleGlobTempl<SOCHAR>::Add(
|
|||||||
if (rc != SG_SUCCESS) {
|
if (rc != SG_SUCCESS) {
|
||||||
if (rc == SG_ERR_NOMATCH && (m_uiFlags & SG_GLOB_NOCHECK)) {
|
if (rc == SG_ERR_NOMATCH && (m_uiFlags & SG_GLOB_NOCHECK)) {
|
||||||
int ok = AppendName(a_pszFileSpec, false);
|
int ok = AppendName(a_pszFileSpec, false);
|
||||||
if (ok != SG_SUCCESS) rc = ok;
|
if (ok != SG_SUCCESS)
|
||||||
|
rc = ok;
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add it and find all subsequent matches
|
// add it and find all subsequent matches
|
||||||
int nError, nStartLen = m_nArgsLen;
|
int nError, nStartLen = m_nArgsLen;
|
||||||
bool bSuccess;
|
bool bSuccess;
|
||||||
@ -667,21 +640,13 @@ CSimpleGlobTempl<SOCHAR>::Add(
|
|||||||
nStartLen = m_nReservedSlots;
|
nStartLen = m_nReservedSlots;
|
||||||
}
|
}
|
||||||
SetArgvArrayType(POINTERS);
|
SetArgvArrayType(POINTERS);
|
||||||
qsort(
|
qsort(m_rgpArgs + nStartLen, m_nArgsLen - nStartLen, sizeof(m_rgpArgs[0]), fileSortCompare);
|
||||||
m_rgpArgs + nStartLen,
|
|
||||||
m_nArgsLen - nStartLen,
|
|
||||||
sizeof(m_rgpArgs[0]), fileSortCompare);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nError;
|
return nError;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SOCHAR>
|
template < class SOCHAR > int CSimpleGlobTempl < SOCHAR >::Add(int a_nCount, const SOCHAR * const *a_rgpszFileSpec)
|
||||||
int
|
|
||||||
CSimpleGlobTempl<SOCHAR>::Add(
|
|
||||||
int a_nCount,
|
|
||||||
const SOCHAR * const * a_rgpszFileSpec
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
int nResult;
|
int nResult;
|
||||||
for (int n = 0; n < a_nCount; ++n) {
|
for (int n = 0; n < a_nCount; ++n) {
|
||||||
@ -693,12 +658,7 @@ CSimpleGlobTempl<SOCHAR>::Add(
|
|||||||
return SG_SUCCESS;
|
return SG_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SOCHAR>
|
template < class SOCHAR > int CSimpleGlobTempl < SOCHAR >::AppendName(const SOCHAR * a_pszFileName, bool a_bIsDir)
|
||||||
int
|
|
||||||
CSimpleGlobTempl<SOCHAR>::AppendName(
|
|
||||||
const SOCHAR * a_pszFileName,
|
|
||||||
bool a_bIsDir
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// we need the argv array as offsets in case we resize it
|
// we need the argv array as offsets in case we resize it
|
||||||
SetArgvArrayType(OFFSETS);
|
SetArgvArrayType(OFFSETS);
|
||||||
@ -720,12 +680,10 @@ CSimpleGlobTempl<SOCHAR>::AppendName(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure that we have enough room in the argv array
|
// ensure that we have enough room in the argv array
|
||||||
if (!GrowArgvArray(m_nArgsLen + 1)) {
|
if (!GrowArgvArray(m_nArgsLen + 1)) {
|
||||||
return SG_ERR_MEMORY;
|
return SG_ERR_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure that we have enough room in the string buffer
|
// ensure that we have enough room in the string buffer
|
||||||
size_t uiPrefixLen = SimpleGlobUtil::strlen(m_szPathPrefix);
|
size_t uiPrefixLen = SimpleGlobUtil::strlen(m_szPathPrefix);
|
||||||
size_t uiLen = uiPrefixLen + SimpleGlobUtil::strlen(a_pszFileName) + 1; // + null character
|
size_t uiLen = uiPrefixLen + SimpleGlobUtil::strlen(a_pszFileName) + 1; // + null character
|
||||||
@ -735,55 +693,41 @@ CSimpleGlobTempl<SOCHAR>::AppendName(
|
|||||||
if (!GrowStringBuffer(m_uiBufferLen + uiLen)) {
|
if (!GrowStringBuffer(m_uiBufferLen + uiLen)) {
|
||||||
return SG_ERR_MEMORY;
|
return SG_ERR_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add this entry
|
// add this entry
|
||||||
m_rgpArgs[m_nArgsLen++] = (SOCHAR *) m_uiBufferLen; // offset from beginning of buffer
|
m_rgpArgs[m_nArgsLen++] = (SOCHAR *) m_uiBufferLen; // offset from beginning of buffer
|
||||||
SimpleGlobUtil::strcpy_s(m_pBuffer + m_uiBufferLen,
|
SimpleGlobUtil::strcpy_s(m_pBuffer + m_uiBufferLen, m_uiBufferSize - m_uiBufferLen, m_szPathPrefix);
|
||||||
m_uiBufferSize - m_uiBufferLen, m_szPathPrefix);
|
SimpleGlobUtil::strcpy_s(m_pBuffer + m_uiBufferLen + uiPrefixLen, m_uiBufferSize - m_uiBufferLen - uiPrefixLen, a_pszFileName);
|
||||||
SimpleGlobUtil::strcpy_s(m_pBuffer + m_uiBufferLen + uiPrefixLen,
|
|
||||||
m_uiBufferSize - m_uiBufferLen - uiPrefixLen, a_pszFileName);
|
|
||||||
m_uiBufferLen += uiLen;
|
m_uiBufferLen += uiLen;
|
||||||
|
|
||||||
// add the directory slash if desired
|
// add the directory slash if desired
|
||||||
if (a_bIsDir && (m_uiFlags & SG_GLOB_MARK) == SG_GLOB_MARK) {
|
if (a_bIsDir && (m_uiFlags & SG_GLOB_MARK) == SG_GLOB_MARK) {
|
||||||
const static SOCHAR szDirSlash[] = { SG_PATH_CHAR, 0 };
|
const static SOCHAR szDirSlash[] = { SG_PATH_CHAR, 0 };
|
||||||
SimpleGlobUtil::strcpy_s(m_pBuffer + m_uiBufferLen - 2,
|
SimpleGlobUtil::strcpy_s(m_pBuffer + m_uiBufferLen - 2, m_uiBufferSize - (m_uiBufferLen - 2), szDirSlash);
|
||||||
m_uiBufferSize - (m_uiBufferLen - 2), szDirSlash);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return SG_SUCCESS;
|
return SG_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SOCHAR>
|
template < class SOCHAR > void CSimpleGlobTempl < SOCHAR >::SetArgvArrayType(ARG_ARRAY_TYPE a_nNewType)
|
||||||
void
|
|
||||||
CSimpleGlobTempl<SOCHAR>::SetArgvArrayType(
|
|
||||||
ARG_ARRAY_TYPE a_nNewType
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (m_nArgArrayType == a_nNewType) return;
|
if (m_nArgArrayType == a_nNewType)
|
||||||
|
return;
|
||||||
if (a_nNewType == POINTERS) {
|
if (a_nNewType == POINTERS) {
|
||||||
SG_ASSERT(m_nArgArrayType == OFFSETS);
|
SG_ASSERT(m_nArgArrayType == OFFSETS);
|
||||||
for (int n = 0; n < m_nArgsLen; ++n) {
|
for (int n = 0; n < m_nArgsLen; ++n) {
|
||||||
m_rgpArgs[n] = (m_rgpArgs[n] == (SOCHAR*)-1) ?
|
m_rgpArgs[n] = (m_rgpArgs[n] == (SOCHAR *) - 1) ? NULL : m_pBuffer + (size_t) m_rgpArgs[n];
|
||||||
NULL : m_pBuffer + (size_t) m_rgpArgs[n];
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
SG_ASSERT(a_nNewType == OFFSETS);
|
SG_ASSERT(a_nNewType == OFFSETS);
|
||||||
SG_ASSERT(m_nArgArrayType == POINTERS);
|
SG_ASSERT(m_nArgArrayType == POINTERS);
|
||||||
for (int n = 0; n < m_nArgsLen; ++n) {
|
for (int n = 0; n < m_nArgsLen; ++n) {
|
||||||
m_rgpArgs[n] = (m_rgpArgs[n] == NULL) ?
|
m_rgpArgs[n] = (m_rgpArgs[n] == NULL) ? (SOCHAR *) - 1 : (SOCHAR *) (m_rgpArgs[n] - m_pBuffer);
|
||||||
(SOCHAR*) -1 : (SOCHAR*) (m_rgpArgs[n] - m_pBuffer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_nArgArrayType = a_nNewType;
|
m_nArgArrayType = a_nNewType;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SOCHAR>
|
template < class SOCHAR > bool CSimpleGlobTempl < SOCHAR >::GrowArgvArray(int a_nNewLen)
|
||||||
bool
|
|
||||||
CSimpleGlobTempl<SOCHAR>::GrowArgvArray(
|
|
||||||
int a_nNewLen
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (a_nNewLen >= m_nArgsSize) {
|
if (a_nNewLen >= m_nArgsSize) {
|
||||||
static const int SG_ARGV_INITIAL_SIZE = 32;
|
static const int SG_ARGV_INITIAL_SIZE = 32;
|
||||||
@ -792,18 +736,15 @@ CSimpleGlobTempl<SOCHAR>::GrowArgvArray(
|
|||||||
nNewSize *= 2;
|
nNewSize *= 2;
|
||||||
}
|
}
|
||||||
void *pNewBuffer = realloc(m_rgpArgs, nNewSize * sizeof(SOCHAR *));
|
void *pNewBuffer = realloc(m_rgpArgs, nNewSize * sizeof(SOCHAR *));
|
||||||
if (!pNewBuffer) return false;
|
if (!pNewBuffer)
|
||||||
|
return false;
|
||||||
m_nArgsSize = nNewSize;
|
m_nArgsSize = nNewSize;
|
||||||
m_rgpArgs = (SOCHAR **) pNewBuffer;
|
m_rgpArgs = (SOCHAR **) pNewBuffer;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SOCHAR>
|
template < class SOCHAR > bool CSimpleGlobTempl < SOCHAR >::GrowStringBuffer(size_t a_uiMinSize)
|
||||||
bool
|
|
||||||
CSimpleGlobTempl<SOCHAR>::GrowStringBuffer(
|
|
||||||
size_t a_uiMinSize
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (a_uiMinSize >= m_uiBufferSize) {
|
if (a_uiMinSize >= m_uiBufferSize) {
|
||||||
static const int SG_BUFFER_INITIAL_SIZE = 1024;
|
static const int SG_BUFFER_INITIAL_SIZE = 1024;
|
||||||
@ -812,19 +753,15 @@ CSimpleGlobTempl<SOCHAR>::GrowStringBuffer(
|
|||||||
uiNewSize *= 2;
|
uiNewSize *= 2;
|
||||||
}
|
}
|
||||||
void *pNewBuffer = realloc(m_pBuffer, uiNewSize * sizeof(SOCHAR));
|
void *pNewBuffer = realloc(m_pBuffer, uiNewSize * sizeof(SOCHAR));
|
||||||
if (!pNewBuffer) return false;
|
if (!pNewBuffer)
|
||||||
|
return false;
|
||||||
m_uiBufferSize = uiNewSize;
|
m_uiBufferSize = uiNewSize;
|
||||||
m_pBuffer = (SOCHAR *) pNewBuffer;
|
m_pBuffer = (SOCHAR *) pNewBuffer;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SOCHAR>
|
template < class SOCHAR > int CSimpleGlobTempl < SOCHAR >::fileSortCompare(const void *a1, const void *a2)
|
||||||
int
|
|
||||||
CSimpleGlobTempl<SOCHAR>::fileSortCompare(
|
|
||||||
const void *a1,
|
|
||||||
const void *a2
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const SOCHAR *s1 = *(const SOCHAR **) a1;
|
const SOCHAR *s1 = *(const SOCHAR **) a1;
|
||||||
const SOCHAR *s2 = *(const SOCHAR **) a2;
|
const SOCHAR *s2 = *(const SOCHAR **) a2;
|
||||||
|
@ -60,86 +60,63 @@ typedef unsigned __int16 uint16_t;
|
|||||||
/*! \brief Find the bit position of the highest set bit in a word
|
/*! \brief Find the bit position of the highest set bit in a word
|
||||||
\param bits The word to be searched
|
\param bits The word to be searched
|
||||||
\return The bit number of the highest set bit, or -1 if the word is zero. */
|
\return The bit number of the highest set bit, or -1 if the word is zero. */
|
||||||
static __inline__ int top_bit(unsigned int bits)
|
static __inline__ int top_bit(unsigned int bits) {
|
||||||
{
|
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
__asm__ __volatile__(" movl $-1,%%edx;\n"
|
__asm__ __volatile__(" movl $-1,%%edx;\n" " bsrl %%eax,%%edx;\n":"=d"(res)
|
||||||
" bsrl %%eax,%%edx;\n"
|
|
||||||
: "=d" (res)
|
|
||||||
:"a" (bits));
|
:"a" (bits));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*//*! \brief Find the bit position of the lowest set bit in a word
|
||||||
|
|
||||||
/*! \brief Find the bit position of the lowest set bit in a word
|
|
||||||
\param bits The word to be searched
|
\param bits The word to be searched
|
||||||
\return The bit number of the lowest set bit, or -1 if the word is zero. */
|
\return The bit number of the lowest set bit, or -1 if the word is zero. */ static __inline__ int bottom_bit(unsigned int bits) {
|
||||||
static __inline__ int bottom_bit(unsigned int bits)
|
|
||||||
{
|
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
__asm__ __volatile__(" movl $-1,%%edx;\n"
|
__asm__ __volatile__(" movl $-1,%%edx;\n" " bsfl %%eax,%%edx;\n":"=d"(res)
|
||||||
" bsfl %%eax,%%edx;\n"
|
|
||||||
: "=d" (res)
|
|
||||||
:"a" (bits));
|
:"a" (bits));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
#elif defined(__x86_64__)
|
#elif defined(__x86_64__)
|
||||||
static __inline__ int top_bit(unsigned int bits)
|
static __inline__ int top_bit(unsigned int bits) {
|
||||||
{
|
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
__asm__ __volatile__(" movq $-1,%%rdx;\n"
|
__asm__ __volatile__(" movq $-1,%%rdx;\n" " bsrq %%rax,%%rdx;\n":"=d"(res)
|
||||||
" bsrq %%rax,%%rdx;\n"
|
|
||||||
: "=d" (res)
|
|
||||||
:"a" (bits));
|
:"a" (bits));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/ static __inline__ int bottom_bit(unsigned int bits) {
|
||||||
|
|
||||||
static __inline__ int bottom_bit(unsigned int bits)
|
|
||||||
{
|
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
__asm__ __volatile__(" movq $-1,%%rdx;\n"
|
__asm__ __volatile__(" movq $-1,%%rdx;\n" " bsfq %%rax,%%rdx;\n":"=d"(res)
|
||||||
" bsfq %%rax,%%rdx;\n"
|
|
||||||
: "=d" (res)
|
|
||||||
:"a" (bits));
|
:"a" (bits));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
#else
|
#else
|
||||||
static __inline__ int top_bit(unsigned int bits)
|
static __inline__ int top_bit(unsigned int bits) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (bits == 0)
|
if (bits == 0)
|
||||||
return -1;
|
return -1;
|
||||||
i = 0;
|
i = 0;
|
||||||
if (bits & 0xFFFF0000)
|
if (bits & 0xFFFF0000) {
|
||||||
{
|
|
||||||
bits &= 0xFFFF0000;
|
bits &= 0xFFFF0000;
|
||||||
i += 16;
|
i += 16;
|
||||||
}
|
}
|
||||||
if (bits & 0xFF00FF00)
|
if (bits & 0xFF00FF00) {
|
||||||
{
|
|
||||||
bits &= 0xFF00FF00;
|
bits &= 0xFF00FF00;
|
||||||
i += 8;
|
i += 8;
|
||||||
}
|
}
|
||||||
if (bits & 0xF0F0F0F0)
|
if (bits & 0xF0F0F0F0) {
|
||||||
{
|
|
||||||
bits &= 0xF0F0F0F0;
|
bits &= 0xF0F0F0F0;
|
||||||
i += 4;
|
i += 4;
|
||||||
}
|
}
|
||||||
if (bits & 0xCCCCCCCC)
|
if (bits & 0xCCCCCCCC) {
|
||||||
{
|
|
||||||
bits &= 0xCCCCCCCC;
|
bits &= 0xCCCCCCCC;
|
||||||
i += 2;
|
i += 2;
|
||||||
}
|
}
|
||||||
if (bits & 0xAAAAAAAA)
|
if (bits & 0xAAAAAAAA) {
|
||||||
{
|
|
||||||
bits &= 0xAAAAAAAA;
|
bits &= 0xAAAAAAAA;
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
@ -147,35 +124,29 @@ static __inline__ int top_bit(unsigned int bits)
|
|||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
static __inline__ int bottom_bit(unsigned int bits)
|
static __inline__ int bottom_bit(unsigned int bits) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (bits == 0)
|
if (bits == 0)
|
||||||
return -1;
|
return -1;
|
||||||
i = 32;
|
i = 32;
|
||||||
if (bits & 0x0000FFFF)
|
if (bits & 0x0000FFFF) {
|
||||||
{
|
|
||||||
bits &= 0x0000FFFF;
|
bits &= 0x0000FFFF;
|
||||||
i -= 16;
|
i -= 16;
|
||||||
}
|
}
|
||||||
if (bits & 0x00FF00FF)
|
if (bits & 0x00FF00FF) {
|
||||||
{
|
|
||||||
bits &= 0x00FF00FF;
|
bits &= 0x00FF00FF;
|
||||||
i -= 8;
|
i -= 8;
|
||||||
}
|
}
|
||||||
if (bits & 0x0F0F0F0F)
|
if (bits & 0x0F0F0F0F) {
|
||||||
{
|
|
||||||
bits &= 0x0F0F0F0F;
|
bits &= 0x0F0F0F0F;
|
||||||
i -= 4;
|
i -= 4;
|
||||||
}
|
}
|
||||||
if (bits & 0x33333333)
|
if (bits & 0x33333333) {
|
||||||
{
|
|
||||||
bits &= 0x33333333;
|
bits &= 0x33333333;
|
||||||
i -= 2;
|
i -= 2;
|
||||||
}
|
}
|
||||||
if (bits & 0x55555555)
|
if (bits & 0x55555555) {
|
||||||
{
|
|
||||||
bits &= 0x55555555;
|
bits &= 0x55555555;
|
||||||
i -= 1;
|
i -= 1;
|
||||||
}
|
}
|
||||||
@ -228,20 +199,16 @@ static __inline__ int bottom_bit(unsigned int bits)
|
|||||||
\param linear The sample to encode.
|
\param linear The sample to encode.
|
||||||
\return The u-law value.
|
\return The u-law value.
|
||||||
*/
|
*/
|
||||||
static __inline__ uint8_t linear_to_ulaw(int linear)
|
static __inline__ uint8_t linear_to_ulaw(int linear) {
|
||||||
{
|
|
||||||
uint8_t u_val;
|
uint8_t u_val;
|
||||||
int mask;
|
int mask;
|
||||||
int seg;
|
int seg;
|
||||||
|
|
||||||
/* Get the sign and the magnitude of the value. */
|
/* Get the sign and the magnitude of the value. */
|
||||||
if (linear < 0)
|
if (linear < 0) {
|
||||||
{
|
|
||||||
linear = ULAW_BIAS - linear;
|
linear = ULAW_BIAS - linear;
|
||||||
mask = 0x7F;
|
mask = 0x7F;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
linear = ULAW_BIAS + linear;
|
linear = ULAW_BIAS + linear;
|
||||||
mask = 0xFF;
|
mask = 0xFF;
|
||||||
}
|
}
|
||||||
@ -269,8 +236,7 @@ static __inline__ uint8_t linear_to_ulaw(int linear)
|
|||||||
\param ulaw The u-law sample to decode.
|
\param ulaw The u-law sample to decode.
|
||||||
\return The linear value.
|
\return The linear value.
|
||||||
*/
|
*/
|
||||||
static __inline__ int16_t ulaw_to_linear(uint8_t ulaw)
|
static __inline__ int16_t ulaw_to_linear(uint8_t ulaw) {
|
||||||
{
|
|
||||||
int t;
|
int t;
|
||||||
|
|
||||||
/* Complement to obtain normal u-law value. */
|
/* Complement to obtain normal u-law value. */
|
||||||
@ -308,18 +274,14 @@ static __inline__ int16_t ulaw_to_linear(uint8_t ulaw)
|
|||||||
\param linear The sample to encode.
|
\param linear The sample to encode.
|
||||||
\return The A-law value.
|
\return The A-law value.
|
||||||
*/
|
*/
|
||||||
static __inline__ uint8_t linear_to_alaw(int linear)
|
static __inline__ uint8_t linear_to_alaw(int linear) {
|
||||||
{
|
|
||||||
int mask;
|
int mask;
|
||||||
int seg;
|
int seg;
|
||||||
|
|
||||||
if (linear >= 0)
|
if (linear >= 0) {
|
||||||
{
|
|
||||||
/* Sign (bit 7) bit = 1 */
|
/* Sign (bit 7) bit = 1 */
|
||||||
mask = ALAW_AMI_MASK | 0x80;
|
mask = ALAW_AMI_MASK | 0x80;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Sign (bit 7) bit = 0 */
|
/* Sign (bit 7) bit = 0 */
|
||||||
mask = ALAW_AMI_MASK;
|
mask = ALAW_AMI_MASK;
|
||||||
linear = -linear - 8;
|
linear = -linear - 8;
|
||||||
@ -327,10 +289,8 @@ static __inline__ uint8_t linear_to_alaw(int linear)
|
|||||||
|
|
||||||
/* Convert the scaled magnitude to segment number. */
|
/* Convert the scaled magnitude to segment number. */
|
||||||
seg = top_bit(linear | 0xFF) - 7;
|
seg = top_bit(linear | 0xFF) - 7;
|
||||||
if (seg >= 8)
|
if (seg >= 8) {
|
||||||
{
|
if (linear >= 0) {
|
||||||
if (linear >= 0)
|
|
||||||
{
|
|
||||||
/* Out of range. Return maximum value. */
|
/* Out of range. Return maximum value. */
|
||||||
return (uint8_t) (0x7F ^ mask);
|
return (uint8_t) (0x7F ^ mask);
|
||||||
}
|
}
|
||||||
@ -346,8 +306,7 @@ static __inline__ uint8_t linear_to_alaw(int linear)
|
|||||||
\param alaw The A-law sample to decode.
|
\param alaw The A-law sample to decode.
|
||||||
\return The linear value.
|
\return The linear value.
|
||||||
*/
|
*/
|
||||||
static __inline__ int16_t alaw_to_linear(uint8_t alaw)
|
static __inline__ int16_t alaw_to_linear(uint8_t alaw) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
int seg;
|
int seg;
|
||||||
|
|
||||||
|
@ -56,8 +56,6 @@ SWITCH_BEGIN_EXTERN_C
|
|||||||
*/
|
*/
|
||||||
/** The fundamental pool type */
|
/** The fundamental pool type */
|
||||||
/* see switch types.h typedef struct apr_pool_t switch_memory_pool_t;*/
|
/* see switch types.h typedef struct apr_pool_t switch_memory_pool_t;*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear all memory in the pool and run all the cleanups. This also destroys all
|
* Clear all memory in the pool and run all the cleanups. This also destroys all
|
||||||
* subpools.
|
* subpools.
|
||||||
@ -125,11 +123,13 @@ SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t * dso, char *b
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SWITCH_DECLARE(int) switch_snprintf(_Out_z_cap_(len) char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format, ...);
|
SWITCH_DECLARE(int) switch_snprintf(_Out_z_cap_(len)
|
||||||
|
char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format, ...);
|
||||||
|
|
||||||
SWITCH_DECLARE(int) switch_vasprintf(_Out_opt_ char **buf, _In_z_ _Printf_format_string_ const char *format, _In_ va_list ap);
|
SWITCH_DECLARE(int) switch_vasprintf(_Out_opt_ char **buf, _In_z_ _Printf_format_string_ const char *format, _In_ va_list ap);
|
||||||
|
|
||||||
SWITCH_DECLARE(char *) switch_copy_string(_Out_z_cap_(dst_size) char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size);
|
SWITCH_DECLARE(char *) switch_copy_string(_Out_z_cap_(dst_size)
|
||||||
|
char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
@ -798,8 +798,7 @@ SWITCH_DECLARE(switch_status_t) switch_directory_exists(const char *dirname, swi
|
|||||||
* @param perm Permissions for the new direcoty.
|
* @param perm Permissions for the new direcoty.
|
||||||
* @param pool the pool to use.
|
* @param pool the pool to use.
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm,
|
SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool);
|
||||||
switch_memory_pool_t *pool);
|
|
||||||
|
|
||||||
/** Creates a new directory on the file system, but behaves like
|
/** Creates a new directory on the file system, but behaves like
|
||||||
* 'mkdir -p'. Creates intermediate directories as required. No error
|
* 'mkdir -p'. Creates intermediate directories as required. No error
|
||||||
@ -808,8 +807,7 @@ SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileper
|
|||||||
* @param perm Permissions for the new direcoty.
|
* @param perm Permissions for the new direcoty.
|
||||||
* @param pool the pool to use.
|
* @param pool the pool to use.
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path, switch_fileperms_t perm,
|
SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool);
|
||||||
switch_memory_pool_t *pool);
|
|
||||||
|
|
||||||
typedef struct switch_dir switch_dir_t;
|
typedef struct switch_dir switch_dir_t;
|
||||||
|
|
||||||
@ -1063,8 +1061,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t * sock, const
|
|||||||
* @param buf The data to send
|
* @param buf The data to send
|
||||||
* @param len The length of the data to send
|
* @param len The length of the data to send
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t * sock, switch_sockaddr_t * where, int32_t flags, const char *buf,
|
SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf, switch_size_t *len);
|
||||||
switch_size_t *len);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param from The apr_sockaddr_t to fill in the recipient info
|
* @param from The apr_sockaddr_t to fill in the recipient info
|
||||||
|
@ -122,7 +122,8 @@ SWITCH_DECLARE(void) switch_buffer_set_loops(_In_ switch_buffer_t *buffer, _In_
|
|||||||
* \param datalen amount of data to be written
|
* \param datalen amount of data to be written
|
||||||
* \return int amount of buffer used after the write, or 0 if no space available
|
* \return int amount of buffer used after the write, or 0 if no space available
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_size_t) switch_buffer_write(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen) const void *data, _In_ switch_size_t datalen);
|
SWITCH_DECLARE(switch_size_t) switch_buffer_write(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen)
|
||||||
|
const void *data, _In_ switch_size_t datalen);
|
||||||
|
|
||||||
/*! \brief Remove data from the buffer
|
/*! \brief Remove data from the buffer
|
||||||
* \param buffer any buffer of type switch_buffer_t
|
* \param buffer any buffer of type switch_buffer_t
|
||||||
@ -142,7 +143,8 @@ SWITCH_DECLARE(void) switch_buffer_zero(_In_ switch_buffer_t *buffer);
|
|||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(void) switch_buffer_destroy(switch_buffer_t **buffer);
|
SWITCH_DECLARE(void) switch_buffer_destroy(switch_buffer_t **buffer);
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_size_t) switch_buffer_zwrite(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen) const void *data, _In_ switch_size_t datalen);
|
SWITCH_DECLARE(switch_size_t) switch_buffer_zwrite(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen)
|
||||||
|
const void *data, _In_ switch_size_t datalen);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
@ -140,8 +140,7 @@ struct switch_caller_extension {
|
|||||||
\return a new extension object allocated from the session's memory pool
|
\return a new extension object allocated from the session's memory pool
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(_In_ switch_core_session_t *session,
|
SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(_In_ switch_core_session_t *session,
|
||||||
_In_z_ const char *extension_name,
|
_In_z_ const char *extension_name, _In_z_ const char *extension_number);
|
||||||
_In_z_ const char *extension_number);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Add an application (instruction) to the given extension
|
\brief Add an application (instruction) to the given extension
|
||||||
@ -152,8 +151,7 @@ SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(_In_ swi
|
|||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(void) switch_caller_extension_add_application(_In_ switch_core_session_t *session,
|
SWITCH_DECLARE(void) switch_caller_extension_add_application(_In_ switch_core_session_t *session,
|
||||||
_In_ switch_caller_extension_t *caller_extension,
|
_In_ switch_caller_extension_t *caller_extension,
|
||||||
_In_z_ const char *application_name,
|
_In_z_ const char *application_name, _In_z_ const char *extra_data);
|
||||||
_In_z_ const char *extra_data);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -191,8 +189,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(_In_ switch_
|
|||||||
_In_opt_z_ const char *aniii,
|
_In_opt_z_ const char *aniii,
|
||||||
_In_opt_z_ const char *rdnis,
|
_In_opt_z_ const char *rdnis,
|
||||||
_In_opt_z_ const char *source,
|
_In_opt_z_ const char *source,
|
||||||
_In_opt_z_ const char *context,
|
_In_opt_z_ const char *context, _In_opt_z_ const char *destination_number);
|
||||||
_In_opt_z_ const char *destination_number);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Clone an existing caller profile object
|
\brief Clone an existing caller profile object
|
||||||
@ -216,8 +213,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_dup(_In_ switch_
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_caller_profile_event_set_data(_In_ switch_caller_profile_t *caller_profile,
|
SWITCH_DECLARE(void) switch_caller_profile_event_set_data(_In_ switch_caller_profile_t *caller_profile,
|
||||||
_In_opt_z_ const char *prefix,
|
_In_opt_z_ const char *prefix, _In_ switch_event_t *event);
|
||||||
_In_ switch_event_t *event);
|
|
||||||
|
|
||||||
SWITCH_END_EXTERN_C
|
SWITCH_END_EXTERN_C
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -438,7 +438,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf_string(_In_ switch_cha
|
|||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_channel_dequeue_dtmf(_In_ switch_channel_t *channel, _In_ switch_dtmf_t *dtmf);
|
SWITCH_DECLARE(switch_status_t) switch_channel_dequeue_dtmf(_In_ switch_channel_t *channel, _In_ switch_dtmf_t *dtmf);
|
||||||
SWITCH_DECLARE(void) switch_channel_flush_dtmf(_In_ switch_channel_t *channel);
|
SWITCH_DECLARE(void) switch_channel_flush_dtmf(_In_ switch_channel_t *channel);
|
||||||
SWITCH_DECLARE(switch_size_t) switch_channel_dequeue_dtmf_string(_In_ switch_channel_t *channel, _Out_opt_bytecapcount_(len) char *dtmf_str, _In_ switch_size_t len);
|
SWITCH_DECLARE(switch_size_t) switch_channel_dequeue_dtmf_string(_In_ switch_channel_t *channel, _Out_opt_bytecapcount_(len)
|
||||||
|
char *dtmf_str, _In_ switch_size_t len);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Render the name of the provided state enum
|
\brief Render the name of the provided state enum
|
||||||
@ -469,7 +470,8 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(_In_ switch_channel_t *channe
|
|||||||
\note it's necessary to test if the return val is the same as the input and free the string if it is not.
|
\note it's necessary to test if the return val is the same as the input and free the string if it is not.
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(char *) switch_channel_expand_variables(_In_ switch_channel_t *channel, _In_ const char *in);
|
SWITCH_DECLARE(char *) switch_channel_expand_variables(_In_ switch_channel_t *channel, _In_ const char *in);
|
||||||
SWITCH_DECLARE(char *) switch_channel_build_param_string(_In_ switch_channel_t *channel, _In_opt_ switch_caller_profile_t *caller_profile, _In_opt_ const char *prefix);
|
SWITCH_DECLARE(char *) switch_channel_build_param_string(_In_ switch_channel_t *channel, _In_opt_ switch_caller_profile_t *caller_profile,
|
||||||
|
_In_opt_ const char *prefix);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(_In_ switch_channel_t *channel);
|
SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(_In_ switch_channel_t *channel);
|
||||||
|
|
||||||
#define switch_channel_stop_broadcast(_channel) if (switch_channel_test_flag(_channel, CF_BROADCAST)) switch_channel_set_flag(_channel, CF_BREAK | CF_STOP_BROADCAST)
|
#define switch_channel_stop_broadcast(_channel) if (switch_channel_test_flag(_channel, CF_BROADCAST)) switch_channel_set_flag(_channel, CF_BREAK | CF_STOP_BROADCAST)
|
||||||
|
@ -52,7 +52,6 @@ SWITCH_BEGIN_EXTERN_C
|
|||||||
s.raw_write_function = switch_console_stream_raw_write; \
|
s.raw_write_function = switch_console_stream_raw_write; \
|
||||||
s.alloc_len = SWITCH_CMD_CHUNK_LEN; \
|
s.alloc_len = SWITCH_CMD_CHUNK_LEN; \
|
||||||
s.alloc_chunk = SWITCH_CMD_CHUNK_LEN
|
s.alloc_chunk = SWITCH_CMD_CHUNK_LEN
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief A simple comand loop that reads input from the terminal
|
\brief A simple comand loop that reads input from the terminal
|
||||||
*/
|
*/
|
||||||
|
@ -132,9 +132,7 @@ struct switch_core_port_allocator;
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(_In_ switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(_In_ switch_core_session_t *session,
|
||||||
_In_ switch_media_bug_callback_t callback,
|
_In_ switch_media_bug_callback_t callback,
|
||||||
_In_opt_ void *user_data,
|
_In_opt_ void *user_data,
|
||||||
_In_ time_t stop_time,
|
_In_ time_t stop_time, _In_ switch_media_bug_flag_t flags, _Out_ switch_media_bug_t **new_bug);
|
||||||
_In_ switch_media_bug_flag_t flags,
|
|
||||||
_Out_ switch_media_bug_t **new_bug);
|
|
||||||
/*!
|
/*!
|
||||||
\brief Obtain private data from a media bug
|
\brief Obtain private data from a media bug
|
||||||
\param bug the bug to get the data from
|
\param bug the bug to get the data from
|
||||||
@ -221,8 +219,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(_In_ switch_media_bug
|
|||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_new(_In_ switch_port_t start,
|
SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_new(_In_ switch_port_t start,
|
||||||
_In_ switch_port_t end,
|
_In_ switch_port_t end,
|
||||||
_In_ switch_port_flag_t flags,
|
_In_ switch_port_flag_t flags, _Out_ switch_core_port_allocator_t **new_allocator);
|
||||||
_Out_ switch_core_port_allocator_t **new_allocator);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Get a port from the port allocator
|
\brief Get a port from the port allocator
|
||||||
@ -406,7 +403,8 @@ SWITCH_DECLARE(void *) switch_core_perform_permanent_alloc(_In_ switch_size_t me
|
|||||||
#define switch_core_permanent_alloc(_memory) switch_core_perform_permanent_alloc(_memory, __FILE__, __SWITCH_FUNC__, __LINE__)
|
#define switch_core_permanent_alloc(_memory) switch_core_perform_permanent_alloc(_memory, __FILE__, __SWITCH_FUNC__, __LINE__)
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE(void *) switch_core_perform_alloc(_In_ switch_memory_pool_t *pool, _In_ switch_size_t memory, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
|
SWITCH_DECLARE(void *) switch_core_perform_alloc(_In_ switch_memory_pool_t *pool, _In_ switch_size_t memory, _In_z_ const char *file,
|
||||||
|
_In_z_ const char *func, _In_ int line);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Allocate memory directly from a memory pool
|
\brief Allocate memory directly from a memory pool
|
||||||
@ -416,7 +414,8 @@ SWITCH_DECLARE(void *) switch_core_perform_alloc(_In_ switch_memory_pool_t *pool
|
|||||||
*/
|
*/
|
||||||
#define switch_core_alloc(_pool, _mem) switch_core_perform_alloc(_pool, _mem, __FILE__, __SWITCH_FUNC__, __LINE__)
|
#define switch_core_alloc(_pool, _mem) switch_core_perform_alloc(_pool, _mem, __FILE__, __SWITCH_FUNC__, __LINE__)
|
||||||
|
|
||||||
_Ret_ SWITCH_DECLARE(void *) switch_core_perform_session_alloc(_In_ switch_core_session_t *session, _In_ switch_size_t memory, const char *file, const char *func, int line);
|
_Ret_ SWITCH_DECLARE(void *) switch_core_perform_session_alloc(_In_ switch_core_session_t *session, _In_ switch_size_t memory, const char *file,
|
||||||
|
const char *func, int line);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Allocate memory from a session's pool
|
\brief Allocate memory from a session's pool
|
||||||
@ -439,7 +438,8 @@ SWITCH_DECLARE(char *) switch_core_perform_permanent_strdup(_In_z_ const char *t
|
|||||||
#define switch_core_permanent_strdup(_todup) switch_core_perform_permanent_strdup(_todup, __FILE__, __SWITCH_FUNC__, __LINE__)
|
#define switch_core_permanent_strdup(_todup) switch_core_perform_permanent_strdup(_todup, __FILE__, __SWITCH_FUNC__, __LINE__)
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE(char *) switch_core_perform_session_strdup(_In_ switch_core_session_t *session, _In_z_ const char *todup, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
|
SWITCH_DECLARE(char *) switch_core_perform_session_strdup(_In_ switch_core_session_t *session, _In_z_ const char *todup, _In_z_ const char *file,
|
||||||
|
_In_z_ const char *func, _In_ int line);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Copy a string using memory allocation from a session's pool
|
\brief Copy a string using memory allocation from a session's pool
|
||||||
@ -450,7 +450,8 @@ SWITCH_DECLARE(char *) switch_core_perform_session_strdup(_In_ switch_core_sessi
|
|||||||
#define switch_core_session_strdup(_session, _todup) switch_core_perform_session_strdup(_session, _todup, __FILE__, __SWITCH_FUNC__, __LINE__)
|
#define switch_core_session_strdup(_session, _todup) switch_core_perform_session_strdup(_session, _todup, __FILE__, __SWITCH_FUNC__, __LINE__)
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE(char *) switch_core_perform_strdup(_In_ switch_memory_pool_t *pool, _In_z_ const char *todup, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
|
SWITCH_DECLARE(char *) switch_core_perform_strdup(_In_ switch_memory_pool_t *pool, _In_z_ const char *todup, _In_z_ const char *file,
|
||||||
|
_In_z_ const char *func, _In_ int line);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Copy a string using memory allocation from a given pool
|
\brief Copy a string using memory allocation from a given pool
|
||||||
@ -620,7 +621,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(_In_ switch_co
|
|||||||
\param indication the indication message to pass
|
\param indication the indication message to pass
|
||||||
\return SWITCH_STATUS_SUCCESS if the message was passed
|
\return SWITCH_STATUS_SUCCESS if the message was passed
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(_In_ switch_core_session_t *session, _In_ switch_core_session_message_types_t indication);
|
SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(_In_ switch_core_session_t *session,
|
||||||
|
_In_ switch_core_session_message_types_t indication);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Queue an indication message on a session
|
\brief Queue an indication message on a session
|
||||||
@ -628,7 +630,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(_In_ switch_
|
|||||||
\param indication the indication message to queue
|
\param indication the indication message to queue
|
||||||
\return SWITCH_STATUS_SUCCESS if the message was queued
|
\return SWITCH_STATUS_SUCCESS if the message was queued
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(_In_ switch_core_session_t *session, _In_ switch_core_session_message_types_t indication);
|
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(_In_ switch_core_session_t *session,
|
||||||
|
_In_ switch_core_session_message_types_t indication);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief DE-Queue an message on a given session
|
\brief DE-Queue an message on a given session
|
||||||
@ -656,17 +659,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_event_send(_In_z_ const char
|
|||||||
SWITCH_DECLARE(switch_app_log_t *) switch_core_session_get_app_log(_In_ switch_core_session_t *session);
|
SWITCH_DECLARE(switch_app_log_t *) switch_core_session_get_app_log(_In_ switch_core_session_t *session);
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_exec(_In_ switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_core_session_exec(_In_ switch_core_session_t *session,
|
||||||
_In_ const switch_application_interface_t *application_interface,
|
_In_ const switch_application_interface_t *application_interface, _In_opt_z_ const char *arg);
|
||||||
_In_opt_z_ const char *arg);
|
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application(_In_ switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application(_In_ switch_core_session_t *session,
|
||||||
_In_ const char *app,
|
_In_ const char *app, _In_opt_z_ const char *arg);
|
||||||
_In_opt_z_ const char *arg);
|
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(_In_ switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(_In_ switch_core_session_t *session,
|
||||||
_In_z_ const char *exten,
|
_In_z_ const char *exten,
|
||||||
_In_opt_z_ const char *dialplan,
|
_In_opt_z_ const char *dialplan, _In_opt_z_ const char *context);
|
||||||
_In_opt_z_ const char *context);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Send an event to a session translating it to it's native message format
|
\brief Send an event to a session translating it to it's native message format
|
||||||
@ -721,8 +721,7 @@ SWITCH_DECLARE(int) switch_core_session_get_stream_count(_In_ switch_core_sessio
|
|||||||
\param obj an arguement
|
\param obj an arguement
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(void) switch_core_session_launch_thread(_In_ switch_core_session_t *session,
|
SWITCH_DECLARE(void) switch_core_session_launch_thread(_In_ switch_core_session_t *session,
|
||||||
_In_ void *(*func) (switch_thread_t *, void *),
|
_In_ void *(*func) (switch_thread_t *, void *), _In_opt_ void *obj);
|
||||||
_In_opt_ void *obj);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Signal a thread using a thread session to terminate
|
\brief Signal a thread using a thread session to terminate
|
||||||
@ -737,8 +736,7 @@ SWITCH_DECLARE(void) switch_core_thread_session_end(_In_ switch_core_thread_sess
|
|||||||
\param thread_session the thread_session to use
|
\param thread_session the thread_session to use
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(void) switch_core_service_session(_In_ switch_core_session_t *session,
|
SWITCH_DECLARE(void) switch_core_service_session(_In_ switch_core_session_t *session,
|
||||||
_In_ switch_core_thread_session_t *thread_session,
|
_In_ switch_core_thread_session_t *thread_session, _In_ int stream_id);
|
||||||
_In_ int stream_id);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Request an outgoing session spawned from an existing session using a desired endpoing module
|
\brief Request an outgoing session spawned from an existing session using a desired endpoing module
|
||||||
@ -756,13 +754,11 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(_In_opt
|
|||||||
_In_z_ const char *endpoint_name,
|
_In_z_ const char *endpoint_name,
|
||||||
_In_ switch_caller_profile_t *caller_profile,
|
_In_ switch_caller_profile_t *caller_profile,
|
||||||
_Inout_ switch_core_session_t **new_session,
|
_Inout_ switch_core_session_t **new_session,
|
||||||
_Inout_ switch_memory_pool_t **pool,
|
_Inout_ switch_memory_pool_t **pool, _In_ switch_originate_flag_t flags);
|
||||||
_In_ switch_originate_flag_t flags);
|
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_call_cause_t) switch_core_session_resurrect_channel(_In_z_ const char *endpoint_name,
|
SWITCH_DECLARE(switch_call_cause_t) switch_core_session_resurrect_channel(_In_z_ const char *endpoint_name,
|
||||||
_Inout_ switch_core_session_t **new_session,
|
_Inout_ switch_core_session_t **new_session,
|
||||||
_Inout_ switch_memory_pool_t **pool,
|
_Inout_ switch_memory_pool_t **pool, _In_ void *data);
|
||||||
_In_ void *data);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Receive a message on a given session
|
\brief Receive a message on a given session
|
||||||
@ -837,7 +833,8 @@ SWITCH_DECLARE(uint32_t) switch_core_session_flush_private_events(switch_core_se
|
|||||||
\param stream_id which logical media channel to use
|
\param stream_id which logical media channel to use
|
||||||
\return SWITCH_STATUS_SUCCESS a the frame was read
|
\return SWITCH_STATUS_SUCCESS a the frame was read
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
|
SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
|
||||||
|
int stream_id);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Read a video frame from a session
|
\brief Read a video frame from a session
|
||||||
@ -847,7 +844,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(_In_ switch_core_
|
|||||||
\param stream_id which logical media channel to use
|
\param stream_id which logical media channel to use
|
||||||
\return SWITCH_STATUS_SUCCESS a if the frame was read
|
\return SWITCH_STATUS_SUCCESS a if the frame was read
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
|
SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
|
||||||
|
int stream_id);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Write a video frame to a session
|
\brief Write a video frame to a session
|
||||||
@ -857,7 +855,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(_In_ switch
|
|||||||
\param stream_id which logical media channel to use
|
\param stream_id which logical media channel to use
|
||||||
\return SWITCH_STATUS_SUCCESS a if the frame was written
|
\return SWITCH_STATUS_SUCCESS a if the frame was written
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
|
SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags,
|
||||||
|
int stream_id);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Reset the buffers and resampler on a session
|
\brief Reset the buffers and resampler on a session
|
||||||
@ -874,7 +873,8 @@ SWITCH_DECLARE(void) switch_core_session_reset(_In_ switch_core_session_t *sessi
|
|||||||
\param stream_id which logical media channel to use
|
\param stream_id which logical media channel to use
|
||||||
\return SWITCH_STATUS_SUCCESS a the frame was written
|
\return SWITCH_STATUS_SUCCESS a the frame was written
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
|
SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags,
|
||||||
|
int stream_id);
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_perform_kill_channel(_In_ switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_core_session_perform_kill_channel(_In_ switch_core_session_t *session,
|
||||||
@ -944,7 +944,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(_In_ switch_hash_t * has
|
|||||||
\return SWITCH_STATUS_SUCCESS if the data is added
|
\return SWITCH_STATUS_SUCCESS if the data is added
|
||||||
\note the string key must be a constant or a dynamic string
|
\note the string key must be a constant or a dynamic string
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(_In_ switch_hash_t * hash, _In_z_ const char *key, _In_opt_ const void *data, _In_ switch_mutex_t *mutex);
|
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ const void *data,
|
||||||
|
_In_ switch_mutex_t *mutex);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Delete data from a hash based on desired key
|
\brief Delete data from a hash based on desired key
|
||||||
@ -983,7 +984,8 @@ SWITCH_DECLARE(void *) switch_core_hash_find_locked(_In_ switch_hash_t * hash, _
|
|||||||
|
|
||||||
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(char *depricate_me, _In_ switch_hash_t *hash);
|
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(char *depricate_me, _In_ switch_hash_t *hash);
|
||||||
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(_In_ switch_hash_index_t *hi);
|
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(_In_ switch_hash_index_t *hi);
|
||||||
SWITCH_DECLARE(void) switch_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptrdiff_cap_(klen) const void **key, _Out_opt_ switch_ssize_t *klen, _Out_ void **val);
|
SWITCH_DECLARE(void) switch_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptrdiff_cap_(klen)
|
||||||
|
const void **key, _Out_opt_ switch_ssize_t *klen, _Out_ void **val);
|
||||||
|
|
||||||
///\}
|
///\}
|
||||||
|
|
||||||
@ -999,7 +1001,8 @@ SWITCH_DECLARE(void) switch_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptr
|
|||||||
\param pool the memory pool to use for allocation
|
\param pool the memory pool to use for allocation
|
||||||
\return
|
\return
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, const char *timer_name, int interval, int samples, switch_memory_pool_t *pool);
|
SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, const char *timer_name, int interval, int samples,
|
||||||
|
switch_memory_pool_t *pool);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Wait for one cycle on an existing timer
|
\brief Wait for one cycle on an existing timer
|
||||||
@ -1214,9 +1217,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
|
|||||||
_In_ switch_file_handle_t *fh,
|
_In_ switch_file_handle_t *fh,
|
||||||
_In_z_ const char *file_path,
|
_In_z_ const char *file_path,
|
||||||
_In_ uint8_t channels,
|
_In_ uint8_t channels,
|
||||||
_In_ uint32_t rate,
|
_In_ uint32_t rate, _In_ unsigned int flags, _In_opt_ switch_memory_pool_t *pool);
|
||||||
_In_ unsigned int flags,
|
|
||||||
_In_opt_ switch_memory_pool_t *pool);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Open a media file using file format modules
|
\brief Open a media file using file format modules
|
||||||
@ -1305,8 +1306,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(_In_ switch_speech_handl
|
|||||||
const char *module_name,
|
const char *module_name,
|
||||||
const char *voice_name,
|
const char *voice_name,
|
||||||
_In_ unsigned int rate,
|
_In_ unsigned int rate,
|
||||||
_In_ unsigned int interval,
|
_In_ unsigned int interval, switch_speech_flag_t *flags, _In_ switch_memory_pool_t *pool);
|
||||||
switch_speech_flag_t *flags, _In_ switch_memory_pool_t *pool);
|
|
||||||
/*!
|
/*!
|
||||||
\brief Feed text to the TTS module
|
\brief Feed text to the TTS module
|
||||||
\param sh the speech handle to feed
|
\param sh the speech handle to feed
|
||||||
@ -1379,11 +1379,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_close(switch_speech_handle_t
|
|||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_asr_open(switch_asr_handle_t *ah,
|
SWITCH_DECLARE(switch_status_t) switch_core_asr_open(switch_asr_handle_t *ah,
|
||||||
const char *module_name,
|
const char *module_name,
|
||||||
const char *codec,
|
const char *codec, int rate, const char *dest, switch_asr_flag_t *flags, switch_memory_pool_t *pool);
|
||||||
int rate,
|
|
||||||
const char *dest,
|
|
||||||
switch_asr_flag_t *flags,
|
|
||||||
switch_memory_pool_t *pool);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Close an asr handle
|
\brief Close an asr handle
|
||||||
|
@ -32,8 +32,7 @@
|
|||||||
#define SWITCH_EVENT_HOOKS_H
|
#define SWITCH_EVENT_HOOKS_H
|
||||||
|
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
SWITCH_BEGIN_EXTERN_C
|
SWITCH_BEGIN_EXTERN_C typedef struct switch_io_event_hooks switch_io_event_hooks_t;
|
||||||
typedef struct switch_io_event_hooks switch_io_event_hooks_t;
|
|
||||||
|
|
||||||
typedef struct switch_io_event_hook_outgoing_channel switch_io_event_hook_outgoing_channel_t;
|
typedef struct switch_io_event_hook_outgoing_channel switch_io_event_hook_outgoing_channel_t;
|
||||||
typedef struct switch_io_event_hook_receive_message switch_io_event_hook_receive_message_t;
|
typedef struct switch_io_event_hook_receive_message switch_io_event_hook_receive_message_t;
|
||||||
|
@ -8,36 +8,23 @@ extern "C" {
|
|||||||
#ifdef DOH
|
#ifdef DOH
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
#define this_check(x) do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n"); return x;}} while(0)
|
#define this_check(x) do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n"); return x;}} while(0)
|
||||||
#define this_check_void() do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n");}} while(0)
|
#define this_check_void() do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n");}} while(0)
|
||||||
|
|
||||||
#define sanity_check(x) do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
|
#define sanity_check(x) do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
|
||||||
#define sanity_check_noreturn do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return;}} while(0)
|
#define sanity_check_noreturn do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return;}} while(0)
|
||||||
#define init_vars() do { allocated = 0; session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; xml_cdr_text = NULL; memset(&args, 0, sizeof(args)); ap = NULL; caller_profile.source = "mod_unknown"; caller_profile.dialplan = ""; caller_profile.context = ""; caller_profile.caller_id_name = ""; caller_profile.caller_id_number = ""; caller_profile.network_addr = ""; caller_profile.ani = ""; caller_profile.aniii = ""; caller_profile.rdnis = ""; caller_profile.username = ""; on_hangup = NULL; memset(&cb_state, 0, sizeof(cb_state)); hook_state = CS_NEW; } while(0)
|
#define init_vars() do { allocated = 0; session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; xml_cdr_text = NULL; memset(&args, 0, sizeof(args)); ap = NULL; caller_profile.source = "mod_unknown"; caller_profile.dialplan = ""; caller_profile.context = ""; caller_profile.caller_id_name = ""; caller_profile.caller_id_number = ""; caller_profile.network_addr = ""; caller_profile.ani = ""; caller_profile.aniii = ""; caller_profile.rdnis = ""; caller_profile.username = ""; on_hangup = NULL; memset(&cb_state, 0, sizeof(cb_state)); hook_state = CS_NEW; } while(0)
|
||||||
|
//// C++ Interface: switch_to_cpp_mempool//// Description: This class allows for overloading the new operator to allocate from a switch_memory_pool_t//// Author: Yossi Neiman <freeswitch@cartissolutions.com>, (C) 2007//// Copyright: See COPYING file that comes with this distribution//
|
||||||
|
|
||||||
//
|
|
||||||
// C++ Interface: switch_to_cpp_mempool
|
|
||||||
//
|
|
||||||
// Description: This class allows for overloading the new operator to allocate from a switch_memory_pool_t
|
|
||||||
//
|
|
||||||
// Author: Yossi Neiman <freeswitch@cartissolutions.com>, (C) 2007
|
|
||||||
//
|
|
||||||
// Copyright: See COPYING file that comes with this distribution
|
|
||||||
//
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#ifndef SWITCHTOMEMPOOL
|
#ifndef SWITCHTOMEMPOOL
|
||||||
#define SWITCHTOMEMPOOL
|
#define SWITCHTOMEMPOOL
|
||||||
class SwitchToMempool {
|
class SwitchToMempool {
|
||||||
public:
|
public:
|
||||||
SwitchToMempool() { }
|
SwitchToMempool() {
|
||||||
SwitchToMempool(switch_memory_pool_t *mem) { memorypool = mem; }
|
} SwitchToMempool(switch_memory_pool_t *mem) {
|
||||||
void *operator new(switch_size_t num_bytes, switch_memory_pool_t *mem)
|
memorypool = mem;
|
||||||
{
|
}
|
||||||
|
void *operator new(switch_size_t num_bytes, switch_memory_pool_t *mem) {
|
||||||
void *ptr = switch_core_alloc(mem, (switch_size_t) num_bytes);
|
void *ptr = switch_core_alloc(mem, (switch_size_t) num_bytes);
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
@ -81,12 +68,7 @@ class IVRMenu {
|
|||||||
const char *exit_sound,
|
const char *exit_sound,
|
||||||
const char *confirm_macro,
|
const char *confirm_macro,
|
||||||
const char *confirm_key,
|
const char *confirm_key,
|
||||||
int confirm_attempts,
|
int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures);
|
||||||
int inter_timeout,
|
|
||||||
int digit_len,
|
|
||||||
int timeout,
|
|
||||||
int max_failures
|
|
||||||
);
|
|
||||||
virtual SWITCH_DECLARE_CONSTRUCTOR ~ IVRMenu();
|
virtual SWITCH_DECLARE_CONSTRUCTOR ~ IVRMenu();
|
||||||
SWITCH_DECLARE(void) bindAction(char *action, const char *arg, const char *bind);
|
SWITCH_DECLARE(void) bindAction(char *action, const char *arg, const char *bind);
|
||||||
SWITCH_DECLARE(void) execute(CoreSession * session, const char *name);
|
SWITCH_DECLARE(void) execute(CoreSession * session, const char *name);
|
||||||
@ -222,9 +204,7 @@ class CoreSession {
|
|||||||
* \return an int status code indicating success or failure
|
* \return an int status code indicating success or failure
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(int) originate(CoreSession *a_leg_session,
|
SWITCH_DECLARE(int) originate(CoreSession * a_leg_session, char *dest, int timeout = 60);
|
||||||
char *dest,
|
|
||||||
int timeout=60);
|
|
||||||
|
|
||||||
|
|
||||||
/** \brief set a DTMF callback function
|
/** \brief set a DTMF callback function
|
||||||
@ -253,19 +233,12 @@ class CoreSession {
|
|||||||
* (see mod_python.i). This does NOT call any callbacks upon
|
* (see mod_python.i). This does NOT call any callbacks upon
|
||||||
* receiving dtmf digits. For that, use collectDigits.
|
* receiving dtmf digits. For that, use collectDigits.
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(char *) getDigits(
|
SWITCH_DECLARE(char *) getDigits(int maxdigits, char *terminators, int timeout);
|
||||||
int maxdigits,
|
|
||||||
char *terminators,
|
|
||||||
int timeout);
|
|
||||||
|
|
||||||
SWITCH_DECLARE(int) transfer(char *extensions, char *dialplan, char *context);
|
SWITCH_DECLARE(int) transfer(char *extensions, char *dialplan, char *context);
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE(char *) read(int min_digits,
|
SWITCH_DECLARE(char *) read(int min_digits, int max_digits, const char *prompt_audio_file, int timeout, const char *valid_terminators);
|
||||||
int max_digits,
|
|
||||||
const char *prompt_audio_file,
|
|
||||||
int timeout,
|
|
||||||
const char *valid_terminators);
|
|
||||||
|
|
||||||
/** \brief Play a file into channel and collect dtmfs
|
/** \brief Play a file into channel and collect dtmfs
|
||||||
*
|
*
|
||||||
@ -278,11 +251,7 @@ class CoreSession {
|
|||||||
SWITCH_DECLARE(char *) playAndGetDigits(int min_digits,
|
SWITCH_DECLARE(char *) playAndGetDigits(int min_digits,
|
||||||
int max_digits,
|
int max_digits,
|
||||||
int max_tries,
|
int max_tries,
|
||||||
int timeout,
|
int timeout, char *terminators, char *audio_files, char *bad_input_audio_files, char *digits_regex);
|
||||||
char *terminators,
|
|
||||||
char *audio_files,
|
|
||||||
char *bad_input_audio_files,
|
|
||||||
char *digits_regex);
|
|
||||||
|
|
||||||
/** \brief Play a file that resides on disk into the channel
|
/** \brief Play a file that resides on disk into the channel
|
||||||
*
|
*
|
||||||
@ -324,19 +293,22 @@ class CoreSession {
|
|||||||
/** \brief Get the uuid of this session
|
/** \brief Get the uuid of this session
|
||||||
* \return the uuid of this session
|
* \return the uuid of this session
|
||||||
*/
|
*/
|
||||||
char* get_uuid() const { return uuid; };
|
char *get_uuid() const {
|
||||||
|
return uuid;
|
||||||
|
};
|
||||||
|
|
||||||
/** \brief Get the callback function arguments associated with this session
|
/** \brief Get the callback function arguments associated with this session
|
||||||
* \return a const reference to the callback function arguments
|
* \return a const reference to the callback function arguments
|
||||||
*/
|
*/
|
||||||
const switch_input_args_t& get_cb_args() const { return args; };
|
const switch_input_args_t &get_cb_args() const {
|
||||||
|
return args;
|
||||||
|
};
|
||||||
|
|
||||||
/** \brief Callback to the language specific hangup callback
|
/** \brief Callback to the language specific hangup callback
|
||||||
*/
|
*/
|
||||||
virtual void check_hangup_hook() = 0;
|
virtual void check_hangup_hook() = 0;
|
||||||
|
|
||||||
virtual switch_status_t run_dtmf_callback(void *input,
|
virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype) = 0;
|
||||||
switch_input_type_t itype) = 0;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -361,10 +333,7 @@ SWITCH_DECLARE(void) bridge(CoreSession &session_a, CoreSession &session_b);
|
|||||||
SWITCH_DECLARE_NONSTD(switch_status_t) hanguphook(switch_core_session_t *session);
|
SWITCH_DECLARE_NONSTD(switch_status_t) hanguphook(switch_core_session_t *session);
|
||||||
|
|
||||||
SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *session,
|
SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *session,
|
||||||
void *input,
|
void *input, switch_input_type_t itype, void *buf, unsigned int buflen);
|
||||||
switch_input_type_t itype,
|
|
||||||
void *buf,
|
|
||||||
unsigned int buflen);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -382,4 +351,3 @@ SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *sess
|
|||||||
* For VIM:
|
* For VIM:
|
||||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
|
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -41,9 +41,7 @@
|
|||||||
|
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
SWITCH_BEGIN_EXTERN_C
|
SWITCH_BEGIN_EXTERN_C struct switch_unicast_conninfo {
|
||||||
|
|
||||||
struct switch_unicast_conninfo {
|
|
||||||
switch_core_session_t *session;
|
switch_core_session_t *session;
|
||||||
switch_codec_t read_codec;
|
switch_codec_t read_codec;
|
||||||
switch_frame_t write_frame;
|
switch_frame_t write_frame;
|
||||||
@ -76,10 +74,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_deactivate_unicast(switch_core_sessio
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_t *session,
|
||||||
char *local_ip,
|
char *local_ip,
|
||||||
switch_port_t local_port,
|
switch_port_t local_port,
|
||||||
char *remote_ip,
|
char *remote_ip, switch_port_t remote_port, char *transport, char *flags);
|
||||||
switch_port_t remote_port,
|
|
||||||
char *transport,
|
|
||||||
char *flags);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Generate an XML CDR report.
|
\brief Generate an XML CDR report.
|
||||||
@ -145,9 +140,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
|
|||||||
switch_size_t buflen,
|
switch_size_t buflen,
|
||||||
switch_size_t maxdigits,
|
switch_size_t maxdigits,
|
||||||
const char *terminators, char *terminator,
|
const char *terminators, char *terminator,
|
||||||
uint32_t first_timeout,
|
uint32_t first_timeout, uint32_t digit_timeout, uint32_t abs_timeout);
|
||||||
uint32_t digit_timeout,
|
|
||||||
uint32_t abs_timeout);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Engage background Speech detection on a session
|
\brief Engage background Speech detection on a session
|
||||||
@ -161,9 +154,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
|
|||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session,
|
||||||
const char *mod_name,
|
const char *mod_name,
|
||||||
const char *grammar,
|
const char *grammar, const char *path, const char *dest, switch_asr_handle_t *ah);
|
||||||
const char *path,
|
|
||||||
const char *dest, switch_asr_handle_t *ah);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Stop background Speech detection on a session
|
\brief Stop background Speech detection on a session
|
||||||
@ -222,9 +213,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
|
|||||||
\return SWITCH_STATUS_SUCESS if all is well
|
\return SWITCH_STATUS_SUCESS if all is well
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session_t *session,
|
||||||
const char *uuid,
|
const char *uuid, const char *require_group, switch_eavesdrop_flag_t flags);
|
||||||
const char *require_group,
|
|
||||||
switch_eavesdrop_flag_t flags);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief displace the media for a session with the audio from a file
|
\brief displace the media for a session with the audio from a file
|
||||||
@ -309,8 +298,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_tone_detect_session(switch_core_
|
|||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_session_t *session,
|
||||||
const char *key, const char *tone_spec,
|
const char *key, const char *tone_spec,
|
||||||
const char *flags, time_t timeout,
|
const char *flags, time_t timeout, const char *app, const char *data);
|
||||||
const char *app, const char *data);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -322,7 +310,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi
|
|||||||
\param args arguements to pass for callbacks etc
|
\param args arguements to pass for callbacks etc
|
||||||
\return SWITCH_STATUS_SUCCESS if all is well
|
\return SWITCH_STATUS_SUCCESS if all is well
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, const char *file, switch_input_args_t *args);
|
SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, const char *file,
|
||||||
|
switch_input_args_t *args);
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *session, char *script, int32_t loops, switch_input_args_t *args);
|
SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *session, char *script, int32_t loops, switch_input_args_t *args);
|
||||||
|
|
||||||
@ -337,9 +326,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi
|
|||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(_In_ switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(_In_ switch_core_session_t *session,
|
||||||
_In_ switch_file_handle_t *fh,
|
_In_ switch_file_handle_t *fh,
|
||||||
_In_z_ const char *file,
|
_In_z_ const char *file, _In_opt_ switch_input_args_t *args, _In_ uint32_t limit);
|
||||||
_In_opt_ switch_input_args_t *args,
|
|
||||||
_In_ uint32_t limit);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -407,8 +394,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||||||
const switch_state_handler_table_t *table,
|
const switch_state_handler_table_t *table,
|
||||||
const char *cid_name_override,
|
const char *cid_name_override,
|
||||||
const char *cid_num_override,
|
const char *cid_num_override,
|
||||||
switch_caller_profile_t *caller_profile_override,
|
switch_caller_profile_t *caller_profile_override, switch_originate_flag_t flags);
|
||||||
switch_originate_flag_t flags);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Bridge Audio from one session to another
|
\brief Bridge Audio from one session to another
|
||||||
@ -439,7 +425,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *
|
|||||||
\param dialplan the new dialplan (OPTIONAL, may be NULL)
|
\param dialplan the new dialplan (OPTIONAL, may be NULL)
|
||||||
\param context the new context (OPTIONAL, may be NULL)
|
\param context the new context (OPTIONAL, may be NULL)
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(_In_ switch_core_session_t *session, const char *extension, const char *dialplan, const char *context);
|
SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(_In_ switch_core_session_t *session, const char *extension, const char *dialplan,
|
||||||
|
const char *context);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Transfer an existing session to another location in the future
|
\brief Transfer an existing session to another location in the future
|
||||||
@ -690,10 +677,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_me
|
|||||||
const char *confirm_macro,
|
const char *confirm_macro,
|
||||||
const char *confirm_key,
|
const char *confirm_key,
|
||||||
int confirm_attempts,
|
int confirm_attempts,
|
||||||
int inter_timeout,
|
int inter_timeout, int digit_len, int timeout, int max_failures, switch_memory_pool_t *pool);
|
||||||
int digit_len,
|
|
||||||
int timeout, int max_failures,
|
|
||||||
switch_memory_pool_t *pool);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*\brief switch_ivr_menu_bind_action: Bind a keystroke to an action.
|
*\brief switch_ivr_menu_bind_action: Bind a keystroke to an action.
|
||||||
@ -703,7 +687,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_me
|
|||||||
*\param bind KeyStrokes to bind the action to.
|
*\param bind KeyStrokes to bind the action to.
|
||||||
*\return SWUTCH_STATUS_SUCCESS if the action was binded
|
*\return SWUTCH_STATUS_SUCCESS if the action was binded
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t * menu, switch_ivr_action_t ivr_action, const char *arg, const char *bind);
|
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t *menu, switch_ivr_action_t ivr_action, const char *arg,
|
||||||
|
const char *bind);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -783,15 +768,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
|
|||||||
const char *prompt_audio_file,
|
const char *prompt_audio_file,
|
||||||
const char *var_name,
|
const char *var_name,
|
||||||
char *digit_buffer,
|
char *digit_buffer,
|
||||||
switch_size_t digit_buffer_length,
|
switch_size_t digit_buffer_length, uint32_t timeout, const char *valid_terminators);
|
||||||
uint32_t timeout,
|
|
||||||
const char *valid_terminators);
|
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key,
|
||||||
switch_bind_flag_t bind_flags, const char *app);
|
switch_bind_flag_t bind_flags, const char *app);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session);
|
SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *session, const char *unhold_key, const char *moh_a, const char *moh_b);
|
SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *session, const char *unhold_key, const char *moh_a, const char *moh_b);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type, const char *say_method, switch_input_args_t *args);
|
SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type,
|
||||||
|
const char *say_method, switch_input_args_t *args);
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name);
|
SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name);
|
||||||
SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name);
|
SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name);
|
||||||
|
@ -128,8 +128,7 @@ SWITCH_DECLARE(switch_dialplan_interface_t *) switch_loadable_module_get_dialpla
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_loadable_module_build_dynamic(char *filename,
|
SWITCH_DECLARE(switch_status_t) switch_loadable_module_build_dynamic(char *filename,
|
||||||
switch_module_load_t switch_module_load,
|
switch_module_load_t switch_module_load,
|
||||||
switch_module_runtime_t switch_module_runtime,
|
switch_module_runtime_t switch_module_runtime,
|
||||||
switch_module_shutdown_t switch_module_shutdown,
|
switch_module_shutdown_t switch_module_shutdown, switch_bool_t runtime);
|
||||||
switch_bool_t runtime);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -317,8 +316,7 @@ SWITCH_DECLARE(uint32_t) switch_core_codec_next_id(void);
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void switch_core_codec_add_implementation(switch_memory_pool_t *pool,
|
static inline void switch_core_codec_add_implementation(switch_memory_pool_t *pool, switch_codec_interface_t *codec_interface,
|
||||||
switch_codec_interface_t *codec_interface,
|
|
||||||
/*! enumeration defining the type of the codec */
|
/*! enumeration defining the type of the codec */
|
||||||
const switch_codec_type_t codec_type,
|
const switch_codec_type_t codec_type,
|
||||||
/*! the IANA code number */
|
/*! the IANA code number */
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
SWITCH_BEGIN_EXTERN_C
|
SWITCH_BEGIN_EXTERN_C
|
||||||
/*! \brief A table of functions to execute at various states
|
/*! \brief A table of functions to execute at various states
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SWITCH_SHN_ON_INIT,
|
SWITCH_SHN_ON_INIT,
|
||||||
SWITCH_SHN_ON_ROUTING,
|
SWITCH_SHN_ON_ROUTING,
|
||||||
@ -100,6 +99,30 @@ struct switch_io_event_hooks;
|
|||||||
|
|
||||||
|
|
||||||
typedef switch_call_cause_t (*switch_io_outgoing_channel_t)
|
typedef switch_call_cause_t (*switch_io_outgoing_channel_t)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t);
|
(switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t);
|
||||||
typedef switch_status_t (*switch_io_read_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
|
typedef switch_status_t (*switch_io_read_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
|
||||||
typedef switch_status_t (*switch_io_write_frame_t) (switch_core_session_t *, switch_frame_t *, switch_io_flag_t, int);
|
typedef switch_status_t (*switch_io_write_frame_t) (switch_core_session_t *, switch_frame_t *, switch_io_flag_t, int);
|
||||||
|
@ -44,9 +44,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <sqltypes.h>
|
#include <sqltypes.h>
|
||||||
|
|
||||||
SWITCH_BEGIN_EXTERN_C
|
SWITCH_BEGIN_EXTERN_C struct switch_odbc_handle;
|
||||||
|
|
||||||
struct switch_odbc_handle;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SWITCH_ODBC_STATE_INIT,
|
SWITCH_ODBC_STATE_INIT,
|
||||||
@ -70,7 +68,6 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec(switch_odb
|
|||||||
char *sql, switch_core_db_callback_func_t callback, void *pdata);
|
char *sql, switch_core_db_callback_func_t callback, void *pdata);
|
||||||
SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, SQLHSTMT stmt);
|
SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, SQLHSTMT stmt);
|
||||||
SWITCH_END_EXTERN_C
|
SWITCH_END_EXTERN_C
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* For Emacs:
|
/* For Emacs:
|
||||||
* Local Variables:
|
* Local Variables:
|
||||||
|
@ -59,21 +59,16 @@ SWITCH_BEGIN_EXTERN_C
|
|||||||
* C4610: struct can never be instantiated - user defined constructor required
|
* C4610: struct can never be instantiated - user defined constructor required
|
||||||
*/
|
*/
|
||||||
#pragma warning(disable:4100 4200 4204 4706 4819 4132 4510 4512 4610 4996)
|
#pragma warning(disable:4100 4200 4204 4706 4819 4132 4510 4512 4610 4996)
|
||||||
|
|
||||||
#define SWITCH_HAVE_ODBC 1
|
#define SWITCH_HAVE_ODBC 1
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# pragma comment(lib, "odbc32.lib")
|
# pragma comment(lib, "odbc32.lib")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma include_alias(<libteletone.h>, <../../libs/libteletone/src/libteletone.h>)
|
#pragma include_alias(<libteletone.h>, <../../libs/libteletone/src/libteletone.h>)
|
||||||
#pragma include_alias(<libteletone_generate.h>, <../../libs/libteletone/src/libteletone_generate.h>)
|
#pragma include_alias(<libteletone_generate.h>, <../../libs/libteletone/src/libteletone_generate.h>)
|
||||||
#pragma include_alias(<libteletone_detect.h>, <../../libs/libteletone/src/libteletone_detect.h>)
|
#pragma include_alias(<libteletone_detect.h>, <../../libs/libteletone/src/libteletone_detect.h>)
|
||||||
|
|
||||||
#if (_MSC_VER >= 1400) // VC8+
|
#if (_MSC_VER >= 1400) // VC8+
|
||||||
#define switch_assert(expr) assert(expr);__analysis_assume( expr )
|
#define switch_assert(expr) assert(expr);__analysis_assume( expr )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (_MSC_VER >= 1400) // VC8+
|
#if (_MSC_VER >= 1400) // VC8+
|
||||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
#ifndef _CRT_SECURE_NO_DEPRECATE
|
||||||
#define _CRT_SECURE_NO_DEPRECATE
|
#define _CRT_SECURE_NO_DEPRECATE
|
||||||
@ -298,7 +293,6 @@ SWITCH_END_EXTERN_C
|
|||||||
#ifndef switch_assert
|
#ifndef switch_assert
|
||||||
#define switch_assert(expr) assert(expr)
|
#define switch_assert(expr) assert(expr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __ATTR_SAL
|
#ifndef __ATTR_SAL
|
||||||
/* used for msvc code analysis */
|
/* used for msvc code analysis */
|
||||||
/* http://msdn2.microsoft.com/en-us/library/ms235402.aspx */
|
/* http://msdn2.microsoft.com/en-us/library/ms235402.aspx */
|
||||||
@ -324,8 +318,6 @@ SWITCH_END_EXTERN_C
|
|||||||
#define _Out_ptrdiff_cap_(x)
|
#define _Out_ptrdiff_cap_(x)
|
||||||
#define _Out_opt_ptrdiff_cap_(x)
|
#define _Out_opt_ptrdiff_cap_(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* For Emacs:
|
/* For Emacs:
|
||||||
* Local Variables:
|
* Local Variables:
|
||||||
* mode:c
|
* mode:c
|
||||||
|
@ -45,8 +45,6 @@ SWITCH_BEGIN_EXTERN_C
|
|||||||
#define SWITCH_RTP_KEY_LEN 30
|
#define SWITCH_RTP_KEY_LEN 30
|
||||||
#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32"
|
#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32"
|
||||||
#define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80"
|
#define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80"
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SWITCH_RTP_CRYPTO_SEND,
|
SWITCH_RTP_CRYPTO_SEND,
|
||||||
SWITCH_RTP_CRYPTO_RECV,
|
SWITCH_RTP_CRYPTO_RECV,
|
||||||
@ -72,10 +70,7 @@ typedef struct switch_rtp_crypto_key switch_rtp_crypto_key_t;
|
|||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_session,
|
SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_session,
|
||||||
switch_rtp_crypto_direction_t direction,
|
switch_rtp_crypto_direction_t direction,
|
||||||
uint32_t index,
|
uint32_t index, switch_rtp_crypto_key_type_t type, unsigned char *key, switch_size_t keylen);
|
||||||
switch_rtp_crypto_key_type_t type,
|
|
||||||
unsigned char *key,
|
|
||||||
switch_size_t keylen);
|
|
||||||
|
|
||||||
///\defgroup rtp RTP (RealTime Transport Protocol)
|
///\defgroup rtp RTP (RealTime Transport Protocol)
|
||||||
///\ingroup core1
|
///\ingroup core1
|
||||||
@ -130,10 +125,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
|
|||||||
switch_payload_t payload,
|
switch_payload_t payload,
|
||||||
uint32_t samples_per_interval,
|
uint32_t samples_per_interval,
|
||||||
uint32_t ms_per_packet,
|
uint32_t ms_per_packet,
|
||||||
switch_rtp_flag_t flags,
|
switch_rtp_flag_t flags, char *timer_name, const char **err, switch_memory_pool_t *pool);
|
||||||
char *timer_name,
|
|
||||||
const char **err,
|
|
||||||
switch_memory_pool_t *pool);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -158,10 +150,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
|
|||||||
switch_payload_t payload,
|
switch_payload_t payload,
|
||||||
uint32_t samples_per_interval,
|
uint32_t samples_per_interval,
|
||||||
uint32_t ms_per_packet,
|
uint32_t ms_per_packet,
|
||||||
switch_rtp_flag_t flags,
|
switch_rtp_flag_t flags, char *timer_name, const char **err, switch_memory_pool_t *pool);
|
||||||
char *timer_name,
|
|
||||||
const char **err,
|
|
||||||
switch_memory_pool_t *pool);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -341,7 +330,8 @@ SWITCH_DECLARE(switch_size_t) switch_rtp_dequeue_dtmf(switch_rtp_t *rtp_session,
|
|||||||
\return the number of bytes read
|
\return the number of bytes read
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_session,
|
SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_session,
|
||||||
void **data, uint32_t * datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags);
|
void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags,
|
||||||
|
switch_io_flag_t io_flags);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Read data from a given RTP session without copying
|
\brief Read data from a given RTP session without copying
|
||||||
@ -390,9 +380,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
|
|||||||
\return the number of bytes written
|
\return the number of bytes written
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
|
SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
|
||||||
void *data,
|
void *data, uint32_t datalen, uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags);
|
||||||
uint32_t datalen,
|
|
||||||
uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Retrieve the SSRC from a given RTP session
|
\brief Retrieve the SSRC from a given RTP session
|
||||||
|
@ -91,11 +91,9 @@ SWITCH_BEGIN_EXTERN_C
|
|||||||
#define SWITCH_SEQ_CLEARLINE SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINE_CHAR_STR
|
#define SWITCH_SEQ_CLEARLINE SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINE_CHAR_STR
|
||||||
#define SWITCH_SEQ_CLEARLINEEND SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINEEND_CHAR
|
#define SWITCH_SEQ_CLEARLINEEND SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINEEND_CHAR
|
||||||
#define SWITCH_SEQ_CLEARSCR SWITCH_SEQ_ESC SWITCH_SEQ_CLEARSCR_CHAR SWITCH_SEQ_HOME
|
#define SWITCH_SEQ_CLEARSCR SWITCH_SEQ_ESC SWITCH_SEQ_CLEARSCR_CHAR SWITCH_SEQ_HOME
|
||||||
|
|
||||||
#define SWITCH_DEFAULT_DTMF_DURATION 2000
|
#define SWITCH_DEFAULT_DTMF_DURATION 2000
|
||||||
#define SWITCH_MAX_DTMF_DURATION 192000
|
#define SWITCH_MAX_DTMF_DURATION 192000
|
||||||
#define SWITCH_DEFAULT_DIR_PERMS SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_UEXECUTE | SWITCH_FPROT_GREAD | SWITCH_FPROT_GEXECUTE
|
#define SWITCH_DEFAULT_DIR_PERMS SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_UEXECUTE | SWITCH_FPROT_GREAD | SWITCH_FPROT_GEXECUTE
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#define SWITCH_PATH_SEPARATOR "\\"
|
#define SWITCH_PATH_SEPARATOR "\\"
|
||||||
#else
|
#else
|
||||||
@ -1214,10 +1212,7 @@ typedef switch_status_t (*switch_core_codec_encode_func_t) (switch_codec_t *code
|
|||||||
void *decoded_data,
|
void *decoded_data,
|
||||||
uint32_t decoded_data_len,
|
uint32_t decoded_data_len,
|
||||||
uint32_t decoded_rate,
|
uint32_t decoded_rate,
|
||||||
void *encoded_data,
|
void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag);
|
||||||
uint32_t * encoded_data_len,
|
|
||||||
uint32_t * encoded_rate,
|
|
||||||
unsigned int *flag);
|
|
||||||
|
|
||||||
|
|
||||||
typedef switch_status_t (*switch_core_codec_decode_func_t) (switch_codec_t *codec,
|
typedef switch_status_t (*switch_core_codec_decode_func_t) (switch_codec_t *codec,
|
||||||
@ -1225,10 +1220,7 @@ typedef switch_status_t (*switch_core_codec_decode_func_t) (switch_codec_t *code
|
|||||||
void *encoded_data,
|
void *encoded_data,
|
||||||
uint32_t encoded_data_len,
|
uint32_t encoded_data_len,
|
||||||
uint32_t encoded_rate,
|
uint32_t encoded_rate,
|
||||||
void *decoded_data,
|
void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag);
|
||||||
uint32_t * decoded_data_len,
|
|
||||||
uint32_t * decoded_rate,
|
|
||||||
unsigned int *flag);
|
|
||||||
|
|
||||||
typedef switch_status_t (*switch_core_codec_init_func_t) (switch_codec_t *, switch_codec_flag_t, const switch_codec_settings_t *codec_settings);
|
typedef switch_status_t (*switch_core_codec_init_func_t) (switch_codec_t *, switch_codec_flag_t, const switch_codec_settings_t *codec_settings);
|
||||||
typedef switch_status_t (*switch_core_codec_destroy_func_t) (switch_codec_t *);
|
typedef switch_status_t (*switch_core_codec_destroy_func_t) (switch_codec_t *);
|
||||||
@ -1255,7 +1247,8 @@ typedef struct switch_stream_handle switch_stream_handle_t;
|
|||||||
typedef switch_status_t (*switch_stream_handle_write_function_t) (switch_stream_handle_t *handle, const char *fmt, ...);
|
typedef switch_status_t (*switch_stream_handle_write_function_t) (switch_stream_handle_t *handle, const char *fmt, ...);
|
||||||
typedef switch_status_t (*switch_stream_handle_raw_write_function_t) (switch_stream_handle_t *handle, uint8_t *data, switch_size_t datalen);
|
typedef switch_status_t (*switch_stream_handle_raw_write_function_t) (switch_stream_handle_t *handle, uint8_t *data, switch_size_t datalen);
|
||||||
|
|
||||||
typedef switch_status_t (*switch_api_function_t) (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream);
|
typedef switch_status_t (*switch_api_function_t) (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session,
|
||||||
|
_In_ switch_stream_handle_t *stream);
|
||||||
|
|
||||||
#define SWITCH_STANDARD_API(name) static switch_status_t name (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream)
|
#define SWITCH_STANDARD_API(name) static switch_status_t name (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream)
|
||||||
|
|
||||||
|
@ -54,15 +54,12 @@ SWITCH_BEGIN_EXTERN_C
|
|||||||
#else
|
#else
|
||||||
#define switch_is_file_path(file) (file && ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR)))
|
#define switch_is_file_path(file) (file && ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Test for NULL or zero length string
|
\brief Test for NULL or zero length string
|
||||||
\param s the string to test
|
\param s the string to test
|
||||||
\return true value if the string is NULL or zero length
|
\return true value if the string is NULL or zero length
|
||||||
*/
|
*/
|
||||||
#define switch_strlen_zero(s) (!s || *s == '\0')
|
#define switch_strlen_zero(s) (!s || *s == '\0')
|
||||||
|
|
||||||
|
|
||||||
static inline switch_bool_t switch_is_moh(const char *s)
|
static inline switch_bool_t switch_is_moh(const char *s)
|
||||||
{
|
{
|
||||||
if (switch_strlen_zero(s) || !strcasecmp(s, "silence") || !strcasecmp(s, "indicate_hold")) {
|
if (switch_strlen_zero(s) || !strcasecmp(s, "silence") || !strcasecmp(s, "indicate_hold")) {
|
||||||
@ -78,7 +75,8 @@ SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size
|
|||||||
SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen);
|
SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen);
|
||||||
SWITCH_DECLARE(char *) switch_amp_encode(char *s, char *buf, switch_size_t len);
|
SWITCH_DECLARE(char *) switch_amp_encode(char *s, char *buf, switch_size_t len);
|
||||||
|
|
||||||
static inline switch_bool_t switch_is_digit_string(const char *s) {
|
static inline switch_bool_t switch_is_digit_string(const char *s)
|
||||||
|
{
|
||||||
|
|
||||||
while (s && *s) {
|
while (s && *s) {
|
||||||
if (*s < 48 || *s > 57) {
|
if (*s < 48 || *s > 57) {
|
||||||
@ -113,7 +111,8 @@ atoi(expr))) ? SWITCH_TRUE : SWITCH_FALSE
|
|||||||
\param family the address family to return (AF_INET or AF_INET6)
|
\param family the address family to return (AF_INET or AF_INET6)
|
||||||
\return SWITCH_STATUS_SUCCESSS for success, otherwise failure
|
\return SWITCH_STATUS_SUCCESSS for success, otherwise failure
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_find_local_ip(_Out_opt_bytecapcount_(len) char *buf, _In_ int len, _In_ int family);
|
SWITCH_DECLARE(switch_status_t) switch_find_local_ip(_Out_opt_bytecapcount_(len)
|
||||||
|
char *buf, _In_ int len, _In_ int family);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief find the char representation of an ip adress
|
\brief find the char representation of an ip adress
|
||||||
|
@ -332,10 +332,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(const char *key,
|
|||||||
const char *user_name,
|
const char *user_name,
|
||||||
const char *domain_name,
|
const char *domain_name,
|
||||||
const char *ip,
|
const char *ip,
|
||||||
switch_xml_t *root,
|
switch_xml_t *root, switch_xml_t *domain, switch_xml_t *user, switch_event_t *params);
|
||||||
switch_xml_t *domain,
|
|
||||||
switch_xml_t *user,
|
|
||||||
switch_event_t *params);
|
|
||||||
|
|
||||||
///\brief open a config in the core registry
|
///\brief open a config in the core registry
|
||||||
///\param file_path the name of the config section e.g. modules.conf
|
///\param file_path the name of the config section e.g. modules.conf
|
||||||
|
@ -124,7 +124,8 @@ SWITCH_DECLARE(int) switch_vsnprintf(char *buf, switch_size_t len, const char *f
|
|||||||
|
|
||||||
SWITCH_DECLARE(char *) switch_copy_string(char *dst, const char *src, switch_size_t dst_size)
|
SWITCH_DECLARE(char *) switch_copy_string(char *dst, const char *src, switch_size_t dst_size)
|
||||||
{
|
{
|
||||||
if (!dst) return NULL;
|
if (!dst)
|
||||||
|
return NULL;
|
||||||
if (!src) {
|
if (!src) {
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
return dst;
|
return dst;
|
||||||
@ -391,15 +392,12 @@ SWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename, switch_
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm,
|
SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool)
|
||||||
switch_memory_pool_t *pool)
|
|
||||||
{
|
{
|
||||||
return apr_dir_make(path, perm, pool);
|
return apr_dir_make(path, perm, pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path,
|
SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool)
|
||||||
switch_fileperms_t perm,
|
|
||||||
switch_memory_pool_t *pool)
|
|
||||||
{
|
{
|
||||||
return apr_dir_make_recursive(path, perm, pool);
|
return apr_dir_make_recursive(path, perm, pool);
|
||||||
}
|
}
|
||||||
@ -507,7 +505,6 @@ SWITCH_DECLARE(switch_status_t) switch_threadattr_priority_increase(switch_threa
|
|||||||
if (stat == 0) {
|
if (stat == 0) {
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return stat;
|
return stat;
|
||||||
}
|
}
|
||||||
|
@ -45,9 +45,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memor
|
|||||||
const char *ani,
|
const char *ani,
|
||||||
const char *aniii,
|
const char *aniii,
|
||||||
const char *rdnis,
|
const char *rdnis,
|
||||||
const char *source,
|
const char *source, const char *context, const char *destination_number)
|
||||||
const char *context,
|
|
||||||
const char *destination_number)
|
|
||||||
{
|
{
|
||||||
switch_caller_profile_t *profile = NULL;
|
switch_caller_profile_t *profile = NULL;
|
||||||
|
|
||||||
@ -276,7 +274,8 @@ SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_
|
|||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER) ? "yes" : "no");
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER) ? "yes" : "no");
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(switch_core_session_t *session, const char *extension_name, const char *extension_number)
|
SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(switch_core_session_t *session, const char *extension_name,
|
||||||
|
const char *extension_number)
|
||||||
{
|
{
|
||||||
switch_caller_extension_t *caller_extension = NULL;
|
switch_caller_extension_t *caller_extension = NULL;
|
||||||
|
|
||||||
@ -290,7 +289,8 @@ SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(switch_c
|
|||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session_t *session,
|
SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session_t *session,
|
||||||
switch_caller_extension_t *caller_extension, const char *application_name, const char *application_data)
|
switch_caller_extension_t *caller_extension, const char *application_name,
|
||||||
|
const char *application_data)
|
||||||
{
|
{
|
||||||
switch_caller_application_t *caller_application = NULL;
|
switch_caller_application_t *caller_application = NULL;
|
||||||
|
|
||||||
|
@ -769,8 +769,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state(
|
|||||||
const char *file, const char *func, int line)
|
const char *file, const char *func, int line)
|
||||||
{
|
{
|
||||||
switch_mutex_lock(channel->flag_mutex);
|
switch_mutex_lock(channel->flag_mutex);
|
||||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "%s Running State Change %s\n",
|
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "%s Running State Change %s\n", channel->name, state_names[state]);
|
||||||
channel->name, state_names[state]);
|
|
||||||
channel->running_state = state;
|
channel->running_state = state;
|
||||||
|
|
||||||
if (channel->state_flags) {
|
if (channel->state_flags) {
|
||||||
@ -797,7 +796,8 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state(
|
|||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%s", (char *) state_num);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%s", (char *) state_num);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", channel->name);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", channel->name);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", switch_core_session_get_uuid(channel->session));
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", switch_core_session_get_uuid(channel->session));
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Call-Direction", "%s", switch_channel_test_flag(channel, CF_OUTBOUND) ? "outbound" : "inbound");
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Call-Direction", "%s",
|
||||||
|
switch_channel_test_flag(channel, CF_OUTBOUND) ? "outbound" : "inbound");
|
||||||
if (switch_channel_test_flag(channel, CF_ANSWERED)) {
|
if (switch_channel_test_flag(channel, CF_ANSWERED)) {
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Answer-State", "answered");
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Answer-State", "answered");
|
||||||
} else if (switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
|
} else if (switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
|
||||||
@ -1830,7 +1830,8 @@ SWITCH_DECLARE(char *) switch_channel_build_param_string(switch_channel_t *chann
|
|||||||
switch_stream_handle_t stream = { 0 };
|
switch_stream_handle_t stream = { 0 };
|
||||||
switch_size_t encode_len = 1024, new_len = 0;
|
switch_size_t encode_len = 1024, new_len = 0;
|
||||||
char *encode_buf = NULL;
|
char *encode_buf = NULL;
|
||||||
const char *prof[12] = { 0 }, *prof_names[12] = {0};
|
const char *prof[12] = { 0 }, *prof_names[12] = {
|
||||||
|
0};
|
||||||
char *e = NULL;
|
char *e = NULL;
|
||||||
switch_event_header_t *hi;
|
switch_event_header_t *hi;
|
||||||
uint32_t x = 0;
|
uint32_t x = 0;
|
||||||
@ -1938,7 +1939,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
|
|||||||
char start[80] = "", answer[80] = "", progress[80] = "", progress_media[80] = "", end[80] = "", tmp[80] = "", profile_start[80] = "";
|
char start[80] = "", answer[80] = "", progress[80] = "", progress_media[80] = "", end[80] = "", tmp[80] = "", profile_start[80] = "";
|
||||||
int32_t duration = 0, legbillsec = 0, billsec = 0, mduration = 0, billmsec = 0, legbillmsec = 0, progressmsec = 0, progress_mediamsec = 0;
|
int32_t duration = 0, legbillsec = 0, billsec = 0, mduration = 0, billmsec = 0, legbillmsec = 0, progressmsec = 0, progress_mediamsec = 0;
|
||||||
switch_time_t uduration = 0, legbillusec = 0, billusec = 0, progresssec = 0, progressusec = 0, progress_mediasec = 0, progress_mediausec = 0;
|
switch_time_t uduration = 0, legbillusec = 0, billusec = 0, progresssec = 0, progressusec = 0, progress_mediasec = 0, progress_mediausec = 0;
|
||||||
time_t tt_created = 0, tt_answered = 0, tt_progress = 0, tt_progress_media = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_hungup = 0, tt_prof_created, mtt_prof_created, mtt_progress = 0 , mtt_progress_media = 0;
|
time_t tt_created = 0, tt_answered = 0, tt_progress = 0, tt_progress_media = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_hungup =
|
||||||
|
0, tt_prof_created, mtt_prof_created, mtt_progress = 0, mtt_progress_media = 0;
|
||||||
|
|
||||||
if (!(caller_profile = switch_channel_get_caller_profile(channel)) || !channel->variables) {
|
if (!(caller_profile = switch_channel_get_caller_profile(channel)) || !channel->variables) {
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
|
@ -286,8 +286,7 @@ SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (channel == SWITCH_CHANNEL_ID_EVENT &&
|
if (channel == SWITCH_CHANNEL_ID_EVENT &&
|
||||||
switch_event_running() == SWITCH_STATUS_SUCCESS &&
|
switch_event_running() == SWITCH_STATUS_SUCCESS && switch_event_create(&event, SWITCH_EVENT_LOG) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_event_create(&event, SWITCH_EVENT_LOG) == SWITCH_STATUS_SUCCESS) {
|
|
||||||
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Data", "%s", data);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Data", "%s", data);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-File", "%s", filep);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-File", "%s", filep);
|
||||||
@ -313,7 +312,8 @@ static char prompt_str[512] = "";
|
|||||||
/*
|
/*
|
||||||
* If a fnkey is configured then process the command
|
* If a fnkey is configured then process the command
|
||||||
*/
|
*/
|
||||||
static unsigned char console_fnkey_pressed(int i) {
|
static unsigned char console_fnkey_pressed(int i)
|
||||||
|
{
|
||||||
char *c, *cmd;
|
char *c, *cmd;
|
||||||
|
|
||||||
assert((i > 0) && (i <= 12));
|
assert((i > 0) && (i <= 12));
|
||||||
@ -335,45 +335,58 @@ static unsigned char console_fnkey_pressed(int i) {
|
|||||||
return CC_REDISPLAY;
|
return CC_REDISPLAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char console_f1key(EditLine *el, int ch) {
|
static unsigned char console_f1key(EditLine * el, int ch)
|
||||||
|
{
|
||||||
return console_fnkey_pressed(1);
|
return console_fnkey_pressed(1);
|
||||||
}
|
}
|
||||||
static unsigned char console_f2key(EditLine *el, int ch) {
|
static unsigned char console_f2key(EditLine * el, int ch)
|
||||||
|
{
|
||||||
return console_fnkey_pressed(2);
|
return console_fnkey_pressed(2);
|
||||||
}
|
}
|
||||||
static unsigned char console_f3key(EditLine *el, int ch) {
|
static unsigned char console_f3key(EditLine * el, int ch)
|
||||||
|
{
|
||||||
return console_fnkey_pressed(3);
|
return console_fnkey_pressed(3);
|
||||||
}
|
}
|
||||||
static unsigned char console_f4key(EditLine *el, int ch) {
|
static unsigned char console_f4key(EditLine * el, int ch)
|
||||||
|
{
|
||||||
return console_fnkey_pressed(4);
|
return console_fnkey_pressed(4);
|
||||||
}
|
}
|
||||||
static unsigned char console_f5key(EditLine *el, int ch) {
|
static unsigned char console_f5key(EditLine * el, int ch)
|
||||||
|
{
|
||||||
return console_fnkey_pressed(5);
|
return console_fnkey_pressed(5);
|
||||||
}
|
}
|
||||||
static unsigned char console_f6key(EditLine *el, int ch) {
|
static unsigned char console_f6key(EditLine * el, int ch)
|
||||||
|
{
|
||||||
return console_fnkey_pressed(6);
|
return console_fnkey_pressed(6);
|
||||||
}
|
}
|
||||||
static unsigned char console_f7key(EditLine *el, int ch) {
|
static unsigned char console_f7key(EditLine * el, int ch)
|
||||||
|
{
|
||||||
return console_fnkey_pressed(7);
|
return console_fnkey_pressed(7);
|
||||||
}
|
}
|
||||||
static unsigned char console_f8key(EditLine *el, int ch) {
|
static unsigned char console_f8key(EditLine * el, int ch)
|
||||||
|
{
|
||||||
return console_fnkey_pressed(8);
|
return console_fnkey_pressed(8);
|
||||||
}
|
}
|
||||||
static unsigned char console_f9key(EditLine *el, int ch) {
|
static unsigned char console_f9key(EditLine * el, int ch)
|
||||||
|
{
|
||||||
return console_fnkey_pressed(9);
|
return console_fnkey_pressed(9);
|
||||||
}
|
}
|
||||||
static unsigned char console_f10key(EditLine *el, int ch) {
|
static unsigned char console_f10key(EditLine * el, int ch)
|
||||||
|
{
|
||||||
return console_fnkey_pressed(10);
|
return console_fnkey_pressed(10);
|
||||||
}
|
}
|
||||||
static unsigned char console_f11key(EditLine *el, int ch) {
|
static unsigned char console_f11key(EditLine * el, int ch)
|
||||||
|
{
|
||||||
return console_fnkey_pressed(11);
|
return console_fnkey_pressed(11);
|
||||||
}
|
}
|
||||||
static unsigned char console_f12key(EditLine *el, int ch) {
|
static unsigned char console_f12key(EditLine * el, int ch)
|
||||||
|
{
|
||||||
return console_fnkey_pressed(12);
|
return console_fnkey_pressed(12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char * prompt(EditLine *e) {
|
char *prompt(EditLine * e)
|
||||||
|
{
|
||||||
if (*prompt_str == '\0') {
|
if (*prompt_str == '\0') {
|
||||||
gethostname(hostname, sizeof(hostname));
|
gethostname(hostname, sizeof(hostname));
|
||||||
switch_snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", hostname);
|
switch_snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", hostname);
|
||||||
@ -523,12 +536,9 @@ static unsigned char complete(EditLine *el, int ch)
|
|||||||
argc = switch_separate_string(dupdup, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
argc = switch_separate_string(dupdup, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||||
|
|
||||||
if (h.words == 0) {
|
if (h.words == 0) {
|
||||||
stream.write_function(&stream,
|
stream.write_function(&stream, "select distinct a1 from complete where " "a1 not in (select name from interfaces) %s ", argc ? "and" : "");
|
||||||
"select distinct a1 from complete where "
|
|
||||||
"a1 not in (select name from interfaces) %s ", argc ? "and" : "");
|
|
||||||
} else {
|
} else {
|
||||||
stream.write_function(&stream,
|
stream.write_function(&stream, "select distinct a%d from complete where ", h.words + 1);
|
||||||
"select distinct a%d from complete where ", h.words + 1);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,8 +436,7 @@ SWITCH_DECLARE(int32_t) set_high_priority(void)
|
|||||||
* So let's try to remove the mlock limit here...
|
* So let's try to remove the mlock limit here...
|
||||||
*/
|
*/
|
||||||
if (setrlimit(RLIMIT_MEMLOCK, &lim) < 0) {
|
if (setrlimit(RLIMIT_MEMLOCK, &lim) < 0) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to disable memlock limit, application may crash if run as non-root user!\n");
|
||||||
"Failed to disable memlock limit, application may crash if run as non-root user!\n");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -514,7 +513,6 @@ SWITCH_DECLARE(int32_t) change_user_group(const char *user, const char *group)
|
|||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to change gid!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to change gid!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_INITGROUPS
|
#ifdef HAVE_INITGROUPS
|
||||||
/*
|
/*
|
||||||
* Set all the other groups the user is a member of
|
* Set all the other groups the user is a member of
|
||||||
@ -790,7 +788,8 @@ SWITCH_DECLARE(void) switch_load_network_lists(switch_bool_t reload)
|
|||||||
if (reload) {
|
if (reload) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) to list %s\n", cidr, ok ? "allow" : "deny", name);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) to list %s\n", cidr, ok ? "allow" : "deny", name);
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Adding %s (%s) to list %s\n", cidr, ok ? "allow" : "deny", name);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Adding %s (%s) to list %s\n", cidr, ok ? "allow" : "deny",
|
||||||
|
name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (reload) {
|
if (reload) {
|
||||||
@ -924,7 +923,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
|
|||||||
if (level != SWITCH_LOG_INVALID) {
|
if (level != SWITCH_LOG_INVALID) {
|
||||||
switch_core_session_ctl(SCSC_LOGLEVEL, &level);
|
switch_core_session_ctl(SCSC_LOGLEVEL, &level);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SETRLIMIT
|
#ifdef HAVE_SETRLIMIT
|
||||||
} else if (!strcasecmp(var, "dump-cores")) {
|
} else if (!strcasecmp(var, "dump-cores")) {
|
||||||
struct rlimit rlp;
|
struct rlimit rlp;
|
||||||
@ -953,11 +951,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
|
|||||||
switch_time_set_monotonic(SWITCH_FALSE);
|
switch_time_set_monotonic(SWITCH_FALSE);
|
||||||
} else if (!strcasecmp(var, "max-sessions")) {
|
} else if (!strcasecmp(var, "max-sessions")) {
|
||||||
switch_core_session_limit(atoi(val));
|
switch_core_session_limit(atoi(val));
|
||||||
}
|
} else if (!strcasecmp(var, "rtp-start-port")) {
|
||||||
else if (!strcasecmp(var, "rtp-start-port")) {
|
|
||||||
switch_rtp_set_start_port((switch_port_t) atoi(val));
|
switch_rtp_set_start_port((switch_port_t) atoi(val));
|
||||||
}
|
} else if (!strcasecmp(var, "rtp-end-port")) {
|
||||||
else if (!strcasecmp(var, "rtp-end-port")) {
|
|
||||||
switch_rtp_set_end_port((switch_port_t) atoi(val));
|
switch_rtp_set_end_port((switch_port_t) atoi(val));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1113,9 +1109,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t
|
|||||||
"\nFreeSWITCH Version %s Started.\nCrash Protection [%s]\nMax Sessions[%u]\nSession Rate[%d]\nSQL [%s]\n", SWITCH_VERSION_FULL,
|
"\nFreeSWITCH Version %s Started.\nCrash Protection [%s]\nMax Sessions[%u]\nSession Rate[%d]\nSQL [%s]\n", SWITCH_VERSION_FULL,
|
||||||
switch_test_flag((&runtime), SCF_CRASH_PROT) ? "Enabled" : "Disabled",
|
switch_test_flag((&runtime), SCF_CRASH_PROT) ? "Enabled" : "Disabled",
|
||||||
switch_core_session_limit(0),
|
switch_core_session_limit(0),
|
||||||
switch_core_sessions_per_second(0),
|
switch_core_sessions_per_second(0), switch_test_flag((&runtime), SCF_USE_SQL) ? "Enabled" : "Disabled");
|
||||||
switch_test_flag((&runtime), SCF_USE_SQL) ? "Enabled" : "Disabled"
|
|
||||||
);
|
|
||||||
|
|
||||||
switch_clear_flag((&runtime), SCF_NO_NEW_SESSIONS);
|
switch_clear_flag((&runtime), SCF_NO_NEW_SESSIONS);
|
||||||
|
|
||||||
|
@ -37,11 +37,7 @@
|
|||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_asr_open(switch_asr_handle_t *ah,
|
SWITCH_DECLARE(switch_status_t) switch_core_asr_open(switch_asr_handle_t *ah,
|
||||||
const char *module_name,
|
const char *module_name,
|
||||||
const char *codec,
|
const char *codec, int rate, const char *dest, switch_asr_flag_t *flags, switch_memory_pool_t *pool)
|
||||||
int rate,
|
|
||||||
const char *dest,
|
|
||||||
switch_asr_flag_t *flags,
|
|
||||||
switch_memory_pool_t *pool)
|
|
||||||
{
|
{
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
char buf[256] = "";
|
char buf[256] = "";
|
||||||
|
@ -92,7 +92,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(switch_core_
|
|||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-name", "%s", codec->implementation->iananame);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-name", "%s", codec->implementation->iananame);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-rate", "%d", codec->implementation->actual_samples_per_second);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-rate", "%d", codec->implementation->actual_samples_per_second);
|
||||||
if (codec->implementation->actual_samples_per_second != codec->implementation->samples_per_second) {
|
if (codec->implementation->actual_samples_per_second != codec->implementation->samples_per_second) {
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-write-codec-rate", "%d", codec->implementation->actual_samples_per_second);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-write-codec-rate", "%d",
|
||||||
|
codec->implementation->actual_samples_per_second);
|
||||||
}
|
}
|
||||||
switch_event_fire(&event);
|
switch_event_fire(&event);
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,8 @@ SWITCH_DECLARE(void) switch_core_db_free(char *z)
|
|||||||
sqlite3_free(z);
|
sqlite3_free(z);
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(int) switch_core_db_changes(switch_core_db_t *db) {
|
SWITCH_DECLARE(int) switch_core_db_changes(switch_core_db_t *db)
|
||||||
|
{
|
||||||
return sqlite3_changes(db);
|
return sqlite3_changes(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,10 +38,7 @@
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, const char *func, int line,
|
SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, const char *func, int line,
|
||||||
switch_file_handle_t *fh,
|
switch_file_handle_t *fh,
|
||||||
const char *file_path,
|
const char *file_path,
|
||||||
uint8_t channels,
|
uint8_t channels, uint32_t rate, unsigned int flags, switch_memory_pool_t *pool)
|
||||||
uint32_t rate,
|
|
||||||
unsigned int flags,
|
|
||||||
switch_memory_pool_t *pool)
|
|
||||||
{
|
{
|
||||||
char *ext;
|
char *ext;
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
@ -142,11 +139,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh,
|
|||||||
if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->native_rate != fh->samplerate) {
|
if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->native_rate != fh->samplerate) {
|
||||||
if (!fh->resampler) {
|
if (!fh->resampler) {
|
||||||
if (switch_resample_create(&fh->resampler,
|
if (switch_resample_create(&fh->resampler,
|
||||||
fh->native_rate,
|
fh->native_rate, orig_len, fh->samplerate, (uint32_t) orig_len, fh->memory_pool) != SWITCH_STATUS_SUCCESS) {
|
||||||
orig_len,
|
|
||||||
fh->samplerate,
|
|
||||||
(uint32_t)orig_len,
|
|
||||||
fh->memory_pool) != SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
|
||||||
return SWITCH_STATUS_GENERR;
|
return SWITCH_STATUS_GENERR;
|
||||||
}
|
}
|
||||||
@ -196,11 +189,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_write(switch_file_handle_t *fh,
|
|||||||
if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->native_rate != fh->samplerate) {
|
if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->native_rate != fh->samplerate) {
|
||||||
if (!fh->resampler) {
|
if (!fh->resampler) {
|
||||||
if (switch_resample_create(&fh->resampler,
|
if (switch_resample_create(&fh->resampler,
|
||||||
fh->native_rate,
|
fh->native_rate, orig_len, fh->samplerate, (uint32_t) orig_len, fh->memory_pool) != SWITCH_STATUS_SUCCESS) {
|
||||||
orig_len,
|
|
||||||
fh->samplerate,
|
|
||||||
(uint32_t)orig_len,
|
|
||||||
fh->memory_pool) != SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
|
||||||
return SWITCH_STATUS_GENERR;
|
return SWITCH_STATUS_GENERR;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@
|
|||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include "private/switch_core_pvt.h"
|
#include "private/switch_core_pvt.h"
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
|
SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags,
|
||||||
|
int stream_id)
|
||||||
{
|
{
|
||||||
switch_io_event_hook_video_write_frame_t *ptr;
|
switch_io_event_hook_video_write_frame_t *ptr;
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
@ -56,7 +57,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
|
SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
|
||||||
|
int stream_id)
|
||||||
{
|
{
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
switch_io_event_hook_video_read_frame_t *ptr;
|
switch_io_event_hook_video_read_frame_t *ptr;
|
||||||
@ -68,8 +70,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (session->endpoint_interface->io_routines->read_video_frame) {
|
if (session->endpoint_interface->io_routines->read_video_frame) {
|
||||||
if ((status =
|
if ((status = session->endpoint_interface->io_routines->read_video_frame(session, frame, flags, stream_id)) == SWITCH_STATUS_SUCCESS) {
|
||||||
session->endpoint_interface->io_routines->read_video_frame(session, frame, flags, stream_id)) == SWITCH_STATUS_SUCCESS) {
|
|
||||||
for (ptr = session->event_hooks.video_read_frame; ptr; ptr = ptr->next) {
|
for (ptr = session->event_hooks.video_read_frame; ptr; ptr = ptr->next) {
|
||||||
if ((status = ptr->video_read_frame(session, frame, flags, stream_id)) != SWITCH_STATUS_SUCCESS) {
|
if ((status = ptr->video_read_frame(session, frame, flags, stream_id)) != SWITCH_STATUS_SUCCESS) {
|
||||||
break;
|
break;
|
||||||
@ -98,7 +99,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
|
SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
|
||||||
|
int stream_id)
|
||||||
{
|
{
|
||||||
switch_io_event_hook_read_frame_t *ptr;
|
switch_io_event_hook_read_frame_t *ptr;
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
@ -126,8 +128,7 @@ top:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (session->endpoint_interface->io_routines->read_frame) {
|
if (session->endpoint_interface->io_routines->read_frame) {
|
||||||
if ((status =
|
if ((status = session->endpoint_interface->io_routines->read_frame(session, frame, flags, stream_id)) == SWITCH_STATUS_SUCCESS) {
|
||||||
session->endpoint_interface->io_routines->read_frame(session, frame, flags, stream_id)) == SWITCH_STATUS_SUCCESS) {
|
|
||||||
for (ptr = session->event_hooks.read_frame; ptr; ptr = ptr->next) {
|
for (ptr = session->event_hooks.read_frame; ptr; ptr = ptr->next) {
|
||||||
if ((status = ptr->read_frame(session, frame, flags, stream_id)) != SWITCH_STATUS_SUCCESS) {
|
if ((status = ptr->read_frame(session, frame, flags, stream_id)) != SWITCH_STATUS_SUCCESS) {
|
||||||
break;
|
break;
|
||||||
@ -296,7 +297,8 @@ top:
|
|||||||
switch_mutex_lock(bp->read_mutex);
|
switch_mutex_lock(bp->read_mutex);
|
||||||
switch_buffer_write(bp->raw_read_buffer, read_frame->data, read_frame->datalen);
|
switch_buffer_write(bp->raw_read_buffer, read_frame->data, read_frame->datalen);
|
||||||
if (bp->callback) {
|
if (bp->callback) {
|
||||||
if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ) == SWITCH_FALSE || (bp->stop_time && bp->stop_time <= switch_timestamp(NULL))) {
|
if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ) == SWITCH_FALSE
|
||||||
|
|| (bp->stop_time && bp->stop_time <= switch_timestamp(NULL))) {
|
||||||
ok = SWITCH_FALSE;
|
ok = SWITCH_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,7 +450,8 @@ top:
|
|||||||
if (bp->ready && switch_test_flag(bp, SMBF_READ_PING)) {
|
if (bp->ready && switch_test_flag(bp, SMBF_READ_PING)) {
|
||||||
switch_mutex_lock(bp->read_mutex);
|
switch_mutex_lock(bp->read_mutex);
|
||||||
if (bp->callback) {
|
if (bp->callback) {
|
||||||
if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ_PING) == SWITCH_FALSE || (bp->stop_time && bp->stop_time <= switch_timestamp(NULL))) {
|
if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ_PING) == SWITCH_FALSE
|
||||||
|
|| (bp->stop_time && bp->stop_time <= switch_timestamp(NULL))) {
|
||||||
ok = SWITCH_FALSE;
|
ok = SWITCH_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -504,7 +507,8 @@ static switch_status_t perform_write(switch_core_session_t *session, switch_fram
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
|
SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags,
|
||||||
|
int stream_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
|
@ -58,7 +58,8 @@ SWITCH_DECLARE(switch_memory_pool_t *) switch_core_session_get_pool(switch_core_
|
|||||||
|
|
||||||
/* **ONLY** alloc things with this function that **WILL NOT** outlive
|
/* **ONLY** alloc things with this function that **WILL NOT** outlive
|
||||||
the session itself or expect an earth shattering KABOOM!*/
|
the session itself or expect an earth shattering KABOOM!*/
|
||||||
SWITCH_DECLARE(void *) switch_core_perform_session_alloc(switch_core_session_t *session, switch_size_t memory, const char *file, const char *func, int line)
|
SWITCH_DECLARE(void *) switch_core_perform_session_alloc(switch_core_session_t *session, switch_size_t memory, const char *file, const char *func,
|
||||||
|
int line)
|
||||||
{
|
{
|
||||||
void *ptr = NULL;
|
void *ptr = NULL;
|
||||||
switch_assert(session != NULL);
|
switch_assert(session != NULL);
|
||||||
@ -199,7 +200,6 @@ SWITCH_DECLARE(char *) switch_core_perform_session_strdup(switch_core_session_t
|
|||||||
if (!todup) {
|
if (!todup) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LOCK_MORE
|
#ifdef LOCK_MORE
|
||||||
switch_mutex_lock(memory_manager.mem_lock);
|
switch_mutex_lock(memory_manager.mem_lock);
|
||||||
#endif
|
#endif
|
||||||
@ -231,7 +231,6 @@ SWITCH_DECLARE(char *) switch_core_perform_strdup(switch_memory_pool_t *pool, co
|
|||||||
if (!todup) {
|
if (!todup) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LOCK_MORE
|
#ifdef LOCK_MORE
|
||||||
switch_mutex_lock(memory_manager.mem_lock);
|
switch_mutex_lock(memory_manager.mem_lock);
|
||||||
#endif
|
#endif
|
||||||
@ -388,7 +387,6 @@ static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t * thread, void *obj)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(PER_POOL_LOCK) || defined(DESTROY_POOLS)
|
#if defined(PER_POOL_LOCK) || defined(DESTROY_POOLS)
|
||||||
apr_pool_destroy(pop);
|
apr_pool_destroy(pop);
|
||||||
#else
|
#else
|
||||||
|
@ -57,7 +57,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(switch_core_sessio
|
|||||||
if (switch_test_flag(session, SSF_DESTROYED)) {
|
if (switch_test_flag(session, SSF_DESTROYED)) {
|
||||||
status = SWITCH_STATUS_FALSE;
|
status = SWITCH_STATUS_FALSE;
|
||||||
#ifdef SWITCH_DEBUG_RWLOCKS
|
#ifdef SWITCH_DEBUG_RWLOCKS
|
||||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Read lock FAIL\n", switch_channel_get_name(session->channel));
|
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Read lock FAIL\n",
|
||||||
|
switch_channel_get_name(session->channel));
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
status = (switch_status_t) switch_thread_rwlock_tryrdlock(session->rwlock);
|
status = (switch_status_t) switch_thread_rwlock_tryrdlock(session->rwlock);
|
||||||
@ -75,7 +76,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(switch_core_sessio
|
|||||||
SWITCH_DECLARE(void) switch_core_session_perform_write_lock(switch_core_session_t *session, const char *file, const char *func, int line)
|
SWITCH_DECLARE(void) switch_core_session_perform_write_lock(switch_core_session_t *session, const char *file, const char *func, int line)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Write lock AQUIRED\n", switch_channel_get_name(session->channel));
|
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Write lock AQUIRED\n",
|
||||||
|
switch_channel_get_name(session->channel));
|
||||||
#else
|
#else
|
||||||
SWITCH_DECLARE(void) switch_core_session_write_lock(switch_core_session_t *session)
|
SWITCH_DECLARE(void) switch_core_session_write_lock(switch_core_session_t *session)
|
||||||
{
|
{
|
||||||
|
@ -174,9 +174,7 @@ SWITCH_DECLARE(int) switch_core_session_get_stream_count(switch_core_session_t *
|
|||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_call_cause_t) switch_core_session_resurrect_channel(const char *endpoint_name,
|
SWITCH_DECLARE(switch_call_cause_t) switch_core_session_resurrect_channel(const char *endpoint_name,
|
||||||
switch_core_session_t **new_session,
|
switch_core_session_t **new_session, switch_memory_pool_t **pool, void *data)
|
||||||
switch_memory_pool_t **pool,
|
|
||||||
void *data)
|
|
||||||
{
|
{
|
||||||
const switch_endpoint_interface_t *endpoint_interface;
|
const switch_endpoint_interface_t *endpoint_interface;
|
||||||
|
|
||||||
@ -192,8 +190,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_resurrect_channel(const
|
|||||||
const char *endpoint_name,
|
const char *endpoint_name,
|
||||||
switch_caller_profile_t *caller_profile,
|
switch_caller_profile_t *caller_profile,
|
||||||
switch_core_session_t **new_session,
|
switch_core_session_t **new_session,
|
||||||
switch_memory_pool_t **pool,
|
switch_memory_pool_t **pool, switch_originate_flag_t flags)
|
||||||
switch_originate_flag_t flags)
|
|
||||||
{
|
{
|
||||||
switch_io_event_hook_outgoing_channel_t *ptr;
|
switch_io_event_hook_outgoing_channel_t *ptr;
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
@ -249,7 +246,8 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_resurrect_channel(const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((cause = endpoint_interface->io_routines->outgoing_channel(session, var_event, outgoing_profile, new_session, pool, flags)) != SWITCH_CAUSE_SUCCESS) {
|
if ((cause =
|
||||||
|
endpoint_interface->io_routines->outgoing_channel(session, var_event, outgoing_profile, new_session, pool, flags)) != SWITCH_CAUSE_SUCCESS) {
|
||||||
return cause;
|
return cause;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -690,8 +688,7 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t *
|
|||||||
switch_event_t *event;
|
switch_event_t *event;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Close Channel %s [%s]\n",
|
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Close Channel %s [%s]\n",
|
||||||
switch_channel_get_name((*session)->channel),
|
switch_channel_get_name((*session)->channel), switch_channel_state_name(switch_channel_get_state((*session)->channel)));
|
||||||
switch_channel_state_name(switch_channel_get_state((*session)->channel)));
|
|
||||||
|
|
||||||
switch_core_media_bug_remove_all(*session);
|
switch_core_media_bug_remove_all(*session);
|
||||||
switch_ivr_deactivate_unicast(*session);
|
switch_ivr_deactivate_unicast(*session);
|
||||||
@ -1013,7 +1010,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application(switch_c
|
|||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *session,
|
||||||
const switch_application_interface_t *application_interface, const char *arg) {
|
const switch_application_interface_t *application_interface, const char *arg)
|
||||||
|
{
|
||||||
switch_app_log_t *log, *lp;
|
switch_app_log_t *log, *lp;
|
||||||
switch_event_t *event;
|
switch_event_t *event;
|
||||||
const char *var;
|
const char *var;
|
||||||
@ -1060,7 +1058,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *
|
|||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(switch_core_session_t *session, const char *exten, const char *dialplan, const char *context)
|
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(switch_core_session_t *session, const char *exten, const char *dialplan,
|
||||||
|
const char *context)
|
||||||
{
|
{
|
||||||
char *dp[25];
|
char *dp[25];
|
||||||
char *dpstr;
|
char *dpstr;
|
||||||
|
@ -38,10 +38,7 @@
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *sh,
|
SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *sh,
|
||||||
const char *module_name,
|
const char *module_name,
|
||||||
const char *voice_name,
|
const char *voice_name,
|
||||||
unsigned int rate,
|
unsigned int rate, unsigned int interval, switch_speech_flag_t *flags, switch_memory_pool_t *pool)
|
||||||
unsigned int interval,
|
|
||||||
switch_speech_flag_t *flags,
|
|
||||||
switch_memory_pool_t *pool)
|
|
||||||
{
|
{
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
char buf[256] = "";
|
char buf[256] = "";
|
||||||
|
@ -50,8 +50,7 @@ static void switch_core_standard_on_hangup(switch_core_session_t *session)
|
|||||||
static void switch_core_standard_on_reset(switch_core_session_t *session)
|
static void switch_core_standard_on_reset(switch_core_session_t *session)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard RESET %s\n",
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard RESET %s\n", switch_channel_get_name(session->channel));
|
||||||
switch_channel_get_name(session->channel));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void switch_core_standard_on_routing(switch_core_session_t *session)
|
static void switch_core_standard_on_routing(switch_core_session_t *session)
|
||||||
@ -405,7 +404,8 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
|
|||||||
}
|
}
|
||||||
SWITCH_STANDARD_STREAM(stream);
|
SWITCH_STANDARD_STREAM(stream);
|
||||||
switch_api_execute(cmd, arg, NULL, &stream);
|
switch_api_execute(cmd, arg, NULL, &stream);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hangup Command %s(%s):\n%s\n", cmd, arg, switch_str_nil((char *) stream.data));
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hangup Command %s(%s):\n%s\n", cmd, arg,
|
||||||
|
switch_str_nil((char *) stream.data));
|
||||||
switch_safe_free(stream.data);
|
switch_safe_free(stream.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@
|
|||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include "private/switch_core_pvt.h"
|
#include "private/switch_core_pvt.h"
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, const char *timer_name, int interval, int samples, switch_memory_pool_t *pool)
|
SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, const char *timer_name, int interval, int samples,
|
||||||
|
switch_memory_pool_t *pool)
|
||||||
{
|
{
|
||||||
switch_timer_interface_t *timer_interface;
|
switch_timer_interface_t *timer_interface;
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
|
@ -513,7 +513,8 @@ SWITCH_DECLARE(char *) switch_event_get_header(switch_event_t *event, char *head
|
|||||||
{
|
{
|
||||||
switch_event_header_t *hp;
|
switch_event_header_t *hp;
|
||||||
switch_assert(event);
|
switch_assert(event);
|
||||||
if (!header_name) return NULL;
|
if (!header_name)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
for (hp = event->headers; hp; hp = hp->next) {
|
for (hp = event->headers; hp; hp = hp->next) {
|
||||||
if (!strcasecmp(hp->name, header_name)) {
|
if (!strcasecmp(hp->name, header_name)) {
|
||||||
@ -863,7 +864,8 @@ SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const ch
|
|||||||
ret = vasprintf(&data, fmt, ap);
|
ret = vasprintf(&data, fmt, ap);
|
||||||
#else
|
#else
|
||||||
data = (char *) malloc(2048);
|
data = (char *) malloc(2048);
|
||||||
if (!data) return NULL;
|
if (!data)
|
||||||
|
return NULL;
|
||||||
ret = vsnprintf(data, 2048, fmt, ap);
|
ret = vsnprintf(data, 2048, fmt, ap);
|
||||||
#endif
|
#endif
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
@ -1286,7 +1288,8 @@ SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, co
|
|||||||
switch_stream_handle_t stream = { 0 };
|
switch_stream_handle_t stream = { 0 };
|
||||||
switch_size_t encode_len = 1024, new_len = 0;
|
switch_size_t encode_len = 1024, new_len = 0;
|
||||||
char *encode_buf = NULL;
|
char *encode_buf = NULL;
|
||||||
const char *prof[12] = { 0 }, *prof_names[12] = {0};
|
const char *prof[12] = { 0 }, *prof_names[12] = {
|
||||||
|
0};
|
||||||
char *e = NULL;
|
char *e = NULL;
|
||||||
switch_event_header_t *hi;
|
switch_event_header_t *hi;
|
||||||
uint32_t x = 0;
|
uint32_t x = 0;
|
||||||
@ -1330,8 +1333,7 @@ SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, co
|
|||||||
char *var = hi->name;
|
char *var = hi->name;
|
||||||
char *val = hi->value;
|
char *val = hi->value;
|
||||||
|
|
||||||
if (vars_map != NULL)
|
if (vars_map != NULL) {
|
||||||
{
|
|
||||||
if ((data = switch_core_hash_find(vars_map, var)) == NULL || strcasecmp(((char *) data), "enabled"))
|
if ((data = switch_core_hash_find(vars_map, var)) == NULL || strcasecmp(((char *) data), "enabled"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -151,10 +151,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_deactivate_unicast(switch_core_sessio
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_t *session,
|
||||||
char *local_ip,
|
char *local_ip,
|
||||||
switch_port_t local_port,
|
switch_port_t local_port,
|
||||||
char *remote_ip,
|
char *remote_ip, switch_port_t remote_port, char *transport, char *flags)
|
||||||
switch_port_t remote_port,
|
|
||||||
char *transport,
|
|
||||||
char *flags)
|
|
||||||
{
|
{
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
switch_unicast_conninfo_t *conninfo = switch_core_session_alloc(session, sizeof(*conninfo));
|
switch_unicast_conninfo_t *conninfo = switch_core_session_alloc(session, sizeof(*conninfo));
|
||||||
@ -504,13 +501,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
|
|||||||
if (switch_test_flag(conninfo, SUF_NATIVE)) {
|
if (switch_test_flag(conninfo, SUF_NATIVE)) {
|
||||||
tstatus = SWITCH_STATUS_NOOP;
|
tstatus = SWITCH_STATUS_NOOP;
|
||||||
} else {
|
} else {
|
||||||
tstatus = switch_core_codec_decode(
|
tstatus = switch_core_codec_decode(read_codec,
|
||||||
read_codec,
|
|
||||||
&conninfo->read_codec,
|
&conninfo->read_codec,
|
||||||
read_frame->data,
|
read_frame->data,
|
||||||
read_frame->datalen,
|
read_frame->datalen,
|
||||||
read_codec->implementation->actual_samples_per_second,
|
read_codec->implementation->actual_samples_per_second, decoded, &dlen, &rate, &flags);
|
||||||
decoded, &dlen, &rate, &flags);
|
|
||||||
}
|
}
|
||||||
switch (tstatus) {
|
switch (tstatus) {
|
||||||
case SWITCH_STATUS_NOOP:
|
case SWITCH_STATUS_NOOP:
|
||||||
@ -658,9 +653,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
|
|||||||
switch_size_t buflen,
|
switch_size_t buflen,
|
||||||
switch_size_t maxdigits,
|
switch_size_t maxdigits,
|
||||||
const char *terminators, char *terminator,
|
const char *terminators, char *terminator,
|
||||||
uint32_t first_timeout,
|
uint32_t first_timeout, uint32_t digit_timeout, uint32_t abs_timeout)
|
||||||
uint32_t digit_timeout,
|
|
||||||
uint32_t abs_timeout)
|
|
||||||
{
|
{
|
||||||
switch_size_t i = 0, x = strlen(buf);
|
switch_size_t i = 0, x = strlen(buf);
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
@ -947,7 +940,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, const char *extension, const char *dialplan, const char *context)
|
SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, const char *extension, const char *dialplan,
|
||||||
|
const char *context)
|
||||||
{
|
{
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
switch_caller_profile_t *profile, *new_profile;
|
switch_caller_profile_t *profile, *new_profile;
|
||||||
@ -1403,7 +1397,8 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_chan_vars(switch_xml_t xml, switch_channe
|
|||||||
switch_xml_t variable;
|
switch_xml_t variable;
|
||||||
switch_event_header_t *hi = switch_channel_variable_first(channel);
|
switch_event_header_t *hi = switch_channel_variable_first(channel);
|
||||||
|
|
||||||
if (!hi) return off;
|
if (!hi)
|
||||||
|
return off;
|
||||||
|
|
||||||
for (; hi; hi = hi->next) {
|
for (; hi; hi = hi->next) {
|
||||||
if (!switch_strlen_zero(hi->name) && !switch_strlen_zero(hi->value) && ((variable = switch_xml_add_child_d(xml, hi->name, off++)))) {
|
if (!switch_strlen_zero(hi->name) && !switch_strlen_zero(hi->value) && ((variable = switch_xml_add_child_d(xml, hi->name, off++)))) {
|
||||||
@ -1697,7 +1692,8 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3
|
|||||||
stfu_n_destroy(&jb);
|
stfu_n_destroy(&jb);
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type, const char *say_method, switch_input_args_t *args)
|
SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type,
|
||||||
|
const char *say_method, switch_input_args_t *args)
|
||||||
{
|
{
|
||||||
switch_say_interface_t *si;
|
switch_say_interface_t *si;
|
||||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
|
@ -307,8 +307,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_
|
|||||||
file,
|
file,
|
||||||
read_codec->implementation->number_of_channels,
|
read_codec->implementation->number_of_channels,
|
||||||
read_codec->implementation->actual_samples_per_second,
|
read_codec->implementation->actual_samples_per_second,
|
||||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
|
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||||
NULL) != SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||||
switch_core_session_reset(session, SWITCH_TRUE);
|
switch_core_session_reset(session, SWITCH_TRUE);
|
||||||
return SWITCH_STATUS_GENERR;
|
return SWITCH_STATUS_GENERR;
|
||||||
@ -490,9 +489,7 @@ static switch_bool_t eavesdrop_callback(switch_media_bug_t *bug, void *user_data
|
|||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session_t *session,
|
||||||
const char *uuid,
|
const char *uuid, const char *require_group, switch_eavesdrop_flag_t flags)
|
||||||
const char *require_group,
|
|
||||||
switch_eavesdrop_flag_t flags)
|
|
||||||
{
|
{
|
||||||
switch_core_session_t *tsession;
|
switch_core_session_t *tsession;
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
@ -1191,8 +1188,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_tone_detect_session(switch_core_
|
|||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_session_t *session,
|
||||||
const char *key, const char *tone_spec,
|
const char *key, const char *tone_spec,
|
||||||
const char *flags, time_t timeout,
|
const char *flags, time_t timeout, const char *app, const char *data)
|
||||||
const char *app, const char *data)
|
|
||||||
{
|
{
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
|
switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
|
||||||
@ -1242,7 +1238,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi
|
|||||||
do {
|
do {
|
||||||
teletone_process_t this;
|
teletone_process_t this;
|
||||||
next = strchr(p, ',');
|
next = strchr(p, ',');
|
||||||
while(*p == ' ') p++;
|
while (*p == ' ')
|
||||||
|
p++;
|
||||||
if ((this = (teletone_process_t) atof(p))) {
|
if ((this = (teletone_process_t) atof(p))) {
|
||||||
ok++;
|
ok++;
|
||||||
cont->list[cont->index].map.freqs[i++] = this;
|
cont->list[cont->index].map.freqs[i++] = this;
|
||||||
@ -1659,10 +1656,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_c
|
|||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session,
|
||||||
const char *mod_name,
|
const char *mod_name,
|
||||||
const char *grammar,
|
const char *grammar, const char *path, const char *dest, switch_asr_handle_t *ah)
|
||||||
const char *path,
|
|
||||||
const char *dest,
|
|
||||||
switch_asr_handle_t *ah)
|
|
||||||
{
|
{
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
|
switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
|
||||||
|
@ -176,7 +176,6 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SWITCH_VIDEO_IN_THREADS
|
#ifdef SWITCH_VIDEO_IN_THREADS
|
||||||
if (switch_channel_test_flag(chan_a, CF_VIDEO) && switch_channel_test_flag(chan_b, CF_VIDEO) && !vid_launch) {
|
if (switch_channel_test_flag(chan_a, CF_VIDEO) && switch_channel_test_flag(chan_b, CF_VIDEO) && !vid_launch) {
|
||||||
vid_launch++;
|
vid_launch++;
|
||||||
@ -250,7 +249,6 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SWITCH_VIDEO_IN_THREADS
|
#ifndef SWITCH_VIDEO_IN_THREADS
|
||||||
if (switch_channel_test_flag(chan_a, CF_VIDEO) && switch_channel_test_flag(chan_b, CF_VIDEO)) {
|
if (switch_channel_test_flag(chan_a, CF_VIDEO) && switch_channel_test_flag(chan_b, CF_VIDEO)) {
|
||||||
/* read video from 1 channel and write it to the other */
|
/* read video from 1 channel and write it to the other */
|
||||||
@ -448,8 +446,7 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio
|
|||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((other_uuid = switch_channel_get_variable(channel, SWITCH_UUID_BRIDGE)) &&
|
if ((other_uuid = switch_channel_get_variable(channel, SWITCH_UUID_BRIDGE)) && (other_session = switch_core_session_locate(other_uuid))) {
|
||||||
(other_session = switch_core_session_locate(other_uuid))) {
|
|
||||||
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
|
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
|
||||||
switch_event_t *event;
|
switch_event_t *event;
|
||||||
uint8_t ready_a, ready_b;
|
uint8_t ready_a, ready_b;
|
||||||
|
@ -166,7 +166,8 @@ static void launch_collect_thread(struct key_collect *collect)
|
|||||||
|
|
||||||
static uint8_t check_channel_status(switch_channel_t **peer_channels,
|
static uint8_t check_channel_status(switch_channel_t **peer_channels,
|
||||||
switch_core_session_t **peer_sessions,
|
switch_core_session_t **peer_sessions,
|
||||||
uint32_t len, int32_t *idx, uint32_t * hups, char *file, char *key, uint8_t early_ok, uint8_t *ring_ready, uint8_t return_ring_ready)
|
uint32_t len, int32_t *idx, uint32_t *hups, char *file, char *key, uint8_t early_ok, uint8_t *ring_ready,
|
||||||
|
uint8_t return_ring_ready)
|
||||||
{
|
{
|
||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
@ -184,8 +185,7 @@ static uint8_t check_channel_status(switch_channel_t **peer_channels,
|
|||||||
|
|
||||||
state = switch_channel_get_state(peer_channels[i]);
|
state = switch_channel_get_state(peer_channels[i]);
|
||||||
if (state >= CS_HANGUP || state == CS_RESET || switch_channel_test_flag(peer_channels[i], CF_TRANSFER) ||
|
if (state >= CS_HANGUP || state == CS_RESET || switch_channel_test_flag(peer_channels[i], CF_TRANSFER) ||
|
||||||
switch_channel_test_flag(peer_channels[i], CF_BRIDGED) ||
|
switch_channel_test_flag(peer_channels[i], CF_BRIDGED) || !switch_channel_test_flag(peer_channels[i], CF_ORIGINATING)
|
||||||
!switch_channel_test_flag(peer_channels[i], CF_ORIGINATING)
|
|
||||||
) {
|
) {
|
||||||
(*hups)++;
|
(*hups)++;
|
||||||
} else if ((switch_channel_test_flag(peer_channels[i], CF_ANSWERED) ||
|
} else if ((switch_channel_test_flag(peer_channels[i], CF_ANSWERED) ||
|
||||||
@ -342,8 +342,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
|
|||||||
ringback_data,
|
ringback_data,
|
||||||
read_codec->implementation->number_of_channels,
|
read_codec->implementation->number_of_channels,
|
||||||
read_codec->implementation->actual_samples_per_second,
|
read_codec->implementation->actual_samples_per_second,
|
||||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
|
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||||
NULL) != SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Playing File\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Playing File\n");
|
||||||
switch_safe_free(tmp_data);
|
switch_safe_free(tmp_data);
|
||||||
goto done;
|
goto done;
|
||||||
@ -370,7 +369,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (switch_channel_ready(peer_channel) && !(switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
|
while (switch_channel_ready(peer_channel)
|
||||||
|
&& !(switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
|
||||||
int diff = (int) (switch_timestamp_now() - start);
|
int diff = (int) (switch_timestamp_now() - start);
|
||||||
|
|
||||||
if (diff > timelimit) {
|
if (diff > timelimit) {
|
||||||
@ -463,8 +463,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||||||
const switch_state_handler_table_t *table,
|
const switch_state_handler_table_t *table,
|
||||||
const char *cid_name_override,
|
const char *cid_name_override,
|
||||||
const char *cid_num_override,
|
const char *cid_num_override,
|
||||||
switch_caller_profile_t *caller_profile_override,
|
switch_caller_profile_t *caller_profile_override, switch_originate_flag_t flags)
|
||||||
switch_originate_flag_t flags)
|
|
||||||
{
|
{
|
||||||
switch_originate_flag_t myflags = SOF_NONE;
|
switch_originate_flag_t myflags = SOF_NONE;
|
||||||
char *pipe_names[MAX_PEERS] = { 0 };
|
char *pipe_names[MAX_PEERS] = { 0 };
|
||||||
@ -801,10 +800,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||||||
new_profile = switch_caller_profile_new(pool,
|
new_profile = switch_caller_profile_new(pool,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
cid_name_override,
|
cid_name_override, cid_num_override, NULL, NULL, NULL, NULL, __FILE__, NULL, chan_data);
|
||||||
cid_num_override,
|
|
||||||
NULL, NULL, NULL, NULL, __FILE__, NULL,
|
|
||||||
chan_data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -821,9 +817,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||||||
myflags |= SOF_FORKED_DIAL;
|
myflags |= SOF_FORKED_DIAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((reason = switch_core_session_outgoing_channel(session, var_event, chan_type, new_profile, &new_session, &pool, myflags)) != SWITCH_CAUSE_SUCCESS) {
|
if ((reason =
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel of type [%s] cause: [%s]\n",
|
switch_core_session_outgoing_channel(session, var_event, chan_type, new_profile, &new_session, &pool,
|
||||||
chan_type, switch_channel_cause2str(reason));
|
myflags)) != SWITCH_CAUSE_SUCCESS) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel of type [%s] cause: [%s]\n", chan_type,
|
||||||
|
switch_channel_cause2str(reason));
|
||||||
if (pool) {
|
if (pool) {
|
||||||
switch_core_destroy_memory_pool(&pool);
|
switch_core_destroy_memory_pool(&pool);
|
||||||
}
|
}
|
||||||
@ -962,7 +960,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||||
"Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
|
"Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
|
||||||
read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
|
read_codec->implementation->actual_samples_per_second,
|
||||||
|
read_codec->implementation->microseconds_per_frame / 1000);
|
||||||
write_frame.codec = &write_codec;
|
write_frame.codec = &write_codec;
|
||||||
write_frame.datalen = read_codec->implementation->bytes_per_frame;
|
write_frame.datalen = read_codec->implementation->bytes_per_frame;
|
||||||
write_frame.samples = write_frame.datalen / 2;
|
write_frame.samples = write_frame.datalen / 2;
|
||||||
@ -995,8 +994,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||||||
ringback_data,
|
ringback_data,
|
||||||
read_codec->implementation->number_of_channels,
|
read_codec->implementation->number_of_channels,
|
||||||
read_codec->implementation->actual_samples_per_second,
|
read_codec->implementation->actual_samples_per_second,
|
||||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
|
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||||
NULL) != SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Playing File\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Playing File\n");
|
||||||
switch_safe_free(tmp_data);
|
switch_safe_free(tmp_data);
|
||||||
goto notready;
|
goto notready;
|
||||||
@ -1038,7 +1036,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||||||
switch_channel_ring_ready(caller_channel);
|
switch_channel_ring_ready(caller_channel);
|
||||||
sent_ring = 1;
|
sent_ring = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When the AND operator is being used, and fail_on_single_reject is set, a hangup indicates that the call should fail.
|
// When the AND operator is being used, and fail_on_single_reject is set, a hangup indicates that the call should fail.
|
||||||
if ((to = (uint8_t) ((switch_timestamp(NULL) - start) >= (time_t) timelimit_sec))
|
if ((to = (uint8_t) ((switch_timestamp(NULL) - start) >= (time_t) timelimit_sec))
|
||||||
|| (fail_on_single_reject && hups)) {
|
|| (fail_on_single_reject && hups)) {
|
||||||
@ -1063,7 +1060,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||||||
if (session &&
|
if (session &&
|
||||||
!switch_channel_test_flag(caller_channel, CF_PROXY_MODE) &&
|
!switch_channel_test_flag(caller_channel, CF_PROXY_MODE) &&
|
||||||
!switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA) &&
|
!switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA) &&
|
||||||
(ringback_data || (switch_channel_test_flag(caller_channel, CF_ANSWERED) || switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)))) {
|
(ringback_data
|
||||||
|
|| (switch_channel_test_flag(caller_channel, CF_ANSWERED) || switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)))) {
|
||||||
|
|
||||||
switch_status_t tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
|
switch_status_t tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
|
||||||
|
|
||||||
@ -1132,8 +1130,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (switch_channel_test_flag(peer_channels[i], CF_TRANSFER) || switch_channel_test_flag(peer_channels[i], CF_BRIDGED) ||
|
if (switch_channel_test_flag(peer_channels[i], CF_TRANSFER) || switch_channel_test_flag(peer_channels[i], CF_BRIDGED) ||
|
||||||
switch_channel_get_state(peer_channels[i]) == CS_RESET ||
|
switch_channel_get_state(peer_channels[i]) == CS_RESET || !switch_channel_test_flag(peer_channels[i], CF_ORIGINATING)
|
||||||
!switch_channel_test_flag(peer_channels[i], CF_ORIGINATING)
|
|
||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
|
|||||||
char *say_type = (char *) switch_xml_attr_soft(action, "type");
|
char *say_type = (char *) switch_xml_attr_soft(action, "type");
|
||||||
char *say_method = (char *) switch_xml_attr_soft(action, "method");
|
char *say_method = (char *) switch_xml_attr_soft(action, "method");
|
||||||
|
|
||||||
status = si->say_function(session, odata, switch_ivr_get_say_type_by_name(say_type), switch_ivr_get_say_method_by_name(say_method), args);
|
status =
|
||||||
|
si->say_function(session, odata, switch_ivr_get_say_type_by_name(say_type), switch_ivr_get_say_method_by_name(say_method),
|
||||||
|
args);
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", module_name);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", module_name);
|
||||||
}
|
}
|
||||||
@ -680,8 +682,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(audio_buffer, write_frame.data,
|
if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(audio_buffer, write_frame.data, read_codec->implementation->bytes_per_frame)) <= 0) {
|
||||||
read_codec->implementation->bytes_per_frame)) <= 0) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1197,10 +1198,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
|
|||||||
uint32_t max_digits,
|
uint32_t max_digits,
|
||||||
const char *prompt_audio_file,
|
const char *prompt_audio_file,
|
||||||
const char *var_name,
|
const char *var_name,
|
||||||
char *digit_buffer,
|
char *digit_buffer, switch_size_t digit_buffer_length, uint32_t timeout, const char *valid_terminators)
|
||||||
switch_size_t digit_buffer_length,
|
|
||||||
uint32_t timeout,
|
|
||||||
const char *valid_terminators)
|
|
||||||
{
|
{
|
||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
switch_input_args_t args = { 0 };
|
switch_input_args_t args = { 0 };
|
||||||
@ -1727,7 +1725,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
|
|||||||
if (need_create) {
|
if (need_create) {
|
||||||
if (switch_core_codec_init(codec,
|
if (switch_core_codec_init(codec,
|
||||||
codec_name,
|
codec_name,
|
||||||
NULL, (int) rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) {
|
NULL, (int) rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
|
||||||
|
pool) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activated\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activated\n");
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed %s@%uhz 1 channel %dms\n", codec_name, rate, interval);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed %s@%uhz 1 channel %dms\n", codec_name, rate, interval);
|
||||||
|
@ -155,13 +155,15 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
|
|||||||
if (!impl->iananame) {
|
if (!impl->iananame) {
|
||||||
load_interface = 0;
|
load_interface = 0;
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
|
||||||
"Failed to load codec interface %s from %s due to no iana name in an implementation.\n", ptr->interface_name, key);
|
"Failed to load codec interface %s from %s due to no iana name in an implementation.\n", ptr->interface_name,
|
||||||
|
key);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (impl->bytes_per_frame > SWITCH_RECOMMENDED_BUFFER_SIZE) {
|
if (impl->bytes_per_frame > SWITCH_RECOMMENDED_BUFFER_SIZE) {
|
||||||
load_interface = 0;
|
load_interface = 0;
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
|
||||||
"Failed to load codec interface %s from %s due to bytes per frame exceeding buffer size.\n", ptr->interface_name, key);
|
"Failed to load codec interface %s from %s due to bytes per frame exceeding buffer size.\n", ptr->interface_name,
|
||||||
|
key);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -841,8 +843,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_unload_module(char *dir,
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_loadable_module_build_dynamic(char *filename,
|
SWITCH_DECLARE(switch_status_t) switch_loadable_module_build_dynamic(char *filename,
|
||||||
switch_module_load_t switch_module_load,
|
switch_module_load_t switch_module_load,
|
||||||
switch_module_runtime_t switch_module_runtime,
|
switch_module_runtime_t switch_module_runtime,
|
||||||
switch_module_shutdown_t switch_module_shutdown,
|
switch_module_shutdown_t switch_module_shutdown, switch_bool_t runtime)
|
||||||
switch_bool_t runtime)
|
|
||||||
{
|
{
|
||||||
switch_loadable_module_t *module = NULL;
|
switch_loadable_module_t *module = NULL;
|
||||||
switch_module_load_t load_func_ptr = NULL;
|
switch_module_load_t load_func_ptr = NULL;
|
||||||
|
@ -347,7 +347,8 @@ SWITCH_DECLARE(void) switch_core_memory_reclaim_logger(void)
|
|||||||
{
|
{
|
||||||
void *pop;
|
void *pop;
|
||||||
int size = switch_queue_size(LOG_RECYCLE_QUEUE);
|
int size = switch_queue_size(LOG_RECYCLE_QUEUE);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Returning %d recycled log node(s) %d bytes\n", size, (int)sizeof(switch_log_node_t) * size);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Returning %d recycled log node(s) %d bytes\n", size,
|
||||||
|
(int) sizeof(switch_log_node_t) * size);
|
||||||
while (switch_queue_trypop(LOG_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
|
while (switch_queue_trypop(LOG_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
|
||||||
free(pop);
|
free(pop);
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,9 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_connect(switch_odbc_hand
|
|||||||
} else {
|
} else {
|
||||||
SQLCHAR outstr[1024] = { 0 };
|
SQLCHAR outstr[1024] = { 0 };
|
||||||
SQLSMALLINT outstrlen = 0;
|
SQLSMALLINT outstrlen = 0;
|
||||||
result = SQLDriverConnect(handle->con, NULL, (SQLCHAR *) handle->dsn, (SQLSMALLINT)strlen(handle->dsn), outstr, sizeof(outstr), &outstrlen, SQL_DRIVER_NOPROMPT);
|
result =
|
||||||
|
SQLDriverConnect(handle->con, NULL, (SQLCHAR *) handle->dsn, (SQLSMALLINT) strlen(handle->dsn), outstr, sizeof(outstr), &outstrlen,
|
||||||
|
SQL_DRIVER_NOPROMPT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
|
if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
|
||||||
|
@ -58,8 +58,7 @@ static switch_status_t switch_raw_encode(switch_codec_t *codec,
|
|||||||
switch_codec_t *other_codec,
|
switch_codec_t *other_codec,
|
||||||
void *decoded_data,
|
void *decoded_data,
|
||||||
uint32_t decoded_data_len,
|
uint32_t decoded_data_len,
|
||||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
|
uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
|
||||||
unsigned int *flag)
|
|
||||||
{
|
{
|
||||||
/* NOOP indicates that the audio in is already the same as the audio out, so no conversion was necessary. */
|
/* NOOP indicates that the audio in is already the same as the audio out, so no conversion was necessary. */
|
||||||
if (codec && other_codec && codec->implementation && other_codec->implementation &&
|
if (codec && other_codec && codec->implementation && other_codec->implementation &&
|
||||||
@ -75,8 +74,7 @@ static switch_status_t switch_raw_decode(switch_codec_t *codec,
|
|||||||
switch_codec_t *other_codec,
|
switch_codec_t *other_codec,
|
||||||
void *encoded_data,
|
void *encoded_data,
|
||||||
uint32_t encoded_data_len,
|
uint32_t encoded_data_len,
|
||||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
|
uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
|
||||||
unsigned int *flag)
|
|
||||||
{
|
{
|
||||||
if (codec && other_codec && codec->implementation && other_codec->implementation &&
|
if (codec && other_codec && codec->implementation && other_codec->implementation &&
|
||||||
codec->implementation->actual_samples_per_second != other_codec->implementation->actual_samples_per_second) {
|
codec->implementation->actual_samples_per_second != other_codec->implementation->actual_samples_per_second) {
|
||||||
@ -302,8 +300,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
|
|||||||
SWITCH_ADD_CODEC(codec_interface, "PROXY VIDEO PASS-THROUGH");
|
SWITCH_ADD_CODEC(codec_interface, "PROXY VIDEO PASS-THROUGH");
|
||||||
switch_core_codec_add_implementation(pool, codec_interface,
|
switch_core_codec_add_implementation(pool, codec_interface,
|
||||||
SWITCH_CODEC_TYPE_VIDEO, 31, "PROXY-VID", NULL, 90000, 90000, 0,
|
SWITCH_CODEC_TYPE_VIDEO, 31, "PROXY-VID", NULL, 90000, 90000, 0,
|
||||||
0, 0, 0, 0, 1, 1, 1,
|
0, 0, 0, 0, 1, 1, 1, switch_proxy_init, switch_proxy_encode, switch_proxy_decode, switch_proxy_destroy);
|
||||||
switch_proxy_init, switch_proxy_encode, switch_proxy_decode, switch_proxy_destroy);
|
|
||||||
|
|
||||||
|
|
||||||
SWITCH_ADD_CODEC(codec_interface, "PROXY PASS-THROUGH");
|
SWITCH_ADD_CODEC(codec_interface, "PROXY PASS-THROUGH");
|
||||||
@ -331,13 +328,11 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
|
|||||||
|
|
||||||
switch_core_codec_add_implementation(pool, codec_interface,
|
switch_core_codec_add_implementation(pool, codec_interface,
|
||||||
SWITCH_CODEC_TYPE_AUDIO, 118, "L16", NULL, 22050, 22050, 352800,
|
SWITCH_CODEC_TYPE_AUDIO, 118, "L16", NULL, 22050, 22050, 352800,
|
||||||
20000, 441, 882, 882, 1, 1, 1,
|
20000, 441, 882, 882, 1, 1, 1, switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
|
||||||
switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
|
|
||||||
|
|
||||||
switch_core_codec_add_implementation(pool, codec_interface,
|
switch_core_codec_add_implementation(pool, codec_interface,
|
||||||
SWITCH_CODEC_TYPE_AUDIO, 118, "L16", NULL, 11025, 11025, 176400,
|
SWITCH_CODEC_TYPE_AUDIO, 118, "L16", NULL, 11025, 11025, 176400,
|
||||||
40000, 441, 882, 882, 1, 1, 1,
|
40000, 441, 882, 882, 1, 1, 1, switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
|
||||||
switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,8 +34,7 @@
|
|||||||
#include <pcre.h>
|
#include <pcre.h>
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_regex_t *) switch_regex_compile(const char *pattern,
|
SWITCH_DECLARE(switch_regex_t *) switch_regex_compile(const char *pattern,
|
||||||
int options, const char **errorptr, int *erroroffset,
|
int options, const char **errorptr, int *erroroffset, const unsigned char *tables)
|
||||||
const unsigned char *tables)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return pcre_compile(pattern, options, errorptr, erroroffset, tables);
|
return pcre_compile(pattern, options, errorptr, erroroffset, tables);
|
||||||
|
@ -186,12 +186,7 @@ struct switch_rtp {
|
|||||||
|
|
||||||
static int global_init = 0;
|
static int global_init = 0;
|
||||||
static int rtp_common_write(switch_rtp_t *rtp_session,
|
static int rtp_common_write(switch_rtp_t *rtp_session,
|
||||||
rtp_msg_t *send_msg,
|
rtp_msg_t *send_msg, void *data, uint32_t datalen, switch_payload_t payload, uint32_t timestamp, switch_frame_flag_t *flags);
|
||||||
void *data,
|
|
||||||
uint32_t datalen,
|
|
||||||
switch_payload_t payload,
|
|
||||||
uint32_t timestamp,
|
|
||||||
switch_frame_flag_t *flags);
|
|
||||||
|
|
||||||
|
|
||||||
static switch_status_t ice_out(switch_rtp_t *rtp_session)
|
static switch_status_t ice_out(switch_rtp_t *rtp_session)
|
||||||
@ -463,7 +458,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_s
|
|||||||
*err = "Bind Error!";
|
*err = "Bind Error!";
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
len = sizeof(i);
|
len = sizeof(i);
|
||||||
switch_socket_opt_set(new_sock, SWITCH_SO_NONBLOCK, TRUE);
|
switch_socket_opt_set(new_sock, SWITCH_SO_NONBLOCK, TRUE);
|
||||||
@ -545,10 +539,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_
|
|||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_session,
|
SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_session,
|
||||||
switch_rtp_crypto_direction_t direction,
|
switch_rtp_crypto_direction_t direction,
|
||||||
uint32_t index,
|
uint32_t index, switch_rtp_crypto_key_type_t type, unsigned char *key, switch_size_t keylen)
|
||||||
switch_rtp_crypto_key_type_t type,
|
|
||||||
unsigned char *key,
|
|
||||||
switch_size_t keylen)
|
|
||||||
{
|
{
|
||||||
switch_rtp_crypto_key_t *crypto_key;
|
switch_rtp_crypto_key_t *crypto_key;
|
||||||
srtp_policy_t *policy;
|
srtp_policy_t *policy;
|
||||||
@ -645,10 +636,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
|
|||||||
switch_payload_t payload,
|
switch_payload_t payload,
|
||||||
uint32_t samples_per_interval,
|
uint32_t samples_per_interval,
|
||||||
uint32_t ms_per_packet,
|
uint32_t ms_per_packet,
|
||||||
switch_rtp_flag_t flags,
|
switch_rtp_flag_t flags, char *timer_name, const char **err, switch_memory_pool_t *pool)
|
||||||
char *timer_name,
|
|
||||||
const char **err,
|
|
||||||
switch_memory_pool_t *pool)
|
|
||||||
{
|
{
|
||||||
switch_rtp_t *rtp_session = NULL;
|
switch_rtp_t *rtp_session = NULL;
|
||||||
uint32_t ssrc = rand() & 0xffff;
|
uint32_t ssrc = rand() & 0xffff;
|
||||||
@ -718,8 +706,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!switch_strlen_zero(timer_name)) {
|
if (!switch_strlen_zero(timer_name)) {
|
||||||
if (switch_core_timer_init(&rtp_session->timer, timer_name, ms_per_packet / 1000, samples_per_interval, pool) ==
|
if (switch_core_timer_init(&rtp_session->timer, timer_name, ms_per_packet / 1000, samples_per_interval, pool) == SWITCH_STATUS_SUCCESS) {
|
||||||
SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||||
"Starting timer [%s] %d bytes per %dms\n", timer_name, samples_per_interval, ms_per_packet);
|
"Starting timer [%s] %d bytes per %dms\n", timer_name, samples_per_interval, ms_per_packet);
|
||||||
} else {
|
} else {
|
||||||
@ -742,10 +729,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
|
|||||||
switch_payload_t payload,
|
switch_payload_t payload,
|
||||||
uint32_t samples_per_interval,
|
uint32_t samples_per_interval,
|
||||||
uint32_t ms_per_packet,
|
uint32_t ms_per_packet,
|
||||||
switch_rtp_flag_t flags,
|
switch_rtp_flag_t flags, char *timer_name, const char **err, switch_memory_pool_t *pool)
|
||||||
char *timer_name,
|
|
||||||
const char **err,
|
|
||||||
switch_memory_pool_t *pool)
|
|
||||||
{
|
{
|
||||||
switch_rtp_t *rtp_session = NULL;
|
switch_rtp_t *rtp_session = NULL;
|
||||||
|
|
||||||
@ -1020,19 +1004,12 @@ static void do_2833(switch_rtp_t *rtp_session)
|
|||||||
|
|
||||||
for (x = 0; x < loops; x++) {
|
for (x = 0; x < loops; x++) {
|
||||||
switch_rtp_write_manual(rtp_session,
|
switch_rtp_write_manual(rtp_session,
|
||||||
rtp_session->dtmf_data.out_digit_packet,
|
rtp_session->dtmf_data.out_digit_packet, 4, 0, rtp_session->te, rtp_session->dtmf_data.timestamp_dtmf, &flags);
|
||||||
4,
|
|
||||||
0,
|
|
||||||
rtp_session->te,
|
|
||||||
rtp_session->dtmf_data.timestamp_dtmf,
|
|
||||||
&flags);
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s packet for [%c] ts=%u dur=%d/%d/%d seq=%d\n",
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s packet for [%c] ts=%u dur=%d/%d/%d seq=%d\n",
|
||||||
loops == 1 ? "middle" : "end", rtp_session->dtmf_data.out_digit,
|
loops == 1 ? "middle" : "end", rtp_session->dtmf_data.out_digit,
|
||||||
rtp_session->dtmf_data.timestamp_dtmf,
|
rtp_session->dtmf_data.timestamp_dtmf,
|
||||||
rtp_session->dtmf_data.out_digit_sofar,
|
rtp_session->dtmf_data.out_digit_sofar,
|
||||||
rtp_session->dtmf_data.out_digit_sub_sofar,
|
rtp_session->dtmf_data.out_digit_sub_sofar, rtp_session->dtmf_data.out_digit_dur, rtp_session->seq);
|
||||||
rtp_session->dtmf_data.out_digit_dur,
|
|
||||||
rtp_session->seq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loops != 1) {
|
if (loops != 1) {
|
||||||
@ -1084,17 +1061,13 @@ static void do_2833(switch_rtp_t *rtp_session)
|
|||||||
rtp_session->dtmf_data.out_digit_packet,
|
rtp_session->dtmf_data.out_digit_packet,
|
||||||
4,
|
4,
|
||||||
switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BUGGY_2833) ? 0 : 1,
|
switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BUGGY_2833) ? 0 : 1,
|
||||||
rtp_session->te,
|
rtp_session->te, rtp_session->dtmf_data.timestamp_dtmf, &flags);
|
||||||
rtp_session->dtmf_data.timestamp_dtmf,
|
|
||||||
&flags);
|
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send start packet for [%c] ts=%u dur=%d/%d/%d seq=%d\n",
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send start packet for [%c] ts=%u dur=%d/%d/%d seq=%d\n",
|
||||||
rtp_session->dtmf_data.out_digit,
|
rtp_session->dtmf_data.out_digit,
|
||||||
rtp_session->dtmf_data.timestamp_dtmf,
|
rtp_session->dtmf_data.timestamp_dtmf,
|
||||||
rtp_session->dtmf_data.out_digit_sofar,
|
rtp_session->dtmf_data.out_digit_sofar,
|
||||||
rtp_session->dtmf_data.out_digit_sub_sofar,
|
rtp_session->dtmf_data.out_digit_sub_sofar, rtp_session->dtmf_data.out_digit_dur, rtp_session->seq);
|
||||||
rtp_session->dtmf_data.out_digit_dur,
|
|
||||||
rtp_session->seq);
|
|
||||||
|
|
||||||
free(rdigit);
|
free(rdigit);
|
||||||
}
|
}
|
||||||
@ -1274,7 +1247,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
|
|||||||
if (++rtp_session->srtp_errs >= MAX_SRTP_ERRS) {
|
if (++rtp_session->srtp_errs >= MAX_SRTP_ERRS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||||
"error: srtp unprotection failed with code %d%s\n", stat,
|
"error: srtp unprotection failed with code %d%s\n", stat,
|
||||||
stat == err_status_replay_fail ? " (replay check failed)" : stat == err_status_auth_fail ? " (auth check failed)" : "");
|
stat == err_status_replay_fail ? " (replay check failed)" : stat ==
|
||||||
|
err_status_auth_fail ? " (auth check failed)" : "");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto end;
|
goto end;
|
||||||
} else {
|
} else {
|
||||||
@ -1325,7 +1299,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
|
|||||||
rtp_session->dtmf_data.flip = 0;
|
rtp_session->dtmf_data.flip = 0;
|
||||||
//printf("you're welcome!\n");
|
//printf("you're welcome!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("done digit=%c ts=%u start_ts=%u dur=%u ddur=%u\n",
|
//printf("done digit=%c ts=%u start_ts=%u dur=%u ddur=%u\n",
|
||||||
//dtmf.digit, ts, rtp_session->dtmf_data.in_digit_ts, duration, dtmf.duration);
|
//dtmf.digit, ts, rtp_session->dtmf_data.in_digit_ts, duration, dtmf.duration);
|
||||||
switch_rtp_queue_rfc2833_in(rtp_session, &dtmf);
|
switch_rtp_queue_rfc2833_in(rtp_session, &dtmf);
|
||||||
@ -1587,7 +1560,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp
|
|||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_session,
|
SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_session,
|
||||||
void **data, uint32_t * datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags)
|
void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags,
|
||||||
|
switch_io_flag_t io_flags)
|
||||||
{
|
{
|
||||||
int bytes = 0;
|
int bytes = 0;
|
||||||
|
|
||||||
@ -1610,12 +1584,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_sessi
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int rtp_common_write(switch_rtp_t *rtp_session,
|
static int rtp_common_write(switch_rtp_t *rtp_session,
|
||||||
rtp_msg_t *send_msg,
|
rtp_msg_t *send_msg, void *data, uint32_t datalen, switch_payload_t payload, uint32_t timestamp, switch_frame_flag_t *flags)
|
||||||
void *data,
|
|
||||||
uint32_t datalen,
|
|
||||||
switch_payload_t payload,
|
|
||||||
uint32_t timestamp,
|
|
||||||
switch_frame_flag_t *flags)
|
|
||||||
{
|
{
|
||||||
switch_size_t bytes;
|
switch_size_t bytes;
|
||||||
uint8_t send = 1;
|
uint8_t send = 1;
|
||||||
@ -1938,8 +1907,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (switch_test_flag(frame, SFF_RTP_HEADER)) {
|
if (switch_test_flag(frame, SFF_RTP_HEADER)) {
|
||||||
return switch_rtp_write_manual(rtp_session, frame->data, frame->datalen, frame->m, frame->payload,
|
return switch_rtp_write_manual(rtp_session, frame->data, frame->datalen, frame->m, frame->payload, (uint32_t) (frame->timestamp), &frame->flags);
|
||||||
(uint32_t)(frame->timestamp), &frame->flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fwd) {
|
if (fwd) {
|
||||||
@ -1956,9 +1924,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
|
|||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
|
SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
|
||||||
void *data,
|
void *data, uint32_t datalen, uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags)
|
||||||
uint32_t datalen,
|
|
||||||
uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags)
|
|
||||||
{
|
{
|
||||||
switch_size_t bytes;
|
switch_size_t bytes;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
@ -457,7 +457,6 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(softtimer_shutdown)
|
|||||||
switch_yield(10000);
|
switch_yield(10000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
timeEndPeriod(1);
|
timeEndPeriod(1);
|
||||||
#endif
|
#endif
|
||||||
|
@ -416,8 +416,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, const char *fr
|
|||||||
"Content-ID: <ATTACHED@freeswitch.org>\n"
|
"Content-ID: <ATTACHED@freeswitch.org>\n"
|
||||||
"Content-Transfer-Encoding: base64\n"
|
"Content-Transfer-Encoding: base64\n"
|
||||||
"Content-Description: Sound attachment.\n"
|
"Content-Description: Sound attachment.\n"
|
||||||
"Content-Disposition: attachment; filename=\"%s\"\n\n",
|
"Content-Disposition: attachment; filename=\"%s\"\n\n", bound, mime_type, stipped_file, stipped_file);
|
||||||
bound, mime_type, stipped_file, stipped_file);
|
|
||||||
if (!write_buf(fd, buf))
|
if (!write_buf(fd, buf))
|
||||||
return SWITCH_FALSE;
|
return SWITCH_FALSE;
|
||||||
|
|
||||||
@ -484,10 +483,10 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, const char *fr
|
|||||||
|
|
||||||
SWITCH_DECLARE(switch_bool_t) switch_is_lan_addr(const char *ip)
|
SWITCH_DECLARE(switch_bool_t) switch_is_lan_addr(const char *ip)
|
||||||
{
|
{
|
||||||
if (switch_strlen_zero(ip)) return SWITCH_FALSE;
|
if (switch_strlen_zero(ip))
|
||||||
|
return SWITCH_FALSE;
|
||||||
|
|
||||||
return (
|
return (strncmp(ip, "10.", 3) &&
|
||||||
strncmp(ip, "10.", 3) &&
|
|
||||||
strncmp(ip, "192.168.", 8) &&
|
strncmp(ip, "192.168.", 8) &&
|
||||||
strncmp(ip, "127.", 4) &&
|
strncmp(ip, "127.", 4) &&
|
||||||
strncmp(ip, "255.", 4) &&
|
strncmp(ip, "255.", 4) &&
|
||||||
@ -498,11 +497,7 @@ SWITCH_DECLARE(switch_bool_t) switch_is_lan_addr(const char *ip)
|
|||||||
strncmp(ip, "172.17.", 7) &&
|
strncmp(ip, "172.17.", 7) &&
|
||||||
strncmp(ip, "172.18.", 7) &&
|
strncmp(ip, "172.18.", 7) &&
|
||||||
strncmp(ip, "172.19.", 7) &&
|
strncmp(ip, "172.19.", 7) &&
|
||||||
strncmp(ip, "172.2", 5) &&
|
strncmp(ip, "172.2", 5) && strncmp(ip, "172.30.", 7) && strncmp(ip, "172.31.", 7) && strncmp(ip, "192.0.2.", 8) && strncmp(ip, "169.254.", 8)
|
||||||
strncmp(ip, "172.30.", 7) &&
|
|
||||||
strncmp(ip, "172.31.", 7) &&
|
|
||||||
strncmp(ip, "192.0.2.", 8) &&
|
|
||||||
strncmp(ip, "169.254.", 8)
|
|
||||||
)? SWITCH_FALSE : SWITCH_TRUE;
|
)? SWITCH_FALSE : SWITCH_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,7 +557,8 @@ SWITCH_DECLARE(char *) switch_strip_spaces(const char *str)
|
|||||||
const char *sp = str;
|
const char *sp = str;
|
||||||
char *p, *s = NULL;
|
char *p, *s = NULL;
|
||||||
|
|
||||||
if (!sp) return NULL;
|
if (!sp)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
while (*sp == ' ') {
|
while (*sp == ' ') {
|
||||||
sp++;
|
sp++;
|
||||||
@ -570,7 +566,8 @@ SWITCH_DECLARE(char *) switch_strip_spaces(const char *str)
|
|||||||
|
|
||||||
s = strdup(sp);
|
s = strdup(sp);
|
||||||
|
|
||||||
if (!s) return NULL;
|
if (!s)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
p = s + (strlen(s) - 1);
|
p = s + (strlen(s) - 1);
|
||||||
|
|
||||||
@ -710,7 +707,8 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int fam
|
|||||||
|
|
||||||
if (!address_info || WSAIoctl(tmp_socket,
|
if (!address_info || WSAIoctl(tmp_socket,
|
||||||
SIO_ROUTING_INTERFACE_QUERY,
|
SIO_ROUTING_INTERFACE_QUERY,
|
||||||
address_info->ai_addr, (DWORD) address_info->ai_addrlen, &l_address, sizeof(l_address), (LPDWORD) & l_address_len, NULL, NULL)) {
|
address_info->ai_addr, (DWORD) address_info->ai_addrlen, &l_address, sizeof(l_address), (LPDWORD) & l_address_len, NULL,
|
||||||
|
NULL)) {
|
||||||
|
|
||||||
closesocket(tmp_socket);
|
closesocket(tmp_socket);
|
||||||
if (address_info)
|
if (address_info)
|
||||||
@ -921,8 +919,7 @@ static const char *switch_inet_ntop6(const unsigned char *src, char *dst, size_t
|
|||||||
* author:
|
* author:
|
||||||
* Paul Vixie, 1996.
|
* Paul Vixie, 1996.
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *switch_inet_ntop(int af, void const *src, char *dst, size_t size)
|
||||||
switch_inet_ntop(int af, void const *src, char *dst, size_t size)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (af) {
|
switch (af) {
|
||||||
@ -949,14 +946,12 @@ switch_inet_ntop(int af, void const *src, char *dst, size_t size)
|
|||||||
* author:
|
* author:
|
||||||
* Paul Vixie, 1996.
|
* Paul Vixie, 1996.
|
||||||
*/
|
*/
|
||||||
static const char *
|
static const char *switch_inet_ntop4(const unsigned char *src, char *dst, size_t size)
|
||||||
switch_inet_ntop4(const unsigned char *src, char *dst, size_t size)
|
|
||||||
{
|
{
|
||||||
static const char fmt[] = "%u.%u.%u.%u";
|
static const char fmt[] = "%u.%u.%u.%u";
|
||||||
char tmp[sizeof "255.255.255.255"];
|
char tmp[sizeof "255.255.255.255"];
|
||||||
|
|
||||||
if (switch_snprintf(tmp, sizeof tmp, fmt,
|
if (switch_snprintf(tmp, sizeof tmp, fmt, src[0], src[1], src[2], src[3]) >= (int) size) {
|
||||||
src[0], src[1], src[2], src[3]) >= (int)size) {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -970,8 +965,7 @@ switch_inet_ntop4(const unsigned char *src, char *dst, size_t size)
|
|||||||
* author:
|
* author:
|
||||||
* Paul Vixie, 1996.
|
* Paul Vixie, 1996.
|
||||||
*/
|
*/
|
||||||
static const char *
|
static const char *switch_inet_ntop6(unsigned char const *src, char *dst, size_t size)
|
||||||
switch_inet_ntop6(unsigned char const *src, char *dst, size_t size)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Note that int32_t and int16_t need only be "at least" large enough
|
* Note that int32_t and int16_t need only be "at least" large enough
|
||||||
@ -981,7 +975,11 @@ switch_inet_ntop6(unsigned char const *src, char *dst, size_t size)
|
|||||||
* to use pointer overlays. All the world's not a VAX.
|
* to use pointer overlays. All the world's not a VAX.
|
||||||
*/
|
*/
|
||||||
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
|
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
|
||||||
struct { int base, len; } best = { -1 , 0 }, cur = { -1, 0 };
|
struct {
|
||||||
|
int base, len;
|
||||||
|
} best = {
|
||||||
|
-1, 0}, cur = {
|
||||||
|
-1, 0};
|
||||||
unsigned int words[8];
|
unsigned int words[8];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1021,8 +1019,7 @@ switch_inet_ntop6(unsigned char const *src, char *dst, size_t size)
|
|||||||
tp = tmp;
|
tp = tmp;
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
/* Are we inside the best run of 0x00's? */
|
/* Are we inside the best run of 0x00's? */
|
||||||
if (best.base != -1 && i >= best.base &&
|
if (best.base != -1 && i >= best.base && i < (best.base + best.len)) {
|
||||||
i < (best.base + best.len)) {
|
|
||||||
if (i == best.base)
|
if (i == best.base)
|
||||||
*tp++ = ':';
|
*tp++ = ':';
|
||||||
continue;
|
continue;
|
||||||
@ -1031,8 +1028,7 @@ switch_inet_ntop6(unsigned char const *src, char *dst, size_t size)
|
|||||||
if (i != 0)
|
if (i != 0)
|
||||||
*tp++ = ':';
|
*tp++ = ':';
|
||||||
/* Is this address an encapsulated IPv4? */
|
/* Is this address an encapsulated IPv4? */
|
||||||
if (i == 6 && best.base == 0 &&
|
if (i == 6 && best.base == 0 && (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
|
||||||
(best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
|
|
||||||
if (!inet_ntop4(src + 12, tp, sizeof tmp - (tp - tmp)))
|
if (!inet_ntop4(src + 12, tp, sizeof tmp - (tp - tmp)))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
tp += strlen(tp);
|
tp += strlen(tp);
|
||||||
@ -1313,9 +1309,7 @@ SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char
|
|||||||
|
|
||||||
memset(array, 0, arraylen * sizeof(*array));
|
memset(array, 0, arraylen * sizeof(*array));
|
||||||
|
|
||||||
return (delim == ' ' ?
|
return (delim == ' ' ? separate_string_blank_delim(buf, array, arraylen) : separate_string_char_delim(buf, delim, array, arraylen));
|
||||||
separate_string_blank_delim(buf, array, arraylen) :
|
|
||||||
separate_string_char_delim(buf, delim, array, arraylen));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(const char *) switch_cut_path(const char *in)
|
SWITCH_DECLARE(const char *) switch_cut_path(const char *in)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user