Revision 78955474 plugins/janus_sip.c

View differences:

plugins/janus_sip.c
272 272
	janus_sip_media media;
273 273
	char *transaction;
274 274
	char *callee;
275
	guint64 destroyed;	/* Time at which this session was marked as destroyed */
275
	gboolean hangingup;
276
	gint64 destroyed;	/* Time at which this session was marked as destroyed */
276 277
	janus_mutex mutex;
277 278
} janus_sip_session;
278 279
static GHashTable *sessions;
......
656 657
	}
657 658
	janus_mutex_lock(&sessions_mutex);
658 659
	if(!session->destroyed) {
659
		session->destroyed = janus_get_monotonic_time();
660 660
		g_hash_table_remove(sessions, handle);
661 661
		janus_sip_hangup_media(handle);
662
		session->destroyed = janus_get_monotonic_time();
662 663
		JANUS_LOG(LOG_VERB, "Destroying SIP session (%s)...\n", session->account.username ? session->account.username : "unregistered user");
663 664
		/* Shutdown the NUA */
664 665
		nua_shutdown(session->stack->s_nua);
......
797 798
		JANUS_LOG(LOG_ERR, "No session associated with this handle...\n");
798 799
		return;
799 800
	}
800
	if(session->destroyed)
801
	if(session->destroyed || session->hangingup)
801 802
		return;
803
	session->hangingup = TRUE;
802 804
	if(!(session->status == janus_sip_call_status_inviting ||
803 805
		 session->status == janus_sip_call_status_invited ||
804 806
		 session->status == janus_sip_call_status_incall))
......
811 813
	msg->sdp_type = NULL;
812 814
	msg->sdp = NULL;
813 815
	g_async_queue_push(messages, msg);
816
	/* Done */
817
	session->hangingup = FALSE;
814 818
}
815 819

  
816 820
/* Thread to handle incoming messages */

Also available in: Unified diff