*/
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
\param pool a memory pool to use
cause_str = switch_channel_cause2str(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);
return;
}
}
+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_status_t status = SWITCH_STATUS_FALSE;