From c2dec6923322c4a15fd472a7b70749f7c621e2bc Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 9 Jan 2017 08:58:06 +0100 Subject: [PATCH] TT#8766 mod_sipwise_pushd: fix error when caller is not from local domain * we can't get_caller_info() nor get_muc_info() from external domains Change-Id: Ieb0c4af4d8c78445cd1352e5e912fb2db3c9165c --- plugins/mod_sipwise_pushd.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/mod_sipwise_pushd.lua b/plugins/mod_sipwise_pushd.lua index ad94705..7ae3547 100644 --- a/plugins/mod_sipwise_pushd.lua +++ b/plugins/mod_sipwise_pushd.lua @@ -88,13 +88,21 @@ local function push_enable(username, domain) return false; end +local function is_local_domain(dom) + return ut.table.contains(ut.table.keys(hosts), dom); +end + local function get_caller_info(jid, caller_defaults) if not jid then return nil; end local node, host = jid_split(jid); + if not is_local_domain(host) then + module:log("debug", "caller[%s] not local", jid); + return nil; + end local vcard = module:shared(format("/%s/sipwise_vcard_cusax/vcard", host)); - if vcard then + if vcard and vcard.get_subscriber_info then local info = vcard.get_subscriber_info(node, host); module:log("debug", "caller_info of %s", jid); if not info.display_name then @@ -204,7 +212,10 @@ local function get_muc_info(stanza, caller_info) muc['jid'] = jid_bare(from); end muc['name'], muc['domain'] = jid_split(muc['jid']); - + if not is_local_domain(muc['domain']) then + module:log("debug", "not from local host[%s]", tostring(muc.domain)); + return nil; + end local room_host = hosts[muc['domain']].muc; if not room_host then module:log("debug", "not from MUC host[%s]", muc.domain);