diff options
author | Joshua Colp <jcolp@digium.com> | 2017-10-22 19:32:20 -0300 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2017-10-22 17:34:14 -0500 |
commit | 252353e0a9b608a0d1dbfd6ec119a751b67734bb (patch) | |
tree | 609b78f4733a88347936fa8e7b4488495593b97c /res/res_xmpp.c | |
parent | 4760b2445c58e95c114985aa5334b4e12c52a0f1 (diff) |
res_xmpp: Ensure the connection filter is available.
Users of the API that res_xmpp provides expect that a
filter be available on the client at all times. When
OAuth authentication support was added this requirement
was not maintained.
This change merely moves the OAuth authentication to
after the filter is created, ensuring users of res_xmpp
can add things to the filter as needed.
ASTERISK-27346
Change-Id: I4ac474afe220e833288ff574e32e2b9a23394886
Diffstat (limited to 'res/res_xmpp.c')
-rw-r--r-- | res/res_xmpp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/res/res_xmpp.c b/res/res_xmpp.c index 444eacbe9..8a06a6c35 100644 --- a/res/res_xmpp.c +++ b/res/res_xmpp.c @@ -3652,13 +3652,6 @@ static int xmpp_client_reconnect(struct ast_xmpp_client *client) return -1; } - if (!ast_strlen_zero(clientcfg->refresh_token)) { - ast_debug(2, "Obtaining OAuth access token for client '%s'\n", client->name); - if (fetch_access_token(clientcfg)) { - return -1; - } - } - ast_xmpp_client_disconnect(client); client->timeout = 50; @@ -3669,6 +3662,13 @@ static int xmpp_client_reconnect(struct ast_xmpp_client *client) return -1; } + if (!ast_strlen_zero(clientcfg->refresh_token)) { + ast_debug(2, "Obtaining OAuth access token for client '%s'\n", client->name); + if (fetch_access_token(clientcfg)) { + return -1; + } + } + /* If it's a component connect to user otherwise connect to server */ res = iks_connect_via(client->parser, S_OR(clientcfg->server, client->jid->server), clientcfg->port, ast_test_flag(&clientcfg->flags, XMPP_COMPONENT) ? clientcfg->user : client->jid->server); |