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_close_channel (EmpathyTpCall *call)
375 EmpathyTpCallPriv *priv = GET_PRIV (call);
377 if (priv->status == EMPATHY_TP_CALL_STATUS_CLOSED)
380 DEBUG ("Closing channel");
382 tp_cli_channel_call_close (priv->channel, -1,
383 NULL, NULL, NULL, NULL);
385 priv->status = EMPATHY_TP_CALL_STATUS_CLOSED;
386 g_object_notify (G_OBJECT (call), "status");
390 tp_call_stream_engine_invalidated_cb (TpProxy *stream_engine,
396 DEBUG ("Stream engine proxy invalidated: %s", message);
397 tp_call_close_channel (call);
401 tp_call_stream_engine_watch_name_owner_cb (TpDBusDaemon *daemon,
403 const gchar *new_owner,
406 EmpathyTpCallPriv *priv = GET_PRIV (call);
408 /* G_STR_EMPTY(new_owner) means either stream-engine has not started yet or
409 * has crashed. We want to close the channel if stream-engine has crashed.
411 DEBUG ("Watch SE: name='%s' SE running='%s' new_owner='%s'",
412 name, priv->stream_engine_running ? "yes" : "no",
413 new_owner ? new_owner : "none");
414 if (priv->stream_engine_running && G_STR_EMPTY (new_owner))
416 DEBUG ("Stream engine falled off the bus");
417 tp_call_close_channel (call);
421 priv->stream_engine_running = !G_STR_EMPTY (new_owner);
425 tp_call_stream_engine_handle_channel (EmpathyTpCall *call)
427 EmpathyTpCallPriv *priv = GET_PRIV (call);
434 DEBUG ("Revving up the stream engine");
436 priv->stream_engine = g_object_new (TP_TYPE_PROXY,
437 "bus-name", STREAM_ENGINE_BUS_NAME,
438 "dbus-connection", tp_get_bus (),
439 "object-path", STREAM_ENGINE_OBJECT_PATH,
441 tp_proxy_add_interface_by_id (priv->stream_engine,
442 EMP_IFACE_QUARK_STREAM_ENGINE);
443 tp_proxy_add_interface_by_id (priv->stream_engine,
444 EMP_IFACE_QUARK_CHANNEL_HANDLER);
446 g_signal_connect (priv->stream_engine, "invalidated",
447 G_CALLBACK (tp_call_stream_engine_invalidated_cb),
450 /* FIXME: dbus daemon should be unique */
451 priv->dbus_daemon = tp_dbus_daemon_new (tp_get_bus ());
452 tp_dbus_daemon_watch_name_owner (priv->dbus_daemon, STREAM_ENGINE_BUS_NAME,
453 tp_call_stream_engine_watch_name_owner_cb,
456 g_object_get (priv->channel,
457 "connection", &connection,
458 "channel-type", &channel_type,
459 "object-path", &object_path,
460 "handle_type", &handle_type,
464 emp_cli_channel_handler_call_handle_channel (priv->stream_engine, -1,
465 connection->bus_name,
466 connection->object_path,
467 channel_type, object_path, handle_type, handle,
468 tp_call_async_cb, "calling handle channel", NULL,
471 g_object_unref (connection);
472 g_free (channel_type);
473 g_free (object_path);
477 tp_call_constructor (GType type,
478 guint n_construct_params,
479 GObjectConstructParam *construct_params)
483 EmpathyTpCallPriv *priv;
485 object = G_OBJECT_CLASS (empathy_tp_call_parent_class)->constructor (type,
486 n_construct_params, construct_params);
488 call = EMPATHY_TP_CALL (object);
489 priv = GET_PRIV (call);
491 /* Setup streamed media channel */
492 g_signal_connect (priv->channel, "invalidated",
493 G_CALLBACK (tp_call_channel_invalidated_cb), call);
494 tp_cli_channel_type_streamed_media_connect_to_stream_added (priv->channel,
495 tp_call_stream_added_cb, NULL, NULL, G_OBJECT (call), NULL);
496 tp_cli_channel_type_streamed_media_connect_to_stream_removed (priv->channel,
497 tp_call_stream_removed_cb, NULL, NULL, G_OBJECT (call), NULL);
498 tp_cli_channel_type_streamed_media_connect_to_stream_state_changed (priv->channel,
499 tp_call_stream_state_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
500 tp_cli_channel_type_streamed_media_connect_to_stream_direction_changed (priv->channel,
501 tp_call_stream_direction_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
502 tp_cli_channel_type_streamed_media_call_list_streams (priv->channel, -1,
503 tp_call_request_streams_cb, NULL, NULL, G_OBJECT (call));
505 /* Update status when members changes */
506 tp_call_update_status (call);
507 g_signal_connect (priv->channel, "group-members-changed",
508 G_CALLBACK (tp_call_members_changed_cb), call);
510 /* Start stream engine */
511 tp_call_stream_engine_handle_channel (call);
517 tp_call_finalize (GObject *object)
519 EmpathyTpCallPriv *priv = GET_PRIV (object);
521 DEBUG ("Finalizing: %p", object);
523 g_slice_free (EmpathyTpCallStream, priv->audio);
524 g_slice_free (EmpathyTpCallStream, priv->video);
526 if (priv->channel != NULL)
528 g_signal_handlers_disconnect_by_func (priv->channel,
529 tp_call_channel_invalidated_cb, object);
531 g_object_unref (priv->channel);
532 priv->channel = NULL;
535 if (priv->stream_engine != NULL)
537 g_signal_handlers_disconnect_by_func (priv->stream_engine,
538 tp_call_stream_engine_invalidated_cb, object);
539 g_object_unref (priv->stream_engine);
542 if (priv->contact != NULL)
543 g_object_unref (priv->contact);
545 if (priv->dbus_daemon != NULL)
547 tp_dbus_daemon_cancel_name_owner_watch (priv->dbus_daemon,
548 STREAM_ENGINE_BUS_NAME,
549 tp_call_stream_engine_watch_name_owner_cb,
551 g_object_unref (priv->dbus_daemon);
554 (G_OBJECT_CLASS (empathy_tp_call_parent_class)->finalize) (object);
558 tp_call_set_property (GObject *object,
563 EmpathyTpCallPriv *priv = GET_PRIV (object);
568 priv->channel = g_value_dup_object (value);
571 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
577 tp_call_get_property (GObject *object,
582 EmpathyTpCallPriv *priv = GET_PRIV (object);
587 g_value_set_object (value, priv->channel);
590 g_value_set_object (value, priv->contact);
592 case PROP_IS_INCOMING:
593 g_value_set_boolean (value, priv->is_incoming);
596 g_value_set_uint (value, priv->status);
598 case PROP_AUDIO_STREAM:
599 g_value_set_pointer (value, priv->audio);
601 case PROP_VIDEO_STREAM:
602 g_value_set_pointer (value, priv->video);
605 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
611 empathy_tp_call_class_init (EmpathyTpCallClass *klass)
613 GObjectClass *object_class = G_OBJECT_CLASS (klass);
615 object_class->constructor = tp_call_constructor;
616 object_class->finalize = tp_call_finalize;
617 object_class->set_property = tp_call_set_property;
618 object_class->get_property = tp_call_get_property;
620 g_type_class_add_private (klass, sizeof (EmpathyTpCallPriv));
622 g_object_class_install_property (object_class, PROP_CHANNEL,
623 g_param_spec_object ("channel", "channel", "channel",
625 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
626 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
627 g_object_class_install_property (object_class, PROP_CONTACT,
628 g_param_spec_object ("contact", "Call contact", "Call contact",
629 EMPATHY_TYPE_CONTACT,
630 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
631 g_object_class_install_property (object_class, PROP_IS_INCOMING,
632 g_param_spec_boolean ("is-incoming", "Is media stream incoming",
633 "Is media stream incoming", FALSE, G_PARAM_READABLE |
634 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
635 g_object_class_install_property (object_class, PROP_STATUS,
636 g_param_spec_uint ("status", "Call status",
637 "Call status", 0, 255, 0, G_PARAM_READABLE | G_PARAM_STATIC_NICK |
638 G_PARAM_STATIC_BLURB));
639 g_object_class_install_property (object_class, PROP_AUDIO_STREAM,
640 g_param_spec_pointer ("audio-stream", "Audio stream data",
642 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
643 g_object_class_install_property (object_class, PROP_VIDEO_STREAM,
644 g_param_spec_pointer ("video-stream", "Video stream data",
646 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
650 empathy_tp_call_init (EmpathyTpCall *call)
652 EmpathyTpCallPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (call,
653 EMPATHY_TYPE_TP_CALL, EmpathyTpCallPriv);
656 priv->status = EMPATHY_TP_CALL_STATUS_READYING;
657 priv->contact = NULL;
658 priv->stream_engine_running = FALSE;
659 priv->audio = g_slice_new0 (EmpathyTpCallStream);
660 priv->video = g_slice_new0 (EmpathyTpCallStream);
661 priv->audio->exists = FALSE;
662 priv->video->exists = FALSE;
666 empathy_tp_call_new (TpChannel *channel)
668 g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL);
670 return g_object_new (EMPATHY_TYPE_TP_CALL,
676 empathy_tp_call_accept_incoming_call (EmpathyTpCall *call)
678 EmpathyTpCallPriv *priv = GET_PRIV (call);
679 TpHandle self_handle;
680 GArray handles = {(gchar *) &self_handle, 1};
682 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
683 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_PENDING);
684 g_return_if_fail (priv->is_incoming);
686 DEBUG ("Accepting incoming call");
688 self_handle = tp_channel_group_get_self_handle (priv->channel);
689 tp_cli_channel_interface_group_call_add_members (priv->channel, -1,
690 &handles, NULL, NULL, NULL, NULL, NULL);
694 empathy_tp_call_close (EmpathyTpCall *call)
696 EmpathyTpCallPriv *priv = GET_PRIV (call);
698 g_signal_handlers_disconnect_by_func (priv->channel,
699 tp_call_channel_invalidated_cb, call);
701 tp_call_close_channel (call);
703 g_object_unref (priv->channel);
704 priv->channel = NULL;
708 empathy_tp_call_request_video_stream_direction (EmpathyTpCall *call,
711 EmpathyTpCallPriv *priv = GET_PRIV (call);
714 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
715 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
717 DEBUG ("Requesting video stream direction - is_sending: %d", is_sending);
719 if (!priv->video->exists)
722 tp_call_request_streams_for_capabilities (call,
723 EMPATHY_CAPABILITIES_VIDEO);
728 new_direction = priv->video->direction | TP_MEDIA_STREAM_DIRECTION_SEND;
730 new_direction = priv->video->direction & ~TP_MEDIA_STREAM_DIRECTION_SEND;
732 tp_cli_channel_type_streamed_media_call_request_stream_direction (priv->channel,
733 -1, priv->video->id, new_direction,
734 (tp_cli_channel_type_streamed_media_callback_for_request_stream_direction)
735 tp_call_async_cb, NULL, NULL, G_OBJECT (call));
739 empathy_tp_call_add_preview_video (EmpathyTpCall *call,
740 guint preview_video_socket_id)
742 EmpathyTpCallPriv *priv = GET_PRIV (call);
744 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
746 DEBUG ("Adding preview video");
748 emp_cli_stream_engine_call_add_preview_window (priv->stream_engine, -1,
749 preview_video_socket_id,
751 "adding preview window", NULL,
756 empathy_tp_call_remove_preview_video (EmpathyTpCall *call,
757 guint preview_video_socket_id)
759 EmpathyTpCallPriv *priv = GET_PRIV (call);
761 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
763 DEBUG ("Removing preview video");
765 emp_cli_stream_engine_call_remove_preview_window (priv->stream_engine, -1,
766 preview_video_socket_id,
768 "removing preview window", NULL,
773 empathy_tp_call_add_output_video (EmpathyTpCall *call,
774 guint output_video_socket_id)
776 EmpathyTpCallPriv *priv = GET_PRIV (call);
778 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
780 DEBUG ("Adding output video - socket: %d", output_video_socket_id);
782 emp_cli_stream_engine_call_set_output_window (priv->stream_engine, -1,
783 TP_PROXY (priv->channel)->object_path,
784 priv->video->id, output_video_socket_id,
786 "setting output window", NULL,
791 empathy_tp_call_set_output_volume (EmpathyTpCall *call,
794 EmpathyTpCallPriv *priv = GET_PRIV (call);
796 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
797 g_return_if_fail (priv->status != EMPATHY_TP_CALL_STATUS_CLOSED);
799 DEBUG ("Setting output volume: %d", volume);
801 emp_cli_stream_engine_call_set_output_volume (priv->stream_engine, -1,
802 TP_PROXY (priv->channel)->object_path,
803 priv->audio->id, volume,
805 "setting output volume", NULL,
810 empathy_tp_call_mute_output (EmpathyTpCall *call,
813 EmpathyTpCallPriv *priv = GET_PRIV (call);
815 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
817 DEBUG ("Setting output mute: %d", is_muted);
819 emp_cli_stream_engine_call_mute_output (priv->stream_engine, -1,
820 TP_PROXY (priv->channel)->object_path,
821 priv->audio->id, is_muted,
823 "muting output", NULL,
828 empathy_tp_call_mute_input (EmpathyTpCall *call,
831 EmpathyTpCallPriv *priv = GET_PRIV (call);
833 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
835 DEBUG ("Setting input mute: %d", is_muted);
837 emp_cli_stream_engine_call_mute_input (priv->stream_engine, -1,
838 TP_PROXY (priv->channel)->object_path,
839 priv->audio->id, is_muted,
841 "muting input", NULL,
846 empathy_tp_call_start_tone (EmpathyTpCall *call, TpDTMFEvent event)
848 EmpathyTpCallPriv *priv = GET_PRIV (call);
850 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
851 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
853 if (!priv->audio->exists)
856 tp_cli_channel_interface_dtmf_call_start_tone (priv->channel, -1,
857 priv->audio->id, event,
858 (tp_cli_channel_interface_dtmf_callback_for_start_tone) tp_call_async_cb,
859 "starting tone", NULL, G_OBJECT (call));
863 empathy_tp_call_stop_tone (EmpathyTpCall *call)
865 EmpathyTpCallPriv *priv = GET_PRIV (call);
867 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
868 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
870 if (!priv->audio->exists)
873 tp_cli_channel_interface_dtmf_call_stop_tone (priv->channel, -1,
875 (tp_cli_channel_interface_dtmf_callback_for_stop_tone) tp_call_async_cb,
876 "stoping tone", NULL, G_OBJECT (call));
880 empathy_tp_call_has_dtmf (EmpathyTpCall *call)
882 EmpathyTpCallPriv *priv = GET_PRIV (call);
884 g_return_val_if_fail (EMPATHY_IS_TP_CALL (call), FALSE);
886 return tp_proxy_has_interface_by_id (priv->channel,
887 TP_IFACE_QUARK_CHANNEL_INTERFACE_DTMF);