From df621b1a843afc4fafd2acd908574586859af202 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 5 Apr 2006 21:38:31 +0000 Subject: [PATCH] update git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1051 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_exosip/mod_exosip.c | 11 +++++++++++ src/switch_stun.c | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_exosip/mod_exosip.c b/src/mod/endpoints/mod_exosip/mod_exosip.c index 1e519d9490..8e7fdd79f2 100644 --- a/src/mod/endpoints/mod_exosip/mod_exosip.c +++ b/src/mod/endpoints/mod_exosip/mod_exosip.c @@ -79,6 +79,7 @@ static struct { int debug; int bytes_per_frame; char *dialplan; + char *host; int port; char *codec_string; char *codec_order[SWITCH_MAX_CODECS]; @@ -137,6 +138,7 @@ struct rfc2833_digit { }; SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan) +SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_host, globals.host) SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string) static switch_status exosip_on_init(switch_core_session *session); @@ -1555,6 +1557,8 @@ static int config_exosip(int reload) globals.debug = atoi(val); } else if (!strcmp(var, "port")) { globals.port = atoi(val); + } else if (!strcmp(var, "host")) { + set_global_host(val); } else if (!strcmp(var, "cng")) { if (switch_true(val)) { switch_set_flag(&globals, TFLAG_SILENCE); @@ -1577,6 +1581,11 @@ static int config_exosip(int reload) } } + if (!globals.host) { + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Setting host to 'localhost' Good luck with that...\n"); + set_global_host("localhost"); + } + if (!globals.codec_ms) { globals.codec_ms = 20; } @@ -1584,6 +1593,8 @@ static int config_exosip(int reload) if (!globals.port) { globals.port = 5060; } + + switch_config_close_file(&cfg); diff --git a/src/switch_stun.c b/src/switch_stun.c index 832133defd..eb65f90c39 100644 --- a/src/switch_stun.c +++ b/src/switch_stun.c @@ -98,7 +98,9 @@ SWITCH_DECLARE(void) switch_stun_random_string(char *buf, uint16_t len, char *se } max = (int)strlen(set) - 1; - + + srand(apr_time_now()); + for(x = 0; x < len; x++) { int j = 1+(int)(max*1.0*rand()/(RAND_MAX+1.0)); buf[x] = set[j];