mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-05-02 06:38:04 +00:00
add switch_stristr and use it in dptools
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5887 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
e5b16c4374
commit
b50e8f5c9a
@ -298,6 +298,8 @@ if (vname) {free(vname); vname = NULL;}vname = strdup(string);}
|
|||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char **array, int arraylen);
|
SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char **array, int arraylen);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(const char *) switch_stristr(const char *str, const char *instr);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Escape a string by prefixing a list of characters with an escape character
|
\brief Escape a string by prefixing a list of characters with an escape character
|
||||||
\param pool a memory pool to use
|
\param pool a memory pool to use
|
||||||
|
@ -1223,7 +1223,7 @@ SWITCH_STANDARD_APP(audio_bridge_function)
|
|||||||
cause_str = switch_channel_cause2str(cause);
|
cause_str = switch_channel_cause2str(cause);
|
||||||
snprintf(cause_num, sizeof(cause_num), "%u", cause);
|
snprintf(cause_num, sizeof(cause_num), "%u", cause);
|
||||||
|
|
||||||
if (switch_true(continue_on_fail) || strstr(cause_str, continue_on_fail) || strstr(cause_str, cause_num)) {
|
if (switch_true(continue_on_fail) || switch_stristr(cause_str, continue_on_fail) || strstr(cause_str, cause_num)) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Continue on fail [%s]: Cause: %s\n", continue_on_fail, cause_str);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Continue on fail [%s]: Cause: %s\n", continue_on_fail, cause_str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -197,6 +197,27 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(char *to, char *from, char *he
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SWITCH_DECLARE(const char *) switch_stristr(const char *str, const char *instr)
|
||||||
|
{
|
||||||
|
size_t score = strlen(str), x = 0;
|
||||||
|
const char *a = str, *b = instr, *p = NULL;
|
||||||
|
|
||||||
|
while(*a && *b) {
|
||||||
|
if (tolower(*b) == tolower(*a)) {
|
||||||
|
if (++x == score) {
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
a++;
|
||||||
|
} else {
|
||||||
|
a = str;
|
||||||
|
p = b+1;
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
b++;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int family)
|
SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int family)
|
||||||
{
|
{
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user