void empathy_call_handler_start_call (EmpathyCallHandler *handler, gint64 timestamp) { EmpathyCallHandlerPriv *priv = GET_PRIV (handler); TpAccountChannelRequest *req; TpAccount *account; GHashTable *request; if (priv->call != NULL) { empathy_call_handler_start_tpfs (handler); if (tp_channel_get_requested (TP_CHANNEL (priv->call))) { /* accept outgoing channels immediately */ tp_call_channel_accept_async (priv->call, on_call_accepted_cb, NULL); } else { /* accepting incoming channels when they are INITIALISED */ if (tp_call_channel_get_state (priv->call, NULL, NULL, NULL) == TP_CALL_STATE_INITIALISED) tp_call_channel_accept_async (priv->call, on_call_accepted_cb, NULL); else priv->accept_when_initialised = TRUE; } return; } /* No TpCallChannel (we are redialing). Request a new call channel */ g_assert (priv->contact != NULL); account = empathy_contact_get_account (priv->contact); request = empathy_call_create_call_request ( empathy_contact_get_id (priv->contact), priv->initial_audio, priv->initial_video); req = tp_account_channel_request_new (account, request, timestamp); tp_account_channel_request_create_and_handle_channel_async (req, NULL, empathy_call_handler_request_cb, handler); g_object_unref (req); g_hash_table_unref (request); }
static gboolean has_ongoing_calls (EmpathyCallObserver *self) { GList *l; for (l = self->priv->channels; l != NULL; l = l->next) { TpChannel *channel = TP_CHANNEL (l->data); GQuark type = tp_channel_get_channel_type_id (channel); /* Check that Call channels are not ended */ if (type == TP_IFACE_QUARK_CHANNEL_TYPE_CALL && tp_call_channel_get_state (TP_CALL_CHANNEL (channel), NULL, NULL, NULL) == TP_CALL_STATE_ENDED) continue; return TRUE; } return FALSE; }