Revert manifest to default one
[profile/ivi/tel-plugin-dbus_tapi.git] / src / call.c
1 #include <stdio.h>
2 #include <string.h>
3 #include <pthread.h>
4 #include <unistd.h>
5 #include <stdlib.h>
6 #include <time.h>
7 #include <glib.h>
8 #include <glib-object.h>
9 #include <gio/gio.h>
10
11 #include <aul.h>
12 #include <appsvc.h>
13 #include <bundle.h>
14 #include <tcore.h>
15 #include <plugin.h>
16 #include <server.h>
17 #include <storage.h>
18 #include <user_request.h>
19 #include <core_object.h>
20 #include <co_call.h>
21 #include <communicator.h>
22
23 #include "generated-code.h"
24 #include "common.h"
25
26
27 static void _launch_voice_call( struct tnoti_call_status_incoming* incoming )
28 {
29         char id[2] = {0, };
30         char cli[2] = {0, };
31         char forward[2] = {0, };
32         char active_line[2] = {0, };
33         char cna[2] = {0, };
34         char number[83] = {0, };
35         char name[83] = {0, };
36 //      int ret = 0;
37
38         bundle *kb  = 0;
39
40         snprintf( id, 2, "%d", incoming->id );
41         dbg("id : [%s]", id );
42         snprintf( cli, 2, "%d", incoming->cli.mode );
43         dbg("cli : [%s]", id );
44         snprintf( number, 83, "%s", incoming->cli.number );
45         dbg("number : [%s]", number );
46         snprintf( forward, 2, "%d", incoming->forward );
47         dbg("forward : [%s]", forward );
48         snprintf( active_line, 2, "%d", incoming->active_line );
49         dbg("active_line : [%s]", active_line );
50
51         if ( incoming->cna.mode == CALL_CNA_MODE_PRESENT )
52                 snprintf( cna, 2, "%d", 0 );
53         else
54                 snprintf( cna, 2, "%d", 1 );
55
56         dbg("cna : [%s]", cna );
57         snprintf( name, 83, "%s", incoming->cna.name );
58         dbg("name : [%s]", name );
59
60         kb = bundle_create();
61
62 #if 0
63         /* AUL */
64         bundle_add(kb, "launch-type", "MT");
65         bundle_add(kb, "handle", id);
66         bundle_add(kb, "number", number);
67         bundle_add(kb, "name_mode", cna);
68         bundle_add(kb, "name", name);
69         bundle_add(kb, "clicause", cli);
70         bundle_add(kb, "fwded", forward);
71         bundle_add(kb, "activeline", active_line);
72
73         ret = aul_launch_app("com.samsung.call", kb);
74         dbg("aul_launch_app [ voice call ] : %d", ret );
75 #else
76         /* AppSvc */
77         appsvc_set_operation(kb, APPSVC_OPERATION_CALL);
78         appsvc_set_uri(kb,"tel:MT");
79
80         appsvc_add_data(kb, "launch-type", "MT");
81         appsvc_add_data(kb, "handle", id);
82         appsvc_add_data(kb, "number", number);
83         appsvc_add_data(kb, "name_mode", cna);
84         appsvc_add_data(kb, "name", name);
85         appsvc_add_data(kb, "clicause", cli);
86         appsvc_add_data(kb, "fwded", forward);
87         appsvc_add_data(kb, "activeline", active_line);
88
89         appsvc_run_service(kb, 0, NULL, NULL);
90 #endif
91         bundle_free(kb);
92 }
93
94 static void _launch_video_call( struct tnoti_call_status_incoming* incoming )
95 {
96         char id[2] = {0, };
97         char cli[2] = {0, };
98         char forward[2] = {0, };
99         char number[83] = {0, };
100         int ret = 0;
101
102         bundle *kb  = 0;
103
104         dbg("Func Entrance");
105
106         snprintf( id, 2, "%d", incoming->id );
107         dbg("id : [%s]", id );
108         snprintf( number, 83, "%s", incoming->cli.number );
109         dbg("number : [%s]", number );
110         snprintf( cli, 2, "%d", incoming->cli.mode );
111         dbg("cli : [%s]", id );
112         snprintf( forward, 2, "%d", incoming->forward );
113         dbg("forward : [%s]", forward );
114
115         kb = bundle_create();
116         bundle_add(kb, "KEY_CALL_TYPE", "mt");
117         bundle_add(kb, "KEY_CALL_HANDLE", id);
118         bundle_add(kb, "KEY_CALLING_PARTY_NUMBER", number);
119         bundle_add(kb, "KEY_CLI_CAUSE", cli);
120         bundle_add(kb, "KEY_FORWARDED", forward);
121
122         ret = aul_launch_app("com.samsung.vtmain", kb);
123         bundle_free(kb);
124
125         dbg("VT AUL return %d",ret);
126 }
127
128 static gboolean on_call_dial(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_type, gchar* call_number, gpointer user_data)
129 {
130         struct treq_call_dial req;
131         struct custom_data *ctx = user_data;
132         UserRequest *ur = MAKE_UR(ctx, call, invocation);
133
134         TReturn ret = 0;
135
136         if ( !ur ) {
137                 dbg("[ error ] ur : 0");
138                 return FALSE;
139         }
140
141         req.type = call_type;
142
143         if ( call_number )
144                 memcpy( req.number, call_number, MAX_CALL_DIAL_NUM_LEN );
145
146         tcore_user_request_set_data( ur, sizeof( struct treq_call_dial ), &req );
147         tcore_user_request_set_command( ur, TREQ_CALL_DIAL );
148
149         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
150         if ( ret != TCORE_RETURN_SUCCESS ) {
151                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
152                 return FALSE;
153         }
154
155         return TRUE;
156 }
157
158 static gboolean on_call_answer(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gint answer_type, gpointer user_data)
159 {
160         struct treq_call_answer req;
161         struct custom_data *ctx = user_data;
162         UserRequest *ur = MAKE_UR(ctx, call, invocation);
163
164         TReturn ret = 0;
165
166         if ( !ur ) {
167                 dbg("[ error ] ur : 0");
168                 return FALSE;
169         }
170
171         req.id = call_id;
172         req.type = answer_type;
173
174         tcore_user_request_set_data( ur, sizeof( struct treq_call_answer ), &req );
175         tcore_user_request_set_command( ur, TREQ_CALL_ANSWER );
176
177         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
178         if ( ret != TCORE_RETURN_SUCCESS ) {
179                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
180                 return FALSE;
181         }
182
183         return TRUE;
184 }
185
186 static gboolean on_call_end(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gint end_type, gpointer user_data)
187 {
188         struct treq_call_end req;
189         struct custom_data *ctx = user_data;
190         UserRequest *ur = MAKE_UR(ctx, call, invocation);
191
192         TReturn ret = 0;
193
194         if ( !ur ) {
195                 dbg("[ error ] ur : 0");
196                 return FALSE;
197         }
198
199         req.id = call_id;
200         req.type = end_type;
201
202         tcore_user_request_set_data( ur, sizeof( struct treq_call_end ), &req );
203         tcore_user_request_set_command( ur, TREQ_CALL_END );
204
205         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
206         if ( ret != TCORE_RETURN_SUCCESS ) {
207                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
208                 return FALSE;
209         }
210
211         return TRUE;
212 }
213
214 static gboolean on_call_dtmf(TelephonyCall *call, GDBusMethodInvocation *invocation, gchar *dtmf_string, gpointer user_data)
215 {
216         struct treq_call_dtmf req;
217         struct custom_data *ctx = user_data;
218         UserRequest *ur = MAKE_UR(ctx, call, invocation);
219
220         TReturn ret = 0;
221
222         if ( !ur ) {
223                 dbg("[ error ] ur : 0");
224                 return FALSE;
225         }
226
227         if ( dtmf_string )
228                 memcpy( req.digits, dtmf_string, MAX_CALL_DTMF_DIGITS_LEN );
229
230         tcore_user_request_set_data( ur, sizeof( struct treq_call_dtmf ), &req );
231         tcore_user_request_set_command( ur, TREQ_CALL_SEND_DTMF );
232
233         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
234         if ( ret != TCORE_RETURN_SUCCESS ) {
235                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
236                 return FALSE;
237         }
238
239         return TRUE;
240 }
241
242 static gboolean on_call_active(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gpointer user_data)
243 {
244         struct treq_call_active req;
245         struct custom_data *ctx = user_data;
246         UserRequest *ur = MAKE_UR(ctx, call, invocation);
247
248         TReturn ret = 0;
249
250         if ( !ur ) {
251                 dbg("[ error ] ur : 0");
252                 return FALSE;
253         }
254
255         req.id = call_id;
256
257         tcore_user_request_set_data( ur, sizeof( struct treq_call_active ), &req );
258         tcore_user_request_set_command( ur, TREQ_CALL_ACTIVE );
259
260         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
261         if ( ret != TCORE_RETURN_SUCCESS ) {
262                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
263                 return FALSE;
264         }
265
266         return TRUE;
267 }
268
269 static gboolean on_call_hold(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gpointer user_data)
270 {
271         struct treq_call_hold req;
272         struct custom_data *ctx = user_data;
273         UserRequest *ur = MAKE_UR(ctx, call, invocation);
274
275         TReturn ret = 0;
276
277         if ( !ur ) {
278                 dbg("[ error ] ur : 0");
279                 return FALSE;
280         }
281
282         req.id = call_id;
283
284         tcore_user_request_set_data( ur, sizeof( struct treq_call_hold ), &req );
285         tcore_user_request_set_command( ur, TREQ_CALL_HOLD );
286
287         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
288         if ( ret != TCORE_RETURN_SUCCESS ) {
289                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
290                 return FALSE;
291         }
292
293         return TRUE;
294 }
295
296 static gboolean on_call_swap(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gpointer user_data)
297 {
298         struct treq_call_swap req;
299         struct custom_data *ctx = user_data;
300         UserRequest *ur = MAKE_UR(ctx, call, invocation);
301
302         TReturn ret = 0;
303
304         if ( !ur ) {
305                 dbg("[ error ] ur : 0");
306                 return FALSE;
307         }
308
309         req.id = call_id;
310
311         tcore_user_request_set_data( ur, sizeof( struct treq_call_swap ), &req );
312         tcore_user_request_set_command( ur, TREQ_CALL_SWAP );
313
314         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
315         if ( ret != TCORE_RETURN_SUCCESS ) {
316                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
317                 return FALSE;
318         }
319
320         return TRUE;
321 }
322
323 static gboolean on_call_join(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gpointer user_data)
324 {
325         struct treq_call_join req;
326         struct custom_data *ctx = user_data;
327         UserRequest *ur = MAKE_UR(ctx, call, invocation);
328
329         TReturn ret = 0;
330
331         if ( !ur ) {
332                 dbg("[ error ] ur : 0");
333                 return FALSE;
334         }
335
336         req.id = call_id;
337
338         tcore_user_request_set_data( ur, sizeof( struct treq_call_join ), &req );
339         tcore_user_request_set_command( ur, TREQ_CALL_JOIN );
340
341         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
342         if ( ret != TCORE_RETURN_SUCCESS ) {
343                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
344                 return FALSE;
345         }
346
347         return TRUE;
348 }
349
350 static gboolean on_call_split(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gpointer user_data)
351 {
352         struct treq_call_split req;
353         struct custom_data *ctx = user_data;
354         UserRequest *ur = MAKE_UR(ctx, call, invocation);
355
356         TReturn ret = 0;
357
358         if ( !ur ) {
359                 dbg("[ error ] ur : 0");
360                 return FALSE;
361         }
362
363         req.id = call_id;
364
365         tcore_user_request_set_data( ur, sizeof( struct treq_call_split ), &req );
366         tcore_user_request_set_command( ur, TREQ_CALL_SPLIT );
367
368         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
369         if ( ret != TCORE_RETURN_SUCCESS ) {
370                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
371                 return FALSE;
372         }
373
374         return TRUE;
375 }
376
377 static gboolean on_call_transfer(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gpointer user_data)
378 {
379         struct treq_call_transfer req;
380         struct custom_data *ctx = user_data;
381         UserRequest *ur = MAKE_UR(ctx, call, invocation);
382
383         TReturn ret = 0;
384
385         if ( !ur ) {
386                 dbg("[ error ] ur : 0");
387                 return FALSE;
388         }
389
390         req.id = call_id;
391
392         tcore_user_request_set_data( ur, sizeof( struct treq_call_transfer ), &req );
393         tcore_user_request_set_command( ur, TREQ_CALL_TRANSFER );
394
395         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
396         if ( ret != TCORE_RETURN_SUCCESS ) {
397                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
398                 return FALSE;
399         }
400
401         return TRUE;
402 }
403
404 static gboolean on_call_deflect(TelephonyCall *call, GDBusMethodInvocation *invocation, gchar *call_number, gpointer user_data)
405 {
406         struct treq_call_deflect req;
407         struct custom_data *ctx = user_data;
408         UserRequest *ur = MAKE_UR(ctx, call, invocation);
409
410         TReturn ret = 0;
411
412         if ( !ur ) {
413                 dbg("[ error ] ur : 0");
414                 return FALSE;
415         }
416
417         if ( call_number )
418                 memcpy( req.number, call_number, MAX_CALL_NUMBER_LEN );
419
420         tcore_user_request_set_data( ur, sizeof( struct treq_call_deflect ), &req );
421         tcore_user_request_set_command( ur, TREQ_CALL_DEFLECT );
422
423         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
424         if ( ret != TCORE_RETURN_SUCCESS ) {
425                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
426                 return FALSE;
427         }
428
429         return TRUE;
430 }
431
432 static gboolean on_call_get_status(TelephonyCall *call, GDBusMethodInvocation *invocation, gint call_id, gpointer user_data )
433 {
434         struct custom_data *ctx = user_data;
435         TcorePlugin *plugin = 0;
436         GSList *o_list = 0;
437         CoreObject *o = 0;
438         CallObject *co = 0;
439
440         gchar call_number[MAX_CALL_NUMBER_LEN];
441         gint call_type;
442         gboolean call_direction;
443         gint call_status;
444         gboolean call_multiparty_state;
445
446         plugin = tcore_server_find_plugin(ctx->server, TCORE_PLUGIN_DEFAULT);
447         if ( !plugin ) {
448                 dbg("[ error ] plugin : 0");
449                 return FALSE;
450         }
451
452         o_list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_CALL);
453         if ( !o_list ) {
454                 dbg("[ error ] co_list : 0");
455                 return FALSE;
456         }
457
458         o = (CoreObject *)o_list->data;
459         g_slist_free(o_list);
460
461         co = tcore_call_object_find_by_id( o, call_id );
462         if ( !co ) {
463                 dbg("[ error ] co : 0");
464                 return FALSE;
465         }
466
467         tcore_call_object_get_number( co, call_number );
468
469         call_type = tcore_call_object_get_type( co );
470         call_direction = tcore_call_object_get_direction( co );
471
472         if ( call_direction == TCORE_CALL_DIRECTION_OUTGOING ) {
473                 call_direction = TRUE;
474         } else {
475                 call_direction = FALSE;
476         }
477         
478         call_status = tcore_call_object_get_status( co );
479         call_multiparty_state = tcore_call_object_get_multiparty_state( co );
480
481
482         telephony_call_complete_get_status(call, invocation, 
483                         call_id, call_number, call_type, call_direction, call_status, call_multiparty_state );
484
485         return TRUE;
486 }
487
488 static gboolean on_call_get_status_all(TelephonyCall *call, GDBusMethodInvocation *invocation, gpointer user_data )
489 {
490         struct custom_data *ctx = user_data;
491         TcorePlugin *plugin = 0;
492         GSList *list = 0;
493         CoreObject *o = 0;
494         CallObject *co = 0;
495
496         GVariant *gv = 0;
497         GVariantBuilder b;
498
499         gint call_id;
500         gchar call_number[MAX_CALL_NUMBER_LEN];
501         gint call_type;
502         gboolean call_direction;
503         gint call_status;
504         gboolean call_multiparty_state;
505
506         int len, i;
507
508         plugin = tcore_server_find_plugin(ctx->server, TCORE_PLUGIN_DEFAULT);
509         if ( !plugin ) {
510                 dbg("[ error ] plugin : 0");
511                 return FALSE;
512         }
513
514         list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_CALL);
515         if ( !list ) {
516                 dbg("[ error ] co_list : 0");
517                 return FALSE;
518         }
519
520         o = (CoreObject *)list->data;
521         g_slist_free(list);
522
523         g_variant_builder_init(&b, G_VARIANT_TYPE("aa{sv}"));
524
525 #define MAX_CALL_STATUS_NUM 7
526         for ( i=0; i<MAX_CALL_STATUS_NUM; i++ ) {
527                 list = tcore_call_object_find_by_status( o, i );
528
529                 if ( list ) {
530
531                         GSList *tmp = 0;
532                         tmp = list;
533
534                         dbg("[ check ] there is a call on state (0x%x)", i);
535
536                         while ( tmp ) {
537
538                                 co = (CallObject*)list->data;
539                                 if ( !co ) {
540                                         dbg("[ error ] call object : 0");
541                                         tmp = tmp->next;
542                                         continue;
543                                 }
544
545                                 call_id = tcore_call_object_get_id( co );
546                                 len = tcore_call_object_get_number( co, call_number );
547                                 if ( !len ) {
548                                         dbg("[ check ] no number : (0x%d)", call_id);
549                                 }
550
551                                 call_type = tcore_call_object_get_type( co );
552                                 call_direction = tcore_call_object_get_direction( co );
553
554                                 if ( call_direction == TCORE_CALL_DIRECTION_OUTGOING ) {
555                                         call_direction = TRUE;
556                                 } else {
557                                         call_direction = FALSE;
558                                 }
559
560                                 call_status = tcore_call_object_get_status( co );
561                                 call_multiparty_state = tcore_call_object_get_multiparty_state( co );
562
563                                 g_variant_builder_open(&b, G_VARIANT_TYPE("a{sv}"));
564                                 g_variant_builder_add(&b, "{sv}", "call_id", g_variant_new_int32( call_id ));
565                                 g_variant_builder_add(&b, "{sv}", "call_number", g_variant_new_string( call_number ));
566                                 g_variant_builder_add(&b, "{sv}", "call_type", g_variant_new_int32( call_type ));
567                                 g_variant_builder_add(&b, "{sv}", "call_direction", g_variant_new_boolean( call_direction ));
568                                 g_variant_builder_add(&b, "{sv}", "call_state", g_variant_new_int32( call_status ));
569                                 g_variant_builder_add(&b, "{sv}", "call_multiparty_state", g_variant_new_boolean( call_multiparty_state ));
570                                 g_variant_builder_close(&b);
571
572                                 tmp = g_slist_next( tmp );
573                         }
574
575                 } else {
576                         dbg("[ check ] there is no call on state (0x%x)", i);
577
578                 }
579
580         }
581
582         gv = g_variant_builder_end(&b);
583
584         telephony_call_complete_get_status_all(call, invocation, gv);
585
586         g_variant_unref(gv);
587
588         return TRUE;
589 }
590
591 static gboolean on_call_set_sound_path(TelephonyCall *call, GDBusMethodInvocation *invocation, gint sound_path, gboolean extra_volume_on, gpointer user_data)
592 {
593         struct treq_call_sound_set_path req;
594         struct custom_data *ctx = user_data;
595         UserRequest *ur = MAKE_UR(ctx, call, invocation);
596
597         TReturn ret = 0;
598
599         if ( !ur ) {
600                 dbg("[ error ] ur : 0");
601                 return FALSE;
602         }
603
604         req.path = sound_path;
605         req.extra_volume_on = extra_volume_on;
606
607         tcore_user_request_set_data( ur, sizeof( struct treq_call_sound_set_path ), &req );
608         tcore_user_request_set_command( ur, TREQ_CALL_SET_SOUND_PATH );
609
610         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
611         if ( ret != TCORE_RETURN_SUCCESS ) {
612                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
613                 return FALSE;
614         }
615
616         return TRUE;
617 }
618
619 static gboolean on_call_get_volume(TelephonyCall *call, GDBusMethodInvocation *invocation, gint sound_device, gint sound_type, gpointer user_data)
620 {
621         struct treq_call_sound_get_volume_level req;
622         struct custom_data *ctx = user_data;
623         UserRequest *ur = MAKE_UR(ctx, call, invocation);
624
625         TReturn ret = 0;
626
627         if ( !ur ) {
628                 dbg("[ error ] ur : 0");
629                 return FALSE;
630         }
631
632         req.device = sound_device;
633         req.sound = sound_type;
634
635         tcore_user_request_set_data( ur, sizeof( struct treq_call_sound_get_volume_level ), &req );
636         tcore_user_request_set_command( ur, TREQ_CALL_GET_SOUND_VOLUME_LEVEL );
637
638         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
639         if ( ret != TCORE_RETURN_SUCCESS ) {
640                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
641                 return FALSE;
642         }
643
644         return TRUE;
645 }
646
647 static gboolean on_call_set_volume(TelephonyCall *call, GDBusMethodInvocation *invocation, gint sound_device, gint sound_type, gint sound_volume, gpointer user_data)
648 {
649         struct treq_call_sound_set_volume_level req;
650         struct custom_data *ctx = user_data;
651         UserRequest *ur = MAKE_UR(ctx, call, invocation);
652
653         TReturn ret = 0;
654
655         if ( !ur ) {
656                 dbg("[ error ] ur : 0");
657                 return FALSE;
658         }
659
660         req.device = sound_device;
661         req.sound = sound_type;
662         req.volume = sound_volume;
663
664         tcore_user_request_set_data( ur, sizeof( struct treq_call_sound_set_volume_level ), &req );
665         tcore_user_request_set_command( ur, TREQ_CALL_SET_SOUND_VOLUME_LEVEL );
666
667         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
668         if ( ret != TCORE_RETURN_SUCCESS ) {
669                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
670                 return FALSE;
671         }
672
673         return TRUE;
674 }
675
676 static gboolean on_call_get_mute_status(TelephonyCall *call, GDBusMethodInvocation *invocation, gpointer user_data)
677 {
678         struct custom_data *ctx = user_data;
679         UserRequest *ur = MAKE_UR(ctx, call, invocation);
680
681         TReturn ret = 0;
682
683         if ( !ur ) {
684                 dbg("[ error ] ur : 0");
685                 return FALSE;
686         }
687
688         tcore_user_request_set_command( ur, TREQ_CALL_GET_MUTE_STATUS );
689
690         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
691         if ( ret != TCORE_RETURN_SUCCESS ) {
692                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
693                 return FALSE;
694         }
695
696         return TRUE;
697 }
698
699 static gboolean on_call_mute(TelephonyCall *call, GDBusMethodInvocation *invocation, gpointer user_data)
700 {
701         struct custom_data *ctx = user_data;
702         UserRequest *ur = MAKE_UR(ctx, call, invocation);
703
704         TReturn ret = 0;
705
706         if ( !ur ) {
707                 dbg("[ error ] ur : 0");
708                 return FALSE;
709         }
710
711         tcore_user_request_set_command( ur, TREQ_CALL_MUTE );
712
713         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
714         if ( ret != TCORE_RETURN_SUCCESS ) {
715                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
716                 return FALSE;
717         }
718
719         return TRUE;
720 }
721
722 static gboolean on_call_unmute(TelephonyCall *call, GDBusMethodInvocation *invocation, gpointer user_data)
723 {
724         struct custom_data *ctx = user_data;
725         UserRequest *ur = MAKE_UR(ctx, call, invocation);
726
727         TReturn ret = 0;
728
729         if ( !ur ) {
730                 dbg("[ error ] ur : 0");
731                 return FALSE;
732         }
733
734         tcore_user_request_set_command( ur, TREQ_CALL_UNMUTE );
735
736         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
737         if ( ret != TCORE_RETURN_SUCCESS ) {
738                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
739                 return FALSE;
740         }
741
742         return TRUE;
743 }
744
745 static gboolean on_call_set_sound_recording(TelephonyCall *call, GDBusMethodInvocation *invocation, gint recording_state, gpointer user_data)
746 {
747         struct custom_data *ctx = user_data;
748         struct treq_call_sound_set_recording req;
749
750         UserRequest *ur = MAKE_UR(ctx, call, invocation);
751
752         TReturn ret = 0;
753
754         if ( !ur ) {
755                 dbg("[ error ] ur : 0");
756                 return FALSE;
757         }
758
759         req.state = (gboolean)recording_state;
760
761         tcore_user_request_set_data( ur, sizeof( struct treq_call_sound_set_recording ), &req );
762         tcore_user_request_set_command( ur, TREQ_CALL_SET_SOUND_RECORDING );
763
764         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
765         if ( ret != TCORE_RETURN_SUCCESS ) {
766                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
767                 return FALSE;
768         }
769
770         return TRUE;
771 }
772
773 static gboolean on_call_set_sound_equalization(TelephonyCall *call, GDBusMethodInvocation *invocation, gint eq_mode, gint eq_direction, gchar* eq_parameter, gpointer user_data)
774 {
775         struct custom_data *ctx = user_data;
776         struct treq_call_sound_set_equalization req;
777
778         UserRequest *ur = MAKE_UR(ctx, call, invocation);
779
780         TReturn ret = 0;
781
782         if ( !ur ) {
783                 dbg("[ error ] ur : 0");
784                 return FALSE;
785         }
786
787         req.mode = (gboolean)eq_mode;
788         req.direction = (enum telephony_call_sound_direction)eq_direction;
789         memcpy( (char*)req.parameter, (const char*)eq_parameter, (MAX_CALL_EQ_PARAMETER_SIZE*2) );
790
791         tcore_user_request_set_data( ur, sizeof( struct treq_call_sound_set_equalization ), &req );
792         tcore_user_request_set_command( ur, TREQ_CALL_SET_SOUND_EQUALIZATION );
793
794         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
795         if ( ret != TCORE_RETURN_SUCCESS ) {
796                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
797                 return FALSE;
798         }
799
800         return TRUE;
801 }
802
803 static gboolean on_call_set_sound_noise_reduction(TelephonyCall *call, GDBusMethodInvocation *invocation, gint nr_state, gpointer user_data)
804 {
805         struct custom_data *ctx = user_data;
806         struct treq_call_sound_set_noise_reduction req;
807
808         UserRequest *ur = MAKE_UR(ctx, call, invocation);
809
810         TReturn ret = 0;
811
812         if ( !ur ) {
813                 dbg("[ error ] ur : 0");
814                 return FALSE;
815         }
816
817         req.status = (gboolean)nr_state;
818
819         tcore_user_request_set_data( ur, sizeof( struct treq_call_sound_set_noise_reduction ), &req );
820         tcore_user_request_set_command( ur, TREQ_CALL_SET_SOUND_NOISE_REDUCTION );
821
822         ret = tcore_communicator_dispatch_request( ctx->comm, ur );
823         if ( ret != TCORE_RETURN_SUCCESS ) {
824                 dbg("[ error ] tcore_communicator_dispatch_request() : (0x%x)", ret);
825                 return FALSE;
826         }
827
828         return TRUE;
829 }
830
831
832 gboolean dbus_plugin_setup_call_interface(TelephonyObjectSkeleton *object, struct custom_data *ctx)
833 {
834         TelephonyCall *call;
835
836         call = telephony_call_skeleton_new();
837         telephony_object_skeleton_set_call(object, call);
838         g_object_unref(call);
839
840         g_signal_connect (call,
841                         "handle-dial",
842                         G_CALLBACK (on_call_dial),
843                         ctx);
844
845         g_signal_connect (call,
846                         "handle-answer",
847                         G_CALLBACK (on_call_answer),
848                         ctx);
849
850         g_signal_connect (call,
851                         "handle-end",
852                         G_CALLBACK (on_call_end),
853                         ctx);
854
855         g_signal_connect (call,
856                         "handle-dtmf",
857                         G_CALLBACK (on_call_dtmf),
858                         ctx);
859
860         g_signal_connect (call,
861                         "handle-active",
862                         G_CALLBACK (on_call_active),
863                         ctx);
864
865         g_signal_connect (call,
866                         "handle-hold",
867                         G_CALLBACK (on_call_hold),
868                         ctx);
869
870         g_signal_connect (call,
871                         "handle-swap",
872                         G_CALLBACK (on_call_swap),
873                         ctx);
874
875         g_signal_connect (call,
876                         "handle-join",
877                         G_CALLBACK (on_call_join),
878                         ctx);
879
880         g_signal_connect (call,
881                         "handle-split",
882                         G_CALLBACK (on_call_split),
883                         ctx);
884
885         g_signal_connect (call,
886                         "handle-transfer",
887                         G_CALLBACK (on_call_transfer),
888                         ctx);
889
890         g_signal_connect (call,
891                         "handle-deflect",
892                         G_CALLBACK (on_call_deflect),
893                         ctx);
894
895         g_signal_connect (call,
896                         "handle-get-status",
897                         G_CALLBACK (on_call_get_status),
898                         ctx);
899
900         g_signal_connect (call,
901                         "handle-get-status-all",
902                         G_CALLBACK (on_call_get_status_all),
903                         ctx);
904
905
906         g_signal_connect (call,
907                         "handle-set-sound-path",
908                         G_CALLBACK (on_call_set_sound_path),
909                         ctx);
910
911         g_signal_connect (call,
912                         "handle-get-volume",
913                         G_CALLBACK (on_call_get_volume),
914                         ctx);
915
916         g_signal_connect (call,
917                         "handle-set-volume",
918                         G_CALLBACK (on_call_set_volume),
919                         ctx);
920
921         g_signal_connect (call,
922                         "handle-get-mute-status",
923                         G_CALLBACK (on_call_get_mute_status),
924                         ctx);
925
926         g_signal_connect (call,
927                         "handle-mute",
928                         G_CALLBACK (on_call_mute),
929                         ctx);
930
931         g_signal_connect (call,
932                         "handle-unmute",
933                         G_CALLBACK (on_call_unmute),
934                         ctx);
935
936         g_signal_connect (call,
937                         "handle-set-sound-recording",
938                         G_CALLBACK (on_call_set_sound_recording),
939                         ctx);
940
941         g_signal_connect (call,
942                         "handle-set-sound-equalization",
943                         G_CALLBACK (on_call_set_sound_equalization),
944                         ctx);
945
946         g_signal_connect (call,
947                         "handle-set-sound-noise-reduction",
948                         G_CALLBACK (on_call_set_sound_noise_reduction),
949                         ctx);
950
951
952         return TRUE;
953 }
954
955 gboolean dbus_plugin_call_response(struct custom_data *ctx, UserRequest *ur, struct dbus_request_info *dbus_info, enum tcore_response_command command, unsigned int data_len, const void *data)
956 {
957         int i = 0;
958         GSList *co_list;
959         CoreObject *co_call;
960         char *modem_name = NULL;
961         TcorePlugin *p = NULL;
962
963         modem_name = tcore_user_request_get_modem_name(ur);
964         if (!modem_name)
965                 return FALSE;
966
967         p = tcore_server_find_plugin(ctx->server, modem_name);
968         free(modem_name);
969         if (!p)
970                 return FALSE;
971
972         co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_NETWORK);
973         if (!co_list) {
974                 return FALSE;
975         }
976
977         co_call = (CoreObject *)co_list->data;
978         g_slist_free(co_list);
979
980         if (!co_call) {
981                 return FALSE;
982         }
983
984         switch (command) {
985                 case TRESP_CALL_DIAL: {
986                         struct tresp_call_dial *resp = (struct tresp_call_dial*)data;
987
988                         dbg("receive TRESP_CALL_DIAL");
989                         dbg("resp->err : [%d]", resp->err);
990
991                         telephony_call_complete_dial(dbus_info->interface_object, dbus_info->invocation, resp->err);
992                 } break;
993
994                 case TRESP_CALL_ANSWER: {
995                         struct tresp_call_answer *resp = (struct tresp_call_answer*)data;
996
997                         dbg("receive TRESP_CALL_ANSWER");
998                         dbg("resp->err : [%d]", resp->err);
999                         dbg("resp->id : [%d]", resp->id);
1000
1001                         telephony_call_complete_answer(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id );
1002
1003                 } break;
1004
1005                 case TRESP_CALL_END: {
1006                         struct tresp_call_end *resp = (struct tresp_call_end*)data;
1007
1008                         dbg("receive TRESP_CALL_END");
1009                         dbg("resp->err : [%d]", resp->err);
1010                         dbg("resp->id : [%d]", resp->err);
1011                         dbg("resp->type : [%d]", resp->type);
1012
1013                         telephony_call_complete_end(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id, resp->type );
1014
1015                 } break;
1016
1017                 case TRESP_CALL_HOLD: {
1018                         struct tresp_call_hold *resp = (struct tresp_call_hold*)data;
1019
1020                         dbg("receive TRESP_CALL_HOLD");
1021                         dbg("resp->err : [%d]", resp->err);
1022                         dbg("resp->id : [%d]", resp->id);
1023
1024                         telephony_call_complete_hold(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id );
1025
1026                 } break;
1027
1028                 case TRESP_CALL_ACTIVE: {
1029                         struct tresp_call_active *resp = (struct tresp_call_active*)data;
1030
1031                         dbg("receive TRESP_CALL_ACTIVE");
1032                         dbg("resp->err : [%d]", resp->err);
1033                         dbg("resp->id : [%d]", resp->id);
1034
1035                         telephony_call_complete_active(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id );
1036
1037                 } break;
1038
1039                 case TRESP_CALL_SWAP: {
1040                         struct tresp_call_swap *resp = (struct tresp_call_swap*)data;
1041
1042                         dbg("receive TRESP_CALL_SWAP");
1043                         dbg("resp->err : [%d]", resp->err);
1044                         dbg("resp->id : [%d]", resp->id);
1045
1046                         telephony_call_complete_swap(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id );
1047
1048                 } break;
1049
1050                 case TRESP_CALL_JOIN: {
1051                         struct tresp_call_join *resp = (struct tresp_call_join*)data;
1052
1053                         dbg("receive TRESP_CALL_JOIN");
1054                         dbg("resp->err : [%d]", resp->err);
1055                         dbg("resp->id : [%d]", resp->id);
1056
1057                         telephony_call_complete_join(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id );
1058
1059                 } break;
1060
1061
1062                 case TRESP_CALL_SPLIT: {
1063                         struct tresp_call_split *resp = (struct tresp_call_split*)data;
1064
1065                         dbg("receive TRESP_CALL_SPLIT");
1066                         dbg("resp->err : [%d]", resp->err);
1067                         dbg("resp->id : [%d]", resp->id);
1068
1069                         telephony_call_complete_split(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id );
1070
1071                 } break;
1072
1073                 case TRESP_CALL_DEFLECT: {
1074                         struct tresp_call_deflect *resp = (struct tresp_call_deflect*)data;
1075
1076                         dbg("receive TRESP_CALL_DEFLECT");
1077                         dbg("resp->err : [%d]", resp->err);
1078                         dbg("resp->id : [%d]", resp->id);
1079
1080                         telephony_call_complete_deflect(dbus_info->interface_object, dbus_info->invocation, resp->err );
1081
1082                 } break;
1083
1084                 case TRESP_CALL_TRANSFER: {
1085                         struct tresp_call_transfer *resp = (struct tresp_call_transfer*)data;
1086
1087                         dbg("receive TRESP_CALL_TRANSFER");
1088                         dbg("resp->err : [%d]", resp->err);
1089                         dbg("resp->id : [%d]", resp->id);
1090
1091                         telephony_call_complete_transfer(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->id );
1092
1093                 } break;
1094
1095                 case TRESP_CALL_SEND_DTMF: {
1096                         struct tresp_call_dtmf *resp = (struct tresp_call_dtmf*)data;
1097
1098                         dbg("receive TRESP_CALL_SEND_DTMF");
1099                         dbg("resp->err : [%d]", resp->err);
1100
1101                         telephony_call_complete_dtmf(dbus_info->interface_object, dbus_info->invocation, resp->err);
1102                 } break;
1103
1104                 case TRESP_CALL_SET_SOUND_PATH: {
1105                         struct tresp_call_sound_set_path *resp = (struct tresp_call_sound_set_path*)data;
1106
1107                         dbg("receive TRESP_CALL_SET_SOUND_PATH");
1108                         dbg("resp->err : [%d]", resp->err);
1109
1110                         telephony_call_complete_set_sound_path(dbus_info->interface_object, dbus_info->invocation, resp->err);
1111                 } break;
1112
1113                 case TRESP_CALL_SET_SOUND_VOLUME_LEVEL: {
1114                         struct tresp_call_sound_set_volume_level *resp = (struct tresp_call_sound_set_volume_level*)data;
1115
1116                         dbg("receive TRESP_CALL_SET_SOUND_VOLUME_LEVEL");
1117                         dbg("resp->err : [%d]", resp->err);
1118
1119                         telephony_call_complete_set_volume(dbus_info->interface_object, dbus_info->invocation, resp->err);
1120                 } break;
1121
1122                 case TRESP_CALL_GET_SOUND_VOLUME_LEVEL: {
1123                         struct tresp_call_sound_get_volume_level *resp = (struct tresp_call_sound_get_volume_level*)data;
1124                         GVariant *result = 0;
1125                         GVariantBuilder b;
1126
1127                         dbg("receive TRESP_CALL_GET_SOUND_VOLUME_LEVEL");
1128
1129                         g_variant_builder_init(&b, G_VARIANT_TYPE("aa{sv}"));
1130
1131                         g_variant_builder_open(&b, G_VARIANT_TYPE("a{sv}"));
1132
1133                         dbg("resp->err : [%d]", resp->err);
1134
1135                         g_variant_builder_add(&b, "{sv}", "err", g_variant_new_int32(resp->err));
1136
1137                         if ( !resp->err ) {
1138
1139                                 dbg("resp->record_num : [%d]", resp->record_num);
1140
1141                                 for ( i=0; i<resp->record_num; i++ ) {
1142                                         dbg("resp->type : [%d]", resp->record[i].sound);
1143                                         dbg("resp->level : [%d]", resp->record[i].volume);
1144
1145                                         g_variant_builder_add(&b, "{sv}", "type", g_variant_new_int32(resp->record[i].sound));
1146                                         g_variant_builder_add(&b, "{sv}", "level", g_variant_new_int32(resp->record[i].volume));
1147                                 } 
1148
1149                         }
1150
1151                         g_variant_builder_close(&b);
1152
1153                         result = g_variant_builder_end(&b);
1154
1155                         telephony_call_complete_get_volume(dbus_info->interface_object, dbus_info->invocation, resp->err, result );
1156
1157                         g_variant_unref(result);
1158
1159                 } break;
1160
1161                 case TRESP_CALL_MUTE: {
1162                         struct tresp_call_mute *resp = (struct tresp_call_mute*)data;
1163
1164                         dbg("receive TRESP_CALL_MUTE");
1165                         dbg("resp->err : [%d]", resp->err);
1166
1167                         telephony_call_complete_mute(dbus_info->interface_object, dbus_info->invocation, resp->err);
1168                 } break;
1169
1170                 case TRESP_CALL_UNMUTE: {
1171                         struct tresp_call_unmute *resp = (struct tresp_call_unmute*)data;
1172
1173                         dbg("receive TRESP_CALL_UNMUTE");
1174                         dbg("resp->err : [%d]", resp->err);
1175
1176                         telephony_call_complete_unmute(dbus_info->interface_object, dbus_info->invocation, resp->err);
1177                 } break;
1178
1179                 case TRESP_CALL_GET_MUTE_STATUS: {
1180                         struct tresp_call_get_mute_status *resp = (struct tresp_call_get_mute_status*)data;
1181
1182                         dbg("receive TRESP_CALL_GET_MUTE_STATUS");
1183                         dbg("resp->err : [%d]", resp->err);
1184                         dbg("resp->status : [%d]", resp->status);
1185
1186                         telephony_call_complete_get_mute_status(dbus_info->interface_object, dbus_info->invocation, resp->err, resp->status );
1187
1188                 } break;
1189
1190                 case TRESP_CALL_SET_SOUND_RECORDING: {
1191                         struct tresp_call_sound_set_recording *resp = (struct tresp_call_sound_set_recording*)data;
1192                         telephony_call_complete_set_sound_recording(dbus_info->interface_object, dbus_info->invocation, resp->err );
1193
1194                 } break;
1195
1196                 case TRESP_CALL_SET_SOUND_EQUALIZATION: {
1197                         struct tresp_call_sound_set_equalization *resp = (struct tresp_call_sound_set_equalization*)data;
1198                         telephony_call_complete_set_sound_equalization(dbus_info->interface_object, dbus_info->invocation, resp->err );
1199
1200                 } break;
1201
1202                 case TRESP_CALL_SET_SOUND_NOISE_REDUCTION: {
1203                         struct tresp_call_sound_set_noise_reduction *resp = (struct tresp_call_sound_set_noise_reduction*)data;
1204                         telephony_call_complete_set_sound_noise_reduction(dbus_info->interface_object, dbus_info->invocation, resp->err );
1205
1206                 } break;
1207
1208                 default:
1209                         dbg("not handled command[%d]", command);
1210                 break;
1211
1212         }
1213
1214         return TRUE;
1215 }
1216
1217 gboolean dbus_plugin_call_notification(struct custom_data *ctx, const char *plugin_name, TelephonyObjectSkeleton *object, enum tcore_notification_command command, unsigned int data_len, const void *data)
1218 {
1219         TelephonyCall *call;
1220
1221         if (!object) {
1222                 dbg("object is 0");
1223                 return FALSE;
1224         }
1225
1226         call = telephony_object_peek_call(TELEPHONY_OBJECT(object));
1227         dbg("call = %p", call);
1228
1229         switch (command) {
1230                 case TNOTI_CALL_STATUS_IDLE: {
1231                         struct tnoti_call_status_idle *idle = (struct tnoti_call_status_idle*)data;
1232
1233                         dbg("[ check ] call status : idle");
1234
1235                         if ( idle->type != CALL_TYPE_VIDEO ) {
1236                                 dbg("[ check ] this is voice call");
1237                                 telephony_call_emit_voice_call_status_idle( call, idle->id, idle->cause, 0, 0 );
1238                         } else {
1239                                 dbg("[ check ] this is video call");
1240                                 telephony_call_emit_video_call_status_idle( call, idle->id, idle->cause, 0, 0 );
1241                         }
1242
1243
1244                 } break;
1245                 case TNOTI_CALL_STATUS_DIALING: {
1246                         struct tnoti_call_status_dialing *dialing = (struct tnoti_call_status_dialing*)data;
1247
1248                         dbg("[ check ] call status : dialing");
1249                         dbg("[ check ] call type : (%d)", dialing->type);
1250                         dbg("[ check ] call id : (%d)", dialing->id);
1251
1252                         if ( dialing->type != CALL_TYPE_VIDEO ) {
1253                                 dbg("[ check ] this is voice call");
1254                                 telephony_call_emit_voice_call_status_dialing( call, dialing->id );
1255                         } else {
1256                                 dbg("[ check ] this is video call");
1257                                 telephony_call_emit_video_call_status_dialing( call, dialing->id );
1258                         }
1259
1260                 } break;
1261                 case TNOTI_CALL_STATUS_ALERT: {
1262                         struct tnoti_call_status_alert *alert = (struct tnoti_call_status_alert*)data;
1263
1264                         dbg("[ check ] call status : alert");
1265
1266                         if ( alert->type != CALL_TYPE_VIDEO ) {
1267                                 dbg("[ check ] this is voice call");
1268                                 telephony_call_emit_voice_call_status_alert( call, alert->id );
1269                         } else {
1270                                 dbg("[ check ] this is video call");
1271                                 telephony_call_emit_video_call_status_alert( call, alert->id );
1272                         }
1273
1274                 } break;
1275                 case TNOTI_CALL_STATUS_ACTIVE: {
1276                         struct tnoti_call_status_active *active = (struct tnoti_call_status_active*)data;
1277
1278                         dbg("[ check ] call status : active");
1279
1280                         if ( active->type != CALL_TYPE_VIDEO ) {
1281                                 dbg("[ check ] this is voice call");
1282                                 telephony_call_emit_voice_call_status_active( call, active->id );
1283                         } else {
1284                                 dbg("[ check ] this is video call");
1285                                 telephony_call_emit_video_call_status_active( call, active->id );
1286                         }
1287
1288                 } break;
1289                 case TNOTI_CALL_STATUS_HELD: {
1290                         struct tnoti_call_status_held *held = (struct tnoti_call_status_held*)data;
1291
1292                         dbg("[ check ] call status : held");
1293
1294                         telephony_call_emit_voice_call_status_held( call, held->id );
1295
1296                 } break;
1297                 case TNOTI_CALL_STATUS_INCOMING: {
1298                         struct tnoti_call_status_incoming *incoming = (struct tnoti_call_status_incoming*)data;
1299
1300                         dbg("[ check ] call status : incoming");
1301
1302                         if ( incoming->type != CALL_TYPE_VIDEO ) {
1303                                 dbg("[ check ] this is voice call");
1304
1305                                 telephony_call_emit_voice_call_status_incoming( call, incoming->id );
1306
1307                                 _launch_voice_call( incoming );
1308
1309                         } else {
1310                                 dbg("[ check ] this is video call");
1311                                 telephony_call_emit_video_call_status_incoming( call, incoming->id );
1312
1313                                 _launch_video_call( incoming );
1314                         }
1315
1316                 } break;
1317
1318                 case TNOTI_CALL_SOUND_PATH: {
1319
1320                         struct tnoti_call_sound_path *noti = (struct tnoti_call_sound_path*)data;
1321                         telephony_call_emit_call_sound_path( call, noti->path );
1322
1323
1324                 } break;
1325
1326                 case TNOTI_CALL_SOUND_RINGBACK_TONE: {
1327                         struct tnoti_call_sound_ringback_tone *noti = (struct tnoti_call_sound_ringback_tone*)data;
1328                         telephony_call_emit_call_sound_ringback_tone( call, (gint)noti->status );
1329
1330                 } break;
1331
1332                 case TNOTI_CALL_SOUND_WBAMR: {
1333                         struct tnoti_call_sound_wbamr *noti = (struct tnoti_call_sound_wbamr*)data;
1334                         telephony_call_emit_call_sound_wbamr( call, (gint)noti->status );
1335
1336                 } break;
1337
1338                 case TNOTI_CALL_SOUND_EQUALIZATION: {
1339                         struct tnoti_call_sound_equalization *noti = (struct tnoti_call_sound_equalization*)data;
1340                         telephony_call_emit_call_sound_equalization( call, (gint)noti->mode, (gint)noti->direction );
1341
1342                 } break;
1343
1344                 case TNOTI_CALL_SOUND_NOISE_REDUCTION: {
1345                         struct tnoti_call_sound_noise_reduction *noti = (struct tnoti_call_sound_noise_reduction*)data;
1346                         telephony_call_emit_call_sound_noise_reduction( call, (gint)noti->status );
1347
1348                 } break;
1349
1350                 default:
1351                         dbg("not handled command[%d]", command);
1352                 break;
1353         }
1354
1355         return TRUE;
1356 }
1357