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/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;
70 G_DEFINE_TYPE (EmpathyTpCall, empathy_tp_call, G_TYPE_OBJECT)
73 tp_call_add_stream (EmpathyTpCall *call,
78 guint stream_direction)
80 EmpathyTpCallPriv *priv = GET_PRIV (call);
84 case TP_MEDIA_STREAM_TYPE_AUDIO:
85 DEBUG ("Audio stream - id: %d, state: %d, direction: %d",
86 stream_id, stream_state, stream_direction);
87 priv->audio->exists = TRUE;
88 priv->audio->id = stream_id;
89 priv->audio->state = stream_state;
90 priv->audio->direction = stream_direction;
91 g_object_notify (G_OBJECT (call), "audio-stream");
93 case TP_MEDIA_STREAM_TYPE_VIDEO:
94 DEBUG ("Video stream - id: %d, state: %d, direction: %d",
95 stream_id, stream_state, stream_direction);
96 priv->video->exists = TRUE;
97 priv->video->id = stream_id;
98 priv->video->state = stream_state;
99 priv->video->direction = stream_direction;
100 g_object_notify (G_OBJECT (call), "video-stream");
103 DEBUG ("Unknown stream type: %d", stream_type);
108 tp_call_stream_added_cb (TpChannel *channel,
110 guint contact_handle,
115 DEBUG ("Stream added - stream id: %d, contact handle: %d, stream type: %d",
116 stream_id, contact_handle, stream_type);
118 tp_call_add_stream (EMPATHY_TP_CALL (call), stream_id, contact_handle,
119 stream_type, TP_MEDIA_STREAM_STATE_DISCONNECTED,
120 TP_MEDIA_STREAM_DIRECTION_NONE);
124 tp_call_stream_removed_cb (TpChannel *channel,
129 EmpathyTpCallPriv *priv = GET_PRIV (call);
131 DEBUG ("Stream removed - stream id: %d", stream_id);
133 if (stream_id == priv->audio->id)
135 priv->audio->exists = FALSE;
136 g_object_notify (call, "audio-stream");
138 else if (stream_id == priv->video->id)
140 priv->video->exists = FALSE;
141 g_object_notify (call, "video-stream");
146 tp_call_stream_state_changed_cb (TpChannel *proxy,
152 EmpathyTpCallPriv *priv = GET_PRIV (call);
154 DEBUG ("Stream state changed - stream id: %d, state state: %d",
155 stream_id, stream_state);
157 if (stream_id == priv->audio->id)
159 priv->audio->state = stream_state;
160 g_object_notify (call, "audio-stream");
162 else if (stream_id == priv->video->id)
164 priv->video->state = stream_state;
165 g_object_notify (call, "video-stream");
170 tp_call_stream_direction_changed_cb (TpChannel *channel,
172 guint stream_direction,
177 EmpathyTpCallPriv *priv = GET_PRIV (call);
179 DEBUG ("Stream direction changed - stream: %d, direction: %d",
180 stream_id, stream_direction);
182 if (stream_id == priv->audio->id)
184 priv->audio->direction = stream_direction;
185 g_object_notify (call, "audio-stream");
187 else if (stream_id == priv->video->id)
189 priv->video->direction = stream_direction;
190 g_object_notify (call, "video-stream");
195 tp_call_request_streams_cb (TpChannel *channel,
196 const GPtrArray *streams,
205 DEBUG ("Error requesting streams: %s", error->message);
209 for (i = 0; i < streams->len; i++)
213 guint contact_handle;
216 guint stream_direction;
218 values = g_ptr_array_index (streams, i);
219 stream_id = g_value_get_uint (g_value_array_get_nth (values, 0));
220 contact_handle = g_value_get_uint (g_value_array_get_nth (values, 1));
221 stream_type = g_value_get_uint (g_value_array_get_nth (values, 2));
222 stream_state = g_value_get_uint (g_value_array_get_nth (values, 3));
223 stream_direction = g_value_get_uint (g_value_array_get_nth (values, 4));
225 tp_call_add_stream (EMPATHY_TP_CALL (call), stream_id, contact_handle,
226 stream_type, stream_state, stream_direction);
231 tp_call_request_streams_for_capabilities (EmpathyTpCall *call,
232 EmpathyCapabilities capabilities)
234 EmpathyTpCallPriv *priv = GET_PRIV (call);
235 GArray *stream_types;
239 if (capabilities == EMPATHY_CAPABILITIES_UNKNOWN)
240 capabilities = EMPATHY_CAPABILITIES_AUDIO | EMPATHY_CAPABILITIES_VIDEO;
242 DEBUG ("Requesting new stream for capabilities %d",
245 stream_types = g_array_new (FALSE, FALSE, sizeof (guint));
246 handle = empathy_contact_get_handle (priv->contact);
248 if (capabilities & EMPATHY_CAPABILITIES_AUDIO)
250 stream_type = TP_MEDIA_STREAM_TYPE_AUDIO;
251 g_array_append_val (stream_types, stream_type);
253 if (capabilities & EMPATHY_CAPABILITIES_VIDEO)
255 stream_type = TP_MEDIA_STREAM_TYPE_VIDEO;
256 g_array_append_val (stream_types, stream_type);
259 tp_cli_channel_type_streamed_media_call_request_streams (priv->channel, -1,
260 handle, stream_types, tp_call_request_streams_cb, NULL, NULL,
263 g_array_free (stream_types, TRUE);
267 tp_call_member_added_cb (EmpathyTpGroup *group,
268 EmpathyContact *contact,
269 EmpathyContact *actor,
271 const gchar *message,
274 EmpathyTpCallPriv *priv = GET_PRIV (call);
277 if (!priv->contact && !empathy_contact_is_user (contact))
279 priv->contact = g_object_ref (contact);
280 priv->is_incoming = TRUE;
281 priv->status = EMPATHY_TP_CALL_STATUS_PENDING;
282 g_object_notify (G_OBJECT (call), "is-incoming");
283 g_object_notify (G_OBJECT (call), "contact");
284 g_object_notify (G_OBJECT (call), "status");
287 if (priv->status == EMPATHY_TP_CALL_STATUS_PENDING &&
288 ((priv->is_incoming && contact != priv->contact) ||
289 (!priv->is_incoming && contact == priv->contact)))
291 priv->status = EMPATHY_TP_CALL_STATUS_ACCEPTED;
292 g_object_notify (G_OBJECT (call), "status");
294 g_object_unref (call);
298 empathy_tp_call_to (EmpathyTpCall *call, EmpathyContact *contact)
300 EmpathyTpCallPriv *priv = GET_PRIV (call);
302 priv->contact = g_object_ref (contact);
303 priv->is_incoming = FALSE;
304 priv->status = EMPATHY_TP_CALL_STATUS_PENDING;
305 g_object_notify (G_OBJECT (call), "is-incoming");
306 g_object_notify (G_OBJECT (call), "contact");
307 g_object_notify (G_OBJECT (call), "status");
308 tp_call_request_streams_for_capabilities (call,
309 EMPATHY_CAPABILITIES_AUDIO);
313 tp_call_channel_invalidated_cb (TpChannel *channel,
319 EmpathyTpCallPriv *priv = GET_PRIV (call);
321 DEBUG ("Channel invalidated: %s", message);
322 priv->status = EMPATHY_TP_CALL_STATUS_CLOSED;
323 g_object_notify (G_OBJECT (call), "status");
327 tp_call_async_cb (TpProxy *proxy,
333 DEBUG ("Error %s: %s", (gchar*) user_data, error->message);
337 tp_call_close_channel (EmpathyTpCall *call)
339 EmpathyTpCallPriv *priv = GET_PRIV (call);
341 if (priv->status == EMPATHY_TP_CALL_STATUS_CLOSED)
344 DEBUG ("Closing channel");
346 tp_cli_channel_call_close (priv->channel, -1,
347 NULL, NULL, NULL, NULL);
349 priv->status = EMPATHY_TP_CALL_STATUS_CLOSED;
350 g_object_notify (G_OBJECT (call), "status");
354 tp_call_stream_engine_invalidated_cb (TpProxy *stream_engine,
360 DEBUG ("Stream engine proxy invalidated: %s", message);
361 tp_call_close_channel (call);
365 tp_call_stream_engine_watch_name_owner_cb (TpDBusDaemon *daemon,
367 const gchar *new_owner,
370 EmpathyTpCallPriv *priv = GET_PRIV (call);
372 /* G_STR_EMPTY(new_owner) means either stream-engine has not started yet or
373 * has crashed. We want to close the channel if stream-engine has crashed.
375 DEBUG ("Watch SE: name='%s' SE running='%s' new_owner='%s'",
376 name, priv->stream_engine_running ? "yes" : "no",
377 new_owner ? new_owner : "none");
378 if (priv->stream_engine_running && G_STR_EMPTY (new_owner))
380 DEBUG ("Stream engine falled off the bus");
381 tp_call_close_channel (call);
385 priv->stream_engine_running = !G_STR_EMPTY (new_owner);
389 tp_call_stream_engine_handle_channel (EmpathyTpCall *call)
391 EmpathyTpCallPriv *priv = GET_PRIV (call);
398 DEBUG ("Revving up the stream engine");
400 priv->stream_engine = g_object_new (TP_TYPE_PROXY,
401 "bus-name", STREAM_ENGINE_BUS_NAME,
402 "dbus-connection", tp_get_bus (),
403 "object-path", STREAM_ENGINE_OBJECT_PATH,
405 tp_proxy_add_interface_by_id (priv->stream_engine,
406 EMP_IFACE_QUARK_STREAM_ENGINE);
407 tp_proxy_add_interface_by_id (priv->stream_engine,
408 EMP_IFACE_QUARK_CHANNEL_HANDLER);
410 g_signal_connect (priv->stream_engine, "invalidated",
411 G_CALLBACK (tp_call_stream_engine_invalidated_cb),
414 /* FIXME: dbus daemon should be unique */
415 priv->dbus_daemon = tp_dbus_daemon_new (tp_get_bus ());
416 tp_dbus_daemon_watch_name_owner (priv->dbus_daemon, STREAM_ENGINE_BUS_NAME,
417 tp_call_stream_engine_watch_name_owner_cb,
420 g_object_get (priv->channel,
421 "connection", &connection,
422 "channel-type", &channel_type,
423 "object-path", &object_path,
424 "handle_type", &handle_type,
428 emp_cli_channel_handler_call_handle_channel (priv->stream_engine, -1,
429 connection->bus_name,
430 connection->object_path,
431 channel_type, object_path, handle_type, handle,
432 tp_call_async_cb, "calling handle channel", NULL,
435 g_object_unref (connection);
436 g_free (channel_type);
437 g_free (object_path);
441 tp_call_constructor (GType type,
442 guint n_construct_params,
443 GObjectConstructParam *construct_params)
447 EmpathyTpCallPriv *priv;
449 object = G_OBJECT_CLASS (empathy_tp_call_parent_class)->constructor (type,
450 n_construct_params, construct_params);
452 call = EMPATHY_TP_CALL (object);
453 priv = GET_PRIV (call);
455 /* Setup streamed media channel */
456 g_signal_connect (priv->channel, "invalidated",
457 G_CALLBACK (tp_call_channel_invalidated_cb), call);
458 tp_cli_channel_type_streamed_media_connect_to_stream_added (priv->channel,
459 tp_call_stream_added_cb, NULL, NULL, G_OBJECT (call), NULL);
460 tp_cli_channel_type_streamed_media_connect_to_stream_removed (priv->channel,
461 tp_call_stream_removed_cb, NULL, NULL, G_OBJECT (call), NULL);
462 tp_cli_channel_type_streamed_media_connect_to_stream_state_changed (priv->channel,
463 tp_call_stream_state_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
464 tp_cli_channel_type_streamed_media_connect_to_stream_direction_changed (priv->channel,
465 tp_call_stream_direction_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
466 tp_cli_channel_type_streamed_media_call_list_streams (priv->channel, -1,
467 tp_call_request_streams_cb, NULL, NULL, G_OBJECT (call));
469 /* Setup group interface */
470 priv->group = empathy_tp_group_new (priv->channel);
472 g_signal_connect (priv->group, "member-added",
473 G_CALLBACK (tp_call_member_added_cb), call);
475 /* Start stream engine */
476 tp_call_stream_engine_handle_channel (call);
482 tp_call_finalize (GObject *object)
484 EmpathyTpCallPriv *priv = GET_PRIV (object);
486 DEBUG ("Finalizing: %p", object);
488 g_slice_free (EmpathyTpCallStream, priv->audio);
489 g_slice_free (EmpathyTpCallStream, priv->video);
490 g_object_unref (priv->group);
492 if (priv->group != NULL)
493 g_object_unref (priv->group);
497 if (priv->channel != NULL)
499 g_signal_handlers_disconnect_by_func (priv->channel,
500 tp_call_channel_invalidated_cb, object);
502 g_object_unref (priv->channel);
503 priv->channel = NULL;
506 if (priv->stream_engine != NULL)
508 g_signal_handlers_disconnect_by_func (priv->stream_engine,
509 tp_call_stream_engine_invalidated_cb, object);
510 g_object_unref (priv->stream_engine);
513 if (priv->contact != NULL)
514 g_object_unref (priv->contact);
516 if (priv->dbus_daemon != NULL)
518 tp_dbus_daemon_cancel_name_owner_watch (priv->dbus_daemon,
519 STREAM_ENGINE_BUS_NAME,
520 tp_call_stream_engine_watch_name_owner_cb,
522 g_object_unref (priv->dbus_daemon);
525 (G_OBJECT_CLASS (empathy_tp_call_parent_class)->finalize) (object);
529 tp_call_set_property (GObject *object,
534 EmpathyTpCallPriv *priv = GET_PRIV (object);
539 priv->channel = g_value_dup_object (value);
542 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
548 tp_call_get_property (GObject *object,
553 EmpathyTpCallPriv *priv = GET_PRIV (object);
558 g_value_set_object (value, priv->channel);
561 g_value_set_object (value, priv->contact);
563 case PROP_IS_INCOMING:
564 g_value_set_boolean (value, priv->is_incoming);
567 g_value_set_uint (value, priv->status);
569 case PROP_AUDIO_STREAM:
570 g_value_set_pointer (value, priv->audio);
572 case PROP_VIDEO_STREAM:
573 g_value_set_pointer (value, priv->video);
576 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
582 empathy_tp_call_class_init (EmpathyTpCallClass *klass)
584 GObjectClass *object_class = G_OBJECT_CLASS (klass);
586 object_class->constructor = tp_call_constructor;
587 object_class->finalize = tp_call_finalize;
588 object_class->set_property = tp_call_set_property;
589 object_class->get_property = tp_call_get_property;
591 g_type_class_add_private (klass, sizeof (EmpathyTpCallPriv));
593 g_object_class_install_property (object_class, PROP_CHANNEL,
594 g_param_spec_object ("channel", "channel", "channel",
596 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
597 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
598 g_object_class_install_property (object_class, PROP_CONTACT,
599 g_param_spec_object ("contact", "Call contact", "Call contact",
600 EMPATHY_TYPE_CONTACT,
601 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
602 g_object_class_install_property (object_class, PROP_IS_INCOMING,
603 g_param_spec_boolean ("is-incoming", "Is media stream incoming",
604 "Is media stream incoming", FALSE, G_PARAM_READABLE |
605 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
606 g_object_class_install_property (object_class, PROP_STATUS,
607 g_param_spec_uint ("status", "Call status",
608 "Call status", 0, 255, 0, G_PARAM_READABLE | G_PARAM_STATIC_NICK |
609 G_PARAM_STATIC_BLURB));
610 g_object_class_install_property (object_class, PROP_AUDIO_STREAM,
611 g_param_spec_pointer ("audio-stream", "Audio stream data",
613 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
614 g_object_class_install_property (object_class, PROP_VIDEO_STREAM,
615 g_param_spec_pointer ("video-stream", "Video stream data",
617 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
621 empathy_tp_call_init (EmpathyTpCall *call)
623 EmpathyTpCallPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (call,
624 EMPATHY_TYPE_TP_CALL, EmpathyTpCallPriv);
627 priv->status = EMPATHY_TP_CALL_STATUS_READYING;
628 priv->contact = NULL;
629 priv->stream_engine_running = FALSE;
630 priv->audio = g_slice_new0 (EmpathyTpCallStream);
631 priv->video = g_slice_new0 (EmpathyTpCallStream);
632 priv->audio->exists = FALSE;
633 priv->video->exists = FALSE;
637 empathy_tp_call_new (TpChannel *channel)
639 g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL);
641 return g_object_new (EMPATHY_TYPE_TP_CALL,
647 empathy_tp_call_accept_incoming_call (EmpathyTpCall *call)
649 EmpathyTpCallPriv *priv = GET_PRIV (call);
650 EmpathyContact *self_contact;
652 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
653 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_PENDING);
655 DEBUG ("Accepting incoming call");
657 self_contact = empathy_tp_group_get_self_contact (priv->group);
658 empathy_tp_group_add_member (priv->group, self_contact, NULL);
659 g_object_unref (self_contact);
663 empathy_tp_call_close (EmpathyTpCall *call)
665 EmpathyTpCallPriv *priv = GET_PRIV (call);
667 g_signal_handlers_disconnect_by_func (priv->channel,
668 tp_call_channel_invalidated_cb, call);
670 tp_call_close_channel (call);
672 g_object_unref (priv->channel);
673 priv->channel = NULL;
677 empathy_tp_call_request_video_stream_direction (EmpathyTpCall *call,
680 EmpathyTpCallPriv *priv = GET_PRIV (call);
683 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
684 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
686 DEBUG ("Requesting video stream direction - is_sending: %d", is_sending);
688 if (!priv->video->exists)
691 tp_call_request_streams_for_capabilities (call,
692 EMPATHY_CAPABILITIES_VIDEO);
697 new_direction = priv->video->direction | TP_MEDIA_STREAM_DIRECTION_SEND;
699 new_direction = priv->video->direction & ~TP_MEDIA_STREAM_DIRECTION_SEND;
701 tp_cli_channel_type_streamed_media_call_request_stream_direction (priv->channel,
702 -1, priv->video->id, new_direction,
703 (tp_cli_channel_type_streamed_media_callback_for_request_stream_direction)
704 tp_call_async_cb, NULL, NULL, G_OBJECT (call));
708 empathy_tp_call_add_preview_video (EmpathyTpCall *call,
709 guint preview_video_socket_id)
711 EmpathyTpCallPriv *priv = GET_PRIV (call);
713 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
715 DEBUG ("Adding preview video");
717 emp_cli_stream_engine_call_add_preview_window (priv->stream_engine, -1,
718 preview_video_socket_id,
720 "adding preview window", NULL,
725 empathy_tp_call_remove_preview_video (EmpathyTpCall *call,
726 guint preview_video_socket_id)
728 EmpathyTpCallPriv *priv = GET_PRIV (call);
730 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
732 DEBUG ("Removing preview video");
734 emp_cli_stream_engine_call_remove_preview_window (priv->stream_engine, -1,
735 preview_video_socket_id,
737 "removing preview window", NULL,
742 empathy_tp_call_add_output_video (EmpathyTpCall *call,
743 guint output_video_socket_id)
745 EmpathyTpCallPriv *priv = GET_PRIV (call);
747 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
749 DEBUG ("Adding output video - socket: %d", output_video_socket_id);
751 emp_cli_stream_engine_call_set_output_window (priv->stream_engine, -1,
752 TP_PROXY (priv->channel)->object_path,
753 priv->video->id, output_video_socket_id,
755 "setting output window", NULL,
760 empathy_tp_call_set_output_volume (EmpathyTpCall *call,
763 EmpathyTpCallPriv *priv = GET_PRIV (call);
765 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
766 g_return_if_fail (priv->status != EMPATHY_TP_CALL_STATUS_CLOSED);
768 DEBUG ("Setting output volume: %d", volume);
770 emp_cli_stream_engine_call_set_output_volume (priv->stream_engine, -1,
771 TP_PROXY (priv->channel)->object_path,
772 priv->audio->id, volume,
774 "setting output volume", NULL,
779 empathy_tp_call_mute_output (EmpathyTpCall *call,
782 EmpathyTpCallPriv *priv = GET_PRIV (call);
784 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
786 DEBUG ("Setting output mute: %d", is_muted);
788 emp_cli_stream_engine_call_mute_output (priv->stream_engine, -1,
789 TP_PROXY (priv->channel)->object_path,
790 priv->audio->id, is_muted,
792 "muting output", NULL,
797 empathy_tp_call_mute_input (EmpathyTpCall *call,
800 EmpathyTpCallPriv *priv = GET_PRIV (call);
802 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
804 DEBUG ("Setting input mute: %d", is_muted);
806 emp_cli_stream_engine_call_mute_input (priv->stream_engine, -1,
807 TP_PROXY (priv->channel)->object_path,
808 priv->audio->id, is_muted,
810 "muting input", NULL,
815 empathy_tp_call_start_tone (EmpathyTpCall *call, TpDTMFEvent event)
817 EmpathyTpCallPriv *priv = GET_PRIV (call);
819 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
820 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
822 if (!priv->audio->exists)
825 tp_cli_channel_interface_dtmf_call_start_tone (priv->channel, -1,
826 priv->audio->id, event,
827 (tp_cli_channel_interface_dtmf_callback_for_start_tone) tp_call_async_cb,
828 "starting tone", NULL, G_OBJECT (call));
832 empathy_tp_call_stop_tone (EmpathyTpCall *call)
834 EmpathyTpCallPriv *priv = GET_PRIV (call);
836 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
837 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
839 if (!priv->audio->exists)
842 tp_cli_channel_interface_dtmf_call_stop_tone (priv->channel, -1,
844 (tp_cli_channel_interface_dtmf_callback_for_stop_tone) tp_call_async_cb,
845 "stoping tone", NULL, G_OBJECT (call));
849 empathy_tp_call_has_dtmf (EmpathyTpCall *call)
851 EmpathyTpCallPriv *priv = GET_PRIV (call);
853 g_return_val_if_fail (EMPATHY_IS_TP_CALL (call), FALSE);
855 return tp_proxy_has_interface_by_id (priv->channel,
856 TP_IFACE_QUARK_CHANNEL_INTERFACE_DTMF);