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