2 * tel-plugin-socket-communicator
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Ja-young Gu <jygu@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
25 #include <glib-object.h>
33 #include <communicator.h>
34 #include <core_object.h>
36 #include <user_request.h>
41 #include "tapi_common.h"
42 #include "module_req.h"
44 static void _launch_voice_call( struct tnoti_call_status_incoming* incoming );
45 static void _launch_video_call( struct tnoti_call_status_incoming* incoming );
47 gboolean scomm_service_reqeust_call(unsigned int ch_id, Communicator *c, TcorePlugin *plugin, tapi_service_command_e cmd, gchar *data, void **outparam)
50 gboolean result = TRUE; int err_cause = 0;
52 gchar *serial_d = NULL;
54 GSList *co_list = NULL;
55 CoreObject *co_call = NULL;
56 UserRequest *ur = NULL;
57 struct tcore_user_info ui = { 0, 0, 0, NULL,0,0, NULL };
59 struct _sipc_marshal_object *out_obj;
60 struct _sipc_marshal_object *in_obj;
62 co_list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_CALL);
67 co_call = (CoreObject *)co_list->data;
71 g_slist_free(co_list);
73 in_obj = sipc_util_marshal_object_deserializer(data);
78 ui.channel_id = ch_id;
79 ui.client_cmd = (unsigned int)cmd;
80 ur = tcore_user_request_new(c, tcore_plugin_get_description(plugin)->name);
84 tcore_user_request_set_user_info(ur, &ui);
87 case TAPI_SERVICE_CALL_DIAL: {
88 struct treq_call_dial data;
92 type = sipc_util_marshal_object_get_string(in_obj, "call_type");
93 number = sipc_util_marshal_object_get_string(in_obj, "call_number");
95 data.type = (enum telephony_call_type)*type;
98 dbg("[ error ] number : 0");
103 memcpy( data.number, number, MAX_CALL_DIAL_NUM_LEN );
105 tcore_user_request_set_data(ur, sizeof( struct treq_call_dial ), &data);
106 tcore_user_request_set_command(ur, TREQ_CALL_DIAL);
110 case TAPI_SERVICE_CALL_ANSWER: {
111 struct treq_call_answer data;
116 id = sipc_util_marshal_object_get_string(in_obj, "call_id");
117 type = sipc_util_marshal_object_get_string(in_obj, "answer_type");
119 data.id = (unsigned int)*id;
120 data.type = (enum telephony_call_answer_type)*type;
122 tcore_user_request_set_data(ur, sizeof( struct treq_call_answer ), &data);
123 tcore_user_request_set_command(ur, TREQ_CALL_ANSWER);
126 case TAPI_SERVICE_CALL_END: {
127 struct treq_call_end data;
132 id = sipc_util_marshal_object_get_string(in_obj, "call_id");
133 type = sipc_util_marshal_object_get_string(in_obj, "end_type");
135 data.id = (unsigned int)*id;
136 data.type = (enum telephony_call_end_type)*type;
138 tcore_user_request_set_data(ur, sizeof( struct treq_call_end ), &data);
139 tcore_user_request_set_command(ur, TREQ_CALL_END);
142 case TAPI_SERVICE_CALL_SEND_DTMF: {
143 struct treq_call_dtmf data;
146 str = sipc_util_marshal_object_get_string(in_obj, "call_dtmf");
149 strncpy( data.digits, str, MAX_CALL_DTMF_DIGITS_LEN );
151 dbg("[ error ] str : 0");
156 tcore_user_request_set_data(ur, sizeof( struct treq_call_dtmf ), &data);
157 tcore_user_request_set_command(ur, TREQ_CALL_SEND_DTMF);
160 case TAPI_SERVICE_CALL_HOLD: {
162 id = sipc_util_marshal_object_get_string(in_obj, "call_id");
164 tcore_user_request_set_data(ur, sizeof( unsigned int ), id);
165 tcore_user_request_set_command(ur, TREQ_CALL_HOLD);
168 case TAPI_SERVICE_CALL_ACTIVE: {
170 id = sipc_util_marshal_object_get_string(in_obj, "call_id");
172 tcore_user_request_set_data(ur, sizeof( unsigned int ), id);
173 tcore_user_request_set_command(ur, TREQ_CALL_ACTIVE);
176 case TAPI_SERVICE_CALL_SWAP: {
178 id = sipc_util_marshal_object_get_string(in_obj, "call_id");
180 tcore_user_request_set_data(ur, sizeof( unsigned int ), id);
181 tcore_user_request_set_command(ur, TREQ_CALL_SWAP);
184 case TAPI_SERVICE_CALL_JOIN: {
186 id = sipc_util_marshal_object_get_string(in_obj, "call_id");
188 tcore_user_request_set_data(ur, sizeof( unsigned int ), id);
189 tcore_user_request_set_command(ur, TREQ_CALL_JOIN);
192 case TAPI_SERVICE_CALL_SPLIT: {
194 id = sipc_util_marshal_object_get_string(in_obj, "call_id");
196 tcore_user_request_set_data(ur, sizeof( unsigned int ), id);
197 tcore_user_request_set_command(ur, TREQ_CALL_SPLIT);
200 case TAPI_SERVICE_CALL_DEFLECT: {
202 number = sipc_util_marshal_object_get_string(in_obj, "call_number");
205 dbg("[ error ] number : 0");
210 tcore_user_request_set_data(ur, MAX_CALL_NUMBER_LEN, (char*)number);
211 tcore_user_request_set_command(ur, TREQ_CALL_DEFLECT);
214 case TAPI_SERVICE_CALL_TRANSFER: {
216 id = sipc_util_marshal_object_get_string(in_obj, "call_id");
218 tcore_user_request_set_data(ur, sizeof( unsigned int ), id);
219 tcore_user_request_set_command(ur, TREQ_CALL_TRANSFER);
222 //TAPI_CS_CALL_GETACTIVELINE
223 //TAPI_CS_CALL_SETACTIVELINE
225 case TAPI_SERVICE_CALL_SET_SOUND_PATH: {
226 struct treq_call_sound_set_path data;
229 path = sipc_util_marshal_object_get_string(in_obj, "sound_path");
231 data.path = (enum telephony_call_sound_path)*path;
233 tcore_user_request_set_data(ur, sizeof( struct treq_call_sound_set_path ), &data);
234 tcore_user_request_set_command(ur, TREQ_CALL_SET_SOUND_PATH );
238 case TAPI_SERVICE_CALL_GET_SOUND_VOLUME_LEVEL: {
239 struct treq_call_sound_get_volume_level data;
240 gchar *sound_device = 0;
241 gchar *sound_type = 0;
243 sound_type = sipc_util_marshal_object_get_string(in_obj, "sound_type");
244 sound_device = sipc_util_marshal_object_get_string(in_obj, "sound_device");
246 data.sound = (enum telephony_call_sound_type)sound_type;
247 data.device = (enum telephony_call_sound_device)sound_device;
249 tcore_user_request_set_data(ur, sizeof( struct treq_call_sound_get_volume_level ), &data);
250 tcore_user_request_set_command(ur, TREQ_CALL_GET_SOUND_VOLUME_LEVEL );
253 case TAPI_SERVICE_CALL_SET_SOUND_VOLUME_LEVEL: {
254 struct treq_call_sound_set_volume_level data;
255 gchar *sound_type = 0;
256 gchar *sound_device = 0;
257 gchar *sound_volume = 0;
259 sound_type = sipc_util_marshal_object_get_string(in_obj, "sound_type");
260 sound_device = sipc_util_marshal_object_get_string(in_obj, "sound_device");
261 sound_volume = sipc_util_marshal_object_get_string(in_obj, "sound_volume");
263 data.sound = (enum telephony_call_sound_type)sound_type;
264 data.device = (enum telephony_call_sound_device)sound_device;
265 data.volume = (enum telephony_call_sound_volume_level)sound_volume;
267 tcore_user_request_set_data(ur, sizeof( struct treq_call_sound_set_volume_level ), &data);
268 tcore_user_request_set_command(ur, TREQ_CALL_SET_SOUND_VOLUME_LEVEL );
272 case TAPI_SERVICE_CALL_MUTE: {
274 tcore_user_request_set_command(ur, TREQ_CALL_MUTE);
278 case TAPI_SERVICE_CALL_UNMUTE: {
280 tcore_user_request_set_command(ur, TREQ_CALL_UNMUTE);
284 case TAPI_SERVICE_CALL_GET_MUTE_STATUS: {
286 tcore_user_request_set_command(ur, TREQ_CALL_GET_MUTE_STATUS);
290 case TAPI_SERVICE_CALL_SET_ACTIVE_LINE: {}break;
291 case TAPI_SERVICE_CALL_GET_ACTIVE_LINE: {}break;
292 case TAPI_SERVICE_CALL_ACTIVATE_CCBS: {}break;
297 sipc_util_marshal_object_destory(in_obj);
298 out_obj = sipc_util_marshal_object_create();
299 sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
301 dbg("result = %d", result);
303 *outparam = sipc_util_marshal_object_serializer(out_obj);
304 sipc_util_marshal_object_destory(out_obj);
306 if (result == FALSE) {
307 tcore_user_request_unref(ur);
311 ret = tcore_communicator_dispatch_request(c, ur);
312 if (ret != TCORE_RETURN_SUCCESS) {
319 gboolean scomm_service_response_call(Communicator *comm, UserRequest *ur, enum tcore_response_command command, unsigned int data_len, const void *data)
323 gboolean result = TRUE; int err_cause = 0;
324 gchar *out_d= NULL, *serial_d = NULL;
325 struct custom_data *ctx = NULL;
326 const struct tcore_user_info *ui;
328 sipc_server_t *s = NULL;
329 struct _tapi_header hdr;
330 struct _sipc_marshal_object* out_obj = NULL;
332 memset(&hdr, 0, sizeof(struct _tapi_header));
334 ctx = tcore_communicator_ref_user_data(comm);
336 dbg("user_data is NULL");
340 ui = tcore_user_request_ref_user_info(ur);
343 dbg("application channel id(%d), Command = [0x%x], data_len = %d", ui->channel_id, command, data_len);
344 hdr.cmd = (tapi_service_command_e)ui->client_cmd;
346 out_obj = sipc_util_marshal_object_create();
349 case TRESP_CALL_DIAL: {
350 struct tresp_call_general* resp_data = 0;
351 resp_data = (struct tresp_call_general*)data;
353 sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
354 sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
355 sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
359 case TRESP_CALL_ANSWER: {
360 struct tresp_call_general* resp_data = 0;
361 resp_data = (struct tresp_call_general*)data;
363 sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
364 sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
365 sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
369 case TRESP_CALL_END: {
370 struct tresp_call_general* resp_data = 0;
371 resp_data = (struct tresp_call_general*)data;
373 sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
374 sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
375 sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
378 case TRESP_CALL_END_ALL: {
379 struct tresp_call_general* resp_data = 0;
380 resp_data = (struct tresp_call_general*)data;
382 sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
383 sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
384 sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
387 case TRESP_CALL_END_ALL_ACTIVE: {
388 struct tresp_call_general* resp_data = 0;
389 resp_data = (struct tresp_call_general*)data;
391 sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
392 sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
393 sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
396 case TRESP_CALL_END_ALL_HELD: {
397 struct tresp_call_general* resp_data = 0;
398 resp_data = (struct tresp_call_general*)data;
400 sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
401 sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
402 sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
405 case TRESP_CALL_HOLD: {
406 struct tresp_call_general* resp_data = 0;
407 resp_data = (struct tresp_call_general*)data;
409 sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
410 sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
411 sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
414 case TRESP_CALL_ACTIVE: {
415 struct tresp_call_general* resp_data = 0;
416 resp_data = (struct tresp_call_general*)data;
418 sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
419 sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
420 sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
423 case TRESP_CALL_SWAP: {
424 struct tresp_call_general* resp_data = 0;
425 resp_data = (struct tresp_call_general*)data;
427 sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
428 sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
429 sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
432 case TRESP_CALL_JOIN: {
433 struct tresp_call_general* resp_data = 0;
434 resp_data = (struct tresp_call_general*)data;
436 sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
437 sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
438 sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
441 case TRESP_CALL_SPLIT: {
442 struct tresp_call_general* resp_data = 0;
443 resp_data = (struct tresp_call_general*)data;
445 sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
446 sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
447 sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
450 case TRESP_CALL_DEFLECT: {
453 case TRESP_CALL_TRANSFER: {
454 struct tresp_call_general* resp_data = 0;
455 resp_data = (struct tresp_call_general*)data;
457 sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
458 sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
459 sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
462 case TRESP_CALL_SEND_DTMF: {
465 case TRESP_CALL_SET_SOUND_PATH: {
466 struct tresp_call_sound_general* resp_data = 0;
467 resp_data = (struct tresp_call_sound_general*)data;
469 out_obj = sipc_util_marshal_object_create();
470 sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
471 sipc_util_marshal_object_add_data(out_obj, "sound_err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
475 case TRESP_CALL_SET_SOUND_VOLUME_LEVEL: {
476 struct tresp_call_sound_general* resp_data = 0;
477 resp_data = (struct tresp_call_sound_general*)data;
479 out_obj = sipc_util_marshal_object_create();
480 sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
481 sipc_util_marshal_object_add_data(out_obj, "sound_err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
485 case TRESP_CALL_GET_SOUND_VOLUME_LEVEL: {
489 case TRESP_CALL_MUTE:
490 case TRESP_CALL_UNMUTE: {
491 struct tresp_call_sound_general* resp_data = 0;
492 resp_data = (struct tresp_call_sound_general*)data;
494 out_obj = sipc_util_marshal_object_create();
495 sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
496 sipc_util_marshal_object_add_data(out_obj, "sound_err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
500 case TRESP_CALL_GET_MUTE_STATUS: {
509 serial_d = sipc_util_marshal_object_serializer(out_obj);
510 hdr.data_len = strlen(serial_d);
511 sipc_util_marshal_object_destory(out_obj);
514 out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
515 memcpy(out_d, &hdr, sizeof(struct _tapi_header));
517 memcpy(out_d+sizeof(struct _tapi_header), serial_d, hdr.data_len);
521 ret = sipc_server_send(s, ui->channel_id, out_d, sizeof(struct _tapi_header)+hdr.data_len, SIPC_SEND_DATA_ASYNC);
531 gboolean scomm_service_notification_call(Communicator *comm, CoreObject *source, enum tcore_notification_command command, unsigned int data_len, const void *data)
534 gboolean result = TRUE; int err_cause = 0;
535 gchar *out_d= NULL, *serial_d = NULL;
537 struct custom_data *ctx = NULL;
539 struct _tapi_header hdr;
540 struct _sipc_marshal_object* out_obj = NULL;
542 memset(&hdr, 0, sizeof(struct _tapi_header));
544 ctx = tcore_communicator_ref_user_data(comm);
546 dbg("user_data is NULL");
550 dbg("notification !!! (command = 0x%x, data_len = %d)", command, data_len);
552 out_obj = sipc_util_marshal_object_create();
555 case TNOTI_CALL_STATUS_IDLE: {
556 struct tnoti_call_status_idle *status;
557 status = (struct tnoti_call_status_idle*)data;
559 sipc_util_marshal_object_add_data(out_obj, "call_type", &status->type, SIPC_MARSHAL_DATA_INT_TYPE);
560 sipc_util_marshal_object_add_data(out_obj, "call_id", &status->id, SIPC_MARSHAL_DATA_INT_TYPE);
561 sipc_util_marshal_object_add_data(out_obj, "end_cause", &status->cause, SIPC_MARSHAL_DATA_INT_TYPE);
565 case TNOTI_CALL_STATUS_DIALING: {
566 struct tnoti_call_status_dialing *status;
567 status = (struct tnoti_call_status_dialing*)data;
569 sipc_util_marshal_object_add_data(out_obj, "call_type", &status->type, SIPC_MARSHAL_DATA_INT_TYPE);
570 sipc_util_marshal_object_add_data(out_obj, "call_id", &status->id, SIPC_MARSHAL_DATA_INT_TYPE);
574 case TNOTI_CALL_STATUS_ALERT: {
575 struct tnoti_call_status_alert *status;
576 status = (struct tnoti_call_status_alert*)data;
578 sipc_util_marshal_object_add_data(out_obj, "call_type", &status->type, SIPC_MARSHAL_DATA_INT_TYPE);
579 sipc_util_marshal_object_add_data(out_obj, "call_id", &status->id, SIPC_MARSHAL_DATA_INT_TYPE);
583 case TNOTI_CALL_STATUS_ACTIVE: {
584 struct tnoti_call_status_active *status = 0;
585 status = (struct tnoti_call_status_active*)data;
587 sipc_util_marshal_object_add_data(out_obj, "call_type", &status->type, SIPC_MARSHAL_DATA_INT_TYPE);
588 sipc_util_marshal_object_add_data(out_obj, "call_id", &status->id, SIPC_MARSHAL_DATA_INT_TYPE);
592 case TNOTI_CALL_STATUS_HELD: {
593 struct tnoti_call_status_held *status;
594 status = (struct tnoti_call_status_held*)data;
596 sipc_util_marshal_object_add_data(out_obj, "call_type", &status->type, SIPC_MARSHAL_DATA_INT_TYPE);
597 sipc_util_marshal_object_add_data(out_obj, "call_id", &status->id, SIPC_MARSHAL_DATA_INT_TYPE);
601 case TNOTI_CALL_STATUS_INCOMING: {
602 struct tnoti_call_status_incoming *incoming = 0;
603 incoming = (struct tnoti_call_status_incoming*)data;
605 dbg("incoming noti publish");
607 if ( incoming->type == CALL_TYPE_VOICE )
608 _launch_voice_call( incoming );
610 _launch_video_call( incoming );
615 case TNOTI_CALL_STATUS_WAITING:
617 dbg("unknown notification");
623 serial_d = sipc_util_marshal_object_serializer(out_obj);
624 hdr.data_len = strlen(serial_d);
625 sipc_util_marshal_object_destory(out_obj);
628 out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
629 memcpy(out_d, &hdr, sizeof(struct _tapi_header));
631 memcpy(out_d + sizeof(struct _tapi_header), serial_d, hdr.data_len);
635 ret = sipc_server_broadcast(ctx->sk_server, out_d, sizeof(struct _tapi_header) + hdr.data_len);
636 dbg("ret = %d", ret);
646 static void _launch_voice_call( struct tnoti_call_status_incoming* incoming )
650 char forward[2] = {0, };
651 char active_line[2] = {0, };
653 char number[83] = {0, };
654 char name[83] = {0, };
659 snprintf( id, 2, "%d", incoming->id );
660 dbg("id : [%s]", id );
661 snprintf( cli, 2, "%d", incoming->cli.mode );
662 dbg("cli : [%s]", id );
663 snprintf( number, 83, "%s", incoming->cli.number );
664 dbg("number : [%s]", number );
665 snprintf( forward, 2, "%d", incoming->forward );
666 dbg("forward : [%s]", forward );
667 snprintf( active_line, 2, "%d", incoming->active_line );
668 dbg("active_line : [%s]", active_line );
671 if ( incoming->cna.mode == CALL_CNA_MODE_PRESENT )
672 snprintf( cna, 2, "%d", TAPI_CALL_NAME_AVAIL );
674 snprintf( cna, 2, "%d", TAPI_CALL_NAME_RESTRICTED );
677 snprintf( cna, 2, "%d", incoming->cna.mode );
678 dbg("cna : [%s]", cna );
679 snprintf( name, 83, "%s", incoming->cna.name );
680 dbg("name : [%s]", name );
682 kb = bundle_create();
683 bundle_add(kb, "launch-type", "MT");
684 bundle_add(kb, "handle", id);
685 bundle_add(kb, "number", number);
686 bundle_add(kb, "name_mode", cna);
687 bundle_add(kb, "name", name);
688 bundle_add(kb, "clicause", cli);
689 bundle_add(kb, "fwded", forward);
690 bundle_add(kb, "activeline", active_line);
692 ret = aul_launch_app("com.samsung.call", kb);
695 dbg("aul_launch_app [ voice call ] : %d", ret );
698 static void _launch_video_call( struct tnoti_call_status_incoming* incoming )
702 char forward[2] = {0, };
703 char number[83] = {0, };
708 dbg("Func Entrance");
710 snprintf( id, 2, "%d", incoming->id );
711 dbg("id : [%s]", id );
712 snprintf( number, 83, "%s", incoming->cli.number );
713 dbg("number : [%s]", number );
714 snprintf( cli, 2, "%d", incoming->cli.mode );
715 dbg("cli : [%s]", id );
716 snprintf( forward, 2, "%d", incoming->forward );
717 dbg("forward : [%s]", forward );
719 kb = bundle_create();
720 bundle_add(kb, "KEY_CALL_TYPE", "mt");
721 bundle_add(kb, "KEY_CALL_HANDLE", id);
722 bundle_add(kb, "KEY_CALLING_PARTY_NUMBER", number);
723 bundle_add(kb, "KEY_CLI_CAUSE", cli);
724 bundle_add(kb, "KEY_FORWARDED", forward);
726 ret = aul_launch_app("com.samsung.vtmain", kb);
729 dbg("VT AUL return %d",ret);