[Freeswitch-trunk] [commit] r13543 - freeswitch/trunk/src/mod/endpoints/mod_sofia
FreeSWITCH SVN
mrene at freeswitch.org
Mon Jun 1 17:54:38 PDT 2009
Author: mrene
Date: Mon Jun 1 19:54:38 2009
New Revision: 13543
Log:
mod_sofia: Rewrite sofia_glue_get_user_host
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Mon Jun 1 19:54:38 2009
@@ -3961,20 +3961,30 @@
*user = NULL;
*host = NULL;
- if (!strncasecmp(u, "sip:", 4)) {
- u += 4;
- }
-
+ /* First isolate the host part from the user part */
if ((h = strchr(u, '@'))) {
*h++ = '\0';
} else {
return 0;
}
- p = h + strlen(h) - 1;
+ /* Clean out the user part of its protocol prefix (if any) */
+ if ((p = strchr(u, ':'))) {
+ *p++ = '\0';
+ u = p;
+ }
- if (p && (*p == ':' || *p == ';' || *p == ' ')) {
- *p = '\0';
+ /* Clean out the host part of any suffix */
+ if ((p = strchr(h, ':'))) {
+ *p = 0;
+ }
+
+ if ((p = strchr(h, ';'))) {
+ *p = 0;
+ }
+
+ if ((p = strchr(h, ' '))) {
+ *p = 0;
}
*user = u;
More information about the Freeswitch-trunk
mailing list