From: Michael Jerris Date: Thu, 14 Apr 2011 21:51:45 +0000 (-0400) Subject: add switch_clean_name_string to strip out caller id name chars that can cause issues X-Git-Tag: v1.2-rc1~118^2~119 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=244048f8f57d190c129e18ae782d8a238628bf13;p=thirdparty%2Ffreeswitch.git add switch_clean_name_string to strip out caller id name chars that can cause issues --- diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index b08c204889..4135ade091 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -500,6 +500,23 @@ static inline char *switch_clean_string(char *s) } +static inline char *switch_clean_name_string(char *s) +{ + char *p; + for (p = s; p && *p; p++) { + uint8_t x = (uint8_t) * p; + if ((x < 32) || x == '\'' || x == '"' || x == '<' || x == '>' || x == '\\' || x == ':' || x == '@' || x == '/') { + *p = ' '; + } + if ( (p == s) && (*p == ' ') ) { + s++; + } + } + + return s; +} + + /*! \brief Free a pointer and set it to NULL unless it already is NULL