1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2007 Elliot Fairweather
4 * Copyright (C) 2007-2008 Collabora Ltd.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * Authors: Elliot Fairweather <elliot.fairweather@collabora.co.uk>
21 * Xavier Claessens <xclaesse@gmail.com>
26 #include <telepathy-glib/proxy-subclass.h>
27 #include <telepathy-glib/dbus.h>
28 #include <telepathy-glib/_gen/telepathy-interfaces.h>
30 #include <extensions/extensions.h>
32 #include "empathy-tp-call.h"
33 #include "empathy-contact-factory.h"
34 #include "empathy-tp-group.h"
35 #include "empathy-utils.h"
37 #define DEBUG_FLAG EMPATHY_DEBUG_TP
38 #include "empathy-debug.h"
40 #define STREAM_ENGINE_BUS_NAME "org.freedesktop.Telepathy.StreamEngine"
41 #define STREAM_ENGINE_OBJECT_PATH "/org/freedesktop/Telepathy/StreamEngine"
43 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpCall)
47 TpProxy *stream_engine;
48 TpDBusDaemon *dbus_daemon;
49 EmpathyTpGroup *group;
50 EmpathyContact *contact;
53 gboolean stream_engine_running;
55 EmpathyTpCallStream *audio;
56 EmpathyTpCallStream *video;
71 G_DEFINE_TYPE (EmpathyTpCall, empathy_tp_call, G_TYPE_OBJECT)
74 tp_call_add_stream (EmpathyTpCall *call,
79 guint stream_direction)
81 EmpathyTpCallPriv *priv = GET_PRIV (call);
85 case TP_MEDIA_STREAM_TYPE_AUDIO:
86 DEBUG ("Audio stream - id: %d, state: %d, direction: %d",
87 stream_id, stream_state, stream_direction);
88 priv->audio->exists = TRUE;
89 priv->audio->id = stream_id;
90 priv->audio->state = stream_state;
91 priv->audio->direction = stream_direction;
92 g_object_notify (G_OBJECT (call), "audio-stream");
94 case TP_MEDIA_STREAM_TYPE_VIDEO:
95 DEBUG ("Video stream - id: %d, state: %d, direction: %d",
96 stream_id, stream_state, stream_direction);
97 priv->video->exists = TRUE;
98 priv->video->id = stream_id;
99 priv->video->state = stream_state;
100 priv->video->direction = stream_direction;
101 g_object_notify (G_OBJECT (call), "video-stream");
104 DEBUG ("Unknown stream type: %d", stream_type);
109 tp_call_stream_added_cb (TpChannel *channel,
111 guint contact_handle,
116 DEBUG ("Stream added - stream id: %d, contact handle: %d, stream type: %d",
117 stream_id, contact_handle, stream_type);
119 tp_call_add_stream (EMPATHY_TP_CALL (call), stream_id, contact_handle,
120 stream_type, TP_MEDIA_STREAM_STATE_DISCONNECTED,
121 TP_MEDIA_STREAM_DIRECTION_NONE);
125 tp_call_stream_removed_cb (TpChannel *channel,
130 EmpathyTpCallPriv *priv = GET_PRIV (call);
132 DEBUG ("Stream removed - stream id: %d", stream_id);
134 if (stream_id == priv->audio->id)
136 priv->audio->exists = FALSE;
137 g_object_notify (call, "audio-stream");
139 else if (stream_id == priv->video->id)
141 priv->video->exists = FALSE;
142 g_object_notify (call, "video-stream");
147 tp_call_stream_state_changed_cb (TpChannel *proxy,
153 EmpathyTpCallPriv *priv = GET_PRIV (call);
155 DEBUG ("Stream state changed - stream id: %d, state state: %d",
156 stream_id, stream_state);
158 if (stream_id == priv->audio->id)
160 priv->audio->state = stream_state;
161 g_object_notify (call, "audio-stream");
163 else if (stream_id == priv->video->id)
165 priv->video->state = stream_state;
166 g_object_notify (call, "video-stream");
171 tp_call_stream_direction_changed_cb (TpChannel *channel,
173 guint stream_direction,
178 EmpathyTpCallPriv *priv = GET_PRIV (call);
180 DEBUG ("Stream direction changed - stream: %d, direction: %d",
181 stream_id, stream_direction);
183 if (stream_id == priv->audio->id)
185 priv->audio->direction = stream_direction;
186 g_object_notify (call, "audio-stream");
188 else if (stream_id == priv->video->id)
190 priv->video->direction = stream_direction;
191 g_object_notify (call, "video-stream");
196 tp_call_request_streams_cb (TpChannel *channel,
197 const GPtrArray *streams,
206 DEBUG ("Error requesting streams: %s", error->message);
210 for (i = 0; i < streams->len; i++)
214 guint contact_handle;
217 guint stream_direction;
219 values = g_ptr_array_index (streams, i);
220 stream_id = g_value_get_uint (g_value_array_get_nth (values, 0));
221 contact_handle = g_value_get_uint (g_value_array_get_nth (values, 1));
222 stream_type = g_value_get_uint (g_value_array_get_nth (values, 2));
223 stream_state = g_value_get_uint (g_value_array_get_nth (values, 3));
224 stream_direction = g_value_get_uint (g_value_array_get_nth (values, 4));
226 tp_call_add_stream (EMPATHY_TP_CALL (call), stream_id, contact_handle,
227 stream_type, stream_state, stream_direction);
232 tp_call_request_streams_for_capabilities (EmpathyTpCall *call,
233 EmpathyCapabilities capabilities)
235 EmpathyTpCallPriv *priv = GET_PRIV (call);
236 GArray *stream_types;
240 if (capabilities == EMPATHY_CAPABILITIES_UNKNOWN)
241 capabilities = EMPATHY_CAPABILITIES_AUDIO | EMPATHY_CAPABILITIES_VIDEO;
243 DEBUG ("Requesting new stream for capabilities %d",
246 stream_types = g_array_new (FALSE, FALSE, sizeof (guint));
247 handle = empathy_contact_get_handle (priv->contact);
249 if (capabilities & EMPATHY_CAPABILITIES_AUDIO)
251 stream_type = TP_MEDIA_STREAM_TYPE_AUDIO;
252 g_array_append_val (stream_types, stream_type);
254 if (capabilities & EMPATHY_CAPABILITIES_VIDEO)
256 stream_type = TP_MEDIA_STREAM_TYPE_VIDEO;
257 g_array_append_val (stream_types, stream_type);
260 tp_cli_channel_type_streamed_media_call_request_streams (priv->channel, -1,
261 handle, stream_types, tp_call_request_streams_cb, NULL, NULL,
264 g_array_free (stream_types, TRUE);
268 tp_call_member_added_cb (EmpathyTpGroup *group,
269 EmpathyContact *contact,
270 EmpathyContact *actor,
272 const gchar *message,
275 EmpathyTpCallPriv *priv = GET_PRIV (call);
278 if (!priv->contact && !empathy_contact_is_user (contact))
280 priv->contact = g_object_ref (contact);
281 priv->is_incoming = TRUE;
282 priv->status = EMPATHY_TP_CALL_STATUS_PENDING;
283 g_object_notify (G_OBJECT (call), "is-incoming");
284 g_object_notify (G_OBJECT (call), "contact");
285 g_object_notify (G_OBJECT (call), "status");
286 tp_call_request_streams_for_capabilities (call,
287 EMPATHY_CAPABILITIES_AUDIO);
291 if (priv->status == EMPATHY_TP_CALL_STATUS_PENDING &&
292 ((priv->is_incoming && contact != priv->contact) ||
293 (!priv->is_incoming && contact == priv->contact)))
295 priv->status = EMPATHY_TP_CALL_STATUS_ACCEPTED;
296 g_object_notify (G_OBJECT (call), "status");
298 g_object_unref (call);
302 tp_call_remote_pending_cb (EmpathyTpGroup *group,
303 EmpathyContact *contact,
304 EmpathyContact *actor,
306 const gchar *message,
309 EmpathyTpCallPriv *priv = GET_PRIV (call);
312 if (!priv->contact && !empathy_contact_is_user (contact))
314 priv->contact = g_object_ref (contact);
315 priv->is_incoming = FALSE;
316 priv->status = EMPATHY_TP_CALL_STATUS_PENDING;
317 g_object_notify (G_OBJECT (call), "is-incoming");
318 g_object_notify (G_OBJECT (call), "contact");
319 g_object_notify (G_OBJECT (call), "status");
320 tp_call_request_streams_for_capabilities (call,
321 EMPATHY_CAPABILITIES_AUDIO);
323 g_object_unref (call);
327 tp_call_channel_invalidated_cb (TpChannel *channel,
333 EmpathyTpCallPriv *priv = GET_PRIV (call);
335 DEBUG ("Channel invalidated: %s", message);
336 priv->status = EMPATHY_TP_CALL_STATUS_CLOSED;
337 g_object_notify (G_OBJECT (call), "status");
341 tp_call_async_cb (TpProxy *proxy,
347 DEBUG ("Error %s: %s", (gchar*) user_data, error->message);
351 tp_call_close_channel (EmpathyTpCall *call)
353 EmpathyTpCallPriv *priv = GET_PRIV (call);
355 if (priv->status == EMPATHY_TP_CALL_STATUS_CLOSED)
358 DEBUG ("Closing channel");
360 tp_cli_channel_call_close (priv->channel, -1,
361 NULL, NULL, NULL, NULL);
363 priv->status = EMPATHY_TP_CALL_STATUS_CLOSED;
364 g_object_notify (G_OBJECT (call), "status");
368 tp_call_stream_engine_invalidated_cb (TpProxy *stream_engine,
374 DEBUG ("Stream engine proxy invalidated: %s", message);
375 tp_call_close_channel (call);
379 tp_call_stream_engine_watch_name_owner_cb (TpDBusDaemon *daemon,
381 const gchar *new_owner,
384 EmpathyTpCallPriv *priv = GET_PRIV (call);
386 /* G_STR_EMPTY(new_owner) means either stream-engine has not started yet or
387 * has crashed. We want to close the channel if stream-engine has crashed.
389 DEBUG ("Watch SE: name='%s' SE running='%s' new_owner='%s'",
390 name, priv->stream_engine_running ? "yes" : "no",
391 new_owner ? new_owner : "none");
392 if (priv->stream_engine_running && G_STR_EMPTY (new_owner))
394 DEBUG ("Stream engine falled off the bus");
395 tp_call_close_channel (call);
399 priv->stream_engine_running = !G_STR_EMPTY (new_owner);
403 tp_call_stream_engine_handle_channel (EmpathyTpCall *call)
405 EmpathyTpCallPriv *priv = GET_PRIV (call);
412 DEBUG ("Revving up the stream engine");
414 priv->stream_engine = g_object_new (TP_TYPE_PROXY,
415 "bus-name", STREAM_ENGINE_BUS_NAME,
416 "dbus-connection", tp_get_bus (),
417 "object-path", STREAM_ENGINE_OBJECT_PATH,
419 tp_proxy_add_interface_by_id (priv->stream_engine,
420 EMP_IFACE_QUARK_STREAM_ENGINE);
421 tp_proxy_add_interface_by_id (priv->stream_engine,
422 EMP_IFACE_QUARK_CHANNEL_HANDLER);
424 g_signal_connect (priv->stream_engine, "invalidated",
425 G_CALLBACK (tp_call_stream_engine_invalidated_cb),
428 /* FIXME: dbus daemon should be unique */
429 priv->dbus_daemon = tp_dbus_daemon_new (tp_get_bus ());
430 tp_dbus_daemon_watch_name_owner (priv->dbus_daemon, STREAM_ENGINE_BUS_NAME,
431 tp_call_stream_engine_watch_name_owner_cb,
434 g_object_get (priv->channel,
435 "connection", &connection,
436 "channel-type", &channel_type,
437 "object-path", &object_path,
438 "handle_type", &handle_type,
442 emp_cli_channel_handler_call_handle_channel (priv->stream_engine, -1,
443 connection->bus_name,
444 connection->object_path,
445 channel_type, object_path, handle_type, handle,
446 tp_call_async_cb, "calling handle channel", NULL,
449 g_object_unref (connection);
450 g_free (channel_type);
451 g_free (object_path);
455 tp_call_constructor (GType type,
456 guint n_construct_params,
457 GObjectConstructParam *construct_params)
461 EmpathyTpCallPriv *priv;
463 object = G_OBJECT_CLASS (empathy_tp_call_parent_class)->constructor (type,
464 n_construct_params, construct_params);
466 call = EMPATHY_TP_CALL (object);
467 priv = GET_PRIV (call);
469 /* Setup streamed media channel */
470 g_signal_connect (priv->channel, "invalidated",
471 G_CALLBACK (tp_call_channel_invalidated_cb), call);
472 tp_cli_channel_type_streamed_media_connect_to_stream_added (priv->channel,
473 tp_call_stream_added_cb, NULL, NULL, G_OBJECT (call), NULL);
474 tp_cli_channel_type_streamed_media_connect_to_stream_removed (priv->channel,
475 tp_call_stream_removed_cb, NULL, NULL, G_OBJECT (call), NULL);
476 tp_cli_channel_type_streamed_media_connect_to_stream_state_changed (priv->channel,
477 tp_call_stream_state_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
478 tp_cli_channel_type_streamed_media_connect_to_stream_direction_changed (priv->channel,
479 tp_call_stream_direction_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
480 tp_cli_channel_type_streamed_media_call_list_streams (priv->channel, -1,
481 tp_call_request_streams_cb, NULL, NULL, G_OBJECT (call));
483 /* Setup group interface */
484 priv->group = empathy_tp_group_new (priv->channel);
486 g_signal_connect (priv->group, "member-added",
487 G_CALLBACK (tp_call_member_added_cb), call);
488 g_signal_connect (priv->group, "remote-pending",
489 G_CALLBACK (tp_call_remote_pending_cb), call);
491 /* Start stream engine */
492 tp_call_stream_engine_handle_channel (call);
498 tp_call_finalize (GObject *object)
500 EmpathyTpCallPriv *priv = GET_PRIV (object);
502 DEBUG ("Finalizing: %p", object);
504 g_slice_free (EmpathyTpCallStream, priv->audio);
505 g_slice_free (EmpathyTpCallStream, priv->video);
506 g_object_unref (priv->group);
508 if (priv->channel != NULL)
510 g_signal_handlers_disconnect_by_func (priv->channel,
511 tp_call_channel_invalidated_cb, object);
512 tp_call_close_channel (EMPATHY_TP_CALL (object));
513 g_object_unref (priv->channel);
516 if (priv->stream_engine != NULL)
518 g_signal_handlers_disconnect_by_func (priv->stream_engine,
519 tp_call_stream_engine_invalidated_cb, object);
520 g_object_unref (priv->stream_engine);
523 if (priv->contact != NULL)
524 g_object_unref (priv->contact);
526 if (priv->dbus_daemon != NULL)
528 tp_dbus_daemon_cancel_name_owner_watch (priv->dbus_daemon,
529 STREAM_ENGINE_BUS_NAME,
530 tp_call_stream_engine_watch_name_owner_cb,
532 g_object_unref (priv->dbus_daemon);
535 (G_OBJECT_CLASS (empathy_tp_call_parent_class)->finalize) (object);
539 tp_call_set_property (GObject *object,
544 EmpathyTpCallPriv *priv = GET_PRIV (object);
549 priv->channel = g_value_dup_object (value);
552 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
558 tp_call_get_property (GObject *object,
563 EmpathyTpCallPriv *priv = GET_PRIV (object);
568 g_value_set_object (value, priv->channel);
571 g_value_set_object (value, priv->contact);
573 case PROP_IS_INCOMING:
574 g_value_set_boolean (value, priv->is_incoming);
577 g_value_set_boolean (value, tp_proxy_has_interface_by_id (priv->channel,
578 TP_IFACE_QUARK_CHANNEL_INTERFACE_DTMF));
581 g_value_set_uint (value, priv->status);
583 case PROP_AUDIO_STREAM:
584 g_value_set_pointer (value, priv->audio);
586 case PROP_VIDEO_STREAM:
587 g_value_set_pointer (value, priv->video);
590 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
596 empathy_tp_call_class_init (EmpathyTpCallClass *klass)
598 GObjectClass *object_class = G_OBJECT_CLASS (klass);
602 object_class->constructor = tp_call_constructor;
603 object_class->finalize = tp_call_finalize;
604 object_class->set_property = tp_call_set_property;
605 object_class->get_property = tp_call_get_property;
607 g_type_class_add_private (klass, sizeof (EmpathyTpCallPriv));
609 g_object_class_install_property (object_class, PROP_CHANNEL,
610 g_param_spec_object ("channel", "channel", "channel",
612 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
613 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
614 g_object_class_install_property (object_class, PROP_CONTACT,
615 g_param_spec_object ("contact", "Call contact", "Call contact",
616 EMPATHY_TYPE_CONTACT,
617 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
618 g_object_class_install_property (object_class, PROP_IS_INCOMING,
619 g_param_spec_boolean ("is-incoming", "Is media stream incoming",
620 "Is media stream incoming", FALSE, G_PARAM_READABLE |
621 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
622 g_object_class_install_property (object_class, PROP_HAS_DTMF,
623 g_param_spec_boolean ("has-dtmf", "Has the media channel DTMF",
624 "Has the media channel DTMF", FALSE, G_PARAM_READABLE |
625 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
626 g_object_class_install_property (object_class, PROP_STATUS,
627 g_param_spec_uint ("status", "Call status",
628 "Call status", 0, 255, 0, G_PARAM_READABLE | G_PARAM_STATIC_NICK |
629 G_PARAM_STATIC_BLURB));
630 g_object_class_install_property (object_class, PROP_AUDIO_STREAM,
631 g_param_spec_pointer ("audio-stream", "Audio stream data",
633 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
634 g_object_class_install_property (object_class, PROP_VIDEO_STREAM,
635 g_param_spec_pointer ("video-stream", "Video stream data",
637 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
641 empathy_tp_call_init (EmpathyTpCall *call)
643 EmpathyTpCallPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (call,
644 EMPATHY_TYPE_TP_CALL, EmpathyTpCallPriv);
647 priv->status = EMPATHY_TP_CALL_STATUS_READYING;
648 priv->contact = NULL;
649 priv->stream_engine_running = FALSE;
650 priv->audio = g_slice_new0 (EmpathyTpCallStream);
651 priv->video = g_slice_new0 (EmpathyTpCallStream);
652 priv->audio->exists = FALSE;
653 priv->video->exists = FALSE;
657 empathy_tp_call_new (TpChannel *channel)
659 g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL);
661 return g_object_new (EMPATHY_TYPE_TP_CALL,
667 empathy_tp_call_accept_incoming_call (EmpathyTpCall *call)
669 EmpathyTpCallPriv *priv = GET_PRIV (call);
670 EmpathyContact *self_contact;
672 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
673 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_PENDING);
675 DEBUG ("Accepting incoming call");
677 self_contact = empathy_tp_group_get_self_contact (priv->group);
678 empathy_tp_group_add_member (priv->group, self_contact, NULL);
679 g_object_unref (self_contact);
683 empathy_tp_call_request_video_stream_direction (EmpathyTpCall *call,
686 EmpathyTpCallPriv *priv = GET_PRIV (call);
689 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
690 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
692 DEBUG ("Requesting video stream direction - is_sending: %d", is_sending);
694 if (!priv->video->exists)
697 tp_call_request_streams_for_capabilities (call,
698 EMPATHY_CAPABILITIES_VIDEO);
703 new_direction = priv->video->direction | TP_MEDIA_STREAM_DIRECTION_SEND;
705 new_direction = priv->video->direction & ~TP_MEDIA_STREAM_DIRECTION_SEND;
707 tp_cli_channel_type_streamed_media_call_request_stream_direction (priv->channel,
708 -1, priv->video->id, new_direction,
709 (tp_cli_channel_type_streamed_media_callback_for_request_stream_direction)
710 tp_call_async_cb, NULL, NULL, G_OBJECT (call));
714 empathy_tp_call_add_preview_video (EmpathyTpCall *call,
715 guint preview_video_socket_id)
717 EmpathyTpCallPriv *priv = GET_PRIV (call);
719 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
721 DEBUG ("Adding preview video");
723 emp_cli_stream_engine_call_add_preview_window (priv->stream_engine, -1,
724 preview_video_socket_id,
726 "adding preview window", NULL,
731 empathy_tp_call_remove_preview_video (EmpathyTpCall *call,
732 guint preview_video_socket_id)
734 EmpathyTpCallPriv *priv = GET_PRIV (call);
736 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
738 DEBUG ("Removing preview video");
740 emp_cli_stream_engine_call_remove_preview_window (priv->stream_engine, -1,
741 preview_video_socket_id,
743 "removing preview window", NULL,
748 empathy_tp_call_add_output_video (EmpathyTpCall *call,
749 guint output_video_socket_id)
751 EmpathyTpCallPriv *priv = GET_PRIV (call);
753 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
755 DEBUG ("Adding output video - socket: %d", output_video_socket_id);
757 emp_cli_stream_engine_call_set_output_window (priv->stream_engine, -1,
758 TP_PROXY (priv->channel)->object_path,
759 priv->video->id, output_video_socket_id,
761 "setting output window", NULL,
766 empathy_tp_call_set_output_volume (EmpathyTpCall *call,
769 EmpathyTpCallPriv *priv = GET_PRIV (call);
771 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
772 g_return_if_fail (priv->status != EMPATHY_TP_CALL_STATUS_CLOSED);
774 DEBUG ("Setting output volume: %d", volume);
776 emp_cli_stream_engine_call_set_output_volume (priv->stream_engine, -1,
777 TP_PROXY (priv->channel)->object_path,
778 priv->audio->id, volume,
780 "setting output volume", NULL,
785 empathy_tp_call_mute_output (EmpathyTpCall *call,
788 EmpathyTpCallPriv *priv = GET_PRIV (call);
790 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
792 DEBUG ("Setting output mute: %d", is_muted);
794 emp_cli_stream_engine_call_mute_output (priv->stream_engine, -1,
795 TP_PROXY (priv->channel)->object_path,
796 priv->audio->id, is_muted,
798 "muting output", NULL,
803 empathy_tp_call_mute_input (EmpathyTpCall *call,
806 EmpathyTpCallPriv *priv = GET_PRIV (call);
808 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
810 DEBUG ("Setting input mute: %d", is_muted);
812 emp_cli_stream_engine_call_mute_input (priv->stream_engine, -1,
813 TP_PROXY (priv->channel)->object_path,
814 priv->audio->id, is_muted,
816 "muting input", NULL,
821 empathy_tp_call_start_tone (EmpathyTpCall *call, TpDTMFEvent event)
823 EmpathyTpCallPriv *priv = GET_PRIV (call);
825 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
826 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
828 if (!priv->audio->exists)
831 tp_cli_channel_interface_dtmf_call_start_tone (priv->channel, -1,
832 priv->audio->id, event,
833 (tp_cli_channel_interface_dtmf_callback_for_start_tone) tp_call_async_cb,
834 "starting tone", NULL, G_OBJECT (call));
838 empathy_tp_call_stop_tone (EmpathyTpCall *call)
840 EmpathyTpCallPriv *priv = GET_PRIV (call);
842 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
843 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
845 if (!priv->audio->exists)
848 tp_cli_channel_interface_dtmf_call_stop_tone (priv->channel, -1,
850 (tp_cli_channel_interface_dtmf_callback_for_stop_tone) tp_call_async_cb,
851 "stoping tone", NULL, G_OBJECT (call));