[commit] r10554 - in freeswitch/trunk/src: . include mod/endpoints/mod_sofia
Author: anthm Date: Wed Nov 26 21:30:11 2008 New Revision: 10554 Log: patch for FSCORE-219 Modified: freeswitch/trunk/src/include/switch_stun.h freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c freeswitch/trunk/src/switch_stun.c Modified: freeswitch/trunk/src/include/switch_stun.h ============================================================================== --- freeswitch/trunk/src/include/switch_stun.h (original) +++ freeswitch/trunk/src/include/switch_stun.h Wed Nov 26 21:30:11 2008 @@ -147,6 +147,7 @@ */ SWITCH_DECLARE(const char *) switch_stun_value_to_name(int32_t type, uint32_t value); +SWITCH_DECLARE(char *) switch_stun_host_lookup(const char *host, switch_memory_pool_t *pool); /*! \brief Extract a mapped address (IP:PORT) from a packet attribute 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 Wed Nov 26 21:30:11 2008 @@ -448,7 +448,9 @@ return status; } - if (!strncasecmp(sourceip, "stun:", 5)) { + if (!strncasecmp(sourceip, "host:", 5)) { + status = (*ip = switch_stun_host_lookup(sourceip + 5, pool)) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; + } else if (!strncasecmp(sourceip, "stun:", 5)) { char *p; if (!(profile->pflags & PFLAG_STUN_ENABLED)) { Modified: freeswitch/trunk/src/switch_stun.c ============================================================================== --- freeswitch/trunk/src/switch_stun.c (original) +++ freeswitch/trunk/src/switch_stun.c Wed Nov 26 21:30:11 2008 @@ -428,6 +428,16 @@ return 1; } +SWITCH_DECLARE(char *) switch_stun_host_lookup(const char *host, switch_memory_pool_t *pool) +{ + switch_sockaddr_t *addr = NULL; + char buf[30]; + + switch_sockaddr_info_get(&addr, host, SWITCH_UNSPEC, 0, 0, pool); + return switch_core_strdup(pool, switch_str_nil(switch_get_addr(buf, sizeof(buf), addr))); + +} + SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip, switch_port_t *port, char *stunip, switch_port_t stunport, char **err, switch_memory_pool_t *pool) {
participants (1)
-
FreeSWITCH SVN