Change. Reduce search parent host name.

This can be done because child and parent channels have to be on same FS.
This commit is contained in:
Alexey Melnichuk 2015-09-28 11:35:12 +04:00
parent 5fab1a34f7
commit 7622fd4896
1 changed files with 8 additions and 1 deletions

View File

@ -138,6 +138,8 @@
end end
-- search parent hostname -- search parent hostname
call_hostname = hostname
--[[ parent and child have to be on same box so we do not search it
log.notice("Found parent channel try detect parent hostname") log.notice("Found parent channel try detect parent hostname")
local dbh = Database.new('switch') local dbh = Database.new('switch')
local sql = "SELECT hostname FROM channels WHERE uuid='" .. parent_uuid .. "'" local sql = "SELECT hostname FROM channels WHERE uuid='" .. parent_uuid .. "'"
@ -148,6 +150,7 @@
log.notice("Can not find host name. Channels is dead?") log.notice("Can not find host name. Channels is dead?")
return true return true
end end
--]]
if hostname == call_hostname then if hostname == call_hostname then
log.notice("Found parent call on local machine. Do intercept....") log.notice("Found parent call on local machine. Do intercept....")
@ -288,18 +291,22 @@
channel_variable(uuid, 'fifo_bridge_uuid') or channel_variable(uuid, 'fifo_bridge_uuid') or
uuid uuid
--[[ parent and child have to be on same box so we do not search it
if parent_uuid ~= uuid then if parent_uuid ~= uuid then
uuid = parent_uuid
local sql = "SELECT hostname FROM channels WHERE uuid='" .. uuid .. "'" local sql = "SELECT hostname FROM channels WHERE uuid='" .. uuid .. "'"
call_hostname = dbh:first_value(sql) call_hostname = dbh:first_value(sql)
end end
--]]
if call_hostname then if call_hostname then
uuid = parent_uuid
if call_hostname ~= hostname then if call_hostname ~= hostname then
log.noticef("Found parent call on remote machine `%s`.", call_hostname) log.noticef("Found parent call on remote machine `%s`.", call_hostname)
else else
log.notice("Found parent call on local machine.") log.notice("Found parent call on local machine.")
end end
end end
else else
log.noticef("Found child call on remote machine `%s`.", call_hostname) log.noticef("Found child call on remote machine `%s`.", call_hostname)
-- we can not find parent on this box because channel on other box so we have to -- we can not find parent on this box because channel on other box so we have to