[asterisk-bugs] [JIRA] (ASTERISK-25735) [patch] res_xmpp: Does not connect in component mode

Karsten Wemheuer (JIRA) noreply at issues.asterisk.org
Tue Feb 2 04:13:32 CST 2016


    [ https://issues.asterisk.org/jira/browse/ASTERISK-25735?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=229248#comment-229248 ] 

Karsten Wemheuer commented on ASTERISK-25735:
---------------------------------------------

I tried to follow the process. I hope I did it right (its my first gerrit usage).

> [patch] res_xmpp: Does not connect in component mode
> ----------------------------------------------------
>
>                 Key: ASTERISK-25735
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25735
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_xmpp
>    Affects Versions: 11.21.0
>         Environment: Debian Linux 8, Kernel 4.4, XMPP server Jabberd2 (2.3.4)
>            Reporter: Karsten Wemheuer
>         Attachments: res_xmpp-component-mode.diff
>
>
> In asterisk 1.8 we are using res_jabber to connect asterisk with a xmpp server (jabberd2) in *component mode*. In asterisk 11 and newer version res_jabber is deprecated. So I configured the asterisk 11 with res_xmpp in the same way as res_jabber in asterisk 1.8 before. The connection is not established. The module gets immediately unloaded, because the setting of the username “pbx.pbxtest” is not accepted. In res_xmpp there must be a username like xxx at yyy which is wrong according to the xmpp protocol in component mode (XEP-0114). 
> In res_xmpp.c (line 3705) in function "xmpp_client_config_post_apply" is this peace of code
> {noformat}
> if (!cfg->client->jid || ast_strlen_zero(cfg->client->jid->user)) {
> 	ast_log(LOG_ERROR, "Jabber identity '%s' could not be created for client '%s' - client not active\n", cfg->user, cfg->name);
> 	return -1;
> }
> {noformat}
> With the attached patch this if statement is skipped in case of component mode. The module accepts the old res_jabber configuration, but the connection is still not established.
> If the xmpp server sends out a "stream" element before handshake is finished, the connection gets dropped in res_xmpp. The res_jabber code discards the stream elements and continues the handshaking. The patch  fixes this in function xmpp_component_authenticating.
> Another problem is located in function "xmpp_pak_presence". The current code leaves the function directly if there is no resource. A few lines later there is a call to "xmpp_client_set_presence" in case of component mode. This call is not reached, cause in this situation there is no resource. So the patch moves the lines
> {noformat}
> /* If this is a component presence probe request answer immediately with our presence status */
> if (ast_test_flag(&cfg->flags, XMPP_COMPONENT) && !ast_strlen_zero(type) && !strcasecmp(type, "probe")) {
> 	xmpp_client_set_presence(client, pak->from->full, iks_find_attrib(pak->x, "to"), cfg->status, cfg->statusmsg);
> }
> {noformat}
> to the top of the function.
> The attached patch fixes the issues with component mode in asterisk 11 (tested with latest release 11.21.0).



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list