diff --git a/mbtk/mbtk_rild_v2/src/ril_ecall.c b/mbtk/mbtk_rild_v2/src/ril_ecall.c
index dfb4ace..c86f922 100755
--- a/mbtk/mbtk_rild_v2/src/ril_ecall.c
+++ b/mbtk/mbtk_rild_v2/src/ril_ecall.c
@@ -21,6 +21,93 @@
 
 void ril_rsp_pack_send(int fd, int ril_id, int msg_index, const void* data, int data_len);
 
+static int cfg_ecalldata_get(mbtk_ecall_cfg_item_enum type, uint32 *value, int *cme_err)
+{
+    ATResponse *response = NULL;
+    char *tmp_ptr = NULL;
+    int tmp_int;
+    char cmd[100] = {0};
+    int err = 0;
+
+    snprintf(cmd, sizeof(cmd), "AT*ECALLDATA=5,%d", type);
+    err = at_send_command_singleline(cmd, "*ECALLDATA:", &response);
+
+    if (err < 0 || response->success == 0 || !response->p_intermediates){
+        *cme_err = at_get_cme_error(response);
+        goto exit;
+    }
+
+    char *line = response->p_intermediates->line;
+    err = at_tok_start(&line);
+    if (err < 0)
+    {
+        goto exit;
+    }
+
+    err = at_tok_nextint(&line, &tmp_int);
+    if (err < 0)
+    {
+        goto exit;
+    }
+
+    err = at_tok_nextint(&line, &tmp_int);
+    if (err < 0)
+    {
+        goto exit;
+    }
+
+    err = at_tok_nextint(&line, &tmp_int);
+    if (err < 0)
+    {
+        goto exit;
+    }
+
+    *value = (uint32)(tmp_int * 20);   // ms
+
+    goto exit;
+exit:
+    at_response_free(response);
+    return err;
+}
+
+static int cfg_ecalldata_set(mbtk_ecall_cfg_item_enum type, uint32 value, int *cme_err)
+{
+    ATResponse *response = NULL;
+    char cmd[100] = {0};
+    int err = 0;
+
+    snprintf(cmd, sizeof(cmd), "AT*ECALLDATA=5,%d,%d", type, value / 20);
+    err = at_send_command(cmd, &response);
+    if (err < 0 || response->success == 0){
+        *cme_err = at_get_cme_error(response);
+        goto exit;
+    }
+
+    goto exit;
+exit:
+    at_response_free(response);
+    return err;
+}
+
+static int cfg_ecalltimer_set(const char* type, uint32 value, int *cme_err)
+{
+    ATResponse *response = NULL;
+    char cmd[100] = {0};
+    int err = 0;
+
+    snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=%s,%d", type, value);
+    err = at_send_command(cmd, &response);
+    if (err < 0 || response->success == 0){
+        *cme_err = at_get_cme_error(response);
+        goto exit;
+    }
+
+    goto exit;
+exit:
+    at_response_free(response);
+    return err;
+}
+
 static int req_ecall_msdcfg(mbtk_ecall_msd_cfg_info_t *cfg_info, int *cme_err)
 {
     ATResponse *response = NULL;
@@ -371,66 +458,71 @@
 OK
 
 */
-static int req_ecall_cfg_get(mbtk_ecall_cfg_item_enum type, mbtk_ecall_cfg_info_t *cfg, int *cme_err)
+static int req_ecall_cfg_get(uint32 type, mbtk_ecall_cfg_info_t *cfg, int *cme_err)
 {
     ATResponse *response = NULL;
     char *tmp_ptr = NULL;
     int tmp_int;
-    char cmd[1024] = {0};
     int err = 0;
 
     cfg->type = type;
-    switch(type)
-    {
-        case MBTK_ECALL_CFG_ITEM_T3:
-        case MBTK_ECALL_CFG_ITEM_T5:
-        case MBTK_ECALL_CFG_ITEM_T6:
-        case MBTK_ECALL_CFG_ITEM_T7:
-        case MBTK_ECALL_CFG_ITEM_TH:
-            snprintf(cmd, sizeof(cmd), "AT*ECALLDATA=5,%d", type);
 
-            err = at_send_command_singleline(cmd, "*ECALLDATA:", &response);
-            break;
-        default:
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER?");
-
-            err = at_send_command_singleline(cmd, "*ECALLTIMER:", &response);
-            break;
+    if(type & MBTK_ECALL_CFG_T3) {
+        if(cfg_ecalldata_get(MBTK_ECALL_CFG_ITEM_T3, &(cfg->data[MBTK_ECALL_CFG_ITEM_T3]), cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
     }
 
-    if (err < 0 || response->success == 0 || !response->p_intermediates){
-        *cme_err = at_get_cme_error(response);
-        goto exit;
+    if(type & MBTK_ECALL_CFG_T5) {
+        if(cfg_ecalldata_get(MBTK_ECALL_CFG_ITEM_T5, &(cfg->data[MBTK_ECALL_CFG_ITEM_T5]), cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
     }
 
-    char *line = response->p_intermediates->line;
-    err = at_tok_start(&line);
-    if (err < 0)
-    {
-        goto exit;
+    if(type & MBTK_ECALL_CFG_T6) {
+        if(cfg_ecalldata_get(MBTK_ECALL_CFG_ITEM_T6, &(cfg->data[MBTK_ECALL_CFG_ITEM_T6]), cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
     }
 
-    if(strstr(cmd, "AT*ECALLDATA")) {
-        err = at_tok_nextint(&line, &tmp_int);
+    if(type & MBTK_ECALL_CFG_T7) {
+        if(cfg_ecalldata_get(MBTK_ECALL_CFG_ITEM_T7, &(cfg->data[MBTK_ECALL_CFG_ITEM_T7]), cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
+    }
+
+    if(type & MBTK_ECALL_CFG_TH) {
+        if(cfg_ecalldata_get(MBTK_ECALL_CFG_ITEM_TH, &(cfg->data[MBTK_ECALL_CFG_ITEM_TH]), cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
+    }
+
+    if(type & (MBTK_ECALL_CFG_TIMER_CALLBACK | MBTK_ECALL_CFG_TIMER_CLEARDOWN | MBTK_ECALL_CFG_TIMER_DEREG
+                | MBTK_ECALL_CFG_TIMER_DIAL | MBTK_ECALL_CFG_TIMER_REDIAL | MBTK_ECALL_CFG_TIMER_SMS
+                | MBTK_ECALL_CFG_REDIALCNT | MBTK_ECALL_CFG_SMSPROCESS | MBTK_ECALL_CFG_SMSMSDCNT)) {
+        err = at_send_command_singleline("AT*ECALLTIMER?", "*ECALLTIMER:", &response);
+        if (err < 0 || response->success == 0 || !response->p_intermediates){
+            *cme_err = at_get_cme_error(response);
+            goto exit;
+        }
+
+        char *line = response->p_intermediates->line;
+        err = at_tok_start(&line);
         if (err < 0)
         {
             goto exit;
         }
 
-        err = at_tok_nextint(&line, &tmp_int);
-        if (err < 0)
-        {
-            goto exit;
-        }
-
-        err = at_tok_nextint(&line, &tmp_int);
-        if (err < 0)
-        {
-            goto exit;
-        }
-
-        cfg->data = (uint32)(tmp_int * 20);   // ms
-    } else {
         // *ECALLTIMER: ERA mode, callback timer: 1200s,
         // dial setup timer: 30s, NAD deregister timer: 7200s,
         // cleardown timer: 3600s, redial attempts count: 10,
@@ -443,80 +535,73 @@
             ecall_mode = MBTK_ECALL_MODE_TYPE_EU;
         }
 
-        switch(type)
+        if(type & MBTK_ECALL_CFG_TIMER_CALLBACK)
         {
-            case MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK:
-            {
-                if((tmp_ptr = strstr(line, "callback timer: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 16);   // s
-                    cfg->data *= 1000; // s -> ms
-                }
-                break;
+            if((tmp_ptr = strstr(line, "callback timer: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK] = (uint32)atoi(tmp_ptr + 16);   // s
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK] *= 1000; // s -> ms
             }
-            case MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN:
-            {
-                if((tmp_ptr = strstr(line, "cleardown timer: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 17);   // s
-                    cfg->data *= 1000; // s -> ms
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_TIMER_CLEARDOWN)
+        {
+            if((tmp_ptr = strstr(line, "cleardown timer: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN] = (uint32)atoi(tmp_ptr + 17);   // s
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN] *= 1000; // s -> ms
             }
-            case MBTK_ECALL_CFG_ITEM_TIMER_DEREG:
-            {
-                if((tmp_ptr = strstr(line, "deregister timer: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 18);   // s
-                    cfg->data *= 1000; // s -> ms
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_TIMER_DEREG)
+        {
+            if((tmp_ptr = strstr(line, "deregister timer: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_DEREG] = (uint32)atoi(tmp_ptr + 18);   // s
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_DEREG] *= 1000; // s -> ms
             }
-            case MBTK_ECALL_CFG_ITEM_TIMER_DIAL:
-            {
-                if((tmp_ptr = strstr(line, "dial setup timer: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 18);   // s
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_TIMER_DIAL)
+        {
+            if((tmp_ptr = strstr(line, "dial setup timer: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_DIAL] = (uint32)atoi(tmp_ptr + 18);   // s
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_DIAL] *= 1000; // s -> ms
             }
-            case MBTK_ECALL_CFG_ITEM_TIMER_REDIAL:
-            {
-                if((tmp_ptr = strstr(line, "redial wait timer: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 19);   // s
-                    cfg->data *= 1000; // s -> ms
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_TIMER_REDIAL)
+        {
+            if((tmp_ptr = strstr(line, "redial wait timer: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_REDIAL] = (uint32)atoi(tmp_ptr + 19);   // s
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_REDIAL] *= 1000; // s -> ms
             }
-            case MBTK_ECALL_CFG_ITEM_TIMER_SMS:
-            {
-                if((tmp_ptr = strstr(line, "SMS resend timer: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 18);
-                    cfg->data *= 1000; // s -> ms
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_TIMER_SMS)
+        {
+            if((tmp_ptr = strstr(line, "SMS resend timer: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_SMS] = (uint32)atoi(tmp_ptr + 18);
+                cfg->data[MBTK_ECALL_CFG_ITEM_TIMER_SMS] *= 1000; // s -> ms
             }
-            case MBTK_ECALL_CFG_ITEM_REDIALCNT:
-            {
-                if((tmp_ptr = strstr(line, "redial attempts count: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 23);
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_REDIALCNT)
+        {
+            if((tmp_ptr = strstr(line, "redial attempts count: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_REDIALCNT] = (uint32)atoi(tmp_ptr + 23);
             }
-            case MBTK_ECALL_CFG_ITEM_SMSPROCESS:
-            {
-                if((tmp_ptr = strstr(line, "smsprocess: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 12);
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_SMSPROCESS)
+        {
+            if((tmp_ptr = strstr(line, "smsprocess: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_SMSPROCESS] = (uint32)atoi(tmp_ptr + 12);
             }
-            case MBTK_ECALL_CFG_ITEM_SMSMSDCNT:
-            {
-                if((tmp_ptr = strstr(line, "sms msd send count: ")) != NULL) {
-                    cfg->data = (uint32)atoi(tmp_ptr + 20);
-                }
-                break;
+        }
+
+        if(type & MBTK_ECALL_CFG_SMSMSDCNT)
+        {
+            if((tmp_ptr = strstr(line, "sms msd send count: ")) != NULL) {
+                cfg->data[MBTK_ECALL_CFG_ITEM_SMSMSDCNT] = (uint32)atoi(tmp_ptr + 20);
             }
-            default:
-                LOGE("Unknown config item : %d", type);
-                err = -1;
-                break;
         }
     }
 
@@ -535,88 +620,123 @@
 */
 static int req_ecall_cfg_set(const mbtk_ecall_cfg_info_t *cfg_info, int *cme_err)
 {
-    ATResponse *response = NULL;
-    char cmd[1024] = {0};
     int err = 0;
-
     if(ecall_mode == MBTK_ECALL_MODE_TYPE_EU) {
-        if(cfg_info->type != MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK
-            && cfg_info->type != MBTK_ECALL_CFG_ITEM_TIMER_DIAL
-            && cfg_info->type != MBTK_ECALL_CFG_ITEM_TIMER_DEREG
-            && cfg_info->type != MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN){
+        if((cfg_info->type & MBTK_ECALL_CFG_TIMER_REDIAL)
+            || (cfg_info->type & MBTK_ECALL_CFG_TIMER_SMS)
+            || (cfg_info->type & MBTK_ECALL_CFG_REDIALCNT)
+            || (cfg_info->type & MBTK_ECALL_CFG_SMSPROCESS)
+            || (cfg_info->type & MBTK_ECALL_CFG_SMSMSDCNT)){
             LOGW("No support for EU.");
             return -1;
         }
     }
 
-    switch(cfg_info->type)
-    {
-        case MBTK_ECALL_CFG_ITEM_T3:
-        case MBTK_ECALL_CFG_ITEM_T5:
-        case MBTK_ECALL_CFG_ITEM_T6:
-        case MBTK_ECALL_CFG_ITEM_T7:
-        case MBTK_ECALL_CFG_ITEM_TH:
-            snprintf(cmd, sizeof(cmd), "AT*ECALLDATA=5,%d,%d", cfg_info->type, cfg_info->data / 20);
-            break;
-        case MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK:
+    if(cfg_info->type & MBTK_ECALL_CFG_T3) {
+        if(cfg_ecalldata_set(MBTK_ECALL_CFG_ITEM_T3, cfg_info->data[MBTK_ECALL_CFG_ITEM_T3], cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
         {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=callback,%d", cfg_info->data / 1000);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=cleardown,%d", cfg_info->data / 1000);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_TIMER_DEREG:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=dereg,%d", cfg_info->data / 1000);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_TIMER_DIAL:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=dial,%d", cfg_info->data / 1000);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_TIMER_REDIAL:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=redialtmr,%d", cfg_info->data / 1000);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_TIMER_SMS:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=sms,%d", cfg_info->data / 1000);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_REDIALCNT:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=redialcnt,%d", cfg_info->data);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_SMSPROCESS:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=smsprocess,%d", cfg_info->data);
-            break;
-        }
-        case MBTK_ECALL_CFG_ITEM_SMSMSDCNT:
-        {
-            snprintf(cmd, sizeof(cmd), "AT*ECALLTIMER=smsmsdcnt,%d", cfg_info->data);
-            break;
-        }
-        default:
-            LOGE("Unknown config item : %d", cfg_info->type);
-            err = -1;
             goto exit;
+        }
     }
 
-    err = at_send_command(cmd, &response);
-    if (err < 0 || response->success == 0){
-        *cme_err = at_get_cme_error(response);
-        goto exit;
+    if(cfg_info->type & MBTK_ECALL_CFG_T5) {
+        if(cfg_ecalldata_set(MBTK_ECALL_CFG_ITEM_T5, cfg_info->data[MBTK_ECALL_CFG_ITEM_T5], cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
+    }
+
+    if(cfg_info->type & MBTK_ECALL_CFG_T6) {
+        if(cfg_ecalldata_set(MBTK_ECALL_CFG_ITEM_T6, cfg_info->data[MBTK_ECALL_CFG_ITEM_T6], cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
+    }
+
+    if(cfg_info->type & MBTK_ECALL_CFG_T7) {
+        if(cfg_ecalldata_set(MBTK_ECALL_CFG_ITEM_T7, cfg_info->data[MBTK_ECALL_CFG_ITEM_T7], cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
+    }
+
+    if(cfg_info->type & MBTK_ECALL_CFG_TH) {
+        if(cfg_ecalldata_set(MBTK_ECALL_CFG_ITEM_TH, cfg_info->data[MBTK_ECALL_CFG_ITEM_TH], cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON)
+        {
+            goto exit;
+        }
+    }
+
+    if(cfg_info->type & MBTK_ECALL_CFG_TIMER_CALLBACK)
+    {
+        if(cfg_ecalltimer_set("callback", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK] / 1000, cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON) {
+            goto exit;
+        }
+    }
+    if(cfg_info->type & MBTK_ECALL_CFG_TIMER_CLEARDOWN)
+    {
+        if(cfg_ecalltimer_set("cleardown", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN] / 1000, cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON) {
+            goto exit;
+        }
+    }
+    if(cfg_info->type & MBTK_ECALL_CFG_ITEM_TIMER_DEREG)
+    {
+        if(cfg_ecalltimer_set("dereg", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_DEREG] / 1000, cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON) {
+            goto exit;
+        }
+    }
+    if(cfg_info->type & MBTK_ECALL_CFG_ITEM_TIMER_DIAL)
+    {
+        if(cfg_ecalltimer_set("dial", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_DIAL] / 1000, cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON) {
+            goto exit;
+        }
+    }
+    if(cfg_info->type & MBTK_ECALL_CFG_ITEM_TIMER_REDIAL)
+    {
+        if(cfg_ecalltimer_set("redialtmr", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_REDIAL] / 1000, cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON) {
+            goto exit;
+        }
+    }
+    if(cfg_info->type & MBTK_ECALL_CFG_ITEM_TIMER_SMS)
+    {
+        if(cfg_ecalltimer_set("sms", cfg_info->data[MBTK_ECALL_CFG_ITEM_TIMER_SMS] / 1000, cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON) {
+            goto exit;
+        }
+    }
+    if(cfg_info->type & MBTK_ECALL_CFG_ITEM_REDIALCNT)
+    {
+        if(cfg_ecalltimer_set("redialcnt", cfg_info->data[MBTK_ECALL_CFG_ITEM_REDIALCNT], cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON) {
+            goto exit;
+        }
+    }
+    if(cfg_info->type & MBTK_ECALL_CFG_ITEM_SMSPROCESS)
+    {
+        if(cfg_ecalltimer_set("smsprocess", cfg_info->data[MBTK_ECALL_CFG_ITEM_SMSPROCESS], cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON) {
+            goto exit;
+        }
+    }
+    if(cfg_info->type & MBTK_ECALL_CFG_ITEM_SMSMSDCNT)
+    {
+        if(cfg_ecalltimer_set("smsmsdcnt", cfg_info->data[MBTK_ECALL_CFG_ITEM_SMSMSDCNT], cme_err)
+            || *cme_err != MBTK_RIL_ERR_CME_NON) {
+            goto exit;
+        }
     }
 
 exit:
-    at_response_free(response);
     return err;
 }
 
@@ -1003,7 +1123,7 @@
                         } else {
                             err = MBTK_RIL_ERR_UNKNOWN;
                         }
-                        LOG("Set ecall config[%d] fail.", cfg_info->type);
+                        LOG("Set ecall config[%x] fail.", cfg_info->type);
                     }
                     else
                     {
@@ -1012,15 +1132,15 @@
                 } else { // Get
                     mbtk_ecall_cfg_info_t cfg_info;
                     memset(&cfg_info, 0, sizeof(mbtk_ecall_cfg_info_t));
-                    mbtk_ecall_cfg_item_enum type = (mbtk_ecall_cfg_item_enum)pack->data[0];
-                    if(req_ecall_cfg_get(type, &cfg_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+                    uint32 *type = (uint32*)(pack->data);
+                    if(req_ecall_cfg_get(*type, &cfg_info, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
                     {
                         if(cme_err != MBTK_RIL_ERR_CME_NON) {
                             err = MBTK_RIL_ERR_CME + cme_err;
                         } else {
                             err = MBTK_RIL_ERR_UNKNOWN;
                         }
-                        LOG("Get ecall config[%d] fail.", type);
+                        LOG("Get ecall config[%x] fail.", *type);
                     }
                     else
                     {
