From f3cea0b78e96af5100fd9418db35c300b93c16ad Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Wed, 30 Jul 2008 18:50:47 +0000 Subject: [PATCH] record the local servers ip not the domain so we can figure out the right server later git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9209 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.c | 2 +- src/mod/endpoints/mod_sofia/sofia.c | 8 +++++--- src/mod/endpoints/mod_sofia/sofia_reg.c | 8 +++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 3980d378d9..8ee4ee4827 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -24,7 +24,7 @@ * Contributor(s): * * Anthony Minessale II - * Ken Rice, Asteria Solutions Group, Inc + * Ken Rice * Paul D. Tinsley * Bret McDanel * diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index b3a55c607c..ba95099b7c 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -385,9 +385,10 @@ void event_handler(switch_event_t *event) long expires = (long) switch_timestamp(NULL); char *profile_name = switch_event_get_header(event, "orig-profile-name"); char *to_user = switch_event_get_header(event, "orig-to-user"); - char *to_host = switch_event_get_header(event, "orig-to-host"); sofia_profile_t *profile = NULL; + char guess_ip4[256]; + if (exp_str) { expires += atol(exp_str); } @@ -408,9 +409,10 @@ void event_handler(switch_event_t *event) switch_mutex_lock(profile->ireg_mutex); sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); - + + switch_find_local_ip(guess_ip4, sizeof(guess_ip4), AF_INET); sql = switch_mprintf("insert into sip_registrations values ('%q', '%q','%q','%q','Registered', '%q', %ld, '%q', '%q', '%q')", - call_id, from_user, from_host, contact_str, rpid, expires, user_agent, to_user, to_host); + call_id, from_user, from_host, contact_str, rpid, expires, user_agent, to_user, guess_ip4); if (sql) { sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 3d30800d4c..767ec34afe 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -24,7 +24,7 @@ * Contributor(s): * * Anthony Minessale II - * Ken Rice, krice@suspicious.org (work sponsored by CopperCom, Inc and Asteria Solutions Group, Inc) + * Ken Rice, (work sponsored by Comet Signaling LLC, CopperCom, Inc and Asteria Solutions Group, Inc) * Paul D. Tinsley * Bret McDanel * Marcel Barbulescu @@ -738,6 +738,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (exptime) { const char *agent = "dunno"; + char guess_ip4[256]; if (sip->sip_user_agent) { agent = sip->sip_user_agent->g_string; @@ -750,9 +751,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } switch_mutex_lock(profile->ireg_mutex); sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); - + + switch_find_local_ip(guess_ip4, sizeof(guess_ip4), AF_INET); sql = switch_mprintf("insert into sip_registrations values ('%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q')", call_id, - to_user, to_host, contact_str, reg_desc, rpid, (long) switch_timestamp(NULL) + (long) exptime * 2, agent, from_user, from_host); + to_user, to_host, contact_str, reg_desc, rpid, (long) switch_timestamp(NULL) + (long) exptime * 2, agent, from_user, guess_ip4); if (sql) { sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); }