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>
28 #include <telepathy-farsight/channel.h>
29 #include <telepathy-farsight/stream.h>
33 #include "empathy-tp-call.h"
34 #include "empathy-contact-factory.h"
35 #include "empathy-utils.h"
37 #define DEBUG_FLAG EMPATHY_DEBUG_TP
38 #include "empathy-debug.h"
40 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpCall)
43 gboolean dispose_has_run;
46 EmpathyContact *contact;
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_pipeline_bus_watch (GstBus *bus, GstMessage *message,
393 EmpathyTpCall *call = EMPATHY_TP_CALL (user_data);
394 EmpathyTpCallPriv *priv = GET_PRIV (call);
396 g_assert (priv->tfchannel != NULL);
398 tf_channel_bus_message (priv->tfchannel, message);
404 tp_call_tf_channel_session_created_cb (TfChannel *tfchannel,
405 FsConference *conference, FsParticipant *participant, EmpathyTpCall *call)
407 EmpathyTpCallPriv *priv = GET_PRIV (call);
410 g_assert (priv->pipeline == NULL);
412 priv->pipeline = gst_pipeline_new ("call-pipeline");
414 bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline));
415 gst_bus_add_watch (bus, tp_call_pipeline_bus_watch, call);
416 gst_object_unref (bus);
418 gst_bin_add ( GST_BIN (priv->pipeline), GST_ELEMENT (conference));
419 gst_element_set_state ( GST_ELEMENT(priv->pipeline), GST_STATE_PLAYING);
423 tp_call_tf_stream_src_pad_added_cb (TfStream *stream, GstPad *pad,
424 FsCodec *codec, EmpathyTpCall *call)
426 EmpathyTpCallPriv *priv = GET_PRIV (call);
431 g_object_get (stream, "media-type", &media_type, NULL);
435 case TP_MEDIA_STREAM_TYPE_AUDIO:
436 sink = gst_element_factory_make ("gconfaudiosink", NULL);
438 case TP_MEDIA_STREAM_TYPE_VIDEO:
439 sink = gst_element_factory_make ("gconfvideosink", NULL);
442 g_assert_not_reached();
445 gst_bin_add ( GST_BIN (priv->pipeline), sink);
446 gst_element_set_state (sink, GST_STATE_PLAYING);
448 spad = gst_element_get_static_pad (sink, "sink");
449 gst_pad_link (pad, spad);
450 gst_object_unref (spad);
455 tp_call_tf_stream_request_resource_cb (TfStream *stream,
456 guint direction, EmpathyTpCall *call)
462 tp_call_tf_channel_stream_created_cb (TfChannel *tfchannel, TfStream *stream,
465 EmpathyTpCallPriv *priv = GET_PRIV (call);
470 g_signal_connect (stream, "src-pad-added",
471 G_CALLBACK (tp_call_tf_stream_src_pad_added_cb), call);
472 g_signal_connect (stream, "request-resource",
473 G_CALLBACK (tp_call_tf_stream_request_resource_cb), call);
476 g_object_get (stream, "media-type", &media_type,
477 "sink-pad", &spad, NULL);
481 case TP_MEDIA_STREAM_TYPE_AUDIO:
482 src = gst_element_factory_make ("gconfaudiosrc", NULL);
484 case TP_MEDIA_STREAM_TYPE_VIDEO:
485 src = gst_element_factory_make ("gconfvideosrc", NULL);
488 g_assert_not_reached();
491 gst_bin_add (GST_BIN (priv->pipeline), src);
493 pad = gst_element_get_static_pad (src, "src");
494 gst_pad_link (pad, spad);
495 gst_object_unref (spad);
497 gst_element_set_state (src, GST_STATE_PLAYING);
501 tp_call_constructor (GType type,
502 guint n_construct_params,
503 GObjectConstructParam *construct_params)
507 EmpathyTpCallPriv *priv;
509 object = G_OBJECT_CLASS (empathy_tp_call_parent_class)->constructor (type,
510 n_construct_params, construct_params);
512 call = EMPATHY_TP_CALL (object);
513 priv = GET_PRIV (call);
515 /* Setup streamed media channel */
516 g_signal_connect (priv->channel, "invalidated",
517 G_CALLBACK (tp_call_channel_invalidated_cb), call);
518 tp_cli_channel_type_streamed_media_connect_to_stream_added (priv->channel,
519 tp_call_stream_added_cb, NULL, NULL, G_OBJECT (call), NULL);
520 tp_cli_channel_type_streamed_media_connect_to_stream_removed (priv->channel,
521 tp_call_stream_removed_cb, NULL, NULL, G_OBJECT (call), NULL);
522 tp_cli_channel_type_streamed_media_connect_to_stream_state_changed (priv->channel,
523 tp_call_stream_state_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
524 tp_cli_channel_type_streamed_media_connect_to_stream_direction_changed (priv->channel,
525 tp_call_stream_direction_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
526 tp_cli_channel_type_streamed_media_call_list_streams (priv->channel, -1,
527 tp_call_request_streams_cb, NULL, NULL, G_OBJECT (call));
529 /* Update status when members changes */
530 tp_call_update_status (call);
531 g_signal_connect (priv->channel, "group-members-changed",
532 G_CALLBACK (tp_call_members_changed_cb), call);
535 /* Set up the telepathy farsight channel */
536 priv->tfchannel = tf_channel_new (priv->channel);
537 g_signal_connect (priv->tfchannel, "session-created",
538 G_CALLBACK (tp_call_tf_channel_session_created_cb), call);
539 g_signal_connect (priv->tfchannel, "stream-created",
540 G_CALLBACK (tp_call_tf_channel_stream_created_cb), call);
545 tp_call_dispose (GObject *object)
547 EmpathyTpCallPriv *priv = GET_PRIV (object);
549 DEBUG ("Disposing: %p, %d", object, priv->dispose_has_run);
551 if (priv->dispose_has_run)
554 priv->dispose_has_run = TRUE;
556 g_slice_free (EmpathyTpCallStream, priv->audio);
557 g_slice_free (EmpathyTpCallStream, priv->video);
559 if (priv->channel != NULL)
561 g_signal_handlers_disconnect_by_func (priv->channel,
562 tp_call_channel_invalidated_cb, object);
564 g_object_unref (priv->channel);
565 priv->channel = NULL;
568 if (priv->pipeline != NULL)
570 gst_element_set_state (priv->pipeline, GST_STATE_NULL);
571 gst_object_unref (priv->pipeline);
572 priv->pipeline = NULL;
575 if (priv->tfchannel != NULL)
577 g_object_unref (priv->tfchannel);
578 priv->tfchannel = NULL;
581 if (priv->contact != NULL)
582 g_object_unref (priv->contact);
584 if (G_OBJECT_CLASS (empathy_tp_call_parent_class)->dispose)
585 G_OBJECT_CLASS (empathy_tp_call_parent_class)->dispose (object);
589 tp_call_finalize (GObject *object)
591 EmpathyTpCallPriv *priv = GET_PRIV (object);
593 DEBUG ("Finalizing: %p", object);
595 g_slice_free (EmpathyTpCallStream, priv->audio);
596 g_slice_free (EmpathyTpCallStream, priv->video);
598 (G_OBJECT_CLASS (empathy_tp_call_parent_class)->finalize) (object);
602 tp_call_set_property (GObject *object,
607 EmpathyTpCallPriv *priv = GET_PRIV (object);
612 priv->channel = g_value_dup_object (value);
615 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
621 tp_call_get_property (GObject *object,
626 EmpathyTpCallPriv *priv = GET_PRIV (object);
631 g_value_set_object (value, priv->channel);
634 g_value_set_object (value, priv->contact);
636 case PROP_IS_INCOMING:
637 g_value_set_boolean (value, priv->is_incoming);
640 g_value_set_uint (value, priv->status);
642 case PROP_AUDIO_STREAM:
643 g_value_set_pointer (value, priv->audio);
645 case PROP_VIDEO_STREAM:
646 g_value_set_pointer (value, priv->video);
649 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
655 empathy_tp_call_class_init (EmpathyTpCallClass *klass)
657 GObjectClass *object_class = G_OBJECT_CLASS (klass);
659 object_class->constructor = tp_call_constructor;
660 object_class->dispose = tp_call_dispose;
661 object_class->finalize = tp_call_finalize;
662 object_class->set_property = tp_call_set_property;
663 object_class->get_property = tp_call_get_property;
665 g_type_class_add_private (klass, sizeof (EmpathyTpCallPriv));
667 g_object_class_install_property (object_class, PROP_CHANNEL,
668 g_param_spec_object ("channel", "channel", "channel",
670 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
671 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
672 g_object_class_install_property (object_class, PROP_CONTACT,
673 g_param_spec_object ("contact", "Call contact", "Call contact",
674 EMPATHY_TYPE_CONTACT,
675 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
676 g_object_class_install_property (object_class, PROP_IS_INCOMING,
677 g_param_spec_boolean ("is-incoming", "Is media stream incoming",
678 "Is media stream incoming", FALSE, G_PARAM_READABLE |
679 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
680 g_object_class_install_property (object_class, PROP_STATUS,
681 g_param_spec_uint ("status", "Call status",
682 "Call status", 0, 255, 0, G_PARAM_READABLE | G_PARAM_STATIC_NICK |
683 G_PARAM_STATIC_BLURB));
684 g_object_class_install_property (object_class, PROP_AUDIO_STREAM,
685 g_param_spec_pointer ("audio-stream", "Audio stream data",
687 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
688 g_object_class_install_property (object_class, PROP_VIDEO_STREAM,
689 g_param_spec_pointer ("video-stream", "Video stream data",
691 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
695 empathy_tp_call_init (EmpathyTpCall *call)
697 EmpathyTpCallPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (call,
698 EMPATHY_TYPE_TP_CALL, EmpathyTpCallPriv);
701 priv->status = EMPATHY_TP_CALL_STATUS_READYING;
702 priv->contact = NULL;
703 priv->audio = g_slice_new0 (EmpathyTpCallStream);
704 priv->video = g_slice_new0 (EmpathyTpCallStream);
705 priv->audio->exists = FALSE;
706 priv->video->exists = FALSE;
710 empathy_tp_call_new (TpChannel *channel)
712 g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL);
714 return g_object_new (EMPATHY_TYPE_TP_CALL,
720 empathy_tp_call_accept_incoming_call (EmpathyTpCall *call)
722 EmpathyTpCallPriv *priv = GET_PRIV (call);
723 TpHandle self_handle;
724 GArray handles = {(gchar *) &self_handle, 1};
726 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
727 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_PENDING);
728 g_return_if_fail (priv->is_incoming);
730 DEBUG ("Accepting incoming call");
732 self_handle = tp_channel_group_get_self_handle (priv->channel);
733 tp_cli_channel_interface_group_call_add_members (priv->channel, -1,
734 &handles, NULL, NULL, NULL, NULL, NULL);
738 empathy_tp_call_close (EmpathyTpCall *call)
740 EmpathyTpCallPriv *priv = GET_PRIV (call);
742 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
744 if (priv->status == EMPATHY_TP_CALL_STATUS_CLOSED)
747 DEBUG ("Closing channel");
749 tp_cli_channel_call_close (priv->channel, -1,
750 NULL, NULL, NULL, NULL);
752 priv->status = EMPATHY_TP_CALL_STATUS_CLOSED;
753 g_object_notify (G_OBJECT (call), "status");
757 empathy_tp_call_request_video_stream_direction (EmpathyTpCall *call,
760 EmpathyTpCallPriv *priv = GET_PRIV (call);
763 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
764 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
766 DEBUG ("Requesting video stream direction - is_sending: %d", is_sending);
768 if (!priv->video->exists)
771 tp_call_request_streams_for_capabilities (call,
772 EMPATHY_CAPABILITIES_VIDEO);
777 new_direction = priv->video->direction | TP_MEDIA_STREAM_DIRECTION_SEND;
779 new_direction = priv->video->direction & ~TP_MEDIA_STREAM_DIRECTION_SEND;
781 tp_cli_channel_type_streamed_media_call_request_stream_direction (priv->channel,
782 -1, priv->video->id, new_direction,
783 (tp_cli_channel_type_streamed_media_callback_for_request_stream_direction)
784 tp_call_async_cb, NULL, NULL, G_OBJECT (call));
788 empathy_tp_call_add_preview_video (EmpathyTpCall *call,
789 guint preview_video_socket_id)
791 //EmpathyTpCallPriv *priv = GET_PRIV (call);
793 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
795 DEBUG ("Adding preview video");
797 /* FIXME add the preview window */
801 empathy_tp_call_remove_preview_video (EmpathyTpCall *call,
802 guint preview_video_socket_id)
804 //EmpathyTpCallPriv *priv = GET_PRIV (call);
806 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
808 DEBUG ("Removing preview video");
810 /* FIXME remove the preview window */
814 empathy_tp_call_add_output_video (EmpathyTpCall *call,
815 guint output_video_socket_id)
817 //EmpathyTpCallPriv *priv = GET_PRIV (call);
819 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
821 DEBUG ("Adding output video - socket: %d", output_video_socket_id);
823 /* FIXME add output window */
827 empathy_tp_call_set_output_volume (EmpathyTpCall *call,
830 EmpathyTpCallPriv *priv = GET_PRIV (call);
832 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
833 g_return_if_fail (priv->status != EMPATHY_TP_CALL_STATUS_CLOSED);
835 DEBUG ("Setting output volume: %d", volume);
837 /* FIXME set volume */
841 empathy_tp_call_mute_output (EmpathyTpCall *call,
844 //EmpathyTpCallPriv *priv = GET_PRIV (call);
846 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
848 DEBUG ("Setting output mute: %d", is_muted);
849 /* FIXME mute output */
853 empathy_tp_call_mute_input (EmpathyTpCall *call,
856 //EmpathyTpCallPriv *priv = GET_PRIV (call);
858 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
860 DEBUG ("Setting input mute: %d", is_muted);
862 /* FIXME mute input */
866 empathy_tp_call_start_tone (EmpathyTpCall *call, TpDTMFEvent event)
868 EmpathyTpCallPriv *priv = GET_PRIV (call);
870 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
871 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
873 if (!priv->audio->exists)
876 tp_cli_channel_interface_dtmf_call_start_tone (priv->channel, -1,
877 priv->audio->id, event,
878 (tp_cli_channel_interface_dtmf_callback_for_start_tone) tp_call_async_cb,
879 "starting tone", NULL, G_OBJECT (call));
883 empathy_tp_call_stop_tone (EmpathyTpCall *call)
885 EmpathyTpCallPriv *priv = GET_PRIV (call);
887 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
888 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
890 if (!priv->audio->exists)
893 tp_cli_channel_interface_dtmf_call_stop_tone (priv->channel, -1,
895 (tp_cli_channel_interface_dtmf_callback_for_stop_tone) tp_call_async_cb,
896 "stoping tone", NULL, G_OBJECT (call));
900 empathy_tp_call_has_dtmf (EmpathyTpCall *call)
902 EmpathyTpCallPriv *priv = GET_PRIV (call);
904 g_return_val_if_fail (EMPATHY_IS_TP_CALL (call), FALSE);
906 return tp_proxy_has_interface_by_id (priv->channel,
907 TP_IFACE_QUARK_CHANNEL_INTERFACE_DTMF);