From 8a6f1bb203078b92f63efdc959be2cf809a43729 Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Thu, 11 Mar 2021 23:02:16 +0100 Subject: [PATCH] sip: fix infinite ringtone loop by making sure the call-added signal is emitted early enough so that all consumers (display, ringer, etc) have a chance of getting notified when the call state changes from f.e. DIALING to DISCONNECTED similar to how its done in 03d960ccaf888eee8d62872b4039a8945741824a for the dummy provider. --- plugins/sip/calls-sip-call.c | 2 -- plugins/sip/calls-sip-origin.c | 23 ++++++++++------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/plugins/sip/calls-sip-call.c b/plugins/sip/calls-sip-call.c index 9e96915..b1e15db 100644 --- a/plugins/sip/calls-sip-call.c +++ b/plugins/sip/calls-sip-call.c @@ -140,8 +140,6 @@ hang_up (CallsCall *call) default: g_warning ("Hanging up not possible in state %d", self->state); } - - calls_sip_call_set_state (self, CALLS_CALL_STATE_DISCONNECTED); } static void diff --git a/plugins/sip/calls-sip-origin.c b/plugins/sip/calls-sip-origin.c index 4e1aa8b..daa889e 100644 --- a/plugins/sip/calls-sip-origin.c +++ b/plugins/sip/calls-sip-origin.c @@ -280,11 +280,7 @@ sip_i_state (int status, state = CALLS_CALL_STATE_DISCONNECTED; g_hash_table_remove (origin->call_handles, nh); - - calls_sip_call_set_state (call, state); - g_object_unref (G_OBJECT (call)); - - return; + break; default: return; @@ -649,6 +645,7 @@ remove_call (CallsSipOrigin *self, self->oper->call_handle = NULL; g_signal_emit_by_name (origin, "call-removed", call, reason); + g_object_unref (call); } @@ -717,8 +714,16 @@ add_call (CallsSipOrigin *self, self->oper->call_handle = handle; + self->calls = g_list_append (self->calls, sip_call); g_hash_table_insert (self->call_handles, handle, sip_call); + call = CALLS_CALL (sip_call); + + g_signal_emit_by_name (CALLS_ORIGIN (self), "call-added", call); + g_signal_connect_swapped (call, "state-changed", + G_CALLBACK (on_call_state_changed_cb), + self); + if (!inbound) { calls_sip_call_setup_local_media (sip_call, local_port, local_port + 1); @@ -739,14 +744,6 @@ add_call (CallsSipOrigin *self, SOATAG_RTP_SELECT (SOA_RTP_SELECT_ALL), TAG_END ()); } - call = CALLS_CALL (sip_call); - g_signal_connect_swapped (call, "state-changed", - G_CALLBACK (on_call_state_changed_cb), - self); - - self->calls = g_list_append (self->calls, sip_call); - - g_signal_emit_by_name (CALLS_ORIGIN (self), "call-added", call); }