From 39e4b7dfb2d4130211dce9e00a5bdca565bdbebe Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Tue, 30 Sep 2014 14:54:44 +0200 Subject: [PATCH] MT#8851 pushd: use from info when available if origin is null This fix error if the message is coming from a c2c connection Change-Id: I337b13da286ecda8a0ab9c48baf6a5137fa510d0 --- plugins/mod_sipwise_pushd.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/mod_sipwise_pushd.lua b/plugins/mod_sipwise_pushd.lua index f72531d..006acb2 100644 --- a/plugins/mod_sipwise_pushd.lua +++ b/plugins/mod_sipwise_pushd.lua @@ -76,17 +76,24 @@ local function handle_offline(event) module:log("debug", "handle_offline"); local origin, stanza = event.origin, event.stanza; local to = stanza.attr.to; + local from = stanza.attr.from; local node, host; + local caller = { username = 'unknow', host = 'unknown.local' }; local http_options = { method = "POST", body = "", } + if from then + caller.username, caller.host = jid_split(from); + end + if to then node, host = jid_split(to); if push_enable(node, host) then http_options.body = format(pushd_config.query, - origin.username, origin.host, node, host); + origin.username or caller.username, + origin.host or caller.host, node, host); module:log("debug", "Sending http pushd request: %s data: %s", pushd_config.url, http_options.body); http.request(pushd_config.url, http_options, process_response);