Index: res/res_jabber.c =================================================================== --- res/res_jabber.c (revision 325993) +++ res/res_jabber.c (working copy) @@ -3458,7 +3458,14 @@ iks_insert_attrib(state, "xmlns", "http://asterisk.org"); iks_insert_attrib(state, "eid", eid_str); iks_insert_cdata(state, device_state, strlen(device_state)); - ast_aji_send(client, iks_root(request)); + + /* check that the client is connected or else iksemel segfaults */ + if (client->state == AJI_CONNECTED) { + ast_aji_send(client, iks_root(request)); + } else { + ast_log(LOG_WARNING, "JABBER: Not connected, unable to send device state to PubSub node on %s\n", client->name); + } + iks_delete(request); }