4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
\r
6 * Contact: sharanayya mathapati <sharan.m@samsung.com>
\r
8 * Licensed under the Apache License, Version 2.0 (the "License");
\r
9 * you may not use this file except in compliance with the License.
\r
10 * You may obtain a copy of the License at
\r
12 * http://www.apache.org/licenses/LICENSE-2.0
\r
14 * Unless required by applicable law or agreed to in writing, software
\r
15 * distributed under the License is distributed on an "AS IS" BASIS,
\r
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
17 * See the License for the specific language governing permissions and
\r
18 * limitations under the License.
\r
29 #include <core_object.h>
\r
32 #include <co_call.h>
\r
33 #include <user_request.h>
\r
37 #include "s_common.h"
\r
41 #define STATUS_INCOMING 4
\r
42 #define STATUS_WAITING 5
\r
43 #define STATUS_CONNECTED 7
\r
46 static gboolean setsoundpath = FALSE;
\r
47 static gboolean soundvolume = FALSE;
\r
49 // End Cause field - Call state end cause
\r
54 // These definitions are taken from GSM 04.08 Table 10.86
\r
56 CC_CAUSE_UNASSIGNED_NUMBER,
\r
57 CC_CAUSE_NO_ROUTE_TO_DEST,
\r
58 CC_CAUSE_CHANNEL_UNACCEPTABLE,
\r
59 CC_CAUSE_OPERATOR_DETERMINED_BARRING,
\r
60 CC_CAUSE_NORMAL_CALL_CLEARING,
\r
62 CC_CAUSE_NO_USER_RESPONDING,
\r
63 CC_CAUSE_USER_ALERTING_NO_ANSWER,
\r
64 CC_CAUSE_CALL_REJECTED,
\r
65 CC_CAUSE_NUMBER_CHANGED,
\r
66 CC_CAUSE_NON_SELECTED_USER_CLEARING,
\r
67 CC_CAUSE_DESTINATION_OUT_OF_ORDER,
\r
68 CC_CAUSE_INVALID_NUMBER_FORMAT,
\r
69 CC_CAUSE_FACILITY_REJECTED,
\r
70 CC_CAUSE_RESPONSE_TO_STATUS_ENQUIRY,
\r
71 CC_CAUSE_NORMAL_UNSPECIFIED,
\r
72 CC_CAUSE_NO_CIRCUIT_CHANNEL_AVAILABLE,
\r
73 CC_CAUSE_NETWORK_OUT_OF_ORDER,
\r
74 CC_CAUSE_TEMPORARY_FAILURE,
\r
75 CC_CAUSE_SWITCHING_EQUIPMENT_CONGESTION,
\r
76 CC_CAUSE_ACCESS_INFORMATION_DISCARDED,
\r
77 CC_CAUSE_REQUESTED_CIRCUIT_CHANNEL_NOT_AVAILABLE,
\r
78 CC_CAUSE_RESOURCES_UNAVAILABLE_UNSPECIFIED,
\r
79 CC_CAUSE_QUALITY_OF_SERVICE_UNAVAILABLE,
\r
80 CC_CAUSE_REQUESTED_FACILITY_NOT_SUBSCRIBED,
\r
81 CC_CAUSE_INCOMING_CALL_BARRED_WITHIN_CUG,
\r
82 CC_CAUSE_BEARER_CAPABILITY_NOT_AUTHORISED,
\r
83 CC_CAUSE_BEARER_CAPABILITY_NOT_PRESENTLY_AVAILABLE,
\r
84 CC_CAUSE_SERVICE_OR_OPTION_NOT_AVAILABLE,
\r
85 CC_CAUSE_BEARER_SERVICE_NOT_IMPLEMENTED,
\r
86 CC_CAUSE_ACM_GEQ_ACMMAX,
\r
87 CC_CAUSE_REQUESTED_FACILITY_NOT_IMPLEMENTED,
\r
88 CC_CAUSE_ONLY_RESTRICTED_DIGITAL_INFO_BC_AVAILABLE,
\r
89 CC_CAUSE_SERVICE_OR_OPTION_NOT_IMPLEMENTED,
\r
90 CC_CAUSE_INVALID_TRANSACTION_ID_VALUE,
\r
91 CC_CAUSE_USER_NOT_MEMBER_OF_CUG,
\r
92 CC_CAUSE_INCOMPATIBLE_DESTINATION,
\r
93 CC_CAUSE_INVALID_TRANSIT_NETWORK_SELECTION,
\r
94 CC_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE,
\r
95 CC_CAUSE_INVALID_MANDATORY_INFORMATION,
\r
96 CC_CAUSE_MESSAGE_TYPE_NON_EXISTENT,
\r
97 CC_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROT_STATE,
\r
98 CC_CAUSE_IE_NON_EXISTENT_OR_NOT_IMPLEMENTED,
\r
99 CC_CAUSE_CONDITIONAL_IE_ERROR,
\r
100 CC_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE,
\r
101 CC_CAUSE_RECOVERY_ON_TIMER_EXPIRY,
\r
102 CC_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
\r
103 CC_CAUSE_INTERWORKING_UNSPECIFIED,
\r
104 CC_CAUSE_END = 128,
\r
107 REJECT_CAUSE_IMSI_UNKNOWN_IN_HLR,
\r
108 REJECT_CAUSE_ILLEGAL_MS,
\r
109 REJECT_CAUSE_IMSI_UNKNOWN_IN_VLR,
\r
110 REJECT_CAUSE_IMEI_NOT_ACCEPTED,
\r
111 REJECT_CAUSE_ILLEGAL_ME,
\r
112 REJECT_CAUSE_GPRS_SERVICES_NOT_ALLOWED,
\r
113 REJECT_CAUSE_GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED,
\r
114 REJECT_CAUSE_MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK,
\r
115 REJECT_CAUSE_IMPLICITLY_DETACHED,
\r
116 REJECT_CAUSE_PLMN_NOT_ALLOWED,
\r
117 REJECT_CAUSE_LA_NOT_ALLOWED,
\r
118 REJECT_CAUSE_NATIONAL_ROAMING_NOT_ALLOWED,
\r
119 REJECT_CAUSE_GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN,
\r
120 REJECT_CAUSE_NO_SUITABLE_CELLS_IN_LA,
\r
121 REJECT_CAUSE_MSC_TEMPORARILY_NOT_REACHABLE,
\r
122 REJECT_CAUSE_NETWORK_FAILURE ,
\r
123 REJECT_CAUSE_MAC_FAILURE,
\r
124 REJECT_CAUSE_SYNCH_FAILURE,
\r
125 REJECT_CAUSE_CONGESTTION,
\r
126 REJECT_CAUSE_GSM_AUTH_UNACCEPTED,
\r
127 REJECT_CAUSE_SERVICE_OPTION_NOT_SUPPORTED,
\r
128 REJECT_CAUSE_REQ_SERV_OPT_NOT_SUBSCRIBED,
\r
129 REJECT_CAUSE_SERVICE_OPT__OUT_OF_ORDER,
\r
130 REJECT_CAUSE_CALL_CANNOT_BE_IDENTIFIED,
\r
131 REJECT_CAUSE_NO_PDP_CONTEXT_ACTIVATED,
\r
132 REJECT_CAUSE_RETRY_UPON_ENTRY_INTO_A_NEW_CELL_MIN_VALUE,
\r
133 REJECT_CAUSE_RETRY_UPON_ENTRY_INTO_A_NEW_CELL_MAX_VALUE,
\r
134 REJECT_CAUSE_SEMANTICALLY_INCORRECT_MSG,
\r
135 REJECT_CAUSE_INVALID_MANDATORY_INFO,
\r
136 REJECT_CAUSE_MESSAGE_TYPE_NON_EXISTANT,
\r
137 REJECT_CAUSE_MESSAGE_TYPE_NOT_COMP_PRT_ST,
\r
138 REJECT_CAUSE_IE_NON_EXISTANT,
\r
139 REJECT_CAUSE_MSG_NOT_COMPATIBLE_PROTOCOL_STATE,
\r
142 // Connection Management establishment rejection cause
\r
143 REJECT_CAUSE_REJ_UNSPECIFIED,
\r
145 // AS reject causes
\r
146 REJECT_CAUSE_AS_REJ_RR_REL_IND,
\r
147 REJECT_CAUSE_AS_REJ_RR_RANDOM_ACCESS_FAILURE,
\r
148 REJECT_CAUSE_AS_REJ_RRC_REL_IND,
\r
149 REJECT_CAUSE_AS_REJ_RRC_CLOSE_SESSION_IND,
\r
150 REJECT_CAUSE_AS_REJ_RRC_OPEN_SESSION_FAILURE,
\r
151 REJECT_CAUSE_AS_REJ_LOW_LEVEL_FAIL,
\r
152 REJECT_CAUSE_AS_REJ_LOW_LEVEL_FAIL_REDIAL_NOT_ALLOWED,
\r
153 REJECT_CAUSE_AS_REJ_LOW_LEVEL_IMMED_RETRY,
\r
155 // MM reject causes
\r
156 REJECT_CAUSE_MM_REJ_INVALID_SIM,
\r
157 REJECT_CAUSE_MM_REJ_NO_SERVICE,
\r
158 REJECT_CAUSE_MM_REJ_TIMER_T3230_EXP,
\r
159 REJECT_CAUSE_MM_REJ_NO_CELL_AVAILABLE,
\r
160 REJECT_CAUSE_MM_REJ_WRONG_STATE,
\r
161 REJECT_CAUSE_MM_REJ_ACCESS_CLASS_BLOCKED,
\r
162 // Definitions for release ind causes between MM and CNM
\r
163 REJECT_CAUSE_ABORT_MSG_RECEIVED,
\r
164 REJECT_CAUSE_OTHER_CAUSE,
\r
166 // CNM reject causes
\r
167 REJECT_CAUSE_CNM_REJ_TIMER_T303_EXP,
\r
168 REJECT_CAUSE_CNM_REJ_NO_RESOURCES,
\r
169 REJECT_CAUSE_CNM_MM_REL_PENDING,
\r
170 REJECT_CAUSE_CNM_INVALID_USER_DATA,
\r
171 CALL_END_CAUSE_MAX = 255
\r
172 }call_end_cause_e_type;
\r
175 struct clcc_call_t {
\r
176 struct call_CLCC_info {
\r
178 enum tcore_call_direction direction;
\r
179 enum tcore_call_status status;
\r
180 enum tcore_call_type type;
\r
191 }call_end_cause_info;
\r
193 /**************************************************************************
\r
194 * Local Function Prototypes
\r
195 **************************************************************************/
\r
196 /************************* REQUESTS ***************************/
\r
197 static void _call_status_idle(TcorePlugin *p, CallObject *co);
\r
198 static void _call_status_active(TcorePlugin *p, CallObject *co);
\r
199 static void _call_status_dialing(TcorePlugin *p, CallObject *co);
\r
200 static void _call_status_alert(TcorePlugin *p, CallObject *co);
\r
201 static void _call_status_incoming(TcorePlugin *p, CallObject *co);
\r
202 static void _call_status_waiting(TcorePlugin *p, CallObject *co);
\r
203 static TReturn _call_list_get(CoreObject *o, gboolean *event_flag);
\r
204 static TReturn _set_dtmf_tone_duration(CoreObject *o, UserRequest *ur);
\r
206 /************************* CONFIRMATION ***************************/
\r
207 static void on_confirmation_call_message_send(TcorePending *p, gboolean result, void *user_data); // from Kernel
\r
208 static void on_confirmation_call_hold(TcorePending *p, int data_len, const void *data, void *user_data);
\r
209 static void on_confirmation_call_swap(TcorePending *p, int data_len, const void *data, void *user_data);
\r
210 static void on_confirmation_call_split(TcorePending *p, int data_len, const void *data, void *user_data);
\r
211 static void on_confirmation_call_hold_and_accept(TcorePending *p, int data_len, const void *data, void *user_data);
\r
213 static void _on_confirmation_call_release(TcorePending *p, int data_len, const void *data, void *user_data, int type);
\r
214 static void _on_confirmation_call(TcorePending *p, int data_len, const void *data, void *user_data, int type);
\r
215 static void _on_confirmation_dtmf_tone_duration(TcorePending *p, int data_len, const void *data, void *user_data);
\r
216 static void _on_confirmation_call_end_cause(TcorePending * p, int data_len, const void * data, void * user_data);
\r
218 /************************* RESPONSES ***************************/
\r
219 static void on_response_call_list_get(TcorePending *p, int data_len, const void *data, void *user_data);
\r
221 /************************* NOTIIFICATIONS ***************************/
\r
222 static void on_notification_call_waiting(CoreObject *o, const void *data, void *user_data);
\r
223 static void on_notification_call_incoming(CoreObject *o, const void *data, void *user_data);
\r
224 static void on_notification_call_status(CoreObject *o, const void *data, void *user_data);
\r
225 static gboolean on_notification_call_info(CoreObject *o, const void *data, void *user_data);
\r
226 static gboolean on_notification_call_clip_info(CoreObject *o, const void *data, void *user_data);
\r
229 /**************************************************************************
\r
230 * Local Utility Function Prototypes
\r
231 **************************************************************************/
\r
232 static gboolean _call_request_message(TcorePending *pending, CoreObject *o, UserRequest* ur, void* on_resp, void* user_data);
\r
233 static void _call_branch_by_status(TcorePlugin *p, CallObject *co, unsigned int status);
\r
234 static int _callFromCLCCLine(char *line, struct clcc_call_t *p_call);
\r
236 /**************************************************************************
\r
237 * Local Function Definitions
\r
238 **************************************************************************/
\r
240 const call_end_cause_info call_end_cause_table[] = { // call end cause table to convert Netwotk cause to TAPI cause
\r
242 { 1, CC_CAUSE_UNASSIGNED_NUMBER}, { 3, CC_CAUSE_NO_ROUTE_TO_DEST},
\r
243 { 6, CC_CAUSE_CHANNEL_UNACCEPTABLE}, { 8, CC_CAUSE_OPERATOR_DETERMINED_BARRING},
\r
244 { 16, CC_CAUSE_NORMAL_CALL_CLEARING}, { 17, CC_CAUSE_USER_BUSY},
\r
245 { 18, CC_CAUSE_NO_USER_RESPONDING}, { 19, CC_CAUSE_USER_ALERTING_NO_ANSWER},
\r
246 { 21, CC_CAUSE_CALL_REJECTED}, { 22, CC_CAUSE_NUMBER_CHANGED},
\r
247 { 26, CC_CAUSE_NON_SELECTED_USER_CLEARING}, { 27, CC_CAUSE_DESTINATION_OUT_OF_ORDER},
\r
248 { 28, CC_CAUSE_INVALID_NUMBER_FORMAT}, { 29, CC_CAUSE_FACILITY_REJECTED},
\r
249 { 30, CC_CAUSE_RESPONSE_TO_STATUS_ENQUIRY}, { 31, CC_CAUSE_NORMAL_UNSPECIFIED},
\r
250 { 34, CC_CAUSE_NO_CIRCUIT_CHANNEL_AVAILABLE},{ 38, CC_CAUSE_NETWORK_OUT_OF_ORDER},
\r
251 { 41, CC_CAUSE_TEMPORARY_FAILURE}, { 42, CC_CAUSE_SWITCHING_EQUIPMENT_CONGESTION},
\r
252 { 43, CC_CAUSE_ACCESS_INFORMATION_DISCARDED},{ 44, CC_CAUSE_REQUESTED_CIRCUIT_CHANNEL_NOT_AVAILABLE},
\r
253 { 47, CC_CAUSE_RESOURCES_UNAVAILABLE_UNSPECIFIED}, { 49, CC_CAUSE_QUALITY_OF_SERVICE_UNAVAILABLE},
\r
254 { 50, CC_CAUSE_REQUESTED_FACILITY_NOT_SUBSCRIBED}, { 55, CC_CAUSE_INCOMING_CALL_BARRED_WITHIN_CUG},
\r
255 { 57, CC_CAUSE_BEARER_CAPABILITY_NOT_AUTHORISED}, { 58, CC_CAUSE_BEARER_CAPABILITY_NOT_PRESENTLY_AVAILABLE},
\r
256 { 63, CC_CAUSE_SERVICE_OR_OPTION_NOT_AVAILABLE}, { 65, CC_CAUSE_BEARER_SERVICE_NOT_IMPLEMENTED},
\r
257 { 68, CC_CAUSE_ACM_GEQ_ACMMAX}, { 69, CC_CAUSE_REQUESTED_FACILITY_NOT_IMPLEMENTED},
\r
258 { 70, CC_CAUSE_ONLY_RESTRICTED_DIGITAL_INFO_BC_AVAILABLE}, { 79, CC_CAUSE_SERVICE_OR_OPTION_NOT_IMPLEMENTED},
\r
259 { 81, CC_CAUSE_INVALID_TRANSACTION_ID_VALUE}, { 87, CC_CAUSE_USER_NOT_MEMBER_OF_CUG},
\r
260 { 88, CC_CAUSE_INCOMPATIBLE_DESTINATION}, { 91, CC_CAUSE_INVALID_TRANSIT_NETWORK_SELECTION},
\r
261 { 95, CC_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE}, { 96, CC_CAUSE_INVALID_MANDATORY_INFORMATION},
\r
262 { 97, CC_CAUSE_MESSAGE_TYPE_NON_EXISTENT}, { 98, CC_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROT_STATE},
\r
263 { 99, CC_CAUSE_IE_NON_EXISTENT_OR_NOT_IMPLEMENTED}, { 100, CC_CAUSE_CONDITIONAL_IE_ERROR},
\r
264 { 101,CC_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE},{ 102, CC_CAUSE_RECOVERY_ON_TIMER_EXPIRY},
\r
265 { 111 ,CC_CAUSE_PROTOCOL_ERROR_UNSPECIFIED}, {127, CC_CAUSE_INTERWORKING_UNSPECIFIED},
\r
269 static enum tcore_call_cli_mode _get_clir_status(char *num)
\r
271 enum tcore_call_cli_mode clir = CALL_CLI_MODE_DEFAULT;
\r
274 if(!strncmp(num, "*31#", 4)) {
\r
275 dbg("CLI mode restricted");
\r
276 return TCORE_CALL_CLI_MODE_RESTRICT;
\r
279 if(!strncmp(num, "#31#", 4)) {
\r
280 dbg("CLI mode allowed");
\r
281 return TCORE_CALL_CLI_MODE_PRESENT;
\r
288 static enum tcore_call_status _call_status(unsigned int status)
\r
294 return TCORE_CALL_STATUS_ACTIVE;
\r
296 return TCORE_CALL_STATUS_HELD;
\r
298 return TCORE_CALL_STATUS_DIALING;
\r
300 return TCORE_CALL_STATUS_ALERT;
\r
302 return TCORE_CALL_STATUS_INCOMING;
\r
304 return TCORE_CALL_STATUS_WAITING;
\r
305 case 6: // DISCONNECTED state // FALL THROUGH
\r
307 return TCORE_CALL_STATUS_IDLE;
\r
311 static gboolean _call_is_in_mpty(int mpty)
\r
327 static enum tcore_call_type call_type(int type)
\r
333 return TCORE_CALL_TYPE_VOICE;
\r
335 return TCORE_CALL_TYPE_VIDEO;
\r
340 return TCORE_CALL_TYPE_VOICE;
\r
343 static int _compare_call_end_cause(int networkcause)
\r
345 unsigned int count;
\r
346 for (count = 0; count < sizeof(call_end_cause_table)/sizeof(call_end_cause_info); count++){
\r
347 if (call_end_cause_table[count].network_cause == networkcause)
\r
348 return (call_end_cause_table[count].tapi_cause);
\r
350 return CC_CAUSE_NORMAL_CALL_CLEARING;
\r
354 static gboolean on_notification_call_clip_info(CoreObject *o, const void *data, void *user_data)
\r
363 static gboolean on_notification_call_info(CoreObject *o, const void *data, void *user_data)
\r
365 GSList *tokens = NULL;
\r
366 GSList *lines = NULL;
\r
367 const char *line = NULL;
\r
373 lines = (GSList*)data;
\r
374 if (1 != g_slist_length(lines)) {
\r
375 err("Unsolicited message, BUT multiple lines present");
\r
379 line = (char*)(lines->data);
\r
380 tokens = tcore_at_tok_new(line);
\r
382 stat = g_slist_nth_data(tokens, 1);
\r
384 dbg("Stat is missing from %XCALLSTAT indiaction");
\r
387 status = atoi(stat);
\r
390 case STATUS_INCOMING:
\r
391 dbg("calling on_notification_call_incoming");
\r
392 on_notification_call_incoming(o, line, user_data);
\r
394 case STATUS_WAITING:
\r
395 dbg("calling on_notification_call_waiting");
\r
396 on_notification_call_waiting(o, line, user_data);
\r
398 case STATUS_CONNECTED: /*igonre Connected state. */
\r
399 dbg("Connected state");
\r
402 dbg("calling on_notification_call_status");
\r
403 on_notification_call_status(o, line, user_data);
\r
409 tcore_at_tok_free(tokens);
\r
416 static gboolean _call_request_message(TcorePending *pending,
\r
422 TcoreHal *hal = NULL;
\r
426 tcore_pending_set_timeout(pending, 0);
\r
427 tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT);
\r
430 tcore_pending_set_response_callback(pending, on_resp, user_data);
\r
432 tcore_pending_set_send_callback(pending, on_confirmation_call_message_send, NULL);
\r
435 tcore_pending_link_user_request(pending, ur);
\r
438 err("User Request is NULL, is this internal request??");
\r
442 hal = tcore_object_get_hal(o);
\r
443 // Send request to HAL
\r
444 ret = tcore_hal_send_request(hal, pending);
\r
445 if(TCORE_RETURN_SUCCESS != ret) {
\r
446 err("Request send failed");
\r
454 static void _call_status_idle(TcorePlugin *p, CallObject *co)
\r
456 CoreObject *core_obj = NULL;
\r
457 char *cmd_str = NULL;
\r
458 TcorePending *pending = NULL;
\r
459 TcoreATRequest *req = NULL;
\r
460 gboolean ret = FALSE;
\r
464 core_obj = tcore_plugin_ref_core_object(p, "call");
\r
465 dbg("Call ID [%d], Call Status [%d]", tcore_call_object_get_id(co), tcore_call_object_get_status(co));
\r
467 if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_IDLE) {
\r
469 //get call end cause.
\r
470 cmd_str = g_strdup_printf("%s","AT+XCEER");
\r
471 dbg("Request command string: %s", cmd_str);
\r
473 // Create new Pending request
\r
474 pending = tcore_pending_new(core_obj, 0);
\r
476 // Create new AT-Command request
\r
477 req = tcore_at_request_new(cmd_str, "+XCEER", TCORE_AT_SINGLELINE);
\r
478 dbg("Command: %s, prefix(if any): %s, Command length: %d", req->cmd, req->prefix, strlen(req->cmd));
\r
479 // Free command string
\r
482 // Set request data (AT command) to Pending request
\r
483 tcore_pending_set_request_data(pending, 0, req);
\r
485 ur = tcore_user_request_new(NULL, NULL);
\r
487 ret = _call_request_message (pending, core_obj, ur, _on_confirmation_call_end_cause, co);
\r
490 err("Failed to send AT-Command request");
\r
496 err("Call object was not free");
\r
497 tcore_call_object_free(core_obj, co);
\r
503 static void _call_status_dialing(TcorePlugin *p, CallObject *co)
\r
505 struct tnoti_call_status_dialing data;
\r
508 if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_DIALING) {
\r
509 data.type = tcore_call_object_get_type(co);
\r
510 dbg("data.type : [%d]", data.type);
\r
512 data.id = tcore_call_object_get_id(co);
\r
513 dbg("data.id : [%d]", data.id);
\r
516 tcore_call_object_set_status(co, TCORE_CALL_STATUS_DIALING);
\r
518 // Send notification to TAPI
\r
519 tcore_server_send_notification(tcore_plugin_ref_server(p),
\r
520 tcore_plugin_ref_core_object(p, "call"),
\r
521 TNOTI_CALL_STATUS_DIALING,
\r
522 sizeof(struct tnoti_call_status_dialing),
\r
531 static void _call_status_alert(TcorePlugin *p, CallObject *co)
\r
533 struct tnoti_call_status_alert data;
\r
536 // Alerting has just 1 data 'CALL ID'
\r
537 if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_ALERT) {
\r
538 data.type = tcore_call_object_get_type(co);
\r
539 dbg("data.type : [%d]", data.type);
\r
541 data.id = tcore_call_object_get_id(co);
\r
542 dbg("data.id : [%d]", data.id);
\r
545 tcore_call_object_set_status(co, TCORE_CALL_STATUS_ALERT);
\r
547 // Send notification to TAPI
\r
548 tcore_server_send_notification(tcore_plugin_ref_server(p),
\r
549 tcore_plugin_ref_core_object(p, "call"),
\r
550 TNOTI_CALL_STATUS_ALERT,
\r
551 sizeof(struct tnoti_call_status_alert),
\r
559 static void _call_status_active(TcorePlugin *p, CallObject *co)
\r
561 struct tnoti_call_status_active data;
\r
564 if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_ACTIVE) {
\r
565 data.type = tcore_call_object_get_type(co);
\r
566 dbg("data.type : [%d]", data.type);
\r
568 data.id = tcore_call_object_get_id(co);
\r
569 dbg("data.id : [%d]", data.id);
\r
572 tcore_call_object_set_status(co, TCORE_CALL_STATUS_ACTIVE);
\r
574 // Send notification to TAPI
\r
575 tcore_server_send_notification(tcore_plugin_ref_server(p),
\r
576 tcore_plugin_ref_core_object(p, "call"),
\r
577 TNOTI_CALL_STATUS_ACTIVE,
\r
578 sizeof(struct tnoti_call_status_active),
\r
586 static void _call_status_held(TcorePlugin *p, CallObject *co)
\r
588 struct tnoti_call_status_held data;
\r
591 if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_HELD) {
\r
592 data.type = tcore_call_object_get_type(co);
\r
593 dbg("data.type : [%d]", data.type);
\r
595 data.id = tcore_call_object_get_id(co);
\r
596 dbg("data.id : [%d]", data.id);
\r
599 tcore_call_object_set_status(co, TCORE_CALL_STATUS_HELD);
\r
601 // Send notification to TAPI
\r
602 tcore_server_send_notification(tcore_plugin_ref_server(p),
\r
603 tcore_plugin_ref_core_object(p, "call"),
\r
604 TNOTI_CALL_STATUS_HELD,
\r
605 sizeof(struct tnoti_call_status_held),
\r
613 static void _call_status_incoming(TcorePlugin *p, CallObject *co)
\r
615 struct tnoti_call_status_incoming data;
\r
618 if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_INCOMING) {
\r
619 tcore_call_object_set_status(co, TCORE_CALL_STATUS_INCOMING);
\r
621 data.type = tcore_call_object_get_type(co);
\r
622 dbg("data.type : [%d]", data.type);
\r
624 data.id = tcore_call_object_get_id(co);
\r
625 dbg("data.id : [%d]", data.id);
\r
627 data.cli.mode = tcore_call_object_get_cli_mode(co);
\r
628 dbg("data.cli.mode : [%d]", data.cli.mode);
\r
630 tcore_call_object_get_number(co, data.cli.number);
\r
631 dbg("data.cli.number : [%s]", data.cli.number);
\r
633 data.cna.mode = tcore_call_object_get_cna_mode(co);
\r
634 dbg("data.cna.mode : [%d]", data.cna.mode);
\r
636 tcore_call_object_get_name(co, data.cna.name);
\r
637 dbg("data.cna.name : [%s]", data.cna.name);
\r
639 data.forward = FALSE; // this is tmp code
\r
641 data.active_line = tcore_call_object_get_active_line(co);
\r
642 dbg("data.active_line : [%d]", data.active_line);
\r
644 // Send notification to TAPI
\r
645 tcore_server_send_notification(tcore_plugin_ref_server(p),
\r
646 tcore_plugin_ref_core_object(p, "call"),
\r
647 TNOTI_CALL_STATUS_INCOMING,
\r
648 sizeof(struct tnoti_call_status_incoming),
\r
656 static void _call_status_waiting(TcorePlugin *p, CallObject *co)
\r
659 _call_status_incoming(p, co);
\r
665 static void _call_branch_by_status(TcorePlugin *p, CallObject *co, unsigned int status)
\r
669 dbg("Call Status is %d", status);
\r
671 case TCORE_CALL_STATUS_IDLE:
\r
672 _call_status_idle(p, co);
\r
675 case TCORE_CALL_STATUS_ACTIVE:
\r
676 _call_status_active(p, co);
\r
679 case TCORE_CALL_STATUS_HELD:
\r
680 _call_status_held(p, co);
\r
683 case TCORE_CALL_STATUS_DIALING:
\r
684 _call_status_dialing(p, co);
\r
687 case TCORE_CALL_STATUS_ALERT:
\r
688 _call_status_alert(p, co);
\r
691 case TCORE_CALL_STATUS_INCOMING:
\r
692 _call_status_incoming(p, co);
\r
695 case TCORE_CALL_STATUS_WAITING:
\r
696 _call_status_waiting(p, co);
\r
704 static TReturn _call_list_get(CoreObject *o, gboolean *event_flag)
\r
706 UserRequest* ur = NULL;
\r
707 TcorePending *pending = NULL;
\r
708 char *cmd_str = NULL;
\r
709 TcoreATRequest *req = NULL;
\r
710 gboolean ret = FALSE;
\r
714 err("Core Object is NULL");
\r
715 return TCORE_RETURN_FAILURE;
\r
718 // Create new User Request
\r
719 ur = tcore_user_request_new(NULL, NULL);
\r
722 cmd_str = g_strdup("AT+CLCC");
\r
724 // Create new Pending Request
\r
725 pending = tcore_pending_new(o, 0);
\r
726 req = tcore_at_request_new(cmd_str, "+CLCC", TCORE_AT_MULTILINE);
\r
730 dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
\r
732 tcore_pending_set_request_data(pending, 0, req);
\r
734 ret = _call_request_message (pending, o, ur, on_response_call_list_get, event_flag);
\r
736 err("AT request (%s) sending failed", req->cmd);
\r
737 return TCORE_RETURN_FAILURE;
\r
740 dbg("AT request sent success");
\r
741 return TCORE_RETURN_SUCCESS;
\r
745 static void on_confirmation_call_message_send(TcorePending *p, gboolean result, void *user_data)
\r
749 if (result == FALSE) { // Fail
\r
760 static void on_confirmation_call_outgoing(TcorePending *p, int data_len, const void *data, void *user_data)
\r
762 UserRequest *ur = NULL;
\r
763 GSList *tokens = NULL;
\r
764 const char *line = NULL;
\r
765 const TcoreATResponse* response = data;
\r
766 struct tresp_call_dial resp;
\r
770 ur = tcore_pending_ref_user_request(p);
\r
772 if (response->success > 0) {
\r
773 dbg("RESPONSE OK");
\r
774 resp.err = TCORE_RETURN_SUCCESS;
\r
777 dbg("RESPONSE NOT OK");
\r
779 line = (const char*)response->final_response;
\r
780 tokens = tcore_at_tok_new(line);
\r
782 if (g_slist_length(tokens) < 1) {
\r
783 err("Unspecified error cause OR string corrupted");
\r
784 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
787 error = atoi(g_slist_nth_data(tokens, 0));
\r
789 // TODO: CMEE error mapping is required.
\r
790 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
794 tcore_at_tok_free(tokens);
\r
797 // Send Response to TAPI
\r
798 tcore_user_request_send_response(ur, TRESP_CALL_DIAL, sizeof(struct tresp_call_dial), &resp);
\r
801 err("User Request is NULL");
\r
808 static void on_confirmation_call_accept(TcorePending *p, int data_len, const void *data, void *user_data)
\r
810 UserRequest *ur = NULL;
\r
811 GSList *tokens = NULL;
\r
812 const char *line = NULL;
\r
813 const TcoreATResponse* response = data;
\r
814 struct tresp_call_answer resp;
\r
818 ur = tcore_pending_ref_user_request(p);
\r
820 if (response->success > 0) {
\r
821 dbg("RESPONSE OK");
\r
822 resp.err = TCORE_RETURN_SUCCESS;
\r
825 dbg("RESPONSE NOT OK");
\r
827 line = (const char*)response->final_response;
\r
828 tokens = tcore_at_tok_new(line);
\r
830 if (g_slist_length(tokens) < 1) {
\r
831 err("Unspecified error cause OR string corrupted");
\r
832 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
835 error = atoi(g_slist_nth_data(tokens, 0));
\r
837 // TODO: CMEE error mapping is required.
\r
838 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
842 tcore_at_tok_free(tokens);
\r
845 resp.id = tcore_call_object_get_id((CallObject*)user_data);
\r
847 // Send Response to TAPI
\r
848 tcore_user_request_send_response(ur, TRESP_CALL_ANSWER, sizeof(struct tresp_call_answer), &resp);
\r
851 err("User Request is NULL");
\r
859 static void on_confirmation_call_reject(TcorePending *p, int data_len, const void *data, void *user_data)
\r
861 UserRequest *ur = NULL;
\r
862 GSList *tokens = NULL;
\r
863 const char *line = NULL;
\r
864 const TcoreATResponse* response = data;
\r
865 struct tresp_call_answer resp;
\r
870 ur = tcore_pending_ref_user_request(p);
\r
872 if (response->success > 0) {
\r
874 dbg("RESPONSE OK");
\r
875 resp.err = TCORE_RETURN_SUCCESS;
\r
879 dbg("RESPONSE NOT OK");
\r
880 line = (const char*)response->final_response;
\r
881 tokens = tcore_at_tok_new(line);
\r
883 if (g_slist_length(tokens) < 1) {
\r
884 err("Unspecified error cause OR string corrupted");
\r
885 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
889 error = atoi(g_slist_nth_data(tokens, 0));
\r
890 // TODO: CMEE error mapping is required.
\r
891 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
895 tcore_at_tok_free(tokens);
\r
898 resp.id = tcore_call_object_get_id((CallObject*)user_data);
\r
900 //Send Response to TAPI
\r
901 tcore_user_request_send_response(ur, TRESP_CALL_ANSWER, sizeof(struct tresp_call_answer), &resp);
\r
904 err("User Request is NULL");
\r
911 static void on_confirmation_call_replace(TcorePending *p, int data_len, const void *data, void *user_data)
\r
913 UserRequest *ur = NULL;
\r
914 GSList *tokens = NULL;
\r
915 const char *line = NULL;
\r
916 const TcoreATResponse* response = data;
\r
917 struct tresp_call_answer resp;
\r
921 ur = tcore_pending_ref_user_request(p);
\r
923 if (response->success > 0) {
\r
924 dbg("RESPONSE OK");
\r
925 resp.err = TCORE_RETURN_SUCCESS;
\r
929 dbg("RESPONSE NOT OK");
\r
930 line = (const char*)response->final_response;
\r
931 tokens = tcore_at_tok_new(line);
\r
933 if (g_slist_length(tokens) < 1) {
\r
934 err("Unspecified error cause OR string corrupted");
\r
935 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
938 error = atoi(g_slist_nth_data(tokens, 0));
\r
939 // TODO: CMEE error mapping is required.
\r
940 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
944 tcore_at_tok_free(tokens);
\r
946 resp.id = tcore_call_object_get_id((CallObject*)user_data);
\r
948 // Send Response to TAPI
\r
949 tcore_user_request_send_response(ur, TRESP_CALL_ANSWER, sizeof(struct tresp_call_answer), &resp);
\r
952 dbg("User Request is NULL");
\r
959 static void on_confirmation_call_hold_and_accept(TcorePending *p, int data_len, const void *data, void *user_data)
\r
961 CoreObject *o = NULL;
\r
962 UserRequest *ur = NULL;
\r
963 GSList *tokens = NULL;
\r
964 const char *line = NULL;
\r
965 const TcoreATResponse* response = data;
\r
966 struct tresp_call_answer resp;
\r
971 o = tcore_pending_ref_core_object(p);
\r
972 ur = tcore_pending_ref_user_request(p);
\r
973 resp.id = tcore_call_object_get_id((CallObject*)user_data);
\r
976 if (response->success > 0) {
\r
977 dbg("RESPONSE OK");
\r
978 resp.err = TCORE_RETURN_SUCCESS;
\r
981 err("RESPONSE NOT OK");
\r
982 line = (const char*)response->final_response;
\r
983 tokens = tcore_at_tok_new(line);
\r
985 if (g_slist_length(tokens) < 1) {
\r
986 err("Unspecified error cause OR string corrupted");
\r
987 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
990 error = atoi(g_slist_nth_data(tokens, 0));
\r
992 // TODO: CMEE error mapping is required.
\r
993 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
997 tcore_at_tok_free(tokens);
\r
1000 // Send response to TAPI
\r
1001 tcore_user_request_send_response(ur, TRESP_CALL_ANSWER, sizeof(struct tresp_call_answer), &resp);
\r
1005 CallObject *co = NULL;
\r
1008 list = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_ACTIVE);
\r
1010 err("Can't find active Call");
\r
1014 co = (CallObject*)list->data;
\r
1016 err("Can't get active Call object");
\r
1020 // Set Call Status
\r
1021 tcore_call_object_set_status(co, TCORE_CALL_STATUS_HELD);
\r
1022 dbg("Call status is set to HELD");
\r
1026 err("User Request is NULL");
\r
1033 static void _on_confirmation_call_release(TcorePending *p, int data_len, const void *data, void *user_data, int type)
\r
1035 UserRequest *ur = NULL;
\r
1036 struct tresp_call_end resp;
\r
1037 GSList *tokens = NULL;
\r
1038 const char *line = NULL;
\r
1040 const TcoreATResponse* response = data;
\r
1043 ur = tcore_pending_ref_user_request(p);
\r
1045 if (response->success > 0) {
\r
1046 dbg("RESPONSE OK");
\r
1047 resp.err = TCORE_RETURN_SUCCESS;
\r
1050 err("RESPONSE NOT OK");
\r
1052 line = (const char*)response->final_response;
\r
1053 tokens = tcore_at_tok_new(line);
\r
1055 if (g_slist_length(tokens) < 1) {
\r
1056 err("Unspecified error cause OR string corrupted");
\r
1057 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1060 error = atoi(g_slist_nth_data(tokens, 0));
\r
1062 // TODO: CMEE error mapping is required.
\r
1063 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1065 tcore_at_tok_free(tokens);
\r
1069 resp.id = tcore_call_object_get_id((CallObject*)user_data);
\r
1070 dbg("resp.type = %d resp.id= %d", resp.type,resp.id);
\r
1072 // Send reponse to TAPI
\r
1073 tcore_user_request_send_response(ur, TRESP_CALL_END, sizeof(struct tresp_call_end), &resp);
\r
1076 err("User Request is NULL");
\r
1084 static void on_confirmation_call_endall(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1086 // skip response handling - actual result will be handled in on_confirmation_call_release_all
\r
1087 const TcoreATResponse* response = data;
\r
1090 if (response->success > 0) {
\r
1091 dbg("RESPONSE OK");
\r
1094 err("RESPONSE NOT OK");
\r
1102 static void on_confirmation_call_release_all(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1105 _on_confirmation_call_release(p, data_len, data, user_data, CALL_END_TYPE_ALL);
\r
1111 static void on_confirmation_call_release_specific(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1114 _on_confirmation_call_release(p, data_len, data, user_data, CALL_END_TYPE_DEFAULT);
\r
1119 static void on_confirmation_call_release_all_active(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1122 _on_confirmation_call_release(p, data_len, data, user_data, CALL_END_TYPE_ACTIVE_ALL);
\r
1127 static void on_confirmation_call_release_all_held(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1130 _on_confirmation_call_release(p, data_len, data, user_data, CALL_END_TYPE_HOLD_ALL);
\r
1135 static void _on_confirmation_call(TcorePending *p, int data_len, const void *data, void *user_data, int type)
\r
1137 UserRequest *ur = NULL;
\r
1138 GSList *tokens = NULL;
\r
1139 const char *line = NULL;
\r
1140 const TcoreATResponse *response = NULL;
\r
1144 ur = tcore_pending_ref_user_request(p);
\r
1145 response = (TcoreATResponse *)data;
\r
1146 if (response->success > 0) {
\r
1147 dbg("RESPONSE OK");
\r
1148 error = TCORE_RETURN_SUCCESS;
\r
1151 err("RESPONSE NOT OK");
\r
1153 line = (const char*)response->final_response;
\r
1154 tokens = tcore_at_tok_new(line);
\r
1156 if (g_slist_length(tokens) < 1) {
\r
1157 err("Unspecified error cause OR string corrupted");
\r
1158 error = TCORE_RETURN_3GPP_ERROR;
\r
1161 error = atoi(g_slist_nth_data(tokens, 0));
\r
1163 // TODO: CMEE error mapping is required.
\r
1164 error = TCORE_RETURN_3GPP_ERROR;
\r
1168 tcore_at_tok_free(tokens);
\r
1171 dbg("Response Call type -%d", type);
\r
1174 case TRESP_CALL_HOLD:
\r
1176 struct tresp_call_hold resp;
\r
1179 resp.id = tcore_call_object_get_id((CallObject*)user_data);
\r
1180 dbg("call hold response");
\r
1181 // Send reponse to TAPI
\r
1182 tcore_user_request_send_response(ur, TRESP_CALL_HOLD, sizeof(struct tresp_call_hold), &resp);
\r
1185 case TRESP_CALL_ACTIVE:
\r
1187 struct tresp_call_active resp;
\r
1190 resp.id = tcore_call_object_get_id((CallObject*)user_data);
\r
1191 dbg("call active response");
\r
1192 // Send reponse to TAPI
\r
1193 tcore_user_request_send_response(ur, TRESP_CALL_ACTIVE, sizeof(struct tresp_call_active), &resp);
\r
1196 case TRESP_CALL_JOIN:
\r
1198 struct tresp_call_join resp;
\r
1201 resp.id = tcore_call_object_get_id((CallObject*)user_data);
\r
1202 dbg("call join response");
\r
1204 // Send reponse to TAPI
\r
1205 tcore_user_request_send_response(ur, TRESP_CALL_JOIN, sizeof(struct tresp_call_join), &resp);
\r
1208 case TRESP_CALL_SPLIT:
\r
1210 struct tresp_call_split resp;
\r
1213 resp.id = tcore_call_object_get_id((CallObject*)user_data);
\r
1214 dbg("call split response");
\r
1215 // Send reponse to TAPI
\r
1216 tcore_user_request_send_response(ur, TRESP_CALL_SPLIT, sizeof(struct tresp_call_split), &resp);
\r
1219 case TRESP_CALL_DEFLECT:
\r
1221 struct tresp_call_deflect resp;
\r
1224 resp.id = tcore_call_object_get_id((CallObject*)user_data);
\r
1225 dbg("call deflect response");
\r
1226 // Send reponse to TAPI
\r
1227 tcore_user_request_send_response(ur, TRESP_CALL_DEFLECT, sizeof(struct tresp_call_deflect), &resp);
\r
1231 case TRESP_CALL_TRANSFER:
\r
1233 struct tresp_call_transfer resp;
\r
1236 resp.id = tcore_call_object_get_id((CallObject*)user_data);
\r
1237 dbg("call transfer response");
\r
1238 //Send reponse to TAPI
\r
1239 tcore_user_request_send_response(ur, TRESP_CALL_TRANSFER, sizeof(struct tresp_call_transfer), &resp);
\r
1242 case TRESP_CALL_SEND_DTMF:
\r
1244 struct tresp_call_dtmf resp;
\r
1247 dbg("call dtmf response");
\r
1248 // Send reponse to TAPI
\r
1249 tcore_user_request_send_response(ur, TRESP_CALL_SEND_DTMF, sizeof(struct tresp_call_dtmf), &resp);
\r
1254 dbg("type not supported");
\r
1259 if ((type == TRESP_CALL_HOLD)||(type == TRESP_CALL_ACTIVE)||(type == TRESP_CALL_JOIN)
\r
1260 ||(type == TRESP_CALL_SPLIT)) {
\r
1263 CoreObject *core_obj = NULL;
\r
1264 gboolean *eflag = g_new0(gboolean, 1);
\r
1266 core_obj = tcore_pending_ref_core_object(p);
\r
1269 dbg("Calling _call_list_get");
\r
1270 _call_list_get(core_obj, eflag);
\r
1278 static void on_confirmation_call_hold(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1281 _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_HOLD);
\r
1286 static void on_confirmation_call_active(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1289 _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_ACTIVE);
\r
1294 static void on_confirmation_call_join(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1297 _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_JOIN);
\r
1302 static void on_confirmation_call_split(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1305 _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_SPLIT);
\r
1310 static void on_confirmation_call_deflect(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1313 _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_DEFLECT);
\r
1318 static void on_confirmation_call_transfer(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1321 _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_TRANSFER);
\r
1326 static void on_confirmation_call_dtmf(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1329 _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_SEND_DTMF);
\r
1334 static void _on_confirmation_dtmf_tone_duration(TcorePending * p, int data_len, const void * data, void * user_data)
\r
1336 GSList *tokens = NULL;
\r
1337 const char *line = NULL;
\r
1338 const TcoreATResponse* response = data;
\r
1343 if (response->success > 0) {
\r
1344 dbg("RESPONSE OK");
\r
1345 error = TCORE_RETURN_SUCCESS;
\r
1349 err("RESPONSE NOT OK");
\r
1350 line = (const char*)response->final_response;
\r
1351 tokens = tcore_at_tok_new(line);
\r
1352 if (g_slist_length(tokens) < 1) {
\r
1353 err("err cause not specified or string corrupted");
\r
1354 error = TCORE_RETURN_3GPP_ERROR;
\r
1357 error = atoi(g_slist_nth_data(tokens, 0));
\r
1358 // TODO: CMEE error mapping is required.
\r
1362 tcore_at_tok_free(tokens);
\r
1365 dbg("Set dtmf tone duration response - %d", error);
\r
1369 static void on_confirmation_call_swap(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1371 CoreObject *core_obj = NULL;
\r
1372 UserRequest *ur = NULL;
\r
1373 const TcoreATResponse* response = data;
\r
1374 struct tresp_call_swap resp;
\r
1375 GSList *tokens = NULL;
\r
1376 const char *line = NULL;
\r
1379 core_obj = tcore_pending_ref_core_object(p);
\r
1380 ur = tcore_pending_ref_user_request(p);
\r
1383 if (response->success > 0) {
\r
1384 dbg("RESPONSE OK");
\r
1385 resp.err = TCORE_RETURN_SUCCESS;
\r
1389 err("RESPONSE NOT OK");
\r
1390 line = (const char*)response->final_response;
\r
1391 tokens = tcore_at_tok_new(line);
\r
1392 if (g_slist_length(tokens) < 1) {
\r
1393 err("err cause not specified or string corrupted");
\r
1394 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1397 resp.err = atoi(g_slist_nth_data(tokens, 0));
\r
1399 // TODO: CMEE error mapping is required.
\r
1400 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1404 tcore_at_tok_free(tokens);
\r
1407 resp.id = tcore_call_object_get_id((CallObject*)user_data);
\r
1408 dbg("resp.id = %d", resp.id);
\r
1410 // Send response to TAPI
\r
1411 tcore_user_request_send_response(ur, TRESP_CALL_SWAP, sizeof(struct tresp_call_swap), &resp);
\r
1415 GSList *active = NULL;
\r
1416 GSList *held = NULL;
\r
1417 CallObject *co = NULL;
\r
1418 gboolean *eflag = NULL;
\r
1420 held = tcore_call_object_find_by_status(core_obj, TCORE_CALL_STATUS_HELD);
\r
1422 err("Can't find held Call");
\r
1426 active = tcore_call_object_find_by_status(core_obj, TCORE_CALL_STATUS_ACTIVE);
\r
1428 dbg("Can't find active Call");
\r
1433 co = (CallObject*)held->data;
\r
1435 err("Can't get held Call object");
\r
1439 resp.id = tcore_call_object_get_id(co);
\r
1441 // Send response to TAPI
\r
1442 tcore_user_request_send_response(ur, TRESP_CALL_ACTIVE, sizeof(struct tresp_call_active), &resp);
\r
1444 held = g_slist_next(held);
\r
1448 co = (CallObject*)active->data;
\r
1450 err("[ error ] can't get active call object");
\r
1454 resp.id = tcore_call_object_get_id(co);
\r
1456 // Send response to TAPI
\r
1457 tcore_user_request_send_response(ur, TRESP_CALL_HOLD, sizeof(struct tresp_call_hold), &resp);
\r
1458 active = g_slist_next(active);
\r
1461 eflag = g_new0(gboolean, 1);
\r
1464 dbg("calling _call_list_get");
\r
1465 _call_list_get(core_obj, eflag);
\r
1470 err("User Request is NULL");
\r
1477 static void on_confirmation_call_set_source_sound_path(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1479 UserRequest *ur = NULL;
\r
1480 GSList *tokens = NULL;
\r
1481 const char *line = NULL;
\r
1482 const TcoreATResponse* response = data;
\r
1483 char *resp_str = NULL;
\r
1484 struct tresp_call_sound_set_path resp;
\r
1488 ur = tcore_pending_ref_user_request(p);
\r
1490 //+XDRV: <group_id>,<function_id>,<xdrv_result>[,<response_n>]
\ 3\r
1492 err("Input data is NULL");
\r
1496 if (response->success > 0) {
\r
1497 dbg("RESPONSE OK");
\r
1499 line = (const char*) (((GSList*)response->lines)->data);
\r
1500 tokens = tcore_at_tok_new(line);
\r
1502 resp_str = g_slist_nth_data(tokens, 0);
\r
1503 if(!g_slist_nth_data(tokens, 0)) {
\r
1504 err("group_id is missing");
\r
1505 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1509 if(!g_slist_nth_data(tokens, 1)) {
\r
1510 err(" function_id is missing");
\r
1511 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1515 resp_str = g_slist_nth_data(tokens, 2);
\r
1518 error = atoi(resp_str);
\r
1520 dbg("Response is Success");
\r
1521 resp.err = TCORE_RETURN_SUCCESS;
\r
1524 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1529 tcore_at_tok_free(tokens);
\r
1532 dbg("RESPONSE NOT OK");
\r
1534 line = (const char*)response->final_response;
\r
1535 tokens = tcore_at_tok_new(line);
\r
1537 if (g_slist_length(tokens) < 1) {
\r
1538 err("err cause not specified or string corrupted");
\r
1539 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1542 error = atoi(g_slist_nth_data(tokens, 0));
\r
1544 // TODO: CMEE error mapping is required.
\r
1545 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1549 tcore_at_tok_free(tokens);
\r
1553 if(resp.err != TCORE_RETURN_SUCCESS) { // Send only failed notification . success notification send when destination device is set.
\r
1554 // Send notification to TAPI
\r
1555 tcore_user_request_send_response(ur, TRESP_CALL_SET_SOUND_PATH, sizeof(struct tresp_call_sound_set_path), &resp);
\r
1556 setsoundpath = TRUE;
\r
1560 err("User Request is NULL");
\r
1567 static void on_confirmation_call_set_destination_sound_path(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1569 UserRequest *ur = NULL;
\r
1570 GSList *tokens = NULL;
\r
1571 const char *line = NULL;
\r
1572 char *resp_str = NULL ;
\r
1573 struct tresp_call_sound_set_path resp;
\r
1574 const TcoreATResponse* response = data;
\r
1579 ur = tcore_pending_ref_user_request(p);
\r
1580 // +XDRV: <group_id>,<function_id>,<xdrv_result>[,<response_n>]
\ 3\r
1583 err("Input data is NULL");
\r
1588 if (response->success > 0) {
\r
1589 dbg("RESPONSE OK");
\r
1591 line = (const char*) (((GSList*)response->lines)->data);
\r
1592 tokens = tcore_at_tok_new(line);
\r
1594 resp_str = g_slist_nth_data(tokens, 0);
\r
1595 if(!g_slist_nth_data(tokens, 0)) {
\r
1596 dbg("group_id is missing");
\r
1597 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1601 if(!g_slist_nth_data(tokens, 1)) {
\r
1602 dbg("function_id is missing");
\r
1603 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1607 resp_str = g_slist_nth_data(tokens, 2);
\r
1609 error = atoi(resp_str);
\r
1611 dbg("Response is Success");
\r
1612 resp.err = TCORE_RETURN_SUCCESS;
\r
1615 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1621 tcore_at_tok_free(tokens);
\r
1624 dbg("RESPONSE NOT OK");
\r
1626 line = (const char*)response->final_response;
\r
1627 tokens = tcore_at_tok_new(line);
\r
1629 if (g_slist_length(tokens) < 1) {
\r
1630 err("err cause not specified or string corrupted");
\r
1631 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1634 error = atoi(g_slist_nth_data(tokens, 0));
\r
1635 // TODO: CMEE error mapping is required.
\r
1636 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1640 tcore_at_tok_free(tokens);
\r
1643 if(setsoundpath == TRUE) {
\r
1644 setsoundpath = FALSE;
\r
1647 // Send response to TAPI
\r
1648 tcore_user_request_send_response(ur, TRESP_CALL_SET_SOUND_PATH, sizeof(struct tresp_call_sound_set_path), &resp);
\r
1652 dbg("User Request is NULL");
\r
1659 static void on_confirmation_call_set_source_sound_volume_level(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1661 UserRequest *ur = NULL;
\r
1662 GSList *tokens = NULL;
\r
1663 const char *line = NULL;
\r
1664 const TcoreATResponse* response = data;
\r
1665 char *resp_str = NULL;
\r
1666 struct tresp_call_sound_set_volume_level resp;
\r
1669 ur = tcore_pending_ref_user_request(p);
\r
1671 // +XDRV: <group_id>,<function_id>,<xdrv_result>[,<response_n>]
\ 3\r
1673 err("Input data is NULL");
\r
1677 if (response->success > 0) {
\r
1678 dbg("RESPONSE OK");
\r
1680 line = (const char*) (((GSList*)response->lines)->data);
\r
1681 tokens = tcore_at_tok_new(line);
\r
1683 resp_str = g_slist_nth_data(tokens, 0);
\r
1684 if(!g_slist_nth_data(tokens, 0)) {
\r
1685 err("group_id is missing");
\r
1686 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1690 if(!g_slist_nth_data(tokens, 1)) {
\r
1691 err("function_id is missing");
\r
1692 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1696 resp_str = g_slist_nth_data(tokens, 2);
\r
1698 error = atoi(resp_str);
\r
1701 dbg("Response is Success ");
\r
1702 resp.err = TCORE_RETURN_SUCCESS;
\r
1705 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1711 tcore_at_tok_free(tokens);
\r
1714 dbg("RESPONSE NOT OK");
\r
1716 line = (const char*)response->final_response;
\r
1717 tokens = tcore_at_tok_new(line);
\r
1719 if (g_slist_length(tokens) < 1) {
\r
1720 err("err cause not specified or string corrupted");
\r
1721 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1724 error = atoi(g_slist_nth_data(tokens, 0));
\r
1726 // TODO: CMEE error mapping is required.
\r
1727 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1731 tcore_at_tok_free(tokens);
\r
1735 if(resp.err && soundvolume == FALSE) { // Send only failed notification . success notification send when destination device is set.
\r
1736 // Send reposne to TAPI
\r
1737 tcore_user_request_send_response(ur, TRESP_CALL_SET_SOUND_VOLUME_LEVEL, sizeof(struct tresp_call_sound_set_volume_level), &resp);
\r
1738 soundvolume = TRUE;
\r
1742 err("User Request is NULL");
\r
1750 static void on_confirmation_call_set_destination_sound_volume_level(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1752 UserRequest *ur = NULL;
\r
1753 GSList *tokens = NULL;
\r
1754 const char *line = NULL;
\r
1755 char *resp_str = NULL;
\r
1756 const TcoreATResponse* response = data;
\r
1757 struct tresp_call_sound_set_volume_level resp;
\r
1762 ur = tcore_pending_ref_user_request(p);
\r
1764 // +XDRV: <group_id>,<function_id>,<xdrv_result>[,<response_n>]
\ 3\r
1766 err("Input data is NULL");
\r
1771 if (response->success > 0) {
\r
1773 dbg("RESPONSE OK");
\r
1774 line = (const char*) (((GSList*)response->lines)->data);
\r
1775 tokens = tcore_at_tok_new(line);
\r
1776 resp_str = g_slist_nth_data(tokens, 0);
\r
1778 if(!g_slist_nth_data(tokens, 0)) {
\r
1779 err("group_id is missing");
\r
1780 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1784 if(!g_slist_nth_data(tokens, 1)) {
\r
1785 err("function_id is missing");
\r
1786 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1790 resp_str = g_slist_nth_data(tokens, 2);
\r
1793 error = atoi(resp_str);
\r
1796 dbg("Response is Success");
\r
1797 resp.err = TCORE_RETURN_SUCCESS;
\r
1800 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1806 tcore_at_tok_free(tokens);
\r
1809 dbg("RESPONSE NOT OK");
\r
1811 line = (const char*)response->final_response;
\r
1812 tokens = tcore_at_tok_new(line);
\r
1814 if (g_slist_length(tokens) < 1) {
\r
1815 err("err cause not specified or string corrupted");
\r
1816 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1819 error = atoi(g_slist_nth_data(tokens, 0));
\r
1821 // TODO: CMEE error mapping is required.
\r
1822 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1825 tcore_at_tok_free(tokens);
\r
1828 if(soundvolume == TRUE){
\r
1829 soundvolume = FALSE;
\r
1832 // Send reposne to TAPI
\r
1833 tcore_user_request_send_response(ur, TRESP_CALL_SET_SOUND_VOLUME_LEVEL, sizeof(struct tresp_call_sound_set_volume_level), &resp);
\r
1837 err("User Request is NULL");
\r
1845 static void on_confirmation_call_mute(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1847 UserRequest *ur = NULL;
\r
1848 GSList *tokens = NULL;
\r
1849 const char *line = NULL;
\r
1850 char *resp_str = NULL;
\r
1851 struct tresp_call_mute resp;
\r
1852 const TcoreATResponse* response = data;
\r
1857 ur = tcore_pending_ref_user_request(p);
\r
1860 err("Input data is NULL");
\r
1864 if (response->success > 0) {
\r
1865 dbg("RESPONSE OK");
\r
1867 line = (const char*) (((GSList*)response->lines)->data);
\r
1868 tokens = tcore_at_tok_new(line);
\r
1869 resp_str = g_slist_nth_data(tokens, 0);
\r
1871 if(!g_slist_nth_data(tokens, 0)) {
\r
1872 err("group_id is missing");
\r
1873 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1877 if(!g_slist_nth_data(tokens, 1)) {
\r
1878 err(" function_id is missing");
\r
1879 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1883 resp_str = g_slist_nth_data(tokens, 2);
\r
1886 error = atoi(resp_str);
\r
1888 dbg("Response is Success");
\r
1889 resp.err = TCORE_RETURN_SUCCESS;
\r
1892 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1897 tcore_at_tok_free(tokens);
\r
1900 dbg("RESPONSE NOT OK");
\r
1902 line = (const char*)response->final_response;
\r
1903 tokens = tcore_at_tok_new(line);
\r
1905 if (g_slist_length(tokens) < 1) {
\r
1906 err("err cause not specified or string corrupted");
\r
1907 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1910 error = atoi(g_slist_nth_data(tokens, 0));
\r
1912 // TODO: CMEE error mapping is required.
\r
1913 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1917 tcore_at_tok_free(tokens);
\r
1921 tcore_user_request_send_response(ur, TRESP_CALL_MUTE, sizeof(struct tresp_call_mute), &resp);
\r
1924 err("User Request is NULL");
\r
1931 static void on_confirmation_call_unmute(TcorePending *p, int data_len, const void *data, void *user_data)
\r
1933 const TcoreATResponse *response = NULL;
\r
1934 struct tresp_call_unmute resp;
\r
1935 GSList *tokens = NULL;
\r
1936 const char *line = NULL;
\r
1937 UserRequest *ur = NULL;
\r
1938 char *resp_str = NULL;
\r
1943 response = (TcoreATResponse *)data;
\r
1944 ur = tcore_pending_ref_user_request(p);
\r
1947 err("Input data is NULL");
\r
1951 if (response->success > 0) {
\r
1952 dbg("RESPONSE OK");
\r
1954 line = (const char*) (((GSList*)response->lines)->data);
\r
1955 tokens = tcore_at_tok_new(line);
\r
1956 resp_str = g_slist_nth_data(tokens, 0);
\r
1958 if(!g_slist_nth_data(tokens, 0)) {
\r
1959 err("group_id is missing");
\r
1960 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1964 if(!g_slist_nth_data(tokens, 1)) {
\r
1965 err(" function_id is missing");
\r
1966 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1970 resp_str = g_slist_nth_data(tokens, 2);
\r
1973 error = atoi(resp_str);
\r
1975 dbg("Response is Success");
\r
1976 resp.err = TCORE_RETURN_SUCCESS;
\r
1979 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1984 tcore_at_tok_free(tokens);
\r
1987 dbg("RESPONSE NOT OK");
\r
1989 line = (const char*)response->final_response;
\r
1990 tokens = tcore_at_tok_new(line);
\r
1992 if (g_slist_length(tokens) < 1) {
\r
1993 err("err cause not specified or string corrupted");
\r
1994 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
1997 error = atoi(g_slist_nth_data(tokens, 0));
\r
1999 // TODO: CMEE error mapping is required.
\r
2000 resp.err = TCORE_RETURN_3GPP_ERROR;
\r
2004 tcore_at_tok_free(tokens);
\r
2008 tcore_user_request_send_response(ur, TRESP_CALL_UNMUTE, sizeof(struct tresp_call_unmute), &resp);
\r
2011 err("User Request is NULL");
\r
2019 static void on_response_call_list_get(TcorePending *p, int data_len, const void *data, void *user_data)
\r
2021 TcorePlugin *plugin = NULL;
\r
2022 CoreObject *core_obj = NULL;
\r
2023 CallObject *co = NULL;
\r
2024 struct clcc_call_t *call_list = NULL;
\r
2025 gboolean *event_flag = (gboolean*)user_data;
\r
2026 const TcoreATResponse *response = data;
\r
2027 GSList *resp_data = NULL;
\r
2028 char *line = NULL;
\r
2030 int cllc_info = 0, countCalls = 0, countValidCalls = 0;
\r
2034 plugin = tcore_pending_ref_plugin(p);
\r
2035 core_obj = tcore_pending_ref_core_object(p);
\r
2037 if(response->success > 0) {
\r
2038 dbg("RESPONCE OK");
\r
2039 if(response->lines) {
\r
2040 resp_data = (GSList*)response->lines;
\r
2041 countCalls = g_slist_length(resp_data);
\r
2042 dbg("Total records : %d",countCalls);
\r
2045 if (0 == countCalls) {
\r
2046 err("Call count is zero");
\r
2050 call_list = g_new0(struct clcc_call_t, countCalls);
\r
2052 for (countValidCalls = 0;resp_data != NULL ;resp_data = resp_data->next,countValidCalls++,cllc_info++) {
\r
2054 line = (char*)(resp_data->data);
\r
2056 error = _callFromCLCCLine(line, call_list + countValidCalls);
\r
2061 co = tcore_call_object_find_by_id(core_obj, call_list[cllc_info].info.id);
\r
2063 co = tcore_call_object_new(core_obj, call_list[cllc_info].info.id);
\r
2065 err("error : tcore_call_object_new [ id : %d ]", call_list[cllc_info].info.id);
\r
2070 // Call set parameters
\r
2071 tcore_call_object_set_type(co, call_type(call_list[cllc_info].info.type));
\r
2072 tcore_call_object_set_direction(co, call_list[cllc_info].info.direction);
\r
2073 tcore_call_object_set_multiparty_state(co, _call_is_in_mpty(call_list[cllc_info].info.mpty));
\r
2074 tcore_call_object_set_cli_info(co, CALL_CLI_MODE_DEFAULT, call_list[cllc_info].number);
\r
2075 tcore_call_object_set_active_line(co, 0);
\r
2077 if (*event_flag) {
\r
2078 dbg("Call status before calling _call_branch_by_status() : (%d)", call_list[cllc_info].info.status);
\r
2079 _call_branch_by_status(plugin, co, call_list[cllc_info].info.status);
\r
2083 tcore_call_object_set_status(co, call_list[cllc_info].info.status);
\r
2085 dbg("Call id : (%d)", call_list[cllc_info].info.id);
\r
2086 dbg("Call direction : (%d)", call_list[cllc_info].info.direction);
\r
2087 dbg("Call type : (%d)", call_list[cllc_info].info.type);
\r
2088 dbg("Call mpty : (%d)", call_list[cllc_info].info.mpty);
\r
2089 dbg("Call number : (%s)", call_list[cllc_info].number);
\r
2090 dbg("Call status : (%d)", call_list[cllc_info].info.status);
\r
2095 g_free(call_list);
\r
2099 g_free(event_flag);
\r
2105 static void _on_confirmation_call_end_cause(TcorePending * p, int data_len, const void * data, void * user_data)
\r
2107 TcorePlugin *plugin = NULL;
\r
2108 CoreObject *core_obj = NULL;
\r
2109 CallObject *co = (CallObject *)user_data;
\r
2110 const TcoreATResponse *response = data;
\r
2111 const char *line = NULL;
\r
2112 struct tnoti_call_status_idle call_status;
\r
2113 GSList *tokens = NULL;
\r
2118 plugin = tcore_pending_ref_plugin(p);
\r
2119 core_obj = tcore_pending_ref_core_object(p);
\r
2121 if (response->success > 0){
\r
2122 dbg("RESPONSE OK");
\r
2123 line = (const char*) (((GSList*)response->lines)->data);
\r
2124 tokens = tcore_at_tok_new(line);
\r
2125 resp_str = g_slist_nth_data(tokens, 0);
\r
2127 err("call end cause - report value missing");
\r
2130 resp_str = g_slist_nth_data(tokens, 1);
\r
2132 err("call end cause value missing");
\r
2134 error = atoi(resp_str);
\r
2135 dbg("call end cause - %d",error);
\r
2136 call_status.cause =_compare_call_end_cause(error);
\r
2137 dbg("TAPI call end cause - %d",call_status.cause);
\r
2141 tcore_at_tok_free(tokens);
\r
2144 err("RESPONSE NOT OK");
\r
2145 line = (char*)response->final_response;
\r
2146 tokens = tcore_at_tok_new(line);
\r
2147 if (g_slist_length(tokens) < 1) {
\r
2148 err("err cause not specified or string corrupted");
\r
2151 err(" err cause value: %d",atoi(g_slist_nth_data(tokens, 0)));
\r
2153 call_status.cause = CC_CAUSE_NORMAL_CALL_CLEARING;
\r
2155 tcore_at_tok_free(tokens);
\r
2158 call_status.type = tcore_call_object_get_type(co);
\r
2159 dbg("data.type : [%d]", call_status.type);
\r
2161 call_status.id = tcore_call_object_get_id(co);
\r
2162 dbg("data.id : [%d]", call_status.id);
\r
2165 tcore_call_object_set_status(co, TCORE_CALL_STATUS_IDLE);
\r
2167 // Send Notification to TAPI
\r
2168 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
2170 TNOTI_CALL_STATUS_IDLE,
\r
2171 sizeof(struct tnoti_call_status_idle),
\r
2172 (void*)&call_status);
\r
2174 // Free Call object
\r
2175 tcore_call_object_free(core_obj, co);
\r
2178 static int _callFromCLCCLine(char *line, struct clcc_call_t *p_call)
\r
2180 //+CLCC: 1,0,2,0,0,"18005551212",145
\r
2181 //[+CLCC: <id1>, <dir>, <stat>, <mode>,<mpty>[,<number>,<type>[,<alpha>[,<priority>]]]
\r
2186 unsigned int numcount,tempcount = 0;
\r
2187 unsigned int num_type;
\r
2188 GSList *tokens = NULL;
\r
2189 char *resp = NULL;
\r
2192 tokens = tcore_at_tok_new(line);
\r
2194 resp = g_slist_nth_data(tokens, 0);
\r
2196 err("InValid ID");
\r
2199 p_call->info.id = atoi(resp);
\r
2200 dbg("id : [%d]\n", p_call->info.id);
\r
2203 resp = g_slist_nth_data(tokens, 1);
\r
2205 err("InValid Dir");
\r
2208 isMT = atoi(resp);
\r
2210 p_call->info.direction = TCORE_CALL_DIRECTION_OUTGOING;
\r
2213 p_call->info.direction = TCORE_CALL_DIRECTION_INCOMING;
\r
2215 dbg("Direction : [ %d ]\n", p_call->info.direction);
\r
2218 resp = g_slist_nth_data(tokens, 2);
\r
2220 err("InValid Stat");
\r
2223 state = atoi(resp);
\r
2224 dbg("Call state : %d", state);
\r
2227 p_call->info.status = TCORE_CALL_STATUS_ACTIVE;
\r
2230 p_call->info.status = TCORE_CALL_STATUS_HELD;
\r
2233 p_call->info.status = TCORE_CALL_STATUS_DIALING;
\r
2236 p_call->info.status = TCORE_CALL_STATUS_ALERT;
\r
2239 p_call->info.status = TCORE_CALL_STATUS_INCOMING;
\r
2242 p_call->info.status = TCORE_CALL_STATUS_WAITING;
\r
2245 dbg("Status : [%d]\n", p_call->info.status);
\r
2248 resp = g_slist_nth_data(tokens, 3);
\r
2250 err("InValid Mode");
\r
2253 mode = atoi(resp);
\r
2257 p_call->info.type = TCORE_CALL_TYPE_VOICE;
\r
2260 p_call->info.type = TCORE_CALL_TYPE_VIDEO;
\r
2262 default: // only Voice/VT call is supported in CS. treat other unknown calls as error
\r
2263 dbg("invalid type : [%d]\n", mode);
\r
2266 dbg("Call type : [%d]\n", p_call->info.type);
\r
2269 resp = g_slist_nth_data(tokens, 4);
\r
2271 err("InValid Mpty");
\r
2275 p_call->info.mpty = atoi(resp);
\r
2276 dbg("Mpty : [ %d ]\n", p_call->info.mpty);
\r
2279 resp = g_slist_nth_data(tokens, 5);
\r
2280 dbg("Incoming number - %s and its len - %d", resp, strlen(resp));
\r
2282 // tolerate null here
\r
2284 err("Number is NULL");
\r
2288 num = g_malloc0(strlen(resp)+2);
\r
2290 err("memory allocation failed");
\r
2294 // Strike off double quotes
\r
2295 for (numcount = 0; numcount < strlen(resp); numcount++, tempcount++) {
\r
2296 if(resp[numcount] == '\"') {
\r
2297 num[tempcount] = resp[numcount+1];
\r
2301 num[tempcount] = resp[numcount];
\r
2305 num[tempcount] = '\0';
\r
2306 dbg("num after removing quotes - %s", num);
\r
2308 p_call->info.num_len = strlen(resp);
\r
2309 dbg("num_len : [0x%x]\n", p_call->info.num_len);
\r
2311 // parse <num type>
\r
2312 resp = g_slist_nth_data(tokens, 6);
\r
2314 dbg("InValid Num type");
\r
2317 p_call->info.num_type = atoi(resp);
\r
2318 dbg("BCD num type: [0x%x]\n", p_call->info.num_type);
\r
2320 //check number is international or national.
\r
2321 num_type = ((p_call->info.num_type) >> 4) & 0x07;
\r
2322 dbg("called party's type of number : [0x%x]\n", num_type);
\r
2324 if(num_type == 1 && num[0] != '+') {
\r
2325 //international number
\r
2326 p_call->number[0] = '+';
\r
2327 memcpy(&(p_call->number[1]),num,strlen(num));
\r
2330 memcpy(&(p_call->number),num,strlen(num));
\r
2332 dbg("incoming number - %s", p_call->number);
\r
2337 tcore_at_tok_free(tokens);
\r
2343 err("Invalid CLCC line");
\r
2351 tcore_at_tok_free(tokens);
\r
2357 static void on_notification_call_waiting(CoreObject *o, const void *data, void *user_data)
\r
2359 GSList *tokens = NULL;
\r
2360 const char *line = NULL;
\r
2364 GSList* pList = NULL;
\r
2365 CallObject *co = NULL, *dupco = NULL;
\r
2367 dbg("function entrance");
\r
2368 // check call with waiting status already exist
\r
2369 pList = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_WAITING);
\r
2371 if(pList != NULL) {
\r
2372 dbg("[error]Waiting call already exist. skip");
\r
2375 // check call with incoming status already exist
\r
2376 pList = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_INCOMING);
\r
2378 if(pList != NULL){
\r
2379 dbg("[error]incoming call already exist. skip");
\r
2382 line = (char*)data;
\r
2383 tokens = tcore_at_tok_new(line);
\r
2385 pId = g_slist_nth_data(tokens, 0);
\r
2387 dbg("[error]:Call id is missing from +XCALLSTAT indication");
\r
2391 call_id = atoi(pId);
\r
2392 dupco = tcore_call_object_find_by_id(o, call_id);
\r
2394 dbg("co with same id already exist. skip");
\r
2397 co = tcore_call_object_new(o, call_id);
\r
2399 dbg("[ error ] co is NULL");
\r
2403 tcore_at_tok_free(tokens);
\r
2405 eflag = g_new0(gboolean, 1);
\r
2407 dbg("calling _call_list_get");
\r
2408 _call_list_get(o, eflag);
\r
2412 static void on_notification_call_incoming(CoreObject *o, const void *data, void *user_data)
\r
2414 GSList *tokens = NULL;
\r
2415 const char *line = NULL;
\r
2419 GSList* pList = NULL;
\r
2420 CallObject *co = NULL, *dupco = NULL;
\r
2422 dbg("function entrance");
\r
2423 // check call with incoming status already exist
\r
2424 pList = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_INCOMING);
\r
2426 if(pList != NULL){
\r
2427 dbg("incoming call already exist. skip");
\r
2431 line = (char*)data;
\r
2432 tokens = tcore_at_tok_new(line);
\r
2434 pId = g_slist_nth_data(tokens, 0);
\r
2436 dbg("Error:Call id is missing from %XCALLSTAT indication");
\r
2440 call_id = atoi(pId);
\r
2442 dupco = tcore_call_object_find_by_id(o, call_id);
\r
2444 dbg("co with same id already exist. skip");
\r
2448 co = tcore_call_object_new(o, call_id);
\r
2450 dbg("[ error ] co is NULL");
\r
2454 dbg("freeing at token")
\r
2455 tcore_at_tok_free(tokens);
\r
2457 eflag = g_new0(gboolean, 1);
\r
2460 dbg("calling _call_list_get");
\r
2461 _call_list_get(o, eflag);
\r
2465 static void on_notification_call_status(CoreObject *o, const void *data, void *user_data)
\r
2468 TcorePlugin *plugin = NULL;
\r
2469 CallObject *co = NULL;
\r
2473 char *stat = NULL;
\r
2474 char *pCallId = NULL;
\r
2475 GSList *tokens = NULL;
\r
2476 enum tcore_call_status co_status;
\r
2478 dbg("function entrance");
\r
2479 plugin = tcore_object_ref_plugin(o);
\r
2480 cmd = (char*)data;
\r
2481 tokens = tcore_at_tok_new(cmd);
\r
2483 // parse <Call Id>
\r
2484 pCallId = g_slist_nth_data(tokens, 0);
\r
2486 dbg("pCallId is missing from %XCALLSTAT indiaction");
\r
2490 id = atoi(pCallId);
\r
2491 dbg("call id = %d", id);
\r
2493 if ((stat = g_slist_nth_data(tokens, 1))) {
\r
2494 status = atoi(stat);
\r
2496 dbg("call status = %d", status);
\r
2499 tcore_at_tok_free(tokens);
\r
2500 co_status = _call_status(status);
\r
2502 dbg("co_status = %d", co_status);
\r
2503 switch (co_status) {
\r
2505 case CALL_STATUS_ACTIVE:
\r
2507 dbg("call(%d) status : [ ACTIVE ]", id);
\r
2508 co = tcore_call_object_find_by_id(o,id);
\r
2510 dbg("co is NULL");
\r
2513 _call_status_active(plugin, co);
\r
2518 case CALL_STATUS_HELD:
\r
2519 dbg("call(%d) status : [ held ]", id);
\r
2522 case CALL_STATUS_DIALING:
\r
2524 dbg("call(%d) status : [ dialing ]", id);
\r
2525 co = tcore_call_object_find_by_id(o,id);
\r
2527 co = tcore_call_object_new(o, id);
\r
2529 dbg("error : tcore_call_object_new [ id : %d ]", id);
\r
2534 tcore_call_object_set_type(co, call_type(type));
\r
2535 tcore_call_object_set_direction(co, TCORE_CALL_DIRECTION_OUTGOING);
\r
2536 _call_status_dialing(plugin, co);
\r
2539 case CALL_STATUS_ALERT:
\r
2541 dbg("call(%d) status : [ alert ]", id);
\r
2542 co = tcore_call_object_find_by_id(o, id);
\r
2544 dbg("co is NULL");
\r
2547 _call_status_alert(plugin, co);
\r
2551 case CALL_STATUS_INCOMING:
\r
2552 case CALL_STATUS_WAITING:
\r
2553 dbg("call(%d) status : [ incoming ]", id);
\r
2555 case CALL_STATUS_IDLE:
\r
2558 dbg("call(%d) status : [ release ]", id);
\r
2560 co = tcore_call_object_find_by_id(o, id);
\r
2562 dbg("co is NULL");
\r
2566 plugin = tcore_object_ref_plugin(o);
\r
2568 dbg("plugin is NULL");
\r
2571 _call_status_idle(plugin, co);
\r
2576 dbg("invalid call status", id);
\r
2581 static TReturn s_call_outgoing(CoreObject *o, UserRequest *ur)
\r
2583 struct treq_call_dial* data = 0;
\r
2584 char* raw_str= NULL;
\r
2585 char*cmd_str = NULL;
\r
2586 const char *cclir;
\r
2587 enum tcore_call_cli_mode clir = CALL_CLI_MODE_DEFAULT;
\r
2588 TcorePending *pending = NULL;
\r
2589 TcoreATRequest *req;
\r
2590 gboolean ret = FALSE;
\r
2592 dbg("function entrance");
\r
2593 data = (struct treq_call_dial*)tcore_user_request_ref_data(ur, 0);
\r
2594 clir = _get_clir_status(data->number);
\r
2596 //Compose ATD Cmd string
\r
2598 case TCORE_CALL_CLI_MODE_PRESENT:
\r
2599 dbg("CALL_CLI_MODE_PRESENT");
\r
2601 break; //invocation
\r
2602 case TCORE_CALL_CLI_MODE_RESTRICT:
\r
2603 dbg("CALL_CLI_MODE_RESTRICT");
\r
2605 break; //suppression
\r
2606 case TCORE_CALL_CLI_MODE_DEFAULT:
\r
2609 dbg("CALL_CLI_MODE_DEFAULT");
\r
2610 break; //subscription default
\r
2613 dbg("data->number = %s",data->number);
\r
2615 raw_str = g_strdup_printf("ATD%s%s;", data->number, cclir);
\r
2616 cmd_str = g_strdup_printf("%s",raw_str);
\r
2618 dbg("request command : %s", cmd_str);
\r
2620 pending = tcore_pending_new(o, 0);
\r
2621 req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
\r
2622 dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
\r
2624 tcore_pending_set_request_data(pending, 0, req);
\r
2625 ret = _call_request_message (pending, o, ur, on_confirmation_call_outgoing, NULL);
\r
2631 dbg("AT request(%s) sent failed", req->cmd);
\r
2632 return TCORE_RETURN_FAILURE;
\r
2635 dbg("AT request(%s) sent success",req->cmd);
\r
2637 return TCORE_RETURN_SUCCESS;
\r
2640 static TReturn s_call_answer(CoreObject *o, UserRequest *ur)
\r
2642 char* cmd_str = NULL;
\r
2643 CallObject* co = NULL;
\r
2644 struct treq_call_answer* data = 0;
\r
2645 TcorePending *pending = NULL;
\r
2646 TcoreATRequest *req;
\r
2647 gboolean ret = FALSE;
\r
2649 dbg("function entrance");
\r
2651 data = (struct treq_call_answer*)tcore_user_request_ref_data(ur, 0);
\r
2652 co = tcore_call_object_find_by_id(o, data->id);
\r
2653 if (data->type == CALL_ANSWER_TYPE_ACCEPT) {
\r
2655 dbg(" request type CALL_ANSWER_TYPE_ACCEPT");
\r
2657 cmd_str = g_strdup_printf("%s","ATA");
\r
2658 pending = tcore_pending_new(o, 0);
\r
2659 req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
\r
2660 dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
\r
2662 tcore_pending_set_request_data(pending, 0, req);
\r
2663 ret = _call_request_message (pending, o, ur, on_confirmation_call_accept, co);
\r
2667 dbg("AT request(%s) sent failed", req->cmd);
\r
2668 return TCORE_RETURN_FAILURE;
\r
2674 switch (data->type) {
\r
2675 case CALL_ANSWER_TYPE_REJECT:
\r
2677 dbg("call answer reject");
\r
2678 tcore_call_control_answer_reject(o, ur, on_confirmation_call_reject, co);
\r
2681 case CALL_ANSWER_TYPE_REPLACE:
\r
2683 dbg("call answer replace");
\r
2684 tcore_call_control_answer_replace(o, ur, on_confirmation_call_replace, co);
\r
2687 case CALL_ANSWER_TYPE_HOLD_ACCEPT:
\r
2689 dbg("call answer hold and accept");
\r
2690 tcore_call_control_answer_hold_and_accept(o, ur, on_confirmation_call_hold_and_accept, co);
\r
2694 dbg("[ error ] wrong answer type [ %d ]", data->type);
\r
2695 return TCORE_RETURN_FAILURE;
\r
2699 return TCORE_RETURN_SUCCESS;
\r
2702 static TReturn s_call_release(CoreObject *o, UserRequest *ur)
\r
2704 CallObject* co = NULL;
\r
2705 struct treq_call_end* data = 0;
\r
2706 UserRequest* ur_dup = NULL;
\r
2707 char* chld0_cmd = NULL;
\r
2708 char* chld1_cmd = NULL;
\r
2709 TcorePending *pending = NULL, *pending1 = NULL;
\r
2710 TcoreATRequest *req, *req1;
\r
2711 gboolean ret = FALSE;
\r
2713 dbg("function entrance");
\r
2714 data = (struct treq_call_end*)tcore_user_request_ref_data(ur, 0);
\r
2715 co = tcore_call_object_find_by_id(o, data->id);
\r
2717 dbg("type of release call = %d" , data->type);
\r
2719 if (data->type == CALL_END_TYPE_ALL) {
\r
2721 //releaseAll do not exist on legacy request. send CHLD=0, CHLD=1 in sequence
\r
2722 chld0_cmd = g_strdup("AT+CHLD=0");
\r
2723 chld1_cmd = g_strdup("AT+CHLD=1");
\r
2725 pending = tcore_pending_new(o, 0);
\r
2726 req = tcore_at_request_new(chld0_cmd, NULL, TCORE_AT_NO_RESULT);
\r
2728 dbg("input command is %s",chld0_cmd);
\r
2729 dbg("req-cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
\r
2731 tcore_pending_set_request_data(pending, 0, req);
\r
2732 ur_dup = tcore_user_request_new(NULL, NULL);
\r
2733 ret = _call_request_message(pending ,o, ur_dup, on_confirmation_call_endall, NULL);
\r
2734 g_free(chld0_cmd);
\r
2737 dbg("AT request %s has failed ",req->cmd);
\r
2738 return TCORE_RETURN_FAILURE;
\r
2741 pending1 = tcore_pending_new(o, 0);
\r
2742 req1 = tcore_at_request_new(chld1_cmd, NULL, TCORE_AT_NO_RESULT);
\r
2744 dbg("input command is %s",chld1_cmd);
\r
2745 dbg("req-cmd : %s, prefix(if any) :%s, cmd_len : %d", req1->cmd, req1->prefix, strlen(req1->cmd));
\r
2747 tcore_pending_set_request_data(pending1, 0, req1);
\r
2748 ret = _call_request_message(pending1, o, ur, on_confirmation_call_release_all, co);
\r
2749 g_free(chld1_cmd);
\r
2752 dbg("AT request %s has failed ",req->cmd);
\r
2753 return TCORE_RETURN_FAILURE;
\r
2759 switch (data->type) {
\r
2761 case CALL_END_TYPE_DEFAULT:
\r
2764 id = tcore_call_object_get_id(co);
\r
2766 dbg("call end call id [%d]", id);
\r
2767 tcore_call_control_end_specific(o, ur, id, on_confirmation_call_release_specific, co);
\r
2770 case CALL_END_TYPE_ACTIVE_ALL:
\r
2773 dbg("call end all active");
\r
2774 tcore_call_control_end_all_active(o, ur, on_confirmation_call_release_all_active, co);
\r
2777 case CALL_END_TYPE_HOLD_ALL:
\r
2780 dbg("call end all held");
\r
2781 tcore_call_control_end_all_held(o, ur, on_confirmation_call_release_all_held, co);
\r
2785 dbg("[ error ] wrong end type [ %d ]", data->type);
\r
2786 return TCORE_RETURN_FAILURE;
\r
2791 return TCORE_RETURN_SUCCESS;
\r
2794 static TReturn s_call_hold(CoreObject *o, UserRequest *ur)
\r
2796 struct treq_call_hold *hold = 0;
\r
2797 CallObject *co = NULL;
\r
2799 dbg("function entrance");
\r
2801 hold = (struct treq_call_hold*)tcore_user_request_ref_data(ur, 0);
\r
2802 dbg("call id : [ %d ]", hold->id);
\r
2804 co = tcore_call_object_find_by_id(o, hold->id);
\r
2805 tcore_call_control_hold(o, ur, on_confirmation_call_hold, co);
\r
2807 return TCORE_RETURN_SUCCESS;
\r
2810 static TReturn s_call_active(CoreObject *o, UserRequest *ur)
\r
2812 struct treq_call_active *active = 0;
\r
2813 CallObject *co = NULL;
\r
2815 active = (struct treq_call_active*)tcore_user_request_ref_data(ur, 0);
\r
2816 dbg("call id : [ %d ]", active->id);
\r
2818 co = tcore_call_object_find_by_id(o, active->id);
\r
2819 tcore_call_control_active(o, ur, on_confirmation_call_active, co);
\r
2821 return TCORE_RETURN_SUCCESS;
\r
2824 static TReturn s_call_swap(CoreObject *o, UserRequest *ur)
\r
2826 struct treq_call_swap *swap = NULL;
\r
2827 CallObject *co = NULL;
\r
2829 swap = (struct treq_call_swap*)tcore_user_request_ref_data(ur, 0);
\r
2830 dbg("call id : [ %d ]", swap->id);
\r
2832 co = tcore_call_object_find_by_id(o, swap->id);
\r
2833 tcore_call_control_swap(o, ur, on_confirmation_call_swap, co);
\r
2835 return TCORE_RETURN_SUCCESS;
\r
2838 static TReturn s_call_join(CoreObject *o, UserRequest *ur)
\r
2840 struct treq_call_join *join = 0;
\r
2841 CallObject *co = NULL;
\r
2843 join = (struct treq_call_join*)tcore_user_request_ref_data(ur, 0);
\r
2844 dbg("call id : [ %d ]", join->id);
\r
2846 co = tcore_call_object_find_by_id(o, join->id);
\r
2847 tcore_call_control_join(o, ur, on_confirmation_call_join, co);
\r
2849 return TCORE_RETURN_SUCCESS;
\r
2852 static TReturn s_call_split(CoreObject *o, UserRequest *ur)
\r
2854 struct treq_call_split *split = 0;
\r
2855 CallObject *co = NULL;
\r
2857 split = (struct treq_call_split*)tcore_user_request_ref_data(ur, 0);
\r
2858 co = tcore_call_object_find_by_id (o, split->id);
\r
2859 dbg("call id : [ %d ]", split->id);
\r
2861 tcore_call_control_split(o, ur, split->id, on_confirmation_call_split, co);
\r
2863 return TCORE_RETURN_SUCCESS;
\r
2866 static TReturn s_call_deflect(CoreObject *o, UserRequest *ur)
\r
2868 struct treq_call_deflect *deflect = 0;
\r
2869 CallObject *co = NULL;
\r
2871 deflect = (struct treq_call_deflect*)tcore_user_request_ref_data(ur, 0);
\r
2872 co = tcore_call_object_find_by_number(o, deflect->number);
\r
2873 dbg("deflect number: [ %s ]", deflect->number);
\r
2875 tcore_call_control_deflect(o, ur, deflect->number, on_confirmation_call_deflect, co);
\r
2877 return TCORE_RETURN_SUCCESS;
\r
2880 static TReturn s_call_transfer(CoreObject *o, UserRequest *ur)
\r
2882 struct treq_call_transfer *transfer = 0;
\r
2883 CallObject *co = NULL;
\r
2885 transfer = (struct treq_call_transfer*)tcore_user_request_ref_data(ur, 0);
\r
2886 dbg("call id : [ %d ]", transfer->id);
\r
2888 co = tcore_call_object_find_by_id(o, transfer->id);
\r
2889 tcore_call_control_transfer(o, ur, on_confirmation_call_transfer, co);
\r
2891 return TCORE_RETURN_SUCCESS;
\r
2894 static TReturn s_call_send_dtmf(CoreObject *o, UserRequest *ur)
\r
2896 char*cmd_str = NULL;
\r
2897 TcorePending *pending = NULL;
\r
2898 TcoreATRequest *req;
\r
2900 gboolean ret = FALSE;
\r
2901 struct treq_call_dtmf *dtmf = 0;
\r
2902 char *dtmfstr = NULL, *tmp_dtmf = NULL;
\r
2903 unsigned int dtmf_count;
\r
2905 dbg("Function enter");
\r
2907 dup = tcore_user_request_new(NULL, NULL);
\r
2908 (void)_set_dtmf_tone_duration(o, dup);
\r
2910 dtmf = (struct treq_call_dtmf*)tcore_user_request_ref_data(ur, 0);
\r
2911 dtmfstr = g_malloc0((MAX_CALL_DTMF_DIGITS_LEN * 2)+ 1); // DTMF digits + comma for each dtmf digit.
\r
2913 if(dtmfstr == NULL) {
\r
2914 dbg("Memory allocation failed");
\r
2915 return TCORE_RETURN_FAILURE;
\r
2918 tmp_dtmf = dtmfstr;
\r
2920 for(dtmf_count = 0; dtmf_count < strlen(dtmf->digits); dtmf_count++) {
\r
2922 *tmp_dtmf = dtmf->digits[dtmf_count];
\r
2925 *tmp_dtmf = COMMA;
\r
2929 //last digit is having COMMA , overwrite it with '\0' .
\r
2930 *(--tmp_dtmf) = '\0';
\r
2931 dbg("Input DTMF string(%s)",dtmfstr);
\r
2933 //AT+VTS = <d1>,<d2>,<d3>,<d4>,<d5>,<d6>, ..... <d32>
\r
2934 cmd_str = g_strdup_printf("AT+VTS=%s",dtmfstr);
\r
2935 dbg("request command : %s", cmd_str);
\r
2937 pending = tcore_pending_new(o, 0);
\r
2938 req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
\r
2939 dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
\r
2941 tcore_pending_set_request_data(pending, 0, req);
\r
2942 ret = _call_request_message (pending, o, ur, on_confirmation_call_dtmf, NULL);
\r
2948 dbg("AT request sent failed")
\r
2949 return TCORE_RETURN_FAILURE;
\r
2952 return TCORE_RETURN_SUCCESS;
\r
2955 static TReturn s_call_set_sound_path(CoreObject *o, UserRequest *ur)
\r
2957 UserRequest *ur_dup = NULL;
\r
2958 TcorePending *pending = NULL , *pending1 = NULL;
\r
2959 TcoreATRequest *req , *req1;
\r
2960 char *cmd_str = NULL , *cmd_str1 = NULL;
\r
2961 gboolean ret = FALSE;
\r
2963 dbg("function entrance");
\r
2965 //hard coded value for speaker.
\r
2966 cmd_str = g_strdup_printf("%s","AT+XDRV=40,4,3,0,0,0,0,0,1,0,1,0,1"); //source type.
\r
2967 cmd_str1 = g_strdup_printf("%s","AT+XDRV=40,5,2,0,0,0,0,0,1,0,1,0,1"); //destination type
\r
2969 pending = tcore_pending_new(o, 0);
\r
2970 req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE);
\r
2971 dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
\r
2973 tcore_pending_set_request_data(pending, 0, req);
\r
2974 ur_dup = tcore_user_request_ref(ur);
\r
2976 ret = _call_request_message (pending, o, ur_dup, on_confirmation_call_set_source_sound_path, NULL);
\r
2982 dbg("At request(%s) sent failed",req->cmd);
\r
2983 return TCORE_RETURN_FAILURE;
\r
2986 pending1 = tcore_pending_new(o, 0);
\r
2987 req1 = tcore_at_request_new(cmd_str1,"+XDRV", TCORE_AT_SINGLELINE);
\r
2988 dbg("input command is %s",cmd_str1);
\r
2989 dbg("req-cmd : %s, prefix(if any) :%s, cmd_len : %d", req1->cmd, req1->prefix, strlen(req1->cmd));
\r
2991 tcore_pending_set_request_data(pending1, 0, req1);
\r
2992 ret = _call_request_message(pending1, o, ur, on_confirmation_call_set_destination_sound_path, NULL);
\r
2997 dbg("AT request %s has failed ",req1->cmd);
\r
2998 return TCORE_RETURN_FAILURE;
\r
3001 return TCORE_RETURN_SUCCESS;
\r
3005 static TReturn s_call_set_sound_volume_level(CoreObject *o, UserRequest *ur)
\r
3007 UserRequest *src_ur = NULL;
\r
3008 UserRequest *dest_ur = NULL;
\r
3009 TcorePending *src_pending = NULL;
\r
3010 TcorePending *dest_pending = NULL;
\r
3011 TcoreATRequest *src_req = NULL;
\r
3012 TcoreATRequest *dest_req = NULL;
\r
3013 char *cmd_str = NULL, *volume_level = NULL;
\r
3014 gboolean ret = FALSE;
\r
3016 struct treq_call_sound_set_volume_level* data = NULL;
\r
3017 data = (struct treq_call_sound_set_volume_level*)tcore_user_request_ref_data( ur, 0 );
\r
3019 // Hard-coded values for MIC & Speakers
\r
3021 dbg("Set Source volume");
\r
3023 cmd_str = g_strdup_printf("%s", "AT+XDRV=40,7,3,88"); // Source type
\r
3024 dbg("Request command string: %s", cmd_str);
\r
3026 // Create new Pending request
\r
3027 src_pending = tcore_pending_new(o, 0);
\r
3029 // Create new AT-Command request
\r
3030 src_req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE);
\r
3031 dbg("Command: %s, prefix(if any): %s, Command length: %d", src_req->cmd, src_req->prefix, strlen(src_req->cmd));
\r
3033 // Free Command string
\r
3036 tcore_pending_set_request_data(src_pending, 0, src_req);
\r
3037 src_ur = tcore_user_request_ref(ur);
\r
3040 ret = _call_request_message (src_pending, o, src_ur, on_confirmation_call_set_source_sound_volume_level, NULL);
\r
3042 err("Failed to send AT-Command request");
\r
3043 return TCORE_RETURN_FAILURE;
\r
3046 cmd_str = g_strdup_printf("%s", "AT+XDRV=40,7,0,88"); // Destination type
\r
3047 dbg("Request command string: %s", cmd_str);
\r
3049 // Create new Pending request
\r
3050 src_pending = tcore_pending_new(o, 0);
\r
3052 // Create new AT-Command request
\r
3053 src_req = tcore_at_request_new(cmd_str,"+XDRV", TCORE_AT_SINGLELINE);
\r
3054 dbg("Command: %s, prefix(if any): %s, Command length: %d", src_req->cmd, src_req->prefix, strlen(src_req->cmd));
\r
3056 // Free Command string
\r
3059 tcore_pending_set_request_data(src_pending, 0, src_req);
\r
3061 src_ur= tcore_user_request_ref(ur);
\r
3064 ret = _call_request_message(src_pending, o, src_ur, on_confirmation_call_set_source_sound_volume_level, NULL);
\r
3066 err("Failed to send AT-Command request");
\r
3067 return TCORE_RETURN_FAILURE;
\r
3070 // Destination volume
\r
3071 dbg("Set Source volume");
\r
3073 cmd_str = g_strdup_printf("%s", "AT+XDRV=40,8,0,88"); // Source type
\r
3074 dbg("Request command string: %s", cmd_str);
\r
3076 // Create new Pending request
\r
3077 dest_pending = tcore_pending_new(o, 0);
\r
3079 // Create new AT-Command request
\r
3080 dest_req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE);
\r
3081 dbg("Command: %s, prefix(if any): %s, Command length: %d", dest_req->cmd, dest_req->prefix, strlen(dest_req->cmd));
\r
3083 // Free Command string
\r
3086 tcore_pending_set_request_data(dest_pending, 0, dest_req);
\r
3087 dest_ur = tcore_user_request_ref(ur);
\r
3090 ret = _call_request_message (dest_pending, o, dest_ur, on_confirmation_call_set_source_sound_volume_level, NULL);
\r
3092 err("Failed to send AT-Command request");
\r
3093 return TCORE_RETURN_FAILURE;
\r
3096 dbg("Input volume level - %d",data->volume);
\r
3097 switch(data->volume) {
\r
3099 case CALL_SOUND_MUTE:
\r
3100 volume_level = "0";
\r
3102 case CALL_SOUND_VOLUME_LEVEL_1:
\r
3103 volume_level = "40";
\r
3105 case CALL_SOUND_VOLUME_LEVEL_2:
\r
3106 volume_level = "46";
\r
3108 case CALL_SOUND_VOLUME_LEVEL_3:
\r
3109 volume_level = "52";
\r
3111 case CALL_SOUND_VOLUME_LEVEL_4:
\r
3112 volume_level = "58";
\r
3114 case CALL_SOUND_VOLUME_LEVEL_5:
\r
3115 volume_level = "64";
\r
3117 case CALL_SOUND_VOLUME_LEVEL_6:
\r
3118 volume_level = "70";
\r
3120 case CALL_SOUND_VOLUME_LEVEL_7:
\r
3121 volume_level = "76";
\r
3123 case CALL_SOUND_VOLUME_LEVEL_8:
\r
3124 volume_level = "82";
\r
3126 case CALL_SOUND_VOLUME_LEVEL_9:
\r
3128 volume_level = "88";
\r
3131 cmd_str = g_strdup_printf("%s%s","AT+XDRV=40,8,2,",volume_level); //Destination type
\r
3132 dbg("Request command string: %s", cmd_str);
\r
3134 // Create new Pending request
\r
3135 dest_pending = tcore_pending_new(o, 0);
\r
3137 // Create new AT-Command request
\r
3138 dest_req = tcore_at_request_new(cmd_str,"+XDRV", TCORE_AT_SINGLELINE);
\r
3139 dbg("Command: %s, prefix(if any): %s, Command length: %d", dest_req->cmd, dest_req->prefix, strlen(dest_req->cmd));
\r
3141 // Free Command string
\r
3144 tcore_pending_set_request_data(dest_pending, 0, dest_req);
\r
3147 ret = _call_request_message(dest_pending, o, ur, on_confirmation_call_set_destination_sound_volume_level, NULL);
\r
3149 err("Failed to send AT-Command request");
\r
3150 return TCORE_RETURN_FAILURE;
\r
3153 return TCORE_RETURN_SUCCESS;
\r
3157 static TReturn s_call_get_sound_volume_level(CoreObject *o, UserRequest *ur)
\r
3162 return TCORE_RETURN_SUCCESS;
\r
3165 static TReturn s_call_mute(CoreObject *o, UserRequest *ur)
\r
3167 char *cmd_str = NULL;
\r
3168 TcorePending *pending = NULL;
\r
3169 TcoreATRequest *req = NULL;
\r
3170 gboolean ret = FALSE;
\r
3173 cmd_str = g_strdup_printf("%s","AT+XDRV=40,8,0,0,0");
\r
3175 dbg("Request command string: %s", cmd_str);
\r
3177 // Create new Pending request
\r
3178 pending = tcore_pending_new(o, 0);
\r
3180 // Create new AT-Command request
\r
3181 req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE);
\r
3182 dbg("Command: %s, prefix(if any): %s, Command length: %d", req->cmd, req->prefix, strlen(req->cmd));
\r
3184 // Free command string
\r
3187 // Set request data (AT command) to Pending request
\r
3188 tcore_pending_set_request_data(pending, 0, req);
\r
3191 ret = _call_request_message (pending, o, ur, on_confirmation_call_mute, NULL);
\r
3193 err("Failed to send AT-Command request");
\r
3194 return TCORE_RETURN_FAILURE;
\r
3198 return TCORE_RETURN_SUCCESS;
\r
3201 static TReturn s_call_unmute(CoreObject *o, UserRequest *ur)
\r
3203 char *cmd_str = NULL;
\r
3204 TcorePending *pending = NULL;
\r
3205 TcoreATRequest *req = NULL;
\r
3206 gboolean ret = FALSE;
\r
3209 cmd_str = g_strdup_printf("%s","AT+XDRV=40,8,0,0,88");
\r
3210 dbg("Request command string: %s", cmd_str);
\r
3212 // Create new Pending request
\r
3213 pending = tcore_pending_new(o, 0);
\r
3215 // Create new AT-Command request
\r
3216 req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE);
\r
3217 dbg("Command: %s, prefix(if any): %s, Command length: %d", req->cmd, req->prefix, strlen(req->cmd));
\r
3219 // Free command string
\r
3222 // Set request data (AT command) to Pending request
\r
3223 tcore_pending_set_request_data(pending, 0, req);
\r
3226 ret = _call_request_message (pending, o, ur, on_confirmation_call_unmute, NULL);
\r
3228 err("Failed to send AT-Command request");
\r
3229 return TCORE_RETURN_FAILURE;
\r
3233 return TCORE_RETURN_SUCCESS;
\r
3238 static TReturn s_call_get_mute_status(CoreObject *o, UserRequest *ur)
\r
3243 return TCORE_RETURN_SUCCESS;
\r
3246 static TReturn _set_dtmf_tone_duration(CoreObject *o, UserRequest *ur)
\r
3248 char *cmd_str = NULL;
\r
3249 TcorePending *pending = NULL;
\r
3250 TcoreATRequest *req = NULL;
\r
3251 gboolean ret = FALSE;
\r
3254 cmd_str = g_strdup_printf("%s", "AT+VTD=3"); // ~300 mili secs. +VTD= n, where n = (0 - 255) * 1/10 secs.
\r
3255 dbg("Request command string: %s", cmd_str);
\r
3257 // Create new Pending request
\r
3258 pending = tcore_pending_new(o, 0);
\r
3260 // Create new AT-Command request
\r
3261 req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
\r
3262 dbg("Command: %s, prefix(if any): %s, Command length: %d", req->cmd, req->prefix, strlen(req->cmd));
\r
3264 // Free command string */
\r
3267 // Set request data (AT command) to Pending request
\r
3268 tcore_pending_set_request_data(pending, 0, req);
\r
3271 ret = _call_request_message (pending, o, ur, _on_confirmation_dtmf_tone_duration, NULL);
\r
3273 err("Failed to send AT-Command request");
\r
3274 return TCORE_RETURN_FAILURE;
\r
3278 return TCORE_RETURN_SUCCESS;
\r
3282 static struct tcore_call_operations call_ops = {
\r
3283 .dial = s_call_outgoing,
\r
3284 .answer = s_call_answer,
\r
3285 .end = s_call_release,
\r
3286 .hold = s_call_hold,
\r
3287 .active = s_call_active,
\r
3288 .swap = s_call_swap,
\r
3289 .join = s_call_join,
\r
3290 .split = s_call_split,
\r
3291 .deflect = s_call_deflect,
\r
3292 .transfer = s_call_transfer,
\r
3293 .send_dtmf = s_call_send_dtmf,
\r
3294 .set_sound_path = s_call_set_sound_path,
\r
3295 .set_sound_volume_level = s_call_set_sound_volume_level,
\r
3296 .get_sound_volume_level = s_call_get_sound_volume_level,
\r
3297 .mute = s_call_mute,
\r
3298 .unmute = s_call_unmute,
\r
3299 .get_mute_status = s_call_get_mute_status,
\r
3300 .set_sound_recording = NULL,
\r
3301 .set_sound_equalization = NULL,
\r
3302 .set_sound_noise_reduction = NULL,
\r
3305 static void s_call_info_mo_waiting(CoreObject *o)
\r
3307 TcorePlugin *plugin = NULL;
\r
3308 CallObject *co = NULL;
\r
3313 plugin = tcore_object_ref_plugin(o);
\r
3315 // Call Core object
\r
3316 co = tcore_call_object_current_on_mo_processing(o);
\r
3318 err("Failed to find Call Core object!");
\r
3323 id = tcore_call_object_get_id(co);
\r
3325 // Send notification to TAPI
\r
3326 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3327 tcore_plugin_ref_core_object(plugin, "call"),
\r
3328 TNOTI_CALL_INFO_WAITING,
\r
3329 sizeof(unsigned int),
\r
3336 static void s_call_info_mo_forwarded(CoreObject *o)
\r
3338 TcorePlugin *plugin = NULL;
\r
3339 CallObject *co = NULL;
\r
3344 plugin = tcore_object_ref_plugin(o);
\r
3346 // Call Core object
\r
3347 co = tcore_call_object_current_on_mo_processing(o);
\r
3349 err("Failed to find Call Core object!");
\r
3354 id = tcore_call_object_get_id(co);
\r
3356 // Send notification to TAPI
\r
3357 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3358 tcore_plugin_ref_core_object(plugin, "call"),
\r
3359 TNOTI_CALL_INFO_FORWARDED,
\r
3360 sizeof(unsigned int),
\r
3367 static void s_call_info_mo_barred_incoming(CoreObject *o)
\r
3369 TcorePlugin *plugin = NULL;
\r
3370 CallObject *co = NULL;
\r
3375 plugin = tcore_object_ref_plugin(o);
\r
3377 // Call Core object
\r
3378 co = tcore_call_object_current_on_mo_processing(o);
\r
3380 err("Failed to find Call Core object!");
\r
3385 id = tcore_call_object_get_id(co);
\r
3387 // Send notification to TAPI
\r
3388 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3389 tcore_plugin_ref_core_object(plugin, "call"),
\r
3390 TNOTI_CALL_INFO_BARRED_INCOMING,
\r
3391 sizeof(unsigned int),
\r
3398 static void s_call_info_mo_barred_outgoing(CoreObject *o)
\r
3400 TcorePlugin *plugin = NULL;
\r
3401 CallObject *co = NULL;
\r
3406 plugin = tcore_object_ref_plugin(o);
\r
3408 // Call Core object
\r
3409 co = tcore_call_object_current_on_mo_processing(o);
\r
3411 err("Failed to find Call Core object!");
\r
3416 id = tcore_call_object_get_id(co);
\r
3418 // Send notification to TAPI
\r
3419 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3420 tcore_plugin_ref_core_object(plugin, "call"),
\r
3421 TNOTI_CALL_INFO_BARRED_OUTGOING,
\r
3422 sizeof(unsigned int),
\r
3429 static void s_call_info_mo_deflected(CoreObject *o)
\r
3431 TcorePlugin *plugin = NULL;
\r
3432 CallObject *co = NULL;
\r
3437 plugin = tcore_object_ref_plugin(o);
\r
3439 // Call Core object
\r
3440 co = tcore_call_object_current_on_mo_processing(o);
\r
3442 err("Failed to find Call Core object!");
\r
3447 id = tcore_call_object_get_id(co);
\r
3449 // Send notification to TAPI
\r
3450 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3451 tcore_plugin_ref_core_object(plugin, "call"),
\r
3452 TNOTI_CALL_INFO_DEFLECTED,
\r
3453 sizeof(unsigned int),
\r
3460 static void s_call_info_mo_clir_suppression_reject(CoreObject *o)
\r
3462 TcorePlugin *plugin = NULL;
\r
3463 CallObject *co = NULL;
\r
3468 plugin = tcore_object_ref_plugin(o);
\r
3470 // Call Core object
\r
3471 co = tcore_call_object_current_on_mo_processing(o);
\r
3473 err("Failed to find Call Core object!");
\r
3478 id = tcore_call_object_get_id(co);
\r
3480 // Send notification to TAPI
\r
3481 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3482 tcore_plugin_ref_core_object(plugin, "call"),
\r
3483 TNOTI_CALL_INFO_CLIR_SUPPRESSION_REJECT,
\r
3484 sizeof(unsigned int),
\r
3491 static void s_call_info_mo_cfu(CoreObject *o)
\r
3493 TcorePlugin *plugin = NULL;
\r
3494 CallObject *co = NULL;
\r
3499 plugin = tcore_object_ref_plugin(o);
\r
3501 // Call Core object
\r
3502 co = tcore_call_object_current_on_mo_processing(o);
\r
3504 err("Failed to find Call Core object!");
\r
3509 id = tcore_call_object_get_id(co);
\r
3511 // Send notification to TAPI
\r
3512 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3513 tcore_plugin_ref_core_object(plugin, "call"),
\r
3514 TNOTI_CALL_INFO_FORWARD_UNCONDITIONAL,
\r
3515 sizeof(unsigned int),
\r
3522 static void s_call_info_mo_cfc(CoreObject *o)
\r
3524 TcorePlugin *plugin = NULL;
\r
3525 CallObject *co = NULL;
\r
3530 plugin = tcore_object_ref_plugin(o);
\r
3532 // Call Core object
\r
3533 co = tcore_call_object_current_on_mo_processing(o);
\r
3535 err("Failed to find Call Core object!");
\r
3540 id = tcore_call_object_get_id(co);
\r
3542 // Send notification to TAPI
\r
3543 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3544 tcore_plugin_ref_core_object(plugin, "call"),
\r
3545 TNOTI_CALL_INFO_FORWARD_CONDITIONAL,
\r
3546 sizeof(unsigned int),
\r
3553 static void s_call_info_mt_cli(CoreObject *o, enum tcore_call_cli_mode mode, char* number)
\r
3555 CallObject *co = NULL;
\r
3558 // Call Core object
\r
3559 co = tcore_call_object_current_on_mt_processing(o);
\r
3561 err("Failed to find Call Core object!");
\r
3565 // Set CLI information
\r
3566 tcore_call_object_set_cli_info(co, mode, number);
\r
3572 static void s_call_info_mt_cna(CoreObject *o, enum tcore_call_cna_mode mode, char* name, int dcs)
\r
3574 CallObject *co = NULL;
\r
3577 // Call Core object
\r
3578 co = tcore_call_object_current_on_mt_processing(o);
\r
3580 err("Failed to find Call Core object!");
\r
3584 // Set CNA information
\r
3585 tcore_call_object_set_cna_info(co, mode, name, dcs);
\r
3591 static void s_call_info_mt_forwarded_call(CoreObject *o, char* number)
\r
3593 TcorePlugin *plugin = NULL;
\r
3594 CallObject *co = NULL;
\r
3599 plugin = tcore_object_ref_plugin(o);
\r
3601 // Call Core object
\r
3602 co = tcore_call_object_find_by_number(o, number);
\r
3604 err("Failed to find Call Core object!");
\r
3609 id = tcore_call_object_get_id(co);
\r
3611 // Send notification to TAPI
\r
3612 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3613 tcore_plugin_ref_core_object(plugin, "call"),
\r
3614 TNOTI_CALL_INFO_FORWARDED_CALL,
\r
3615 sizeof(unsigned int),
\r
3622 static void s_call_info_mt_deflected_call(CoreObject *o, char* number)
\r
3624 TcorePlugin *plugin = NULL;
\r
3625 CallObject *co = NULL;
\r
3630 plugin = tcore_object_ref_plugin(o);
\r
3632 // Call Core object
\r
3633 co = tcore_call_object_find_by_number(o, number);
\r
3635 err("Failed to find Call Core object!");
\r
3640 id = tcore_call_object_get_id(co);
\r
3642 // Send notification to TAPI
\r
3643 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3644 tcore_plugin_ref_core_object(plugin, "call"),
\r
3645 TNOTI_CALL_INFO_DEFLECTED_CALL,
\r
3646 sizeof(unsigned int),
\r
3653 static void s_call_info_mt_transfered(CoreObject *o, char* number)
\r
3655 TcorePlugin *plugin = NULL;
\r
3656 CallObject *co = NULL;
\r
3661 plugin = tcore_object_ref_plugin(o);
\r
3663 // Call Core object
\r
3664 co = tcore_call_object_find_by_number(o, number);
\r
3666 err("Failed to find Call Core object!");
\r
3671 id = tcore_call_object_get_id(co);
\r
3673 // Send notification to TAPI
\r
3674 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3675 tcore_plugin_ref_core_object(plugin, "call"),
\r
3676 TNOTI_CALL_INFO_TRANSFERED_CALL,
\r
3677 sizeof(unsigned int),
\r
3684 static void s_call_info_held(CoreObject *o, char* number)
\r
3686 TcorePlugin *plugin = NULL;
\r
3687 CallObject *co = NULL;
\r
3692 plugin = tcore_object_ref_plugin(o);
\r
3694 // Call Core object
\r
3695 co = tcore_call_object_find_by_number(o, number);
\r
3697 err("Failed to find Call Core object!");
\r
3702 id = tcore_call_object_get_id(co);
\r
3704 // Send notification to TAPI
\r
3705 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3706 tcore_plugin_ref_core_object(plugin, "call"),
\r
3707 TNOTI_CALL_INFO_HELD,
\r
3708 sizeof(unsigned int),
\r
3715 static void s_call_info_active(CoreObject *o, char* number)
\r
3717 TcorePlugin *plugin = NULL;
\r
3718 CallObject *co = NULL;
\r
3723 plugin = tcore_object_ref_plugin(o);
\r
3725 // Call Core object
\r
3726 co = tcore_call_object_find_by_number(o, number);
\r
3728 err("Failed to find Call Core object!");
\r
3733 id = tcore_call_object_get_id(co);
\r
3735 // Send notification to TAPI
\r
3736 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3737 tcore_plugin_ref_core_object(plugin, "call"),
\r
3738 TNOTI_CALL_INFO_ACTIVE,
\r
3739 sizeof(unsigned int),
\r
3746 static void s_call_info_joined(CoreObject *o, char* number)
\r
3748 TcorePlugin *plugin = NULL;
\r
3749 CallObject *co = NULL;
\r
3754 plugin = tcore_object_ref_plugin(o);
\r
3756 //Call Core object
\r
3757 co = tcore_call_object_find_by_number(o, number);
\r
3759 err("Failed to find Call Core object!");
\r
3764 id = tcore_call_object_get_id(co);
\r
3766 // Send notification to TAPI
\r
3767 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3768 tcore_plugin_ref_core_object(plugin, "call"),
\r
3769 TNOTI_CALL_INFO_JOINED,
\r
3770 sizeof(unsigned int),
\r
3777 static void s_call_info_released_on_hold(CoreObject *o, char* number)
\r
3779 TcorePlugin *plugin = NULL;
\r
3780 CallObject *co = NULL;
\r
3785 plugin = tcore_object_ref_plugin(o);
\r
3787 // Call Core object
\r
3788 co = tcore_call_object_find_by_number(o, number);
\r
3790 err("Failed to find Call Core object!");
\r
3795 id = tcore_call_object_get_id(co);
\r
3797 // Send notification to TAPI
\r
3798 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3799 tcore_plugin_ref_core_object(plugin, "call"),
\r
3800 TNOTI_CALL_INFO_RELEASED_ON_HOLD,
\r
3801 sizeof(unsigned int),
\r
3808 static void s_call_info_transfer_alert(CoreObject *o, char* number)
\r
3810 TcorePlugin *plugin = NULL;
\r
3811 CallObject *co = NULL;
\r
3816 plugin = tcore_object_ref_plugin(o);
\r
3818 // Call Core object
\r
3819 co = tcore_call_object_find_by_number(o, number);
\r
3821 err("Failed to find Call Core object!");
\r
3826 id = tcore_call_object_get_id(co);
\r
3828 //Send notification to TAPI
\r
3829 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3830 tcore_plugin_ref_core_object(plugin, "call"),
\r
3831 TNOTI_CALL_INFO_TRANSFER_ALERT,
\r
3832 sizeof(unsigned int),
\r
3839 static void s_call_info_transfered(CoreObject *o, char* number)
\r
3841 TcorePlugin *plugin = NULL;
\r
3842 CallObject *co = NULL;
\r
3847 plugin = tcore_object_ref_plugin(o);
\r
3849 // Call Core object
\r
3850 co = tcore_call_object_find_by_number(o, number);
\r
3852 err("Failed to find Call Core object!");
\r
3857 id = tcore_call_object_get_id(co);
\r
3859 // Send notification to TAPI
\r
3860 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3861 tcore_plugin_ref_core_object(plugin, "call"),
\r
3862 TNOTI_CALL_INFO_TRANSFERED,
\r
3863 sizeof(unsigned int),
\r
3870 static void s_call_info_cf_check_message(CoreObject *o, char* number)
\r
3872 TcorePlugin *plugin = NULL;
\r
3873 CallObject *co = NULL;
\r
3878 plugin = tcore_object_ref_plugin(o);
\r
3880 // Call Core object
\r
3881 co = tcore_call_object_find_by_number(o, number);
\r
3883 err("Failed to find Call Core object!");
\r
3888 id = tcore_call_object_get_id(co);
\r
3890 // Send notification to TAPI
\r
3891 tcore_server_send_notification(tcore_plugin_ref_server(plugin),
\r
3892 tcore_plugin_ref_core_object(plugin, "call"),
\r
3893 TNOTI_CALL_INFO_CF_CHECK_MESSAGE,
\r
3894 sizeof(unsigned int),
\r
3901 // Call Information Operations
\r
3902 static struct tcore_call_information_operations call_information_ops = {
\r
3904 .mo_call_waiting = s_call_info_mo_waiting,
\r
3906 .mo_call_forwarded = s_call_info_mo_forwarded,
\r
3907 .mo_call_barred_incoming = s_call_info_mo_barred_incoming,
\r
3908 .mo_call_barred_outgoing = s_call_info_mo_barred_outgoing,
\r
3909 .mo_call_deflected = s_call_info_mo_deflected,
\r
3910 .mo_call_clir_suppression_reject = s_call_info_mo_clir_suppression_reject,
\r
3911 .mo_call_cfu = s_call_info_mo_cfu,
\r
3912 .mo_call_cfc = s_call_info_mo_cfc,
\r
3913 .mt_call_cli = s_call_info_mt_cli,
\r
3914 .mt_call_cna = s_call_info_mt_cna,
\r
3915 .mt_call_forwarded_call = s_call_info_mt_forwarded_call,
\r
3916 .mt_call_cug_call = 0,
\r
3917 .mt_call_deflected_call = s_call_info_mt_deflected_call,
\r
3918 .mt_call_transfered = s_call_info_mt_transfered,
\r
3919 .call_held = s_call_info_held,
\r
3920 .call_active = s_call_info_active,
\r
3921 .call_joined = s_call_info_joined,
\r
3922 .call_released_on_hold = s_call_info_released_on_hold,
\r
3923 .call_transfer_alert = s_call_info_transfer_alert,
\r
3924 .call_transfered = s_call_info_transfered,
\r
3925 .call_cf_check_message = s_call_info_cf_check_message,
\r
3928 gboolean s_call_init(TcorePlugin *p, TcoreHal *h)
\r
3930 CoreObject *o = NULL;
\r
3931 struct property_call_info *data = NULL;
\r
3934 //Creating Call COre object
\r
3935 o = tcore_call_new(p, "call", &call_ops, h);
\r
3937 err("Failed to create Call Core Object");
\r
3941 //Set Call Operations
\r
3942 tcore_call_information_set_operations(o, &call_information_ops);
\r
3945 tcore_object_add_callback(o, "+XCALLSTAT", on_notification_call_info, NULL);
\r
3946 tcore_object_add_callback(o, "+CLIP", on_notification_call_clip_info, NULL);
\r
3949 data = calloc(sizeof(struct property_call_info *), 1);
\r
3950 tcore_plugin_link_property(p, "CALL", data);
\r
3956 void s_call_exit(TcorePlugin *p)
\r
3958 CoreObject *o = NULL;
\r
3959 struct property_network_info *data = NULL;
\r
3962 o = tcore_plugin_ref_core_object(p, "call");
\r
3964 // Free Call Core Object */
\r
3965 tcore_call_free(o);
\r
3967 // Free 'CALL' property */
\r
3968 data = tcore_plugin_ref_property(p, "CALL");
\r