#include "tapi_common.h"
#include "module_req.h"
+static void _launch_voice_call( struct tnoti_call_status_incoming* incoming );
+static void _launch_video_call( struct tnoti_call_status_incoming* incoming );
+
gboolean scomm_service_reqeust_call(unsigned int ch_id, Communicator *c, TcorePlugin *plugin, tapi_service_command_e cmd, gchar *data, void **outparam)
{
int ret = 0;
switch (cmd) {
case TAPI_SERVICE_CALL_DIAL: {
struct treq_call_dial data;
- /*
- * COMMON CODE
- * get_data from in_obj
- *
- * ONLY SYNC API & RETURN DATA
- * out_obj = sipc_util_marshal_object_create();
- * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- *
- * serial_d = sipc_util_marshal_object_serializer(out_obj);
- * s_data_len = strlen(serial_d);
- * sipc_util_marshal_object_destory(out_obj);
- *
- * *outparam = g_new0(char, s_data_len);
- * memcpy(*outparam, serial_d, hdr.s_data_len);
- * g_free(serial_d);
- * return;
- *
- */
+ gchar *type = 0;
+ gchar *number = 0;
+
+ type = sipc_util_marshal_object_get_string(in_obj, "call_type");
+ number = sipc_util_marshal_object_get_string(in_obj, "call_number");
+
+ data.type = (enum telephony_call_type)*type;
+
+ if ( !number ) {
+ dbg("[ error ] number : 0");
+ result = FALSE;
+ goto RETURN;
+ }
+
+ memcpy( data.number, number, MAX_CALL_DIAL_NUM_LEN );
+
tcore_user_request_set_data(ur, sizeof( struct treq_call_dial ), &data);
tcore_user_request_set_command(ur, TREQ_CALL_DIAL);
- }break;
- case TAPI_SERVICE_ANSWER: {
+
+ } break;
+
+ case TAPI_SERVICE_CALL_ANSWER: {
struct treq_call_answer data;
- /*
- * COMMON CODE
- * get_data from in_obj
- *
- * ONLY SYNC API & RETURN DATA
- * out_obj = sipc_util_marshal_object_create();
- * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- *
- * serial_d = sipc_util_marshal_object_serializer(out_obj);
- * s_data_len = strlen(serial_d);
- * sipc_util_marshal_object_destory(out_obj);
- *
- * *outparam = g_new0(char, s_data_len);
- * memcpy(*outparam, serial_d, hdr.s_data_len);
- * g_free(serial_d);
- * return;
- *
- */
+
+ gchar *id = 0;
+ gchar *type = 0;
+
+ id = sipc_util_marshal_object_get_string(in_obj, "call_id");
+ type = sipc_util_marshal_object_get_string(in_obj, "answer_type");
+
+ data.id = (unsigned int)*id;
+ data.type = (enum telephony_call_answer_type)*type;
+
tcore_user_request_set_data(ur, sizeof( struct treq_call_answer ), &data);
tcore_user_request_set_command(ur, TREQ_CALL_ANSWER);
}break;
- case TAPI_SERVICE_END: {
- //TAPI_CS_CALL_RELEASEALL
- //TAPI_CS_CALL_RELEASEALL_ACTIVE
- //TAPI_CS_CALL_RELEASEALL_HELD
+
+ case TAPI_SERVICE_CALL_END: {
struct treq_call_end data;
- /*
- * COMMON CODE
- * get_data from in_obj
- *
- * ONLY SYNC API & RETURN DATA
- * out_obj = sipc_util_marshal_object_create();
- * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- *
- * serial_d = sipc_util_marshal_object_serializer(out_obj);
- * s_data_len = strlen(serial_d);
- * sipc_util_marshal_object_destory(out_obj);
- *
- * *outparam = g_new0(char, s_data_len);
- * memcpy(*outparam, serial_d, hdr.s_data_len);
- * g_free(serial_d);
- * return;
- *
- */
+
+ gchar *id = 0;
+ gchar *type = 0;
+
+ id = sipc_util_marshal_object_get_string(in_obj, "call_id");
+ type = sipc_util_marshal_object_get_string(in_obj, "end_type");
+
+ data.id = (unsigned int)*id;
+ data.type = (enum telephony_call_end_type)*type;
+
tcore_user_request_set_data(ur, sizeof( struct treq_call_end ), &data);
tcore_user_request_set_command(ur, TREQ_CALL_END);
}break;
- //TAPI_CS_CALL_DTMF
-
- case TAPI_SERVICE_HOLD: {
- unsigned int id = 0;
- /*
- * COMMON CODE
- * get_data from in_obj
- *
- * ONLY SYNC API & RETURN DATA
- * out_obj = sipc_util_marshal_object_create();
- * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- *
- * serial_d = sipc_util_marshal_object_serializer(out_obj);
- * s_data_len = strlen(serial_d);
- * sipc_util_marshal_object_destory(out_obj);
- *
- * *outparam = g_new0(char, s_data_len);
- * memcpy(*outparam, serial_d, hdr.s_data_len);
- * g_free(serial_d);
- * return;
- *
- */
- tcore_user_request_set_data(ur, sizeof( unsigned int ), &id);
+ case TAPI_SERVICE_CALL_SEND_DTMF: {
+ struct treq_call_dtmf data;
+ gchar *str;
+
+ str = sipc_util_marshal_object_get_string(in_obj, "call_dtmf");
+
+ if ( str ) {
+ strncpy( data.digits, str, MAX_CALL_DTMF_DIGITS_LEN );
+ } else {
+ dbg("[ error ] str : 0");
+ result = FALSE;
+ goto RETURN;
+ }
+
+ tcore_user_request_set_data(ur, sizeof( struct treq_call_dtmf ), &data);
+ tcore_user_request_set_command(ur, TREQ_CALL_SEND_DTMF);
+ }break;
+
+ case TAPI_SERVICE_CALL_HOLD: {
+ gchar *id = 0;
+ id = sipc_util_marshal_object_get_string(in_obj, "call_id");
+
+ tcore_user_request_set_data(ur, sizeof( unsigned int ), id);
tcore_user_request_set_command(ur, TREQ_CALL_HOLD);
}break;
- case TAPI_SERVICE_ACTIVE: {
- unsigned int id = 0;
- /*
- * COMMON CODE
- * get_data from in_obj
- *
- * ONLY SYNC API & RETURN DATA
- * out_obj = sipc_util_marshal_object_create();
- * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- *
- * serial_d = sipc_util_marshal_object_serializer(out_obj);
- * s_data_len = strlen(serial_d);
- * sipc_util_marshal_object_destory(out_obj);
- *
- * *outparam = g_new0(char, s_data_len);
- * memcpy(*outparam, serial_d, hdr.s_data_len);
- * g_free(serial_d);
- * return;
- *
- */
- tcore_user_request_set_data(ur, sizeof( unsigned int ), &id);
+
+ case TAPI_SERVICE_CALL_ACTIVE: {
+ gchar *id = 0;
+ id = sipc_util_marshal_object_get_string(in_obj, "call_id");
+
+ tcore_user_request_set_data(ur, sizeof( unsigned int ), id);
tcore_user_request_set_command(ur, TREQ_CALL_ACTIVE);
}break;
- case TAPI_SERVICE_SWAP: {
- unsigned int id = 0;
- /*
- * COMMON CODE
- * get_data from in_obj
- *
- * ONLY SYNC API & RETURN DATA
- * out_obj = sipc_util_marshal_object_create();
- * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- *
- * serial_d = sipc_util_marshal_object_serializer(out_obj);
- * s_data_len = strlen(serial_d);
- * sipc_util_marshal_object_destory(out_obj);
- *
- * *outparam = g_new0(char, s_data_len);
- * memcpy(*outparam, serial_d, hdr.s_data_len);
- * g_free(serial_d);
- * return;
- *
- */
- tcore_user_request_set_data(ur, sizeof( unsigned int ), &id);
+
+ case TAPI_SERVICE_CALL_SWAP: {
+ gchar *id = 0;
+ id = sipc_util_marshal_object_get_string(in_obj, "call_id");
+
+ tcore_user_request_set_data(ur, sizeof( unsigned int ), id);
tcore_user_request_set_command(ur, TREQ_CALL_SWAP);
}break;
- case TAPI_SERVICE_JOIN: {
- unsigned int id = 0;
- /*
- * COMMON CODE
- * get_data from in_obj
- *
- * ONLY SYNC API & RETURN DATA
- * out_obj = sipc_util_marshal_object_create();
- * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- *
- * serial_d = sipc_util_marshal_object_serializer(out_obj);
- * s_data_len = strlen(serial_d);
- * sipc_util_marshal_object_destory(out_obj);
- *
- * *outparam = g_new0(char, s_data_len);
- * memcpy(*outparam, serial_d, hdr.s_data_len);
- * g_free(serial_d);
- * return;
- *
- */
- tcore_user_request_set_data(ur, sizeof( unsigned int ), &id);
+
+ case TAPI_SERVICE_CALL_JOIN: {
+ gchar *id = 0;
+ id = sipc_util_marshal_object_get_string(in_obj, "call_id");
+
+ tcore_user_request_set_data(ur, sizeof( unsigned int ), id);
tcore_user_request_set_command(ur, TREQ_CALL_JOIN);
}break;
- case TAPI_SERVICE_SPLIT: {
- unsigned int id = 0;
- /*
- * COMMON CODE
- * get_data from in_obj
- *
- * ONLY SYNC API & RETURN DATA
- * out_obj = sipc_util_marshal_object_create();
- * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- *
- * serial_d = sipc_util_marshal_object_serializer(out_obj);
- * s_data_len = strlen(serial_d);
- * sipc_util_marshal_object_destory(out_obj);
- *
- * *outparam = g_new0(char, s_data_len);
- * memcpy(*outparam, serial_d, hdr.s_data_len);
- * g_free(serial_d);
- * return;
- *
- */
- tcore_user_request_set_data(ur, sizeof( unsigned int ), &id);
+
+ case TAPI_SERVICE_CALL_SPLIT: {
+ gchar *id = 0;
+ id = sipc_util_marshal_object_get_string(in_obj, "call_id");
+
+ tcore_user_request_set_data(ur, sizeof( unsigned int ), id);
tcore_user_request_set_command(ur, TREQ_CALL_SPLIT);
}break;
- case TAPI_SERVICE_DEFLECT: {
- /*
- * COMMON CODE
- * get_data from in_obj
- *
- * ONLY SYNC API & RETURN DATA
- * out_obj = sipc_util_marshal_object_create();
- * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- *
- * serial_d = sipc_util_marshal_object_serializer(out_obj);
- * s_data_len = strlen(serial_d);
- * sipc_util_marshal_object_destory(out_obj);
- *
- * *outparam = g_new0(char, s_data_len);
- * memcpy(*outparam, serial_d, hdr.s_data_len);
- * g_free(serial_d);
- * return;
- *
- */
+
+ case TAPI_SERVICE_CALL_DEFLECT: {
+ gchar *number = 0;
+ number = sipc_util_marshal_object_get_string(in_obj, "call_number");
+
+ if ( !number ) {
+ dbg("[ error ] number : 0");
+ result = FALSE;
+ goto RETURN;
+ }
+
+ tcore_user_request_set_data(ur, MAX_CALL_NUMBER_LEN, (char*)number);
tcore_user_request_set_command(ur, TREQ_CALL_DEFLECT);
}break;
- case TAPI_SERVICE_TRANSFER: {
- unsigned int id = 0;
- /*
- * COMMON CODE
- * get_data from in_obj
- *
- * ONLY SYNC API & RETURN DATA
- * out_obj = sipc_util_marshal_object_create();
- * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- *
- * serial_d = sipc_util_marshal_object_serializer(out_obj);
- * s_data_len = strlen(serial_d);
- * sipc_util_marshal_object_destory(out_obj);
- *
- * *outparam = g_new0(char, s_data_len);
- * memcpy(*outparam, serial_d, hdr.s_data_len);
- * g_free(serial_d);
- * return;
- *
- */
- tcore_user_request_set_data(ur, sizeof( unsigned int ), &id);
+
+ case TAPI_SERVICE_CALL_TRANSFER: {
+ gchar *id = 0;
+ id = sipc_util_marshal_object_get_string(in_obj, "call_id");
+
+ tcore_user_request_set_data(ur, sizeof( unsigned int ), id);
tcore_user_request_set_command(ur, TREQ_CALL_TRANSFER);
}break;
//TAPI_CS_CALL_GETACTIVELINE
//TAPI_CS_CALL_SETACTIVELINE
- case TAPI_SERVICE_SEND_DTMF: {}break;
- case TAPI_SERVICE_SET_SOUND_PATH: {}break;
- case TAPI_SERVICE_GET_SOUND_VOLUME_LEVEL: {}break;
- case TAPI_SERVICE_SET_SOUND_VOLUME_LEVEL: {}break;
- case TAPI_SERVICE_MUTE: {}break;
- case TAPI_SERVICE_UNMUTE: {}break;
- case TAPI_SERVICE_GET_MUTE_STATUS: {}break;
+ case TAPI_SERVICE_CALL_SET_SOUND_PATH: {
+ struct treq_call_sound_set_path data;
+ gchar *path = 0;
+
+ path = sipc_util_marshal_object_get_string(in_obj, "sound_path");
+
+ data.path = (enum telephony_call_sound_path)*path;
+
+ tcore_user_request_set_data(ur, sizeof( struct treq_call_sound_set_path ), &data);
+ tcore_user_request_set_command(ur, TREQ_CALL_SET_SOUND_PATH );
+
+ }break;
+
+ case TAPI_SERVICE_CALL_GET_SOUND_VOLUME_LEVEL: {
+ struct treq_call_sound_get_volume_level data;
+ gchar *sound_device = 0;
+ gchar *sound_type = 0;
+
+ sound_type = sipc_util_marshal_object_get_string(in_obj, "sound_type");
+ sound_device = sipc_util_marshal_object_get_string(in_obj, "sound_device");
+
+ data.sound = (enum telephony_call_sound_type)sound_type;
+ data.device = (enum telephony_call_sound_device)sound_device;
+
+ tcore_user_request_set_data(ur, sizeof( struct treq_call_sound_get_volume_level ), &data);
+ tcore_user_request_set_command(ur, TREQ_CALL_GET_SOUND_VOLUME_LEVEL );
+ }break;
+
+ case TAPI_SERVICE_CALL_SET_SOUND_VOLUME_LEVEL: {
+ struct treq_call_sound_set_volume_level data;
+ gchar *sound_type = 0;
+ gchar *sound_device = 0;
+ gchar *sound_volume = 0;
+
+ sound_type = sipc_util_marshal_object_get_string(in_obj, "sound_type");
+ sound_device = sipc_util_marshal_object_get_string(in_obj, "sound_device");
+ sound_volume = sipc_util_marshal_object_get_string(in_obj, "sound_volume");
+
+ data.sound = (enum telephony_call_sound_type)sound_type;
+ data.device = (enum telephony_call_sound_device)sound_device;
+ data.volume = (enum telephony_call_sound_volume_level)sound_volume;
+
+ tcore_user_request_set_data(ur, sizeof( struct treq_call_sound_set_volume_level ), &data);
+ tcore_user_request_set_command(ur, TREQ_CALL_SET_SOUND_VOLUME_LEVEL );
+
+ }break;
+
+ case TAPI_SERVICE_CALL_MUTE: {
+
+ tcore_user_request_set_command(ur, TREQ_CALL_MUTE);
+
+ }break;
+
+ case TAPI_SERVICE_CALL_UNMUTE: {
+
+ tcore_user_request_set_command(ur, TREQ_CALL_UNMUTE);
+
+ }break;
+
+ case TAPI_SERVICE_CALL_GET_MUTE_STATUS: {
+
+ tcore_user_request_set_command(ur, TREQ_CALL_GET_MUTE_STATUS);
+
+ }break;
+
+ case TAPI_SERVICE_CALL_SET_ACTIVE_LINE: {}break;
+ case TAPI_SERVICE_CALL_GET_ACTIVE_LINE: {}break;
+ case TAPI_SERVICE_CALL_ACTIVATE_CCBS: {}break;
+ }
+
+RETURN:
+
+ sipc_util_marshal_object_destory(in_obj);
+ out_obj = sipc_util_marshal_object_create();
+ sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+
+ dbg("result = %d", result);
+
+ *outparam = sipc_util_marshal_object_serializer(out_obj);
+ sipc_util_marshal_object_destory(out_obj);
+
+ if (result == FALSE) {
+ tcore_user_request_unref(ur);
+ return FALSE;
}
ret = tcore_communicator_dispatch_request(c, ur);
dbg("application channel id(%d), Command = [0x%x], data_len = %d", ui->channel_id, command, data_len);
hdr.cmd = (tapi_service_command_e)ui->client_cmd;
+ out_obj = sipc_util_marshal_object_create();
+
switch (command) {
case TRESP_CALL_DIAL: {
struct tresp_call_general* resp_data = 0;
resp_data = (struct tresp_call_general*)data;
- /*{create output data and create serialized data}
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
+
} break;
case TRESP_CALL_ANSWER: {
struct tresp_call_general* resp_data = 0;
resp_data = (struct tresp_call_general*)data;
- /*{create output data and create serialized data}
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
+
} break;
case TRESP_CALL_END: {
struct tresp_call_general* resp_data = 0;
resp_data = (struct tresp_call_general*)data;
- /*{create output data and create serialized data}
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
} break;
case TRESP_CALL_END_ALL: {
struct tresp_call_general* resp_data = 0;
resp_data = (struct tresp_call_general*)data;
- /*{create output data and create serialized data}
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
} break;
case TRESP_CALL_END_ALL_ACTIVE: {
struct tresp_call_general* resp_data = 0;
resp_data = (struct tresp_call_general*)data;
- /*{create output data and create serialized data}
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
+
} break;
case TRESP_CALL_END_ALL_HELD: {
struct tresp_call_general* resp_data = 0;
resp_data = (struct tresp_call_general*)data;
- /*{create output data and create serialized data}
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
+
} break;
case TRESP_CALL_HOLD: {
struct tresp_call_general* resp_data = 0;
resp_data = (struct tresp_call_general*)data;
- /*{create output data and create serialized data}
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
+
} break;
case TRESP_CALL_ACTIVE: {
struct tresp_call_general* resp_data = 0;
resp_data = (struct tresp_call_general*)data;
- /*{create output data and create serialized data}
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
+
} break;
case TRESP_CALL_SWAP: {
struct tresp_call_general* resp_data = 0;
resp_data = (struct tresp_call_general*)data;
- /*{create output data and create serialized data}
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
+
} break;
case TRESP_CALL_JOIN: {
struct tresp_call_general* resp_data = 0;
resp_data = (struct tresp_call_general*)data;
- /*{create output data and create serialized data}
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
+
} break;
case TRESP_CALL_SPLIT: {
struct tresp_call_general* resp_data = 0;
resp_data = (struct tresp_call_general*)data;
- /*{create output data and create serialized data}
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
+
} break;
case TRESP_CALL_DEFLECT: {
struct tresp_call_general* resp_data = 0;
resp_data = (struct tresp_call_general*)data;
- /*{create output data and create serialized data}
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &resp_data->id, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
+
} break;
case TRESP_CALL_SEND_DTMF: {
} break;
case TRESP_CALL_SET_SOUND_PATH: {
struct tresp_call_sound_general* resp_data = 0;
- //tapi_sound_error_info_t error_info = { 0 };
-
resp_data = (struct tresp_call_sound_general*)data;
- /*{create output data and create serialized data}
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ out_obj = sipc_util_marshal_object_create();
+ sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "sound_err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
+
} break;
case TRESP_CALL_SET_SOUND_VOLUME_LEVEL: {
struct tresp_call_sound_general* resp_data = 0;
- //tapi_sound_error_info_t error_info = { 0 };
- unsigned int err = 0;
-
resp_data = (struct tresp_call_sound_general*)data;
- /*{create output data and create serialized data}
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ out_obj = sipc_util_marshal_object_create();
+ sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "sound_err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
+
} break;
case TRESP_CALL_GET_SOUND_VOLUME_LEVEL: {
case TRESP_CALL_MUTE:
case TRESP_CALL_UNMUTE: {
struct tresp_call_sound_general* resp_data = 0;
- //tapi_sound_error_info_t error_info = { 0 };
- unsigned int err = 0;
-
resp_data = (struct tresp_call_sound_general*)data;
- /*{create output data and create serialized data}
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ out_obj = sipc_util_marshal_object_create();
+ sipc_util_marshal_object_add_data(out_obj, "err", &resp_data->err, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "sound_err_cause", &resp_data->cause, SIPC_MARSHAL_DATA_INT_TYPE);
+
} break;
case TRESP_CALL_GET_MUTE_STATUS: {
gchar *out_d= NULL, *serial_d = NULL;
struct custom_data *ctx = NULL;
- sipc_server_t *s = NULL;
struct _tapi_header hdr;
struct _sipc_marshal_object* out_obj = NULL;
return FALSE;
}
- s = ctx->sk_server;
dbg("notification !!! (command = 0x%x, data_len = %d)", command, data_len);
+ out_obj = sipc_util_marshal_object_create();
+
switch (command) {
case TNOTI_CALL_STATUS_IDLE: {
- //TelCallEndInfo_t resp_data;
- int *id = (int*)data;
-
- //resp_data.CallEndCause = 0;
- //resp_data.pCallHandle = *id;
- //resp_data.CallStartTime = 0;
- //resp_data.CallEndTime = 0;
-
- /*{create output data and create serialized data}
- hdr->cmd = ;
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
-
- //TAPI_EVENT_CLASS_CALL_VOICE,
- //TAPI_EVENT_CALL_END_IND,
- }
- break;
+ struct tnoti_call_status_idle *status;
+ status = (struct tnoti_call_status_idle*)data;
- case TNOTI_CALL_STATUS_DIALING:
- break;
+ sipc_util_marshal_object_add_data(out_obj, "call_type", &status->type, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &status->id, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "end_cause", &status->cause, SIPC_MARSHAL_DATA_INT_TYPE);
- case TNOTI_CALL_STATUS_ALERT:
+ } break;
- /*{create output data and create serialized data}
- hdr->cmd = ;
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ case TNOTI_CALL_STATUS_DIALING: {
+ struct tnoti_call_status_dialing *status;
+ status = (struct tnoti_call_status_dialing*)data;
- //TAPI_EVENT_CLASS_CALL_VOICE,
- //TAPI_EVENT_CALL_ALERT_IND,
- break;
+ sipc_util_marshal_object_add_data(out_obj, "call_type", &status->type, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &status->id, SIPC_MARSHAL_DATA_INT_TYPE);
- case TNOTI_CALL_STATUS_ACTIVE:
+ } break;
- /*{create output data and create serialized data}
- hdr->cmd = ;
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ case TNOTI_CALL_STATUS_ALERT: {
+ struct tnoti_call_status_alert *status;
+ status = (struct tnoti_call_status_alert*)data;
- //TAPI_EVENT_CLASS_CALL_VOICE,
- //TAPI_EVENT_CALL_CONNECTED_IND,
- break;
+ sipc_util_marshal_object_add_data(out_obj, "call_type", &status->type, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &status->id, SIPC_MARSHAL_DATA_INT_TYPE);
- case TNOTI_CALL_STATUS_HELD:
+ } break;
- /*{create output data and create serialized data}
- hdr->cmd = ;
- out_obj = sipc_util_marshal_object_create();
- sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
- sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
- .......
- */
+ case TNOTI_CALL_STATUS_ACTIVE: {
+ struct tnoti_call_status_active *status = 0;
+ status = (struct tnoti_call_status_active*)data;
- //TAPI_EVENT_CLASS_CALL_VOICE,
- //TAPI_EVENT_CALL_HOLD_IND,
- break;
+ sipc_util_marshal_object_add_data(out_obj, "call_type", &status->type, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &status->id, SIPC_MARSHAL_DATA_INT_TYPE);
+
+ } break;
+
+ case TNOTI_CALL_STATUS_HELD: {
+ struct tnoti_call_status_held *status;
+ status = (struct tnoti_call_status_held*)data;
+
+ sipc_util_marshal_object_add_data(out_obj, "call_type", &status->type, SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "call_id", &status->id, SIPC_MARSHAL_DATA_INT_TYPE);
+
+ } break;
case TNOTI_CALL_STATUS_INCOMING: {
struct tnoti_call_status_incoming *incoming = 0;
- char id[2] = {0, };
- char cli[2] = {0, };
- char forward[2] = {0, };
- char active_line[2] = {0, };
- char cna[2] = {0, };
- char number[83] = {0, };
- char name[83] = {0, };
- int ret = 0;
+ incoming = (struct tnoti_call_status_incoming*)data;
- bundle *kb = 0;
+ dbg("incoming noti publish");
- incoming = (struct tnoti_call_status_incoming*)data;
+ if ( incoming->type == CALL_TYPE_VOICE )
+ _launch_voice_call( incoming );
+ else
+ _launch_video_call( incoming );
- snprintf( id, 2, "%d", incoming->id );
- dbg("id : [%s]", id );
- snprintf( cli, 2, "%d", incoming->cli.mode );
- dbg("cli : [%s]", id );
- snprintf( number, 83, "%s", incoming->cli.number );
- dbg("number : [%s]", number );
- snprintf( forward, 2, "%d", incoming->forward );
- dbg("forward : [%s]", forward );
- snprintf( active_line, 2, "%d", incoming->active_line );
- dbg("active_line : [%s]", active_line );
- snprintf( cna, 2, "%d", incoming->cna.mode );
- dbg("cna : [%s]", cna );
- snprintf( name, 83, "%s", incoming->cna.name );
- dbg("name : [%s]", name );
-
- kb = bundle_create();
- bundle_add(kb, "launch-type", "MT");
- bundle_add(kb, "handle", id);
- bundle_add(kb, "number", number);
- bundle_add(kb, "name_mode", cna);
- bundle_add(kb, "name", name);
- bundle_add(kb, "clicause", cli);
- bundle_add(kb, "fwded", forward);
- bundle_add(kb, "activeline", active_line);
-
- ret = aul_launch_app("com.samsung.call", kb);
- bundle_free(kb);
-
- dbg("aul_launch_app [ voice call ] : %d", ret);
- return TRUE;
- }
- break;
+
+ } break;
case TNOTI_CALL_STATUS_WAITING:
default:
+ dbg("unknown notification");
+ return FALSE;
break;
}
- if(out_obj){
+ if (out_obj) {
serial_d = sipc_util_marshal_object_serializer(out_obj);
hdr.data_len = strlen(serial_d);
sipc_util_marshal_object_destory(out_obj);
out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
memcpy(out_d, &hdr, sizeof(struct _tapi_header));
- if(serial_d){
- memcpy(out_d+sizeof(struct _tapi_header), serial_d, hdr.data_len);
+ if (serial_d) {
+ memcpy(out_d + sizeof(struct _tapi_header), serial_d, hdr.data_len);
g_free(serial_d);
}
- ret = sipc_server_broadcast(s, out_d, sizeof(struct _tapi_header)+hdr.data_len);
+ ret = sipc_server_broadcast(ctx->sk_server, out_d, sizeof(struct _tapi_header) + hdr.data_len);
+ dbg("ret = %d", ret);
g_free(out_d);
- if(ret < 0){
+ if (ret < 0) {
return FALSE;
}
return TRUE;
}
+
+static void _launch_voice_call( struct tnoti_call_status_incoming* incoming )
+{
+ char id[2] = {0, };
+ char cli[2] = {0, };
+ char forward[2] = {0, };
+ char active_line[2] = {0, };
+ char cna[2] = {0, };
+ char number[83] = {0, };
+ char name[83] = {0, };
+ int ret = 0;
+
+ bundle *kb = 0;
+
+ snprintf( id, 2, "%d", incoming->id );
+ dbg("id : [%s]", id );
+ snprintf( cli, 2, "%d", incoming->cli.mode );
+ dbg("cli : [%s]", id );
+ snprintf( number, 83, "%s", incoming->cli.number );
+ dbg("number : [%s]", number );
+ snprintf( forward, 2, "%d", incoming->forward );
+ dbg("forward : [%s]", forward );
+ snprintf( active_line, 2, "%d", incoming->active_line );
+ dbg("active_line : [%s]", active_line );
+
+#if 0
+ if ( incoming->cna.mode == CALL_CNA_MODE_PRESENT )
+ snprintf( cna, 2, "%d", TAPI_CALL_NAME_AVAIL );
+ else
+ snprintf( cna, 2, "%d", TAPI_CALL_NAME_RESTRICTED );
+#endif
+
+ snprintf( cna, 2, "%d", incoming->cna.mode );
+ dbg("cna : [%s]", cna );
+ snprintf( name, 83, "%s", incoming->cna.name );
+ dbg("name : [%s]", name );
+
+ kb = bundle_create();
+ bundle_add(kb, "launch-type", "MT");
+ bundle_add(kb, "handle", id);
+ bundle_add(kb, "number", number);
+ bundle_add(kb, "name_mode", cna);
+ bundle_add(kb, "name", name);
+ bundle_add(kb, "clicause", cli);
+ bundle_add(kb, "fwded", forward);
+ bundle_add(kb, "activeline", active_line);
+
+ ret = aul_launch_app("com.samsung.call", kb);
+ bundle_free(kb);
+
+ dbg("aul_launch_app [ voice call ] : %d", ret );
+}
+
+static void _launch_video_call( struct tnoti_call_status_incoming* incoming )
+{
+ char id[2] = {0, };
+ char cli[2] = {0, };
+ char forward[2] = {0, };
+ char number[83] = {0, };
+ int ret = 0;
+
+ bundle *kb = 0;
+
+ dbg("Func Entrance");
+
+ snprintf( id, 2, "%d", incoming->id );
+ dbg("id : [%s]", id );
+ snprintf( number, 83, "%s", incoming->cli.number );
+ dbg("number : [%s]", number );
+ snprintf( cli, 2, "%d", incoming->cli.mode );
+ dbg("cli : [%s]", id );
+ snprintf( forward, 2, "%d", incoming->forward );
+ dbg("forward : [%s]", forward );
+
+ kb = bundle_create();
+ bundle_add(kb, "KEY_CALL_TYPE", "mt");
+ bundle_add(kb, "KEY_CALL_HANDLE", id);
+ bundle_add(kb, "KEY_CALLING_PARTY_NUMBER", number);
+ bundle_add(kb, "KEY_CLI_CAUSE", cli);
+ bundle_add(kb, "KEY_FORWARDED", forward);
+
+ ret = aul_launch_app("com.samsung.vtmain", kb);
+ bundle_free(kb);
+
+ dbg("VT AUL return %d",ret);
+}
+