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>
29 #include <extensions/extensions.h>
31 #include "empathy-tp-call.h"
32 #include "empathy-contact-factory.h"
33 #include "empathy-tp-group.h"
34 #include "empathy-utils.h"
36 #define DEBUG_FLAG EMPATHY_DEBUG_TP
37 #include "empathy-debug.h"
39 #define STREAM_ENGINE_BUS_NAME "org.freedesktop.Telepathy.StreamEngine"
40 #define STREAM_ENGINE_OBJECT_PATH "/org/freedesktop/Telepathy/StreamEngine"
42 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpCall)
46 TpProxy *stream_engine;
47 TpDBusDaemon *dbus_daemon;
48 EmpathyTpGroup *group;
49 EmpathyContact *contact;
52 gboolean stream_engine_running;
54 EmpathyTpCallStream *audio;
55 EmpathyTpCallStream *video;
69 G_DEFINE_TYPE (EmpathyTpCall, empathy_tp_call, G_TYPE_OBJECT)
72 tp_call_add_stream (EmpathyTpCall *call,
77 guint stream_direction)
79 EmpathyTpCallPriv *priv = GET_PRIV (call);
83 case TP_MEDIA_STREAM_TYPE_AUDIO:
84 DEBUG ("Audio stream - id: %d, state: %d, direction: %d",
85 stream_id, stream_state, stream_direction);
86 priv->audio->exists = TRUE;
87 priv->audio->id = stream_id;
88 priv->audio->state = stream_state;
89 priv->audio->direction = stream_direction;
90 g_object_notify (G_OBJECT (call), "audio-stream");
92 case TP_MEDIA_STREAM_TYPE_VIDEO:
93 DEBUG ("Video stream - id: %d, state: %d, direction: %d",
94 stream_id, stream_state, stream_direction);
95 priv->video->exists = TRUE;
96 priv->video->id = stream_id;
97 priv->video->state = stream_state;
98 priv->video->direction = stream_direction;
99 g_object_notify (G_OBJECT (call), "video-stream");
102 DEBUG ("Unknown stream type: %d", stream_type);
107 tp_call_stream_added_cb (TpChannel *channel,
109 guint contact_handle,
114 DEBUG ("Stream added - stream id: %d, contact handle: %d, stream type: %d",
115 stream_id, contact_handle, stream_type);
117 tp_call_add_stream (EMPATHY_TP_CALL (call), stream_id, contact_handle,
118 stream_type, TP_MEDIA_STREAM_STATE_DISCONNECTED,
119 TP_MEDIA_STREAM_DIRECTION_NONE);
123 tp_call_stream_removed_cb (TpChannel *channel,
128 EmpathyTpCallPriv *priv = GET_PRIV (call);
130 DEBUG ("Stream removed - stream id: %d", stream_id);
132 if (stream_id == priv->audio->id)
134 priv->audio->exists = FALSE;
135 g_object_notify (call, "audio-stream");
137 else if (stream_id == priv->video->id)
139 priv->video->exists = FALSE;
140 g_object_notify (call, "video-stream");
145 tp_call_stream_state_changed_cb (TpChannel *proxy,
151 EmpathyTpCallPriv *priv = GET_PRIV (call);
153 DEBUG ("Stream state changed - stream id: %d, state state: %d",
154 stream_id, stream_state);
156 if (stream_id == priv->audio->id)
158 priv->audio->state = stream_state;
159 g_object_notify (call, "audio-stream");
161 else if (stream_id == priv->video->id)
163 priv->video->state = stream_state;
164 g_object_notify (call, "video-stream");
169 tp_call_stream_direction_changed_cb (TpChannel *channel,
171 guint stream_direction,
176 EmpathyTpCallPriv *priv = GET_PRIV (call);
178 DEBUG ("Stream direction changed - stream: %d, direction: %d",
179 stream_id, stream_direction);
181 if (stream_id == priv->audio->id)
183 priv->audio->direction = stream_direction;
184 g_object_notify (call, "audio-stream");
186 else if (stream_id == priv->video->id)
188 priv->video->direction = stream_direction;
189 g_object_notify (call, "video-stream");
194 tp_call_request_streams_cb (TpChannel *channel,
195 const GPtrArray *streams,
204 DEBUG ("Error requesting streams: %s", error->message);
208 for (i = 0; i < streams->len; i++)
212 guint contact_handle;
215 guint stream_direction;
217 values = g_ptr_array_index (streams, i);
218 stream_id = g_value_get_uint (g_value_array_get_nth (values, 0));
219 contact_handle = g_value_get_uint (g_value_array_get_nth (values, 1));
220 stream_type = g_value_get_uint (g_value_array_get_nth (values, 2));
221 stream_state = g_value_get_uint (g_value_array_get_nth (values, 3));
222 stream_direction = g_value_get_uint (g_value_array_get_nth (values, 4));
224 tp_call_add_stream (EMPATHY_TP_CALL (call), stream_id, contact_handle,
225 stream_type, stream_state, stream_direction);
230 tp_call_request_streams_for_capabilities (EmpathyTpCall *call,
231 EmpathyCapabilities capabilities)
233 EmpathyTpCallPriv *priv = GET_PRIV (call);
234 GArray *stream_types;
238 if (capabilities == EMPATHY_CAPABILITIES_UNKNOWN)
239 capabilities = EMPATHY_CAPABILITIES_AUDIO | EMPATHY_CAPABILITIES_VIDEO;
241 DEBUG ("Requesting new stream for capabilities %d",
244 stream_types = g_array_new (FALSE, FALSE, sizeof (guint));
245 handle = empathy_contact_get_handle (priv->contact);
247 if (capabilities & EMPATHY_CAPABILITIES_AUDIO)
249 stream_type = TP_MEDIA_STREAM_TYPE_AUDIO;
250 g_array_append_val (stream_types, stream_type);
252 if (capabilities & EMPATHY_CAPABILITIES_VIDEO)
254 stream_type = TP_MEDIA_STREAM_TYPE_VIDEO;
255 g_array_append_val (stream_types, stream_type);
258 tp_cli_channel_type_streamed_media_call_request_streams (priv->channel, -1,
259 handle, stream_types, tp_call_request_streams_cb, NULL, NULL,
262 g_array_free (stream_types, TRUE);
266 tp_call_member_added_cb (EmpathyTpGroup *group,
267 EmpathyContact *contact,
268 EmpathyContact *actor,
270 const gchar *message,
273 EmpathyTpCallPriv *priv = GET_PRIV (call);
276 if (!priv->contact && !empathy_contact_is_user (contact))
278 priv->contact = g_object_ref (contact);
279 priv->is_incoming = TRUE;
280 priv->status = EMPATHY_TP_CALL_STATUS_PENDING;
281 g_object_notify (G_OBJECT (call), "is-incoming");
282 g_object_notify (G_OBJECT (call), "contact");
283 g_object_notify (G_OBJECT (call), "status");
284 tp_call_request_streams_for_capabilities (call,
285 EMPATHY_CAPABILITIES_AUDIO);
289 if (priv->status == EMPATHY_TP_CALL_STATUS_PENDING &&
290 ((priv->is_incoming && contact != priv->contact) ||
291 (!priv->is_incoming && contact == priv->contact)))
293 priv->status = EMPATHY_TP_CALL_STATUS_ACCEPTED;
294 g_object_notify (G_OBJECT (call), "status");
296 g_object_unref (call);
300 tp_call_remote_pending_cb (EmpathyTpGroup *group,
301 EmpathyContact *contact,
302 EmpathyContact *actor,
304 const gchar *message,
307 EmpathyTpCallPriv *priv = GET_PRIV (call);
310 if (!priv->contact && !empathy_contact_is_user (contact))
312 priv->contact = g_object_ref (contact);
313 priv->is_incoming = FALSE;
314 priv->status = EMPATHY_TP_CALL_STATUS_PENDING;
315 g_object_notify (G_OBJECT (call), "is-incoming");
316 g_object_notify (G_OBJECT (call), "contact");
317 g_object_notify (G_OBJECT (call), "status");
318 tp_call_request_streams_for_capabilities (call,
319 EMPATHY_CAPABILITIES_AUDIO);
321 g_object_unref (call);
325 tp_call_channel_invalidated_cb (TpChannel *channel,
331 EmpathyTpCallPriv *priv = GET_PRIV (call);
333 DEBUG ("Channel invalidated: %s", message);
334 priv->status = EMPATHY_TP_CALL_STATUS_CLOSED;
335 g_object_notify (G_OBJECT (call), "status");
339 tp_call_async_cb (TpProxy *proxy,
345 DEBUG ("Error %s: %s", (gchar*) user_data, error->message);
349 tp_call_close_channel (EmpathyTpCall *call)
351 EmpathyTpCallPriv *priv = GET_PRIV (call);
353 if (priv->status == EMPATHY_TP_CALL_STATUS_CLOSED)
356 DEBUG ("Closing channel");
358 tp_cli_channel_call_close (priv->channel, -1,
359 NULL, NULL, NULL, NULL);
361 priv->status = EMPATHY_TP_CALL_STATUS_CLOSED;
362 g_object_notify (G_OBJECT (call), "status");
366 tp_call_stream_engine_invalidated_cb (TpProxy *stream_engine,
372 DEBUG ("Stream engine proxy invalidated: %s", message);
373 tp_call_close_channel (call);
377 tp_call_stream_engine_watch_name_owner_cb (TpDBusDaemon *daemon,
379 const gchar *new_owner,
382 EmpathyTpCallPriv *priv = GET_PRIV (call);
384 /* G_STR_EMPTY(new_owner) means either stream-engine has not started yet or
385 * has crashed. We want to close the channel if stream-engine has crashed.
387 DEBUG ("Watch SE: name='%s' SE running='%s' new_owner='%s'",
388 name, priv->stream_engine_running ? "yes" : "no",
389 new_owner ? new_owner : "none");
390 if (priv->stream_engine_running && G_STR_EMPTY (new_owner))
392 DEBUG ("Stream engine falled off the bus");
393 tp_call_close_channel (call);
397 priv->stream_engine_running = !G_STR_EMPTY (new_owner);
401 tp_call_stream_engine_handle_channel (EmpathyTpCall *call)
403 EmpathyTpCallPriv *priv = GET_PRIV (call);
410 DEBUG ("Revving up the stream engine");
412 priv->stream_engine = g_object_new (TP_TYPE_PROXY,
413 "bus-name", STREAM_ENGINE_BUS_NAME,
414 "dbus-connection", tp_get_bus (),
415 "object-path", STREAM_ENGINE_OBJECT_PATH,
417 tp_proxy_add_interface_by_id (priv->stream_engine,
418 EMP_IFACE_QUARK_STREAM_ENGINE);
419 tp_proxy_add_interface_by_id (priv->stream_engine,
420 EMP_IFACE_QUARK_CHANNEL_HANDLER);
422 g_signal_connect (priv->stream_engine, "invalidated",
423 G_CALLBACK (tp_call_stream_engine_invalidated_cb),
426 /* FIXME: dbus daemon should be unique */
427 priv->dbus_daemon = tp_dbus_daemon_new (tp_get_bus ());
428 tp_dbus_daemon_watch_name_owner (priv->dbus_daemon, STREAM_ENGINE_BUS_NAME,
429 tp_call_stream_engine_watch_name_owner_cb,
432 g_object_get (priv->channel,
433 "connection", &connection,
434 "channel-type", &channel_type,
435 "object-path", &object_path,
436 "handle_type", &handle_type,
440 emp_cli_channel_handler_call_handle_channel (priv->stream_engine, -1,
441 connection->bus_name,
442 connection->object_path,
443 channel_type, object_path, handle_type, handle,
444 tp_call_async_cb, "calling handle channel", NULL,
447 g_object_unref (connection);
448 g_free (channel_type);
449 g_free (object_path);
453 tp_call_constructor (GType type,
454 guint n_construct_params,
455 GObjectConstructParam *construct_params)
459 EmpathyTpCallPriv *priv;
461 object = G_OBJECT_CLASS (empathy_tp_call_parent_class)->constructor (type,
462 n_construct_params, construct_params);
464 call = EMPATHY_TP_CALL (object);
465 priv = GET_PRIV (call);
467 /* Setup streamed media channel */
468 g_signal_connect (priv->channel, "invalidated",
469 G_CALLBACK (tp_call_channel_invalidated_cb), call);
470 tp_cli_channel_type_streamed_media_connect_to_stream_added (priv->channel,
471 tp_call_stream_added_cb, NULL, NULL, G_OBJECT (call), NULL);
472 tp_cli_channel_type_streamed_media_connect_to_stream_removed (priv->channel,
473 tp_call_stream_removed_cb, NULL, NULL, G_OBJECT (call), NULL);
474 tp_cli_channel_type_streamed_media_connect_to_stream_state_changed (priv->channel,
475 tp_call_stream_state_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
476 tp_cli_channel_type_streamed_media_connect_to_stream_direction_changed (priv->channel,
477 tp_call_stream_direction_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
478 tp_cli_channel_type_streamed_media_call_list_streams (priv->channel, -1,
479 tp_call_request_streams_cb, NULL, NULL, G_OBJECT (call));
481 /* Setup group interface */
482 priv->group = empathy_tp_group_new (priv->channel);
484 g_signal_connect (priv->group, "member-added",
485 G_CALLBACK (tp_call_member_added_cb), call);
486 g_signal_connect (priv->group, "remote-pending",
487 G_CALLBACK (tp_call_remote_pending_cb), call);
489 /* Start stream engine */
490 tp_call_stream_engine_handle_channel (call);
496 tp_call_finalize (GObject *object)
498 EmpathyTpCallPriv *priv = GET_PRIV (object);
500 DEBUG ("Finalizing: %p", object);
502 g_slice_free (EmpathyTpCallStream, priv->audio);
503 g_slice_free (EmpathyTpCallStream, priv->video);
504 g_object_unref (priv->group);
506 if (priv->channel != NULL)
508 g_signal_handlers_disconnect_by_func (priv->channel,
509 tp_call_channel_invalidated_cb, object);
510 tp_call_close_channel (EMPATHY_TP_CALL (object));
511 g_object_unref (priv->channel);
514 if (priv->stream_engine != NULL)
516 g_signal_handlers_disconnect_by_func (priv->stream_engine,
517 tp_call_stream_engine_invalidated_cb, object);
518 g_object_unref (priv->stream_engine);
521 if (priv->contact != NULL)
522 g_object_unref (priv->contact);
524 if (priv->dbus_daemon != NULL)
526 tp_dbus_daemon_cancel_name_owner_watch (priv->dbus_daemon,
527 STREAM_ENGINE_BUS_NAME,
528 tp_call_stream_engine_watch_name_owner_cb,
530 g_object_unref (priv->dbus_daemon);
533 (G_OBJECT_CLASS (empathy_tp_call_parent_class)->finalize) (object);
537 tp_call_set_property (GObject *object,
542 EmpathyTpCallPriv *priv = GET_PRIV (object);
547 priv->channel = g_value_dup_object (value);
550 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
556 tp_call_get_property (GObject *object,
561 EmpathyTpCallPriv *priv = GET_PRIV (object);
566 g_value_set_object (value, priv->channel);
569 g_value_set_object (value, priv->contact);
571 case PROP_IS_INCOMING:
572 g_value_set_boolean (value, priv->is_incoming);
575 g_value_set_uint (value, priv->status);
577 case PROP_AUDIO_STREAM:
578 g_value_set_pointer (value, priv->audio);
580 case PROP_VIDEO_STREAM:
581 g_value_set_pointer (value, priv->video);
584 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
590 empathy_tp_call_class_init (EmpathyTpCallClass *klass)
592 GObjectClass *object_class = G_OBJECT_CLASS (klass);
596 object_class->constructor = tp_call_constructor;
597 object_class->finalize = tp_call_finalize;
598 object_class->set_property = tp_call_set_property;
599 object_class->get_property = tp_call_get_property;
601 g_type_class_add_private (klass, sizeof (EmpathyTpCallPriv));
603 g_object_class_install_property (object_class, PROP_CHANNEL,
604 g_param_spec_object ("channel", "channel", "channel",
606 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
607 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
608 g_object_class_install_property (object_class, PROP_CONTACT,
609 g_param_spec_object ("contact", "Call contact", "Call contact",
610 EMPATHY_TYPE_CONTACT,
611 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
612 g_object_class_install_property (object_class, PROP_IS_INCOMING,
613 g_param_spec_boolean ("is-incoming", "Is media stream incoming",
614 "Is media stream incoming", FALSE, G_PARAM_READABLE |
615 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
616 g_object_class_install_property (object_class, PROP_STATUS,
617 g_param_spec_uint ("status", "Call status",
618 "Call status", 0, 255, 0, G_PARAM_READABLE | G_PARAM_STATIC_NICK |
619 G_PARAM_STATIC_BLURB));
620 g_object_class_install_property (object_class, PROP_AUDIO_STREAM,
621 g_param_spec_pointer ("audio-stream", "Audio stream data",
623 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
624 g_object_class_install_property (object_class, PROP_VIDEO_STREAM,
625 g_param_spec_pointer ("video-stream", "Video stream data",
627 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
631 empathy_tp_call_init (EmpathyTpCall *call)
633 EmpathyTpCallPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (call,
634 EMPATHY_TYPE_TP_CALL, EmpathyTpCallPriv);
637 priv->status = EMPATHY_TP_CALL_STATUS_READYING;
638 priv->contact = NULL;
639 priv->stream_engine_running = FALSE;
640 priv->audio = g_slice_new0 (EmpathyTpCallStream);
641 priv->video = g_slice_new0 (EmpathyTpCallStream);
642 priv->audio->exists = FALSE;
643 priv->video->exists = FALSE;
647 empathy_tp_call_new (TpChannel *channel)
649 g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL);
651 return g_object_new (EMPATHY_TYPE_TP_CALL,
657 empathy_tp_call_accept_incoming_call (EmpathyTpCall *call)
659 EmpathyTpCallPriv *priv = GET_PRIV (call);
660 EmpathyContact *self_contact;
662 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
663 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_PENDING);
665 DEBUG ("Accepting incoming call");
667 self_contact = empathy_tp_group_get_self_contact (priv->group);
668 empathy_tp_group_add_member (priv->group, self_contact, NULL);
669 g_object_unref (self_contact);
673 empathy_tp_call_request_video_stream_direction (EmpathyTpCall *call,
676 EmpathyTpCallPriv *priv = GET_PRIV (call);
679 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
680 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
682 DEBUG ("Requesting video stream direction - is_sending: %d", is_sending);
684 if (!priv->video->exists)
687 tp_call_request_streams_for_capabilities (call,
688 EMPATHY_CAPABILITIES_VIDEO);
693 new_direction = priv->video->direction | TP_MEDIA_STREAM_DIRECTION_SEND;
695 new_direction = priv->video->direction & ~TP_MEDIA_STREAM_DIRECTION_SEND;
697 tp_cli_channel_type_streamed_media_call_request_stream_direction (priv->channel,
698 -1, priv->video->id, new_direction,
699 (tp_cli_channel_type_streamed_media_callback_for_request_stream_direction)
700 tp_call_async_cb, NULL, NULL, G_OBJECT (call));
704 empathy_tp_call_add_preview_video (EmpathyTpCall *call,
705 guint preview_video_socket_id)
707 EmpathyTpCallPriv *priv = GET_PRIV (call);
709 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
711 DEBUG ("Adding preview video");
713 emp_cli_stream_engine_call_add_preview_window (priv->stream_engine, -1,
714 preview_video_socket_id,
716 "adding preview window", NULL,
721 empathy_tp_call_remove_preview_video (EmpathyTpCall *call,
722 guint preview_video_socket_id)
724 EmpathyTpCallPriv *priv = GET_PRIV (call);
726 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
728 DEBUG ("Removing preview video");
730 emp_cli_stream_engine_call_remove_preview_window (priv->stream_engine, -1,
731 preview_video_socket_id,
733 "removing preview window", NULL,
738 empathy_tp_call_add_output_video (EmpathyTpCall *call,
739 guint output_video_socket_id)
741 EmpathyTpCallPriv *priv = GET_PRIV (call);
743 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
745 DEBUG ("Adding output video - socket: %d", output_video_socket_id);
747 emp_cli_stream_engine_call_set_output_window (priv->stream_engine, -1,
748 TP_PROXY (priv->channel)->object_path,
749 priv->video->id, output_video_socket_id,
751 "setting output window", NULL,
756 empathy_tp_call_set_output_volume (EmpathyTpCall *call,
759 EmpathyTpCallPriv *priv = GET_PRIV (call);
761 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
762 g_return_if_fail (priv->status != EMPATHY_TP_CALL_STATUS_CLOSED);
764 DEBUG ("Setting output volume: %d", volume);
766 emp_cli_stream_engine_call_set_output_volume (priv->stream_engine, -1,
767 TP_PROXY (priv->channel)->object_path,
768 priv->audio->id, volume,
770 "setting output volume", NULL,
775 empathy_tp_call_mute_output (EmpathyTpCall *call,
778 EmpathyTpCallPriv *priv = GET_PRIV (call);
780 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
782 DEBUG ("Setting output mute: %d", is_muted);
784 emp_cli_stream_engine_call_mute_output (priv->stream_engine, -1,
785 TP_PROXY (priv->channel)->object_path,
786 priv->audio->id, is_muted,
788 "muting output", NULL,
793 empathy_tp_call_mute_input (EmpathyTpCall *call,
796 EmpathyTpCallPriv *priv = GET_PRIV (call);
798 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
800 DEBUG ("Setting input mute: %d", is_muted);
802 emp_cli_stream_engine_call_mute_input (priv->stream_engine, -1,
803 TP_PROXY (priv->channel)->object_path,
804 priv->audio->id, is_muted,
806 "muting input", NULL,
811 empathy_tp_call_start_tone (EmpathyTpCall *call, TpDTMFEvent event)
813 EmpathyTpCallPriv *priv = GET_PRIV (call);
815 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
816 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_ACCEPTED);
818 if (!priv->audio->exists)
821 tp_cli_channel_interface_dtmf_call_start_tone (priv->channel, -1,
822 priv->audio->id, event,
823 (tp_cli_channel_interface_dtmf_callback_for_start_tone) tp_call_async_cb,
824 "starting tone", NULL, G_OBJECT (call));
828 empathy_tp_call_stop_tone (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_ACCEPTED);
835 if (!priv->audio->exists)
838 tp_cli_channel_interface_dtmf_call_stop_tone (priv->channel, -1,
840 (tp_cli_channel_interface_dtmf_callback_for_stop_tone) tp_call_async_cb,
841 "stoping tone", NULL, G_OBJECT (call));