mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-14 05:18:31 +00:00
FS-3277 --resolve There are actually really only 2 places where it needs the real hostname, the hostname command and the header on the events. I changed everything to the switchname because there were some more sql stmts etc in the core.
This commit is contained in:
1 parent
5510618660
commit
00b53a91ea
18 files changed
+102
-93
No files matched your search
+35
-35
@@ -1141,7 +1141,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
new_sql() = switch_mprintf("insert into tasks values(%q,'%q','%q',%q, '%q')",
|
||||
id,
|
||||
switch_event_get_header_nil(event, "task-desc"),
|
||||
switch_event_get_header_nil(event, "task-group"), manager ? manager : "0", switch_core_get_hostname()
|
||||
switch_event_get_header_nil(event, "task-group"), manager ? manager : "0", switch_core_get_switchname()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1149,7 +1149,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
case SWITCH_EVENT_DEL_SCHEDULE:
|
||||
case SWITCH_EVENT_EXE_SCHEDULE:
|
||||
new_sql() = switch_mprintf("delete from tasks where task_id=%q and hostname='%q'",
|
||||
switch_event_get_header_nil(event, "task-id"), switch_core_get_hostname());
|
||||
switch_event_get_header_nil(event, "task-id"), switch_core_get_switchname());
|
||||
break;
|
||||
case SWITCH_EVENT_RE_SCHEDULE:
|
||||
{
|
||||
@@ -1160,7 +1160,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
new_sql() = switch_mprintf("update tasks set task_desc='%q',task_group='%q', task_sql_manager=%q where task_id=%q and hostname='%q'",
|
||||
switch_event_get_header_nil(event, "task-desc"),
|
||||
switch_event_get_header_nil(event, "task-group"), manager ? manager : "0", id,
|
||||
switch_core_get_hostname());
|
||||
switch_core_get_switchname());
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1170,10 +1170,10 @@ static void core_event_handler(switch_event_t *event)
|
||||
|
||||
if (uuid) {
|
||||
new_sql() = switch_mprintf("delete from channels where uuid='%q' and hostname='%q'",
|
||||
uuid, switch_core_get_hostname());
|
||||
uuid, switch_core_get_switchname());
|
||||
|
||||
new_sql() = switch_mprintf("delete from calls where (caller_uuid='%q' or callee_uuid='%q') and hostname='%q'",
|
||||
uuid, uuid, switch_core_get_hostname());
|
||||
uuid, uuid, switch_core_get_switchname());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1185,12 +1185,12 @@ static void core_event_handler(switch_event_t *event)
|
||||
"update calls set callee_uuid='%q' where callee_uuid='%q' and hostname='%q'",
|
||||
switch_event_get_header_nil(event, "unique-id"),
|
||||
switch_event_get_header_nil(event, "old-unique-id"),
|
||||
switch_core_get_hostname(),
|
||||
switch_core_get_switchname(),
|
||||
switch_event_get_header_nil(event, "unique-id"),
|
||||
switch_event_get_header_nil(event, "old-unique-id"),
|
||||
switch_core_get_hostname(),
|
||||
switch_core_get_switchname(),
|
||||
switch_event_get_header_nil(event, "unique-id"),
|
||||
switch_event_get_header_nil(event, "old-unique-id"), switch_core_get_hostname()
|
||||
switch_event_get_header_nil(event, "old-unique-id"), switch_core_get_switchname()
|
||||
);
|
||||
break;
|
||||
}
|
||||
@@ -1205,7 +1205,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
switch_event_get_header_nil(event, "channel-state"),
|
||||
switch_event_get_header_nil(event, "channel-call-state"),
|
||||
switch_event_get_header_nil(event, "caller-dialplan"),
|
||||
switch_event_get_header_nil(event, "caller-context"), switch_core_get_hostname()
|
||||
switch_event_get_header_nil(event, "caller-context"), switch_core_get_switchname()
|
||||
);
|
||||
break;
|
||||
case SWITCH_EVENT_CODEC:
|
||||
@@ -1218,7 +1218,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
switch_event_get_header_nil(event, "channel-write-codec-name"),
|
||||
switch_event_get_header_nil(event, "channel-write-codec-rate"),
|
||||
switch_event_get_header_nil(event, "channel-write-codec-bit-rate"),
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname());
|
||||
break;
|
||||
case SWITCH_EVENT_CHANNEL_HOLD:
|
||||
case SWITCH_EVENT_CHANNEL_UNHOLD:
|
||||
@@ -1230,7 +1230,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
switch_event_get_header_nil(event, "application-data"),
|
||||
switch_event_get_header_nil(event, "channel-presence-id"),
|
||||
switch_event_get_header_nil(event, "channel-presence-data"),
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname()
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname()
|
||||
);
|
||||
|
||||
}
|
||||
@@ -1245,7 +1245,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
switch_event_get_header_nil(event, "channel-presence-data"),
|
||||
switch_event_get_header_nil(event, "channel-call-uuid"),
|
||||
extra_cols,
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname());
|
||||
free(extra_cols);
|
||||
} else {
|
||||
new_sql() = switch_mprintf("update channels set "
|
||||
@@ -1253,7 +1253,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
switch_event_get_header_nil(event, "channel-presence-id"),
|
||||
switch_event_get_header_nil(event, "channel-presence-data"),
|
||||
switch_event_get_header_nil(event, "channel-call-uuid"),
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1288,7 +1288,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
switch_str_nil(name),
|
||||
switch_str_nil(number),
|
||||
switch_event_get_header_nil(event, "direction"),
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname());
|
||||
|
||||
name = switch_event_get_header(event, "callee-name");
|
||||
number = switch_event_get_header(event, "callee-number");
|
||||
@@ -1305,7 +1305,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
{
|
||||
new_sql() = switch_mprintf("update channels set callstate='%q' where uuid='%q' and hostname='%q'",
|
||||
switch_event_get_header_nil(event, "channel-call-state"),
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname());
|
||||
|
||||
}
|
||||
break;
|
||||
@@ -1337,7 +1337,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
switch_event_get_header_nil(event, "channel-presence-id"),
|
||||
switch_event_get_header_nil(event, "channel-presence-data"),
|
||||
extra_cols,
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname());
|
||||
free(extra_cols);
|
||||
} else {
|
||||
new_sql() = switch_mprintf("update channels set state='%s',cid_name='%q',cid_num='%q',"
|
||||
@@ -1352,13 +1352,13 @@ static void core_event_handler(switch_event_t *event)
|
||||
switch_event_get_header_nil(event, "caller-context"),
|
||||
switch_event_get_header_nil(event, "channel-presence-id"),
|
||||
switch_event_get_header_nil(event, "channel-presence-data"),
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
new_sql() = switch_mprintf("update channels set state='%s' where uuid='%s' and hostname='%q'",
|
||||
switch_event_get_header_nil(event, "channel-state"),
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1384,7 +1384,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
|
||||
new_sql() = switch_mprintf("update channels set call_uuid='%q' where uuid='%s' and hostname='%q'",
|
||||
switch_event_get_header_nil(event, "channel-call-uuid"),
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname());
|
||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname());
|
||||
|
||||
if (runtime.odbc_dbtype == DBTYPE_DEFAULT) {
|
||||
func_name = "function";
|
||||
@@ -1411,7 +1411,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
callee_cid_num,
|
||||
switch_event_get_header_nil(event, "Other-Leg-destination-number"),
|
||||
switch_event_get_header_nil(event, "Other-Leg-channel-name"),
|
||||
switch_event_get_header_nil(event, "Other-Leg-unique-id"), switch_core_get_hostname()
|
||||
switch_event_get_header_nil(event, "Other-Leg-unique-id"), switch_core_get_switchname()
|
||||
);
|
||||
}
|
||||
break;
|
||||
@@ -1420,14 +1420,14 @@ static void core_event_handler(switch_event_t *event)
|
||||
char *uuid = switch_event_get_header_nil(event, "caller-unique-id");
|
||||
|
||||
new_sql() = switch_mprintf("delete from calls where (caller_uuid='%q' or callee_uuid='%q') and hostname='%q'",
|
||||
uuid, uuid, switch_core_get_hostname());
|
||||
uuid, uuid, switch_core_get_switchname());
|
||||
break;
|
||||
}
|
||||
case SWITCH_EVENT_SHUTDOWN:
|
||||
new_sql() = switch_mprintf("delete from channels where hostname='%q';"
|
||||
"delete from interfaces where hostname='%q';"
|
||||
"delete from calls where hostname='%q'",
|
||||
switch_core_get_hostname(), switch_core_get_hostname(), switch_core_get_hostname()
|
||||
switch_core_get_switchname(), switch_core_get_switchname(), switch_core_get_switchname()
|
||||
);
|
||||
break;
|
||||
case SWITCH_EVENT_LOG:
|
||||
@@ -1445,7 +1445,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
switch_mprintf
|
||||
("insert into interfaces (type,name,description,syntax,ikey,filename,hostname) values('%q','%q','%q','%q','%q','%q','%q')", type, name,
|
||||
switch_str_nil(description), switch_str_nil(syntax), switch_str_nil(key), switch_str_nil(filename),
|
||||
switch_core_get_hostname()
|
||||
switch_core_get_switchname()
|
||||
);
|
||||
}
|
||||
break;
|
||||
@@ -1456,7 +1456,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
const char *name = switch_event_get_header_nil(event, "name");
|
||||
if (!zstr(type) && !zstr(name)) {
|
||||
new_sql() = switch_mprintf("delete from interfaces where type='%q' and name='%q' and hostname='%q'", type, name,
|
||||
switch_core_get_hostname());
|
||||
switch_core_get_switchname());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1468,7 +1468,7 @@ static void core_event_handler(switch_event_t *event)
|
||||
break;
|
||||
}
|
||||
new_sql() = switch_mprintf("update channels set secure='%s' where uuid='%s' and hostname='%q'",
|
||||
type, switch_event_get_header_nil(event, "caller-unique-id"), switch_core_get_hostname()
|
||||
type, switch_event_get_header_nil(event, "caller-unique-id"), switch_core_get_switchname()
|
||||
);
|
||||
break;
|
||||
}
|
||||
@@ -1479,12 +1479,12 @@ static void core_event_handler(switch_event_t *event)
|
||||
if (!strcmp("add", op)) {
|
||||
new_sql() = switch_mprintf("insert into nat (port, proto, sticky, hostname) values (%s, %s, %d,'%q')",
|
||||
switch_event_get_header_nil(event, "port"),
|
||||
switch_event_get_header_nil(event, "proto"), sticky, switch_core_get_hostname()
|
||||
switch_event_get_header_nil(event, "proto"), sticky, switch_core_get_switchname()
|
||||
);
|
||||
} else if (!strcmp("del", op)) {
|
||||
new_sql() = switch_mprintf("delete from nat where port=%s and proto=%s and hostname='%q'",
|
||||
switch_event_get_header_nil(event, "port"),
|
||||
switch_event_get_header_nil(event, "proto"), switch_core_get_hostname());
|
||||
switch_event_get_header_nil(event, "proto"), switch_core_get_switchname());
|
||||
} else if (!strcmp("status", op)) {
|
||||
/* call show nat api */
|
||||
} else if (!strcmp("status_response", op)) {
|
||||
@@ -1650,10 +1650,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c
|
||||
|
||||
if (runtime.multiple_registrations) {
|
||||
sql = switch_mprintf("delete from registrations where hostname='%q' and (url='%q' or token='%q')",
|
||||
switch_core_get_hostname(), url, switch_str_nil(token));
|
||||
switch_core_get_switchname(), url, switch_str_nil(token));
|
||||
} else {
|
||||
sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q'",
|
||||
user, realm, switch_core_get_hostname());
|
||||
user, realm, switch_core_get_switchname());
|
||||
}
|
||||
|
||||
switch_queue_push(sql_manager.sql_queue[0], sql);
|
||||
@@ -1668,7 +1668,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c
|
||||
switch_str_nil(network_ip),
|
||||
switch_str_nil(network_port),
|
||||
switch_str_nil(network_proto),
|
||||
switch_core_get_hostname()
|
||||
switch_core_get_switchname()
|
||||
);
|
||||
|
||||
|
||||
@@ -1687,9 +1687,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_del_registration(const char *user, c
|
||||
}
|
||||
|
||||
if (!zstr(token) && runtime.multiple_registrations) {
|
||||
sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q' and token='%q'", user, realm, switch_core_get_hostname(), token);
|
||||
sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q' and token='%q'", user, realm, switch_core_get_switchname(), token);
|
||||
} else {
|
||||
sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q'", user, realm, switch_core_get_hostname());
|
||||
sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q'", user, realm, switch_core_get_switchname());
|
||||
}
|
||||
|
||||
switch_queue_push(sql_manager.sql_queue[0], sql);
|
||||
@@ -1710,9 +1710,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force)
|
||||
now = switch_epoch_time_now(NULL);
|
||||
|
||||
if (force) {
|
||||
sql = switch_mprintf("delete from registrations where hostname='%q'", switch_core_get_hostname());
|
||||
sql = switch_mprintf("delete from registrations where hostname='%q'", switch_core_get_switchname());
|
||||
} else {
|
||||
sql = switch_mprintf("delete from registrations where expires > 0 and expires <= %ld and hostname='%q'", now, switch_core_get_hostname());
|
||||
sql = switch_mprintf("delete from registrations where expires > 0 and expires <= %ld and hostname='%q'", now, switch_core_get_switchname());
|
||||
}
|
||||
|
||||
switch_queue_push(sql_manager.sql_queue[0], sql);
|
||||
@@ -1767,7 +1767,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
|
||||
char sql[512] = "";
|
||||
char *tables[] = { "channels", "calls", "interfaces", "tasks", NULL };
|
||||
int i;
|
||||
const char *hostname = switch_core_get_hostname();
|
||||
const char *hostname = switch_core_get_switchname();
|
||||
|
||||
for (i = 0; tables[i]; i++) {
|
||||
switch_snprintf(sql, sizeof(sql), "delete from %s where hostname='%s'", tables[i], hostname);
|
||||
|
||||
Reference in new issue
Block a user