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>
30 #include <libempathy/empathy-contact-factory.h>
31 #include <libempathy/empathy-tp-group.h>
32 #include <libempathy/empathy-utils.h>
34 #include "empathy-tp-call.h"
36 #define DEBUG_FLAG EMPATHY_DEBUG_TP
37 #include "empathy-debug.h"
39 #define GET_PRIV(object) (G_TYPE_INSTANCE_GET_PRIVATE \
40 ((object), EMPATHY_TYPE_TP_CALL, EmpathyTpCallPriv))
42 #define STREAM_ENGINE_BUS_NAME "org.freedesktop.Telepathy.StreamEngine"
43 #define STREAM_ENGINE_OBJECT_PATH "/org/freedesktop/Telepathy/StreamEngine"
45 typedef struct _EmpathyTpCallPriv EmpathyTpCallPriv;
47 struct _EmpathyTpCallPriv
50 TpProxy *stream_engine;
51 TpDBusDaemon *dbus_daemon;
52 EmpathyTpGroup *group;
53 EmpathyContact *contact;
56 gboolean stream_engine_running;
58 EmpathyTpCallStream *audio;
59 EmpathyTpCallStream *video;
73 G_DEFINE_TYPE (EmpathyTpCall, empathy_tp_call, G_TYPE_OBJECT)
76 tp_call_add_stream (EmpathyTpCall *call,
81 guint stream_direction)
83 EmpathyTpCallPriv *priv = GET_PRIV (call);
87 case TP_MEDIA_STREAM_TYPE_AUDIO:
88 DEBUG ("Audio stream - id: %d, state: %d, direction: %d",
89 stream_id, stream_state, stream_direction);
90 priv->audio->exists = TRUE;
91 priv->audio->id = stream_id;
92 priv->audio->state = stream_state;
93 priv->audio->direction = stream_direction;
94 g_object_notify (G_OBJECT (call), "audio-stream");
96 case TP_MEDIA_STREAM_TYPE_VIDEO:
97 DEBUG ("Video stream - id: %d, state: %d, direction: %d",
98 stream_id, stream_state, stream_direction);
99 priv->video->exists = TRUE;
100 priv->video->id = stream_id;
101 priv->video->state = stream_state;
102 priv->video->direction = stream_direction;
103 g_object_notify (G_OBJECT (call), "video-stream");
106 DEBUG ("Unknown stream type: %d", stream_type);
111 tp_call_stream_added_cb (TpChannel *channel,
113 guint contact_handle,
118 DEBUG ("Stream added - stream id: %d, contact handle: %d, stream type: %d",
119 stream_id, contact_handle, stream_type);
121 tp_call_add_stream (EMPATHY_TP_CALL (call), stream_id, contact_handle,
122 stream_type, TP_MEDIA_STREAM_STATE_DISCONNECTED,
123 TP_MEDIA_STREAM_DIRECTION_NONE);
127 tp_call_stream_removed_cb (TpChannel *channel,
132 EmpathyTpCallPriv *priv = GET_PRIV (call);
134 DEBUG ("Stream removed - stream id: %d", stream_id);
136 if (stream_id == priv->audio->id)
138 priv->audio->exists = FALSE;
139 g_object_notify (call, "audio-stream");
141 else if (stream_id == priv->video->id)
143 priv->video->exists = FALSE;
144 g_object_notify (call, "video-stream");
149 tp_call_stream_state_changed_cb (TpChannel *proxy,
155 EmpathyTpCallPriv *priv = GET_PRIV (call);
157 DEBUG ("Stream state changed - stream id: %d, state state: %d",
158 stream_id, stream_state);
160 if (stream_id == priv->audio->id)
162 priv->audio->state = stream_state;
163 g_object_notify (call, "audio-stream");
165 else if (stream_id == priv->video->id)
167 priv->video->state = stream_state;
168 g_object_notify (call, "video-stream");
173 tp_call_stream_direction_changed_cb (TpChannel *channel,
175 guint stream_direction,
180 EmpathyTpCallPriv *priv = GET_PRIV (call);
182 DEBUG ("Stream direction changed - stream: %d, direction: %d",
183 stream_id, stream_direction);
185 if (stream_id == priv->audio->id)
187 priv->audio->direction = stream_direction;
188 g_object_notify (call, "audio-stream");
190 else if (stream_id == priv->video->id)
192 priv->video->direction = stream_direction;
193 g_object_notify (call, "video-stream");
198 tp_call_request_streams_cb (TpChannel *channel,
199 const GPtrArray *streams,
208 DEBUG ("Error requesting streams: %s", error->message);
212 for (i = 0; i < streams->len; i++)
216 guint contact_handle;
219 guint stream_direction;
221 values = g_ptr_array_index (streams, i);
222 stream_id = g_value_get_uint (g_value_array_get_nth (values, 0));
223 contact_handle = g_value_get_uint (g_value_array_get_nth (values, 1));
224 stream_type = g_value_get_uint (g_value_array_get_nth (values, 2));
225 stream_state = g_value_get_uint (g_value_array_get_nth (values, 3));
226 stream_direction = g_value_get_uint (g_value_array_get_nth (values, 4));
228 tp_call_add_stream (EMPATHY_TP_CALL (call), stream_id, contact_handle,
229 stream_type, stream_state, stream_direction);
234 tp_call_request_streams_for_capabilities (EmpathyTpCall *call,
235 EmpathyCapabilities capabilities)
237 EmpathyTpCallPriv *priv = GET_PRIV (call);
238 GArray *stream_types;
242 if (capabilities == EMPATHY_CAPABILITIES_UNKNOWN)
243 capabilities = EMPATHY_CAPABILITIES_AUDIO | EMPATHY_CAPABILITIES_VIDEO;
245 DEBUG ("Requesting new stream for capabilities %d",
248 stream_types = g_array_new (FALSE, FALSE, sizeof (guint));
249 handle = empathy_contact_get_handle (priv->contact);
251 if (capabilities & EMPATHY_CAPABILITIES_AUDIO)
253 stream_type = TP_MEDIA_STREAM_TYPE_AUDIO;
254 g_array_append_val (stream_types, stream_type);
256 if (capabilities & EMPATHY_CAPABILITIES_VIDEO)
258 stream_type = TP_MEDIA_STREAM_TYPE_VIDEO;
259 g_array_append_val (stream_types, stream_type);
262 tp_cli_channel_type_streamed_media_call_request_streams (priv->channel, -1,
263 handle, stream_types, tp_call_request_streams_cb, NULL, NULL,
266 g_array_free (stream_types, TRUE);
270 tp_call_request_streams (EmpathyTpCall *call)
272 EmpathyTpCallPriv *priv = GET_PRIV (call);
274 tp_call_request_streams_for_capabilities (call,
275 empathy_contact_get_capabilities (priv->contact));
279 tp_call_member_added_cb (EmpathyTpGroup *group,
280 EmpathyContact *contact,
281 EmpathyContact *actor,
283 const gchar *message,
286 EmpathyTpCallPriv *priv = GET_PRIV (call);
288 if (!priv->contact && !empathy_contact_is_user (contact))
290 priv->contact = g_object_ref (contact);
291 priv->is_incoming = TRUE;
292 priv->status = EMPATHY_TP_CALL_STATUS_PENDING;
293 tp_call_request_streams (call);
294 g_object_notify (G_OBJECT (call), "is-incoming");
295 g_object_notify (G_OBJECT (call), "contact");
296 g_object_notify (G_OBJECT (call), "status");
299 if (priv->status == EMPATHY_TP_CALL_STATUS_PENDING &&
300 ((priv->is_incoming && contact != priv->contact) ||
301 (!priv->is_incoming && contact == priv->contact)))
303 priv->status = EMPATHY_TP_CALL_STATUS_ACCEPTED;
304 g_object_notify (G_OBJECT (call), "status");
309 tp_call_remote_pending_cb (EmpathyTpGroup *group,
310 EmpathyContact *contact,
311 EmpathyContact *actor,
313 const gchar *message,
316 EmpathyTpCallPriv *priv = GET_PRIV (call);
318 if (!priv->contact && !empathy_contact_is_user (contact))
320 priv->contact = g_object_ref (contact);
321 priv->is_incoming = FALSE;
322 priv->status = EMPATHY_TP_CALL_STATUS_PENDING;
323 tp_call_request_streams (call);
324 g_object_notify (G_OBJECT (call), "is-incoming");
325 g_object_notify (G_OBJECT (call), "contact");
326 g_object_notify (G_OBJECT (call), "status");
331 tp_call_channel_invalidated_cb (TpChannel *channel,
337 EmpathyTpCallPriv *priv = GET_PRIV (call);
339 DEBUG ("Channel invalidated: %s", message);
340 priv->status = EMPATHY_TP_CALL_STATUS_CLOSED;
341 g_object_notify (G_OBJECT (call), "status");
345 tp_call_async_cb (TpProxy *proxy,
351 DEBUG ("Error %s: %s", (gchar*) user_data, error->message);
355 tp_call_close_channel (EmpathyTpCall *call)
357 EmpathyTpCallPriv *priv = GET_PRIV (call);
359 if (priv->status == EMPATHY_TP_CALL_STATUS_CLOSED)
362 DEBUG ("Closing channel");
364 tp_cli_channel_call_close (priv->channel, -1,
365 NULL, NULL, NULL, NULL);
367 priv->status = EMPATHY_TP_CALL_STATUS_CLOSED;
368 g_object_notify (G_OBJECT (call), "status");
372 tp_call_stream_engine_invalidated_cb (TpProxy *stream_engine,
378 DEBUG ("Stream engine proxy invalidated: %s", message);
379 tp_call_close_channel (call);
383 tp_call_stream_engine_watch_name_owner_cb (TpDBusDaemon *daemon,
385 const gchar *new_owner,
388 EmpathyTpCallPriv *priv = GET_PRIV (call);
390 /* G_STR_EMPTY(new_owner) means either stream-engine has not started yet or
391 * has crashed. We want to close the channel if stream-engine has crashed.
393 DEBUG ("Watch SE: name='%s' SE running='%s' new_owner='%s'",
394 name, priv->stream_engine_running ? "yes" : "no",
395 new_owner ? new_owner : "none");
396 if (priv->stream_engine_running && G_STR_EMPTY (new_owner))
398 DEBUG ("Stream engine falled off the bus");
399 tp_call_close_channel (call);
403 priv->stream_engine_running = !G_STR_EMPTY (new_owner);
407 tp_call_stream_engine_handle_channel (EmpathyTpCall *call)
409 EmpathyTpCallPriv *priv = GET_PRIV (call);
416 DEBUG ("Revving up the stream engine");
418 priv->stream_engine = g_object_new (TP_TYPE_PROXY,
419 "bus-name", STREAM_ENGINE_BUS_NAME,
420 "dbus-connection", tp_get_bus (),
421 "object-path", STREAM_ENGINE_OBJECT_PATH,
423 tp_proxy_add_interface_by_id (priv->stream_engine,
424 EMP_IFACE_QUARK_STREAM_ENGINE);
425 tp_proxy_add_interface_by_id (priv->stream_engine,
426 EMP_IFACE_QUARK_CHANNEL_HANDLER);
428 g_signal_connect (priv->stream_engine, "invalidated",
429 G_CALLBACK (tp_call_stream_engine_invalidated_cb),
432 /* FIXME: dbus daemon should be unique */
433 priv->dbus_daemon = tp_dbus_daemon_new (tp_get_bus ());
434 tp_dbus_daemon_watch_name_owner (priv->dbus_daemon, STREAM_ENGINE_BUS_NAME,
435 tp_call_stream_engine_watch_name_owner_cb,
438 g_object_get (priv->channel,
439 "connection", &connection,
440 "channel-type", &channel_type,
441 "object-path", &object_path,
442 "handle_type", &handle_type,
446 emp_cli_channel_handler_call_handle_channel (priv->stream_engine, -1,
447 connection->bus_name,
448 connection->object_path,
449 channel_type, object_path, handle_type, handle,
450 tp_call_async_cb, "calling handle channel", NULL,
453 g_object_unref (connection);
454 g_free (channel_type);
455 g_free (object_path);
459 tp_call_constructor (GType type,
460 guint n_construct_params,
461 GObjectConstructParam *construct_params)
465 EmpathyTpCallPriv *priv;
467 object = G_OBJECT_CLASS (empathy_tp_call_parent_class)->constructor (type,
468 n_construct_params, construct_params);
470 call = EMPATHY_TP_CALL (object);
471 priv = GET_PRIV (call);
473 /* Setup streamed media channel */
474 g_signal_connect (priv->channel, "invalidated",
475 G_CALLBACK (tp_call_channel_invalidated_cb), call);
476 tp_cli_channel_type_streamed_media_connect_to_stream_added (priv->channel,
477 tp_call_stream_added_cb, NULL, NULL, G_OBJECT (call), NULL);
478 tp_cli_channel_type_streamed_media_connect_to_stream_removed (priv->channel,
479 tp_call_stream_removed_cb, NULL, NULL, G_OBJECT (call), NULL);
480 tp_cli_channel_type_streamed_media_connect_to_stream_state_changed (priv->channel,
481 tp_call_stream_state_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
482 tp_cli_channel_type_streamed_media_connect_to_stream_direction_changed (priv->channel,
483 tp_call_stream_direction_changed_cb, NULL, NULL, G_OBJECT (call), NULL);
484 tp_cli_channel_type_streamed_media_call_list_streams (priv->channel, -1,
485 tp_call_request_streams_cb, NULL, NULL, G_OBJECT (call));
487 /* Setup group interface */
488 priv->group = empathy_tp_group_new (priv->channel);
490 g_signal_connect (priv->group, "member-added",
491 G_CALLBACK (tp_call_member_added_cb), call);
492 g_signal_connect (priv->group, "remote-pending",
493 G_CALLBACK (tp_call_remote_pending_cb), call);
495 /* Start stream engine */
496 tp_call_stream_engine_handle_channel (call);
502 tp_call_finalize (GObject *object)
504 EmpathyTpCallPriv *priv = GET_PRIV (object);
506 DEBUG ("Finalizing: %p", object);
508 g_slice_free (EmpathyTpCallStream, priv->audio);
509 g_slice_free (EmpathyTpCallStream, priv->video);
510 g_object_unref (priv->group);
512 if (priv->channel != NULL)
514 g_signal_handlers_disconnect_by_func (priv->channel,
515 tp_call_channel_invalidated_cb, object);
516 tp_call_close_channel (EMPATHY_TP_CALL (object));
517 g_object_unref (priv->channel);
520 if (priv->stream_engine != NULL)
522 g_signal_handlers_disconnect_by_func (priv->stream_engine,
523 tp_call_stream_engine_invalidated_cb, object);
524 g_object_unref (priv->stream_engine);
527 if (priv->contact != NULL)
528 g_object_unref (priv->contact);
530 if (priv->dbus_daemon != NULL)
532 tp_dbus_daemon_cancel_name_owner_watch (priv->dbus_daemon,
533 STREAM_ENGINE_BUS_NAME,
534 tp_call_stream_engine_watch_name_owner_cb,
536 g_object_unref (priv->dbus_daemon);
539 (G_OBJECT_CLASS (empathy_tp_call_parent_class)->finalize) (object);
543 tp_call_set_property (GObject *object,
548 EmpathyTpCallPriv *priv = GET_PRIV (object);
553 priv->channel = g_value_dup_object (value);
556 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
562 tp_call_get_property (GObject *object,
567 EmpathyTpCallPriv *priv = GET_PRIV (object);
572 g_value_set_object (value, priv->channel);
575 g_value_set_object (value, priv->contact);
577 case PROP_IS_INCOMING:
578 g_value_set_boolean (value, priv->is_incoming);
581 g_value_set_uint (value, priv->status);
583 case PROP_AUDIO_STREAM:
584 g_value_set_pointer (value, priv->audio);
586 case PROP_VIDEO_STREAM:
587 g_value_set_pointer (value, priv->video);
590 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
596 empathy_tp_call_class_init (EmpathyTpCallClass *klass)
598 GObjectClass *object_class = G_OBJECT_CLASS (klass);
602 object_class->constructor = tp_call_constructor;
603 object_class->finalize = tp_call_finalize;
604 object_class->set_property = tp_call_set_property;
605 object_class->get_property = tp_call_get_property;
607 g_type_class_add_private (klass, sizeof (EmpathyTpCallPriv));
609 g_object_class_install_property (object_class, PROP_CHANNEL,
610 g_param_spec_object ("channel", "channel", "channel",
612 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
613 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
614 g_object_class_install_property (object_class, PROP_CONTACT,
615 g_param_spec_object ("contact", "Call contact", "Call contact",
616 EMPATHY_TYPE_CONTACT,
617 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
618 g_object_class_install_property (object_class, PROP_IS_INCOMING,
619 g_param_spec_boolean ("is-incoming", "Is media stream incoming",
620 "Is media stream incoming", FALSE, G_PARAM_READABLE |
621 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
622 g_object_class_install_property (object_class, PROP_STATUS,
623 g_param_spec_uint ("status", "Call status",
624 "Call status", 0, 255, 0, G_PARAM_READABLE | G_PARAM_STATIC_NICK |
625 G_PARAM_STATIC_BLURB));
626 g_object_class_install_property (object_class, PROP_AUDIO_STREAM,
627 g_param_spec_pointer ("audio-stream", "Audio stream data",
629 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
630 g_object_class_install_property (object_class, PROP_VIDEO_STREAM,
631 g_param_spec_pointer ("video-stream", "Video stream data",
633 G_PARAM_READABLE | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
637 empathy_tp_call_init (EmpathyTpCall *call)
639 EmpathyTpCallPriv *priv = GET_PRIV (call);
641 priv->status = EMPATHY_TP_CALL_STATUS_READYING;
642 priv->contact = NULL;
643 priv->stream_engine_running = FALSE;
644 priv->audio = g_slice_new0 (EmpathyTpCallStream);
645 priv->video = g_slice_new0 (EmpathyTpCallStream);
646 priv->audio->exists = FALSE;
647 priv->video->exists = FALSE;
651 empathy_tp_call_new (TpChannel *channel)
653 g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL);
655 return g_object_new (EMPATHY_TYPE_TP_CALL,
661 empathy_tp_call_accept_incoming_call (EmpathyTpCall *call)
663 EmpathyTpCallPriv *priv = GET_PRIV (call);
664 EmpathyContact *self_contact;
666 g_return_if_fail (EMPATHY_IS_TP_CALL (call));
667 g_return_if_fail (priv->status == EMPATHY_TP_CALL_STATUS_PENDING);
669 DEBUG ("Accepting incoming call");
671 self_contact = empathy_tp_group_get_self_contact (priv->group);
672 empathy_tp_group_add_member (priv->group, self_contact, NULL);
673 g_object_unref (self_contact);
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));