Fix #222: SIPE crashes when groupchat session expires (VII)
authorStefan Becker <chemobejk@gmail.com>
Thu, 5 Dec 2013 07:19:02 +0000 (5 09:19 +0200)
committerStefan Becker <chemobejk@gmail.com>
Thu, 5 Dec 2013 20:48:42 +0000 (5 22:48 +0200)
We need to drop the dialog from our side before we can call
sipe_groupchat_init(), otherwise no INVITE will be sent out.

(cherry picked from commit 57f6744f9c2c5dc350c88c74d88a49ea29908704)

src/core/sipe-groupchat.c

index 74d22e7..294cbff 100644 (file)
@@ -373,6 +373,16 @@ static gboolean groupchat_expired_session_response(struct sipe_core_private *sip
 
        /* 481 Call Leg Does Not Exist -> server dropped session */
        if (msg->response == 481) {
+               struct sip_session *session = groupchat->session;
+               struct sip_dialog *dialog = sipe_dialog_find(session,
+                                                            session->with);
+
+               /* close dialog from our side */
+               sip_transport_bye(sipe_private, dialog);
+               sipe_dialog_remove(session, session->with);
+               /* dialog is no longer valid */
+
+               /* re-initialize groupchat session */
                groupchat->session = NULL;
                groupchat->connected = FALSE;
                sipe_groupchat_init(sipe_private);