2 * Copyright (C) 2007 Elliot Fairweather
3 * Copyright (C) 2007-2008 Collabora Ltd.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 * Authors: Elliot Fairweather <elliot.fairweather@collabora.co.uk>
20 * Xavier Claessens <xclaesse@gmail.com>
25 #include <telepathy-glib/proxy-subclass.h>
26 #include <telepathy-glib/dbus.h>
27 #include <telepathy-glib/interfaces.h>
29 #include <extensions/extensions.h>
31 #include "empathy-tp-call.h"
32 #include "empathy-contact-factory.h"
33 #include "empathy-utils.h"
35 #define DEBUG_FLAG EMPATHY_DEBUG_TP
36 #include "empathy-debug.h"
38 #define STREAM_ENGINE_BUS_NAME "org.freedesktop.Telepathy.StreamEngine"
39 #define STREAM_ENGINE_OBJECT_PATH "/org/freedesktop/Telepathy/StreamEngine"
41 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpCall)
45 TpProxy *stream_engine;
46 TpDBusDaemon *dbus_daemon;
47 EmpathyContact *contact;
50 gboolean stream_engine_running;
52 EmpathyTpCallStream *audio;
53 EmpathyTpCallStream *video;
67 G_DEFINE_TYPE (EmpathyTpCall, empathy_tp_call, G_TYPE_OBJECT)
70 tp_call_add_stream (EmpathyTpCall *call,
75 guint stream_direction)
77 EmpathyTpCallPriv *priv = GET_PRIV (call);
81 case TP_MEDIA_STREAM_TYPE_AUDIO:
82 DEBUG ("Audio stream - id: %d, state: %d, direction: %d",
83 stream_id, stream_state, stream_direction);
84 priv->audio->exists = TRUE;
85 priv->audio->id = stream_id;
86 priv->audio->state = stream_state;
87 priv->audio->direction = stream_direction;
88 g_object_notify (G_OBJECT (call), "audio-stream");
90 case TP_MEDIA_STREAM_TYPE_VIDEO:
91 DEBUG ("Video stream - id: %d, state: %d, direction: %d",
92 stream_id, stream_state, stream_direction);
93 priv->video->exists = TRUE;
94 priv->video->id = stream_id;
95 priv->video->state = stream_state;
96 priv->video->direction = stream_direction;
97 g_object_notify (G_OBJECT (call), "video-stream");
100 DEBUG ("Unknown stream type: %d", stream_type);
105 tp_call_stream_added_cb (TpChannel *channel,
107 guint contact_handle,
112 DEBUG ("Stream added - stream id: %d, contact handle: %d, stream type: %d",
113 stream_id, contact_handle, stream_type);
115 tp_call_add_stream (EMPATHY_TP_CALL (call), stream_id, contact_handle,
116 stream_type, TP_MEDIA_STREAM_STATE_DISCONNECTED,
117 TP_MEDIA_STREAM_DIRECTION_NONE);
121 tp_call_stream_removed_cb (TpChannel *channel,
126 EmpathyTpCallPriv *priv = GET_PRIV (call);
128 DEBUG ("Stream removed - stream id: %d", stream_id);
130 if (stream_id == priv->audio->id)
132 priv->audio->exists = FALSE;
133 g_object_notify (call, "audio-stream");
135 else if (stream_id == priv->video->id)
137 priv->video->exists = FALSE;
138 g_object_notify (call, "video-stream");
143 tp_call_stream_state_changed_cb (TpChannel *proxy,
149 EmpathyTpCallPriv *priv = GET_PRIV (call);
151 DEBUG ("Stream state changed - stream id: %d, state state: %d",
152 stream_id, stream_state);
154 if (stream_id == priv->audio->id)
156 priv->audio->state = stream_state;
157 g_object_notify (call, "audio-stream");
159 else if (stream_id == priv->video->id)
161 priv->video->state = stream_state;
162 g_object_notify (call, "video-stream");
167 tp_call_stream_direction_changed_cb (TpChannel *channel,
169 guint stream_direction,
174 EmpathyTpCallPriv *priv = GET_PRIV (call);
176 DEBUG ("Stream direction changed - stream: %d, direction: %d",
177 stream_id, stream_direction);
179 if (stream_id == priv->audio->id)
181 priv->audio->direction = stream_direction;
182 g_object_notify (call, "audio-stream");
184 else if (stream_id == priv->video->id)
186 priv->video->direction = stream_direction;
187 g_object_notify (call, "video-stream");
192 tp_call_request_streams_cb (TpChannel *channel,
193 const GPtrArray *streams,
202 DEBUG ("Error requesting streams: %s", error->message);
206 for (i = 0; i < streams->len; i++)
210 guint contact_handle;
213 guint stream_direction;
215 values = g_ptr_array_index (streams, i);
216 stream_id = g_value_get_uint (g_value_array_get_nth (values, 0));
217 contact_handle = g_value_get_uint (g_value_array_get_nth (values, 1));
218 stream_type = g_value_get_uint (g_value_array_get_nth (values, 2));
219 stream_state = g_value_get_uint (g_value_array_get_nth (values, 3));
220 stream_direction = g_value_get_uint (g_value_array_get_nth (values, 4));
222 tp_call_add_stream (EMPATHY_TP_CALL (call), stream_id, contact_handle,
223 stream_type, stream_state, stream_direction);
228 tp_call_request_streams_for_capabilities (EmpathyTpCall *call,
229 EmpathyCapabilities capabilities)
231 EmpathyTpCallPriv *priv = GET_PRIV (call);
232 GArray *stream_types;
236 if (capabilities == EMPATHY_CAPABILITIES_UNKNOWN)
237 capabilities = EMPATHY_CAPABILITIES_AUDIO | EMPATHY_CAPABILITIES_VIDEO;
239 DEBUG ("Requesting new stream for capabilities %d",
242 stream_types = g_array_new (FALSE, FALSE, sizeof (guint));
243 handle = empathy_contact_get_handle (priv->contact);
245 if (capabilities & EMPATHY_CAPABILITIES_AUDIO)
247 stream_type = TP_MEDIA_STREAM_TYPE_AUDIO;
248 g_array_append_val (stream_types, stream_type);
250 if (capabilities & EMPATHY_CAPABILITIES_VIDEO)
252 stream_type = TP_MEDIA_STREAM_TYPE_VIDEO;
253 g_array_append_val (stream_types, stream_type);
256 tp_cli_channel_type_streamed_media_call_request_streams (priv->channel, -1,
257 handle, stream_types, tp_call_request_streams_cb, NULL, NULL,
260 g_array_free (stream_types, TRUE);
263 static EmpathyContact *
264 tp_call_dup_contact_from_handle (EmpathyTpCall *call, TpHandle handle)
266 EmpathyTpCallPriv *priv = GET_PRIV (call);
267 EmpathyContactFactory *factory;
269 EmpathyContact *contact;
271 factory = empathy_contact_factory_dup_singleton ();
272 account = empathy_channel_get_account (priv->channel);
273 contact = empathy_contact_factory_get_from_handle (factory, account, handle);
275 g_object_unref (factory);
276 g_object_unref (account);
282 tp_call_update_status (EmpathyTpCall *call)
284 EmpathyTpCallPriv *priv = GET_PRIV (call);
285 TpHandle self_handle;
291 self_handle = tp_channel_group_get_self_handle (priv->channel);
292 set = tp_channel_group_get_members (priv->channel);
293 tp_intset_iter_init (&iter, set);
294 while (tp_intset_iter_next (&iter))
296 if (priv->contact == NULL && iter.element != self_handle)
298 /* We found the remote contact */
299 priv->contact = tp_call_dup_contact_from_handle (call, iter.element);
300 priv->is_incoming = TRUE;
301 priv->status = EMPATHY_TP_CALL_STATUS_PENDING;
302 g_object_notify (G_OBJECT (call), "is-incoming");
303 g_object_notify (G_OBJECT (call), "contact");
304 g_object_notify (G_OBJECT (call), "status");
307 if (priv->status == EMPATHY_TP_CALL_STATUS_PENDING &&
308 ((priv->is_incoming && iter.element == self_handle) ||
309 (!priv->is_incoming && iter.element != self_handle)))
311 priv->status = EMPATHY_TP_CALL_STATUS_ACCEPTED;
312 g_object_notify (G_OBJECT (call), "status");
316 g_object_unref (call);
320 tp_call_members_changed_cb (TpChannel *channel,
324 GArray *local_pending,
325 GArray *remote_pending,
330 tp_call_update_status (call);
334 empathy_tp_call_to (EmpathyTpCall *call, EmpathyContact *contact)
336 EmpathyTpCallPriv *priv = GET_PRIV (call);
338 priv->contact = g_object_ref (contact);
339 priv->is_incoming = FALSE;
340 priv->status = EMPATHY_TP_CALL_STATUS_PENDING;
341 g_object_notify (G_OBJECT (call), "is-incoming");
342 g_object_notify (G_OBJECT (call), "contact");
343 g_object_notify (G_OBJECT (call), "status");
344 tp_call_request_streams_for_capabilities (call,
345 EMPATHY_CAPABILITIES_AUDIO);
349 tp_call_channel_invalidated_cb (TpChannel *channel,
355 EmpathyTpCallPriv *priv = GET_PRIV (call);
357 DEBUG ("Channel invalidated: %s", message);
358 priv->status = EMPATHY_TP_CALL_STATUS_CLOSED;
359 g_object_notify (G_OBJECT (call), "status");
363 tp_call_async_cb (TpProxy *proxy,
369 DEBUG ("Error %s: %s", (gchar*) user_data, error->message);
373 tp_call_stream_engine_invalidated_cb (TpProxy *stream_engine,
379 DEBUG ("Stream engine proxy invalidated: %s", message);
380 empathy_tp_call_close (call);
384 tp_call_stream_engine_watch_name_owner_cb (TpDBusDaemon *daemon,
386 const gchar *new_owner,
389 EmpathyTpCallPriv *priv = GET_PRIV (call);
391 /* G_STR_EMPTY(new_owner) means either stream-engine has not started yet or
392 * has crashed. We want to close the channel if stream-engine has crashed.
394 DEBUG ("Watch SE: name='%s' SE running='%s' new_owner='%s'",
395 name, priv->stream_engine_running ? "yes" : "no",
396 new_owner ? new_owner : "none");
397 if (priv->stream_engine_running && G_STR_EMPTY (new_owner))
399 DEBUG ("Stream engine falled off the bus");
400 empathy_tp_call_close (call);
404 priv->stream_engine_running = !G_STR_EMPTY (new_owner);
408 tp_call_stream_engine_handle_channel (EmpathyTpCall *call)
410 EmpathyTpCallPriv *priv = GET_PRIV (call);
417 DEBUG ("Revving up the stream engine");
419 priv->stream_engine = g_object_new (TP_TYPE_PROXY,
420 "bus-name", STREAM_ENGINE_BUS_NAME,
421 "dbus-connection", tp_get_bus (),
422 "object-path", STREAM_ENGINE_OBJECT_PATH,
424 tp_proxy_add_interface_by_id (priv->stream_engine,
425 EMP_IFACE_QUARK_STREAM_ENGINE);
426 tp_proxy_add_interface_by_id (priv->stream_engine,
427 EMP_IFACE_QUARK_CHANNEL_HANDLER);
429 g_signal_connect (priv->stream_engine, "invalidated",
430 G_CALLBACK (tp_call_stream_engine_invalidated_cb),
433 /* FIXME: dbus daemon should be unique */
434 priv->dbus_daemon = tp_dbus_daemon_new (tp_get_bus ());
435 tp_dbus_daemon_watch_name_owner (priv->dbus_daemon, STREAM_ENGINE_BUS_NAME,
436 tp_call_stream_engine_watch_name_owner_cb,
439 g_object_get (priv->channel,
440 "connection", &connection,
441 "channel-type", &channel_type,
442 "object-path", &object_path,
443 "handle_type", &handle_type,
447 emp_cli_channel_handler_call_handle_channel (priv->stream_engine, -1,
448 connection->bus_name,
449 connection->object_path,
450 channel_type, object_path, handle_type, handle,
451 tp_call_async_cb, "calling handle channel", NULL,
454 g_object_unref (connection);
455 g_free (channel_type);
456 g_free (object_path);
460 tp_call_constructor (GType type,
461 guint n_construct_params,
462 GObjectConstructParam *construct_params)
466 EmpathyTpCallPriv *priv;
468 object = G_OBJECT_CLASS (empathy_tp_call_parent_class)->constructor (type,
469 n_construct_params, construct_params);
471 call = EMPATHY_TP_CALL (object);
472 priv = GET_PRIV (call);
474 /* Setup streamed media channel */
475 g_signal_connect (priv->channel, "invalidated",
476 G_CALLBACK (tp_call_channel_invalidated_cb), call);
477 tp_cli_channel_type_streamed_media_connect_to_stream_added (priv->channel,
478 tp_call_stream_added_cb, NULL, NULL, G_OBJECT (call), NULL);
479 tp_cli_channel_type_streamed_media_connect_to_stream_removed (priv->channel,
480 tp_call_stream_removed_cb, NULL, NULL, G_OBJECT (call), NULL);
481 tp_cli_channel_type_streamed_media_connect_to_stream_state_changed (priv->channel,
482 tp_call_stream_state_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
483 tp_cli_channel_type_streamed_media_connect_to_stream_direction_changed (priv->channel,
484 tp_call_stream_direction_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
485 tp_cli_channel_type_streamed_media_call_list_streams (priv->channel, -1,
486 tp_call_request_streams_cb, NULL, NULL, G_OBJECT (call));
488 /* Update status when members changes */
489 tp_call_update_status (call);
490 g_signal_connect (priv->channel, "group-members-changed",
491 G_CALLBACK (tp_call_members_changed_cb), call);
493 /* Start stream engine */
494 tp_call_stream_engine_handle_channel (call);
500 tp_call_finalize (GObject *object)
502 EmpathyTpCallPriv *priv = GET_PRIV (object);
504 DEBUG ("Finalizing: %p", object);
506 g_slice_free (EmpathyTpCallStream, priv->audio);
507 g_slice_free (EmpathyTpCallStream, priv->video);
509 if (priv->channel != NULL)
511 g_signal_handlers_disconnect_by_func (priv->channel,
512 tp_call_channel_invalidated_cb, object);
514 g_object_unref (priv->channel);
515 priv->channel = NULL;
518 if (priv->stream_engine != NULL)
520 g_signal_handlers_disconnect_by_func (priv->stream_engine,
521 tp_call_stream_engine_invalidated_cb, object);
522 g_object_unref (priv->stream_engine);
525 if (priv->contact != NULL)
526 g_object_unref (priv->contact);
528 if (priv->dbus_daemon != NULL)
530 tp_dbus_daemon_cancel_name_owner_watch (priv->dbus_daemon,
531 STREAM_ENGINE_BUS_NAME,
532 tp_call_stream_engine_watch_name_owner_cb,
534 g_object_unref (priv->dbus_daemon);
537 (G_OBJECT_CLASS (empathy_tp_call_parent_class)->finalize) (object);
541 tp_call_set_property (GObject *object,
546 EmpathyTpCallPriv *priv = GET_PRIV (object);
551 priv->channel = g_value_dup_object (value);
554 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
560 tp_call_get_property (GObject *object,
565 EmpathyTpCallPriv *priv = GET_PRIV (object);
570 g_value_set_object (value, priv->channel);
573 g_value_set_object (value, priv->contact);
575 case PROP_IS_INCOMING:
576 g_value_set_boolean (value, priv->is_incoming);
579 g_value_set_uint (value, priv->status);
581 case PROP_AUDIO_STREAM:
582 g_value_set_pointer (value, priv->audio);
584 case PROP_VIDEO_STREAM:
585 g_value_set_pointer (value, priv->video);
588 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
594 empathy_tp_call_class_init (EmpathyTpCallClass *klass)
596 GObjectClass *object_class = G_OBJECT_CLASS (klass);
598 object_class->constructor = tp_call_constructor;
599 object_class->finalize = tp_call_finalize;
600 object_class->set_property = tp_call_set_property;
601 object_class->get_property = tp_call_get_property;
603 g_type_class_add_private (klass, sizeof (EmpathyTpCallPriv));
605 g_object_class_install_property (object_class, PROP_CHANNEL,
606 g_param_spec_object ("channel", "channel", "channel",
608 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
609 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
610 g_object_class_install_property (object_class, PROP_CONTACT,
611 g_param_spec_object ("contact", "Call contact", "Call contact",
612 EMPATHY_TYPE_CONTACT,
613 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
614 g_object_class_install_property (object_class, PROP_IS_INCOMING,
615 g_param_spec_boolean ("is-incoming", "Is media stream incoming",
616 "Is media stream incoming", FALSE, G_PARAM_READABLE |
617 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
618 g_object_class_install_property (object_class, PROP_STATUS,
619 g_param_spec_uint ("status", "Call status",
620 "Call status", 0, 255, 0, G_PARAM_READABLE | G_PARAM_STATIC_NICK |
621 G_PARAM_STATIC_BLURB));
622 g_object_class_install_property (object_class, PROP_AUDIO_STREAM,
623 g_param_spec_pointer ("audio-stream", "Audio stream data",
625 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
626 g_object_class_install_property (object_class, PROP_VIDEO_STREAM,
627 g_param_spec_pointer ("video-stream", "Video stream data",
629 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
633 empathy_tp_call_init (EmpathyTpCall *call)
635 EmpathyTpCallPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (call,
636 EMPATHY_TYPE_TP_CALL, EmpathyTpCallPriv);
639 priv->status = EMPATHY_TP_CALL_STATUS_READYING;
640 priv->contact = NULL;
641 priv->stream_engine_running = FALSE;
642 priv->audio = g_slice_new0 (EmpathyTpCallStream);
643 priv->video = g_slice_new0 (EmpathyTpCallStream);
644 priv->audio->exists = FALSE;
645 priv->video->exists = FALSE;
649 empathy_tp_call_new (TpChannel *channel)
651 g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL);
653 return g_object_new (EMPATHY_TYPE_TP_CALL,
659 empathy_tp_call_accept_incoming_call (EmpathyTpCall *call)
661 EmpathyTpCallPriv *priv = GET_PRIV (call);
662 TpHandle self_handle;
663 GArray handles = {(gchar *) &self_handle, 1};
665 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
666 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_PENDING);
667 g_return_if_fail (priv->is_incoming);
669 DEBUG ("Accepting incoming call");
671 self_handle = tp_channel_group_get_self_handle (priv->channel);
672 tp_cli_channel_interface_group_call_add_members (priv->channel, -1,
673 &handles, NULL, NULL, NULL, NULL, NULL);
677 empathy_tp_call_close (EmpathyTpCall *call)
679 EmpathyTpCallPriv *priv = GET_PRIV (call);
681 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
683 if (priv->status == EMPATHY_TP_CALL_STATUS_CLOSED)
686 DEBUG ("Closing channel");
688 tp_cli_channel_call_close (priv->channel, -1,
689 NULL, NULL, NULL, NULL);
691 priv->status = EMPATHY_TP_CALL_STATUS_CLOSED;
692 g_object_notify (G_OBJECT (call), "status");
696 empathy_tp_call_request_video_stream_direction (EmpathyTpCall *call,
699 EmpathyTpCallPriv *priv = GET_PRIV (call);
702 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
703 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
705 DEBUG ("Requesting video stream direction - is_sending: %d", is_sending);
707 if (!priv->video->exists)
710 tp_call_request_streams_for_capabilities (call,
711 EMPATHY_CAPABILITIES_VIDEO);
716 new_direction = priv->video->direction | TP_MEDIA_STREAM_DIRECTION_SEND;
718 new_direction = priv->video->direction & ~TP_MEDIA_STREAM_DIRECTION_SEND;
720 tp_cli_channel_type_streamed_media_call_request_stream_direction (priv->channel,
721 -1, priv->video->id, new_direction,
722 (tp_cli_channel_type_streamed_media_callback_for_request_stream_direction)
723 tp_call_async_cb, NULL, NULL, G_OBJECT (call));
727 empathy_tp_call_add_preview_video (EmpathyTpCall *call,
728 guint preview_video_socket_id)
730 EmpathyTpCallPriv *priv = GET_PRIV (call);
732 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
734 DEBUG ("Adding preview video");
736 emp_cli_stream_engine_call_add_preview_window (priv->stream_engine, -1,
737 preview_video_socket_id,
739 "adding preview window", NULL,
744 empathy_tp_call_remove_preview_video (EmpathyTpCall *call,
745 guint preview_video_socket_id)
747 EmpathyTpCallPriv *priv = GET_PRIV (call);
749 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
751 DEBUG ("Removing preview video");
753 emp_cli_stream_engine_call_remove_preview_window (priv->stream_engine, -1,
754 preview_video_socket_id,
756 "removing preview window", NULL,
761 empathy_tp_call_add_output_video (EmpathyTpCall *call,
762 guint output_video_socket_id)
764 EmpathyTpCallPriv *priv = GET_PRIV (call);
766 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
768 DEBUG ("Adding output video - socket: %d", output_video_socket_id);
770 emp_cli_stream_engine_call_set_output_window (priv->stream_engine, -1,
771 TP_PROXY (priv->channel)->object_path,
772 priv->video->id, output_video_socket_id,
774 "setting output window", NULL,
779 empathy_tp_call_set_output_volume (EmpathyTpCall *call,
782 EmpathyTpCallPriv *priv = GET_PRIV (call);
784 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
785 g_return_if_fail (priv->status != EMPATHY_TP_CALL_STATUS_CLOSED);
787 DEBUG ("Setting output volume: %d", volume);
789 emp_cli_stream_engine_call_set_output_volume (priv->stream_engine, -1,
790 TP_PROXY (priv->channel)->object_path,
791 priv->audio->id, volume,
793 "setting output volume", NULL,
798 empathy_tp_call_mute_output (EmpathyTpCall *call,
801 EmpathyTpCallPriv *priv = GET_PRIV (call);
803 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
805 DEBUG ("Setting output mute: %d", is_muted);
807 emp_cli_stream_engine_call_mute_output (priv->stream_engine, -1,
808 TP_PROXY (priv->channel)->object_path,
809 priv->audio->id, is_muted,
811 "muting output", NULL,
816 empathy_tp_call_mute_input (EmpathyTpCall *call,
819 EmpathyTpCallPriv *priv = GET_PRIV (call);
821 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
823 DEBUG ("Setting input mute: %d", is_muted);
825 emp_cli_stream_engine_call_mute_input (priv->stream_engine, -1,
826 TP_PROXY (priv->channel)->object_path,
827 priv->audio->id, is_muted,
829 "muting input", NULL,
834 empathy_tp_call_start_tone (EmpathyTpCall *call, TpDTMFEvent event)
836 EmpathyTpCallPriv *priv = GET_PRIV (call);
838 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
839 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
841 if (!priv->audio->exists)
844 tp_cli_channel_interface_dtmf_call_start_tone (priv->channel, -1,
845 priv->audio->id, event,
846 (tp_cli_channel_interface_dtmf_callback_for_start_tone) tp_call_async_cb,
847 "starting tone", NULL, G_OBJECT (call));
851 empathy_tp_call_stop_tone (EmpathyTpCall *call)
853 EmpathyTpCallPriv *priv = GET_PRIV (call);
855 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
856 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
858 if (!priv->audio->exists)
861 tp_cli_channel_interface_dtmf_call_stop_tone (priv->channel, -1,
863 (tp_cli_channel_interface_dtmf_callback_for_stop_tone) tp_call_async_cb,
864 "stoping tone", NULL, G_OBJECT (call));
868 empathy_tp_call_has_dtmf (EmpathyTpCall *call)
870 EmpathyTpCallPriv *priv = GET_PRIV (call);
872 g_return_val_if_fail (EMPATHY_IS_TP_CALL (call), FALSE);
874 return tp_proxy_has_interface_by_id (priv->channel,
875 TP_IFACE_QUARK_CHANNEL_INTERFACE_DTMF);