Initialize Tizen 2.3
[framework/telephony/libslp-tapi.git] / test_src / ss.c
1 /*
2  * libslp-tapi
3  *
4  * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Ja-young Gu <jygu@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <sys/time.h>
25 #include <unistd.h>
26 #include <glib.h>
27
28 #include <tapi_common.h>
29 #include <ITapiSs.h>
30 #include <TapiUtility.h>
31
32 #include "menu.h"
33 #include "ss.h"
34
35 static char data_ss_set_barring_class[MENU_DATA_SIZE + 1] = "16";
36 static char data_ss_set_barring_mode[MENU_DATA_SIZE + 1] = "0";
37 static char data_ss_set_barring_type[MENU_DATA_SIZE + 1] = "1";
38 static char data_ss_set_barring_password[MENU_DATA_SIZE + 1] = "1111";
39
40 static char data_ss_get_barring_status_class[MENU_DATA_SIZE + 1] = "16";
41 static char data_ss_get_barring_status_type[MENU_DATA_SIZE + 1] = "1";
42
43 static char data_ss_change_barring_password_old[MENU_DATA_SIZE + 1] = "1111";
44 static char data_ss_change_barring_password_new[MENU_DATA_SIZE + 1] = "1234";
45
46 static char data_ss_set_forward_class[MENU_DATA_SIZE + 1] = "16";
47 static char data_ss_set_forward_mode[MENU_DATA_SIZE + 1] = "1";
48 static char data_ss_set_forward_condition[MENU_DATA_SIZE + 1] = "5";
49 static char data_ss_set_forward_timer[MENU_DATA_SIZE + 1] = "5";
50 static char data_ss_set_forward_number[MENU_DATA_SIZE + 1] = "01030018655";
51
52 static char data_ss_get_forward_status_class[MENU_DATA_SIZE + 1] = "16";
53 static char data_ss_get_forward_status_condition[MENU_DATA_SIZE + 1] = "1";
54
55 static char data_ss_set_waiting_class[MENU_DATA_SIZE + 1] = "16";
56 static char data_ss_set_waiting_mode[MENU_DATA_SIZE + 1] = "0";
57
58 static char data_ss_get_waiting_status_class[MENU_DATA_SIZE + 1] = "16";
59
60 static char data_ss_get_cli_status_type[MENU_DATA_SIZE + 1] = "1";
61 static char data_ss_set_cli_status_type[MENU_DATA_SIZE + 1] = "1";
62 static char data_ss_set_cli_status[MENU_DATA_SIZE + 1] = "1";
63
64 static char data_ss_ussd_request_type[MENU_DATA_SIZE + 1] = "1";
65 static char data_ss_ussd_request_string[MENU_DATA_SIZE + 1] = "";
66
67 static void on_noti_ss_ussd(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
68 {
69         TelSsUssdMsgInfo_t *noti = data;
70
71         msg("");
72         msgb("event(%s) receive !!", TAPI_NOTI_SS_USSD);
73
74         if (!noti)
75                 return;
76
77         msg(" - Type = 0x%x", noti->Type);
78         msg(" - Length = 0x%x", noti->Length);
79         msg(" - szString = %s", noti->szString);
80 }
81
82 static void on_noti_ss_release_complete(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
83 {
84         TelSsRelCompMsgInfo_t *info = data;
85         int i = 0;
86
87         msg("");
88         msgb("event(%s) receive !!", TAPI_NOTI_SS_RELEASE_COMPLETE);
89
90
91         msg(" - info->RelCompMsgLen = 0x%x", info->RelCompMsgLen);
92         msg(" - info->szRelCompMsg = ");
93         for ( i=0; i<info->RelCompMsgLen; i++ ) {
94                 msg("%d : [%x]", i, info->szRelCompMsg[i]);
95         }
96 }
97
98 static void on_noti_ss_forwarding_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
99 {
100         TelSsForwardNoti_t *noti = data;
101         int i =0;
102
103         msg("SS Forwarding Status Noti");
104
105         for ( i=0; i<noti->record_num; i++ ) {
106                 msg("class : %d", noti->record[i].Class);
107                 msg("status : %d", noti->record[i].Status);
108                 msg("condition : %d", noti->record[i].ForwardCondition);
109                 msg("number present : %d", noti->record[i].bCallForwardingNumberPresent);
110                 msg("no reply time : %d", noti->record[i].NoReplyWaitTime);
111                 msg("ton : %d", noti->record[i].Ton);
112                 msg("npi : %d", noti->record[i].Npi);
113                 msg("number : %s", noti->record[i].szCallForwardingNumber);
114                 msg("");
115         }
116
117 }
118
119 static void on_noti_ss_barring_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
120 {
121         TelSsBarringNoti_t *noti = data;
122         int i =0;
123
124         msg("SS Barring Status Noti");
125
126         for ( i=0; i<noti->record_num; i++ ) {
127                 msg("class : %d", noti->record[i].Class);
128                 msg("status : %d", noti->record[i].Status);
129                 msg("type : %d", noti->record[i].Flavour);
130                 msg("");
131         }
132
133 }
134
135 static void on_noti_ss_waiting_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
136 {
137         TelSsWaitingNoti_t *noti = data;
138         int i =0;
139
140         msg("SS Waiting Status Noti");
141
142         for ( i=0; i<noti->record_num; i++ ) {
143                 msg("class : %d", noti->record[i].Class);
144                 msg("status : %d", noti->record[i].Status);
145                 msg("");
146         }
147 }
148
149 static void on_noti_ss_sups_info(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
150 {
151         TelSsInfo_t *noti = data;
152
153         msg("SS SUPS Info Noti");
154
155         msg("SS error : %d", noti->Cause);
156         msg("status : %d", noti->SsType);
157         msg("");
158 }
159
160 static void on_ss_barring(TapiHandle *handle, int result, void *data, void *user_data)
161 {
162         TelSsBarringResp_t *resp = data;
163         int i = 0;
164
165         msg("");
166         msgb("tel_set_ss_barring() or tel_get_ss_barring_status() response receive");
167         msg(" - result = 0x%x", result);
168
169         if (!resp)
170                 return;
171
172         msg(" - record_num = %d", resp->record_num);
173
174         for (i = 0; i < resp->record_num; i++) {
175                 msg(" - [%d] Class=%d, Status=%d, Flavour=%d",
176                                 i,
177                                 resp->record[i].Class,
178                                 resp->record[i].Status,
179                                 resp->record[i].Flavour);
180         }
181 }
182
183 static void on_ss_change_barring_password(TapiHandle *handle, int result, void *data, void *user_data)
184 {
185         msg("");
186         msgb("tel_change_ss_barring_password() response receive");
187         msg(" - result = 0x%x", result);
188 }
189
190 static void on_ss_forward(TapiHandle *handle, int result, void *data, void *user_data)
191 {
192         TelSsForwardResp_t *resp = data;
193         int i;
194
195         msg("");
196         msgb("tel_set_ss_forward() or tel_get_ss_forward_status() response receive");
197         msg(" - result = 0x%x", result);
198
199         if (!resp)
200                 return;
201
202         msg(" - record_num = %d", resp->record_num);
203
204         for (i = 0; i < resp->record_num; i++) {
205                 msg(" - [%d] Class=%d, Status=%d, ForwardCondition=%d, NoReplyWaitTime=%d, bCallForwardingNumberPresend=%d, szCallForwardingNumber=[%s]",
206                                 i,
207                                 resp->record[i].Class,
208                                 resp->record[i].Status,
209                                 resp->record[i].ForwardCondition,
210                                 resp->record[i].NoReplyWaitTime,
211                                 resp->record[i].bCallForwardingNumberPresent,
212                                 resp->record[i].szCallForwardingNumber);
213         }
214 }
215
216 static void on_ss_waiting(TapiHandle *handle, int result, void *data, void *user_data)
217 {
218         TelSsWaitingResp_t *resp = data;
219         int i;
220
221         msg("");
222         msgb("tel_set_ss_waiting() or tel_get_ss_waiting_status() response receive");
223         msg(" - result = 0x%x", result);
224
225         if (!resp)
226                 return;
227
228         msg(" - record_num = %d", resp->record_num);
229
230         for (i = 0; i < resp->record_num; i++) {
231                 msg(" - [%d] Class=%d, Status=%d",
232                                 i,
233                                 resp->record[i].Class,
234                                 resp->record[i].Status);
235         }
236 }
237
238 static void on_ss_set_cli_status(TapiHandle *handle, int result, void *data, void *user_data)
239 {
240         msg("");
241         msgb("tel_set_ss_cli_status() response receive");
242         msg(" - result = 0x%x", result);
243         return;
244 }
245
246 static void on_ss_get_cli_status(TapiHandle *handle, int result, void *data, void *user_data)
247 {
248         TelSsCliResp_t *resp = data;
249
250         msg("");
251         msgb("tel_get_ss_cli_status() response receive");
252         msg(" - result = 0x%x", result);
253
254         if (!resp)
255                 return;
256
257         msg(" - type = %d", resp->Type);
258         msg(" - status = %d", resp->Status);
259 }
260
261 static void on_ss_send_ussd_request(TapiHandle *handle, int result, void *data, void *user_data)
262 {
263         TelSsUssdResp_t *resp = data;
264
265         msg("");
266         msgb("tel_send_ss_ussd_request() response receive");
267         msg(" - result = 0x%x", result);
268
269         if (!resp)
270                 return;
271
272         msg(" - type = %d", resp->Type);
273         msg(" - status = %d", resp->Status);
274         msg(" - length = %d", resp->Length);
275         msg(" - string = [%s]", resp->szString);
276 }
277
278 static int run_ss_set_barring(MManager *mm, struct menu_data *menu)
279 {
280         TapiHandle *handle = menu_manager_ref_user_data(mm);
281         int result;
282         TelSsBarringInfo_t info;
283
284         msg("call tel_set_ss_barring()");
285
286         memset(&info, 0, sizeof(TelSsBarringInfo_t));
287         info.Class = atoi(data_ss_set_barring_class);
288         info.Mode = atoi(data_ss_set_barring_mode);
289         info.Type = atoi(data_ss_set_barring_type);
290         g_strlcpy(info.szPassword, data_ss_set_barring_password, TAPI_SS_GSM_BARR_PW_LEN_MAX+1);
291
292         msg("info.szPassword - %s data_ss_set_barring_password- %s\n", info.szPassword, data_ss_set_barring_password);
293         msg("Call barring Mode [%d]\n", info.Mode);
294
295         result = tel_set_ss_barring(handle, &info, on_ss_barring, NULL);
296         if (result != TAPI_API_SUCCESS) {
297                 msg("failed. (result = %d)", result);
298         }
299
300         return 0;
301 }
302
303 static int run_ss_get_barring_status(MManager *mm, struct menu_data *menu)
304 {
305         TapiHandle *handle = menu_manager_ref_user_data(mm);
306         int result;
307         TelSsClass_t class;
308         TelSsBarringType_t type;
309
310         msg("call tel_get_ss_barring_status()");
311
312         class = atoi(data_ss_get_barring_status_class);
313         type = atoi(data_ss_get_barring_status_type);
314
315         result = tel_get_ss_barring_status(handle, class, type, on_ss_barring, NULL);
316         if (result != TAPI_API_SUCCESS) {
317                 msg("failed. (result = %d)", result);
318         }
319
320         return 0;
321 }
322
323 static int run_ss_change_barring_password(MManager *mm, struct menu_data *menu)
324 {
325         TapiHandle *handle = menu_manager_ref_user_data(mm);
326         int result;
327
328         msg("call tel_change_ss_barring_password()");
329
330         result = tel_change_ss_barring_password(handle,
331                         data_ss_change_barring_password_old,
332                         data_ss_change_barring_password_new,
333                         data_ss_change_barring_password_new,
334                         on_ss_change_barring_password, NULL);
335         if (result != TAPI_API_SUCCESS) {
336                 msg("failed. (result = %d)", result);
337         }
338
339         return 0;
340 }
341
342 static int run_ss_set_forward(MManager *mm, struct menu_data *menu)
343 {
344         TapiHandle *handle = menu_manager_ref_user_data(mm);
345         int result;
346         TelSsForwardInfo_t info;
347         int len;
348
349         msg("call tel_set_ss_forward()");
350
351         len = strlen(data_ss_set_forward_number);
352         if (len >= TAPI_CALL_DIALDIGIT_LEN_MAX - 1) {
353                 msg("failed. forward_number too long");
354                 return 0;
355         }
356
357         memset(&info, 0, sizeof(TelSsForwardInfo_t));
358         info.Class = atoi(data_ss_set_forward_class);
359         info.Condition = atoi(data_ss_set_forward_condition);
360         info.NoReplyConditionTimer = atoi(data_ss_set_forward_timer);
361         info.Mode = atoi(data_ss_set_forward_mode);
362         info.Ton = 0x01;
363         info.Npi = 0x01;
364         strncpy((char*)info.szPhoneNumber, data_ss_set_forward_number, len);
365         info.szPhoneNumber[len] = '\0';
366
367         result = tel_set_ss_forward(handle, &info, on_ss_forward, NULL);
368         if (result != TAPI_API_SUCCESS) {
369                 msg("failed. (result = %d)", result);
370         }
371
372         return 0;
373 }
374
375 static int run_ss_get_forward_status(MManager *mm, struct menu_data *menu)
376 {
377         TapiHandle *handle = menu_manager_ref_user_data(mm);
378         int result;
379         TelSsClass_t class;
380         TelSsForwardWhen_t condition;
381
382         msg("call tel_get_ss_forward_status()");
383
384         class = atoi(data_ss_get_forward_status_class);
385         condition = atoi(data_ss_get_forward_status_condition);
386
387         result = tel_get_ss_forward_status(handle, class, condition, on_ss_forward, NULL);
388         if (result != TAPI_API_SUCCESS) {
389                 msg("failed. (result = %d)", result);
390         }
391
392         return 0;
393 }
394
395 static int run_ss_set_waiting(MManager *mm, struct menu_data *menu)
396 {
397         TapiHandle *handle = menu_manager_ref_user_data(mm);
398         int result;
399         TelSsWaitingInfo_t info;
400
401         msg("call tel_set_ss_waiting()");
402
403         memset(&info, 0, sizeof(TelSsWaitingInfo_t));
404         info.Class = atoi(data_ss_set_waiting_class);
405         info.Mode = atoi(data_ss_set_waiting_mode);
406
407         result = tel_set_ss_waiting(handle, &info, on_ss_waiting, NULL);
408         if (result != TAPI_API_SUCCESS) {
409                 msg("failed. (result = %d)", result);
410         }
411
412         return 0;
413 }
414
415 static int run_ss_get_waiting_status(MManager *mm, struct menu_data *menu)
416 {
417         TapiHandle *handle = menu_manager_ref_user_data(mm);
418         int result;
419         TelSsClass_t class;
420
421         msg("call tel_get_ss_waiting_status()");
422
423         class = atoi(data_ss_get_waiting_status_class);
424
425         result = tel_get_ss_waiting_status(handle, class, on_ss_waiting, NULL);
426         if (result != TAPI_API_SUCCESS) {
427                 msg("failed. (result = %d)", result);
428         }
429
430         return 0;
431 }
432
433 static int run_ss_set_cli_status(MManager *mm, struct menu_data *menu)
434 {
435         TapiHandle *handle = menu_manager_ref_user_data(mm);
436         int result;
437         TelSsCliType_t type;
438         TelSsCliStatus_t status;
439
440         msg("call tel_set_ss_cli_status()");
441
442         type = atoi(data_ss_set_cli_status_type);
443         status  = atoi(data_ss_set_cli_status);
444
445         result = tel_set_ss_cli_status(handle, type, status, on_ss_set_cli_status, NULL);
446         if (result != TAPI_API_SUCCESS) {
447                 msg("failed. (result = %d)", result);
448         }
449
450         return 0;
451 }
452
453
454 static int run_ss_get_cli_status(MManager *mm, struct menu_data *menu)
455 {
456         TapiHandle *handle = menu_manager_ref_user_data(mm);
457         int result;
458         TelSsCliType_t type;
459
460         msg("call tel_get_ss_cli_status()");
461
462         type = atoi(data_ss_get_cli_status_type);
463
464         result = tel_get_ss_cli_status(handle, type, on_ss_get_cli_status, NULL);
465         if (result != TAPI_API_SUCCESS) {
466                 msg("failed. (result = %d)", result);
467         }
468
469         return 0;
470 }
471
472 static int run_ss_send_ussd_request(MManager *mm, struct menu_data *menu)
473 {
474         TapiHandle *handle = menu_manager_ref_user_data(mm);
475         int result;
476         TelSsUssdMsgInfo_t info;
477
478         msg("call tel_send_ss_ussd_request()");
479
480         memset(&info, 0, sizeof(TelSsUssdMsgInfo_t));
481         info.Type = atoi(data_ss_ussd_request_type);
482         info.Dcs = 0x0f;
483         info.Length = strlen(data_ss_ussd_request_string);
484         if (info.Length > TAPI_SS_USSD_DATA_SIZE_MAX - 1) {
485                 msg("failed. string is too long.");
486                 return 0;
487         }
488         strncpy(info.szString, data_ss_ussd_request_string, TAPI_SS_USSD_DATA_SIZE_MAX - 1);
489
490         result = tel_send_ss_ussd_request(handle, &info, on_ss_send_ussd_request, NULL);
491         if (result != TAPI_API_SUCCESS) {
492                 msg("failed. (result = %d)", result);
493         }
494
495         return 0;
496 }
497
498 static struct menu_data menu_ss_set_barring[] = {
499         { "1", "class", NULL, NULL, data_ss_set_barring_class},
500         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
501         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
502         { "2", "mode", NULL, NULL, data_ss_set_barring_mode},
503         { "-", "(0=Activate, 1=Deactivate)", NULL, NULL, NULL},
504         { "3", "type", NULL, NULL, data_ss_set_barring_type},
505         { "-", "(1=All outgoing calls, 2=Outgoing international calls, 3=BOIC_NOT_HC", NULL, NULL, NULL},
506         { "-", " 4=All incoming calls, 5=BIC_ROAM, 6=AB, 7=AOB, 8=AIB, 9=BIC_NOT_SIM)", NULL, NULL, NULL},
507         { "4", "password", NULL, NULL, data_ss_set_barring_password},
508         { "5", "run", NULL, run_ss_set_barring, NULL},
509         { NULL, NULL, },
510 };
511
512 static struct menu_data menu_ss_get_barring_status[] = {
513         { "1", "class", NULL, NULL, data_ss_get_barring_status_class},
514         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
515         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
516         { "2", "type", NULL, NULL, data_ss_get_barring_status_type},
517         { "-", "(1=All outgoing calls, 2=Outgoing international calls, 3=BOIC_NOT_HC", NULL, NULL, NULL},
518         { "-", " 4=All incoming calls, 5=BIC_ROAM, 6=AB, 7=AOB, 8=AIB, 9=BIC_NOT_SIM)", NULL, NULL, NULL},
519         { "3", "run", NULL, run_ss_get_barring_status, NULL},
520         { NULL, NULL, },
521 };
522
523 static struct menu_data menu_ss_change_barring_password[] = {
524         { "1", "old password", NULL, NULL, data_ss_change_barring_password_old},
525         { "2", "new password", NULL, NULL, data_ss_change_barring_password_new},
526         { "3", "run", NULL, run_ss_change_barring_password, NULL},
527         { NULL, NULL, },
528 };
529
530 static struct menu_data menu_ss_set_forward[] = {
531         { "1", "class", NULL, NULL, data_ss_set_forward_class},
532         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
533         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
534         { "2", "mode", NULL, NULL, data_ss_set_forward_mode},
535         { "-", "(0=Deactivate, 1=Activate, 2=Register, 3=Deregister)", NULL, NULL, NULL},
536         { "3", "condition", NULL, NULL, data_ss_set_forward_condition},
537         { "-", "(1=CFU, 2=CFB, 3=CFNRy, 4=CFNRc, 5=CF_ALL, 6=CFC)", NULL, NULL, NULL},
538         { "4", "timer", NULL, NULL, data_ss_set_forward_timer},
539         { "-", "(5/10/15/20/25/30 secs)", NULL, NULL, NULL},
540         { "5", "number", NULL, NULL, data_ss_set_forward_number},
541         { "6", "run", NULL, run_ss_set_forward, NULL},
542
543         { NULL, NULL, },
544 };
545
546 static struct menu_data menu_ss_get_forward_status[] = {
547         { "1", "class", NULL, NULL, data_ss_get_forward_status_class},
548         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
549         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
550         { "2", "condition", NULL, NULL, data_ss_get_forward_status_condition},
551         { "-", "(1=CFU, 2=CFB, 3=CFNRy, 4=CFNRc, 5=CF_ALL, 6=CFC)", NULL, NULL, NULL},
552         { "3", "run", NULL, run_ss_get_forward_status, NULL},
553         { NULL, NULL, },
554 };
555
556 static struct menu_data menu_ss_set_waiting[] = {
557         { "1", "class", NULL, NULL, data_ss_set_waiting_class},
558         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
559         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
560         { "2", "mode", NULL, NULL, data_ss_set_waiting_mode},
561         { "-", "(0=Activate, 1=Deactivate)", NULL, NULL, NULL},
562         { "3", "run", NULL, run_ss_set_waiting, NULL},
563         { NULL, NULL, },
564 };
565
566 static struct menu_data menu_ss_get_waiting_status[] = {
567         { "1", "class", NULL, NULL, data_ss_get_waiting_status_class},
568         { "-", "(16=All teleservices, 17=All voice, 18=All data teleservices", NULL, NULL, NULL},
569         { "-", " 19=FAX, 22=SMS, 23=VGCS, 24=VBS, 25=ALL_TELE_EXPT_SMS, ...)", NULL, NULL, NULL},
570         { "2", "run", NULL, run_ss_get_waiting_status, NULL},
571         { NULL, NULL, },
572 };
573
574 static struct menu_data menu_ss_set_cli_status[] = {
575         { "1", "type", NULL, NULL, data_ss_set_cli_status_type},
576         { "-", "(1=CLIP, 2=CLIR, 3=COLP, 4=COLR, 5=CDIP, 6=CNAP)", NULL, NULL, NULL},
577         { "2", "mode", NULL, NULL, data_ss_set_cli_status},
578         { "-", "(1=SS_CLI_STATUS_NOT_PROVISONED, 2=SS_CLI_STATUS_PROVISIONED ,)", NULL, NULL, NULL},
579         { "-", "(3=SS_CLI_STATUS_ACTIVATED, 4=SS_CLI_STATUS_UNKOWN ,)", NULL, NULL, NULL},
580         { "-", "(5 =SS_CLI_STATUS_TEMP_RESTRICTED (Only for CLIR) , 6=SS_CLI_STATUS_TEMP_ALLOWED (Only for CLIR) ,)", NULL, NULL, NULL},
581         { "3", "run", NULL, run_ss_set_cli_status, NULL},
582         { NULL, NULL, },
583 };
584
585 static struct menu_data menu_ss_get_cli_status[] = {
586         { "1", "type", NULL, NULL, data_ss_get_cli_status_type},
587         { "-", "(1=CLIP, 2=CLIR, 3=COLP, 4=COLR, 5=CDIP, 6=CNAP)", NULL, NULL, NULL},
588         { "2", "run", NULL, run_ss_get_cli_status, NULL},
589         { NULL, NULL, },
590 };
591
592 static struct menu_data menu_ss_send_ussd_request[] = {
593         { "1", "type", NULL, NULL, data_ss_ussd_request_type},
594         { "-", "(1=INIT, 2=RSP, 3=REL)", NULL, NULL, NULL},
595         { "2", "string", NULL, NULL, data_ss_ussd_request_string},
596         { "3", "run", NULL, run_ss_send_ussd_request, NULL},
597         { NULL, NULL, },
598 };
599
600 struct menu_data menu_ss[] = {
601         { "1", "tel_set_ss_barring", menu_ss_set_barring, NULL, NULL},
602         { "2", "tel_get_ss_barring_status", menu_ss_get_barring_status, NULL, NULL},
603         { "3", "tel_change_ss_barring_password", menu_ss_change_barring_password, NULL, NULL},
604         { "4", "tel_set_ss_forward", menu_ss_set_forward, NULL, NULL},
605         { "5", "tel_get_ss_forward_status", menu_ss_get_forward_status, NULL, NULL},
606         { "6", "tel_set_ss_waiting", menu_ss_set_waiting, NULL, NULL},
607         { "7", "tel_get_ss_waiting_status", menu_ss_get_waiting_status, NULL, NULL},
608         { "8", "tel_set__cli_status", menu_ss_set_cli_status, NULL, NULL},
609         { "9", "tel_get_ss_cli_status", menu_ss_get_cli_status, NULL, NULL},
610         { "10", "tel_send_ss_ussd_request", menu_ss_send_ussd_request, NULL, NULL},
611         { NULL, NULL, },
612 };
613
614 void register_ss_event(TapiHandle *handle)
615 {
616         int ret;
617
618         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_USSD, on_noti_ss_ussd, NULL);
619         if (ret != TAPI_API_SUCCESS) {
620                 msg("event register failed(%d)", ret);
621         }
622
623         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_RELEASE_COMPLETE, on_noti_ss_release_complete, NULL);
624         if (ret != TAPI_API_SUCCESS) {
625                 msg("event register failed(%d)", ret);
626         }
627
628         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_FORWARD_STATUS, on_noti_ss_forwarding_status, NULL);
629         if (ret != TAPI_API_SUCCESS) {
630                 msg("event register failed(%d)", ret);
631         }
632
633         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_BARRING_STATUS, on_noti_ss_barring_status, NULL);
634         if (ret != TAPI_API_SUCCESS) {
635                 msg("event register failed(%d)", ret);
636         }
637
638         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_WAITING_STATUS, on_noti_ss_waiting_status, NULL);
639         if (ret != TAPI_API_SUCCESS) {
640                 msg("event register failed(%d)", ret);
641         }
642
643         ret = tel_register_noti_event(handle, TAPI_NOTI_SS_INFO, on_noti_ss_sups_info, NULL);
644         if (ret != TAPI_API_SUCCESS) {
645                 msg("event register failed(%d)", ret);
646         }
647 }