Index: res/res_jabber.c =================================================================== --- res/res_jabber.c (revision 327640) +++ res/res_jabber.c (working copy) @@ -1510,7 +1510,15 @@ #endif /* If needed, data will be sent unencrypted, and logHook will be called inside iks_send_raw */ - ret = iks_send_raw(client->p, xmlstr); + if((client->timeout != 0 && client->status == AJI_CONNECTED) || (client->status == AJI_CONNECTING)) + { + ret = iks_send_raw(client->p, xmlstr); + } + else { + ast_log(LOG_WARNING, "JABBER: Unable to send message to %s, we are not connected", client->name); + return -1; + } + if (ret != IKS_OK) { return ret; }