Tizen 2.0 beta Release
authorKyoungyoup Park <gynaru.park@samsung.com>
Wed, 22 Aug 2012 06:31:39 +0000 (15:31 +0900)
committerKyoungyoup Park <gynaru.park@samsung.com>
Wed, 22 Aug 2012 06:31:39 +0000 (15:31 +0900)
Change-Id: I9157911d29ca8c728d029def67f5fab9e928925c

43 files changed:
AUTHORS [new file with mode: 0755]
CMakeLists.txt [new file with mode: 0755]
Makefile.manual [new file with mode: 0755]
README [new file with mode: 0755]
debian/changelog [new file with mode: 0755]
debian/compat [new file with mode: 0755]
debian/control [new file with mode: 0755]
debian/copyright [new file with mode: 0755]
debian/dirs [new file with mode: 0755]
debian/docs [new file with mode: 0755]
debian/rules [new file with mode: 0755]
debian/tel-plugin-imc.install.in [new file with mode: 0755]
debian/tel-plugin-imc.postinst [new file with mode: 0755]
include/common/TelErr.h [new file with mode: 0755]
include/s_call.h [new file with mode: 0755]
include/s_common.h [new file with mode: 0755]
include/s_dispatch.h [new file with mode: 0755]
include/s_gps.h [new file with mode: 0755]
include/s_modem.h [new file with mode: 0755]
include/s_network.h [new file with mode: 0755]
include/s_phonebook.h [new file with mode: 0755]
include/s_ps.h [new file with mode: 0755]
include/s_sap.h [new file with mode: 0755]
include/s_sat.h [new file with mode: 0755]
include/s_sim.h [new file with mode: 0755]
include/s_sms.h [new file with mode: 0755]
include/s_ss.h [new file with mode: 0755]
packaging/tel-plugin-imc.spec [new file with mode: 0755]
res/convert_to_sql.c [new file with mode: 0755]
res/wiki_mcc_mnc_oper_list.csv [new file with mode: 0755]
res/wiki_mcc_mnc_oper_list.db [new file with mode: 0755]
res/wiki_mcc_mnc_oper_list.sql [new file with mode: 0755]
src/desc.c [new file with mode: 0755]
src/s_call.c [new file with mode: 0755]
src/s_common.c [new file with mode: 0755]
src/s_modem.c [new file with mode: 0755]
src/s_network.c [new file with mode: 0755]
src/s_ps.c [new file with mode: 0755]
src/s_sat.c [new file with mode: 0755]
src/s_sim.c [new file with mode: 0755]
src/s_sms.c [new file with mode: 0755]
src/s_ss.c [new file with mode: 0755]
tel-plugin-imc.manifest [new file with mode: 0755]

diff --git a/AUTHORS b/AUTHORS
new file mode 100755 (executable)
index 0000000..0e9faa9
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,6 @@
+Jongman Park <jman.park@samsung.com>
+Ja-young Gu <jygu@samsung.com>
+Kyeongchul Kim <kyeongchul.kim@samsung.com>
+DongHoo Park <donghoo.park@samsung.>
+Youngman Park <youngman.park@samsung.com>
+Inho Oh <inho48.oh@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..ba645b1
--- /dev/null
@@ -0,0 +1,55 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(imc-plugin C)
+
+#INCLUDE(FindPkgConfig)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR "\${prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include")
+
+# Set required packages
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED glib-2.0 tcore dlog db-util)
+
+FOREACH(flag ${pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wdeclaration-after-statement -Wmissing-declarations -Wredundant-decls -Wcast-align")
+
+ADD_DEFINITIONS("-DFEATURE_DLOG_DEBUG")
+ADD_DEFINITIONS("-DTCORE_LOG_TAG=\"IMC\"")
+
+MESSAGE(${CMAKE_C_FLAGS})
+MESSAGE(${CMAKE_EXE_LINKER_FLAGS})
+
+SET(SRCS
+               src/desc.c
+               src/s_modem.c
+               src/s_common.c
+               src/s_network.c
+               src/s_sim.c
+               src/s_sat.c
+               src/s_call.c
+               src/s_ss.c
+               src/s_ps.c
+               src/s_sms.c
+)
+
+
+
+# library build
+ADD_LIBRARY(imc-plugin SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(imc-plugin ${pkgs_LDFLAGS})
+SET_TARGET_PROPERTIES(imc-plugin PROPERTIES PREFIX "" OUTPUT_NAME imc-plugin)
+
+
+# install
+INSTALL(TARGETS imc-plugin
+               LIBRARY DESTINATION lib/telephony/plugins)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/res/wiki_mcc_mnc_oper_list.sql DESTINATION /tmp RENAME mcc_mnc_oper_list.sql)
+
diff --git a/Makefile.manual b/Makefile.manual
new file mode 100755 (executable)
index 0000000..af6e86a
--- /dev/null
@@ -0,0 +1,24 @@
+TARGET = imc-plugin.so
+
+SRCS   = desc.c s_hal.c s_phonet.c s_rfs.c s_nvdata.c s_dispatch.c s_common.c \
+                 s_network.c \
+                 s_sim.c
+OBJS   = $(SRCS:.c=.o)
+PKGS   = glib-2.0 lcm tapi tcore
+
+CC             = gcc
+CFLAGS = -Wall -g -fPIC `pkg-config --cflags $(PKGS)` -I.
+LIBS   = -rdynamic -fPIC -ldl \
+                 `pkg-config --libs $(PKGS)`
+
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+       $(CC) $^ $(LIBS) -shared -o $(TARGET)
+
+.c.o: $(SRCS)
+       $(CC) $(CFLAGS) -c $^ -o $@
+
+clean:
+       rm -f $(OBJS) $(TARGET)
diff --git a/README b/README
new file mode 100755 (executable)
index 0000000..ee74275
--- /dev/null
+++ b/README
@@ -0,0 +1,2 @@
+Samsung modem plugin
+(AT):Trying push
diff --git a/debian/changelog b/debian/changelog
new file mode 100755 (executable)
index 0000000..76e53d9
--- /dev/null
@@ -0,0 +1,7 @@
+tel-plugin-imc (0.1.0) unstable; urgency=low
+
+  * Initial
+  * Git: slp/pkgs/t/tel-plugin-imc
+  * Tag: tel-plugin-imc_0.1.0
+
+ -- Inho Oh <inho48.oh@samsung.com>  Thu, 17 July 2012 22:37:29 +0900
diff --git a/debian/compat b/debian/compat
new file mode 100755 (executable)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100755 (executable)
index 0000000..3904671
--- /dev/null
@@ -0,0 +1,20 @@
+Source: tel-plugin-imc
+Section: libs
+Priority: extra
+Maintainer: Jongman Park <jman.park@samsung.com>
+Uploaders: Jayoung Gu <jygu@samsung.com>, Kyeongchul Kim <kyeongchul.kim@samsung.com>, Youngman Park <youngman.park@samsung.com>, Inho Oh <inho48.oh@samsung.com>,  DongHoo Park <donghoo.park@samsung.com>
+Build-Depends: debhelper (>= 5), libglib2.0-dev, libtcore-dev, dlog-dev, libslp-db-util-dev
+Standards-Version: 0.0.0
+
+Package: tel-plugin-imc
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends},
+Description: telephony client API library (Shared Object)
+
+Package: tel-plugin-imc-dbg
+Section: debug
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, tel-plugin-imc (= ${Source-Version})
+Description: telephony client API library (dbg package)
+
diff --git a/debian/copyright b/debian/copyright
new file mode 100755 (executable)
index 0000000..d5a0cca
--- /dev/null
@@ -0,0 +1,7 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License version 2.1.
+
+The full text of the LGPL 2.1 can be found in
+/usr/share/common-licenses.
diff --git a/debian/dirs b/debian/dirs
new file mode 100755 (executable)
index 0000000..ca882bb
--- /dev/null
@@ -0,0 +1,2 @@
+usr/bin
+usr/sbin
diff --git a/debian/docs b/debian/docs
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..9c8aa24
--- /dev/null
@@ -0,0 +1,118 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+CFLAGS ?= -Wall -g
+CXXFLAGS ?=  -Wall -g
+LDFLAGS ?=
+PREFIX ?= /usr
+DATADIR ?= /opt
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+       CXXFLAGS += -O0
+else
+       CFLAGS += -O2
+       CXXFLAGS += -O2
+endif
+
+#CFLAGS += -fvisibility=hidden -fPIC
+CFLAGS += -fvisibility=default -fPIC
+LDFLAGS += -rdynamic -fPIC -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed
+#LDFLAGS += -Wl,--unresolved-symbols=ignore-in-shared-libs,--as-needed
+
+CMAKE_TMP_DIR = $(CURDIR)/cmake_tmp
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       # Add here commands to configure the package.
+       mkdir -p $(CMAKE_TMP_DIR);
+       cd $(CMAKE_TMP_DIR); CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX)
+
+       touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp
+       dh_testdir
+
+       # Add here commands to compile the package.
+       cd $(CMAKE_TMP_DIR) && $(MAKE) all
+
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               cat $$f > $${f%.in}; \
+               sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
+               sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
+       done
+
+       touch $@
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+
+       # Add here commands to clean up after the build process.
+       rm -rf $(CMAKE_TMP_DIR)
+
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               rm -f $${f%.in}; \
+       done
+
+       dh_clean
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+       # Add here commands to install the package into debian/wavplayer.
+       cd $(CMAKE_TMP_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs
+       dh_installdocs
+       dh_installexamples
+       dh_install --sourcedir=debian/tmp
+#      dh_installmenu
+#      dh_installdebconf
+#      dh_installlogrotate
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installmime
+#      dh_python
+#      dh_installinit
+#      dh_installcron
+#      dh_installinfo
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=tel-plugin-imc-dbg
+       dh_compress
+       dh_fixperms
+#      dh_perl
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps --dpkg-shlibdeps-params="-v"
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/debian/tel-plugin-imc.install.in b/debian/tel-plugin-imc.install.in
new file mode 100755 (executable)
index 0000000..18ca293
--- /dev/null
@@ -0,0 +1,2 @@
+@PREFIX@/lib/*
+/tmp/mcc_mnc_oper_list.sql
diff --git a/debian/tel-plugin-imc.postinst b/debian/tel-plugin-imc.postinst
new file mode 100755 (executable)
index 0000000..243a694
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#create db
+mkdir -p /opt/dbspace
+
+if [ ! -f /opt/dbspace/.mcc_mnc_oper_list.db ]
+then
+       sqlite3 /opt/dbspace/.mcc_mnc_oper_list.db < /tmp/mcc_mnc_oper_list.sql
+fi
+
+rm -f /tmp/mcc_mnc_oper_list.sql
+
+if [ -f /opt/dbspace/.mcc_mnc_oper_list.db ]
+then
+       chmod 600 /opt/dbspace/.mcc_mnc_oper_list.db
+fi
+if [ -f /opt/dbspace/.mcc_mnc_oper_list.db-journal ]
+then
+       chmod 644 /opt/dbspace/.mcc_mnc_oper_list.db-journal
+fi
+
+vconftool set -t string memory/telephony/productCode "" -i -f
diff --git a/include/common/TelErr.h b/include/common/TelErr.h
new file mode 100755 (executable)
index 0000000..d839a99
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * @open
+ * @ingroup                    TelephonyAPI
+ * @addtogroup         COMMON_TAPI     COMMON
+ * @{
+ *     These error codes are used by Applications.
+ */
+
+
+#ifndef _TEL_ERR_H_
+#define _TEL_ERR_H_
+/*==================================================================================================
+                                         INCLUDE FILES
+==================================================================================================*/
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*==================================================================================================
+                                           CONSTANTS
+==================================================================================================*/
+
+
+/*==================================================================================================
+                                            MACROS
+==================================================================================================*/
+
+
+/*==================================================================================================
+                                             ENUMS
+==================================================================================================*/
+
+/************************************************************
+**    Errors defined in  "+CME ERROR" ,
+**    - see 3GPP TS 27.007
+**    - ranges are 0x00 ~ 0x7FFF
+************************************************************/
+/**
+       Error codes sent by the modem in response to the above operations.
+*/
+typedef enum
+{
+  /* GENERAL ERRORS */
+  TAPI_OP_GEN_ERR_PHONE_FAILURE        = 0,                                            /* 0 */
+  TAPI_OP_GEN_ERR_NO_CONNECTION_TO_PHONE,                                      /* 1 */
+  TAPI_OP_GEN_ERR_PHONE_ADAPTOR_LINK_RESERVED,                 /* 2 */
+  TAPI_OP_GEN_ERR_OPER_NOT_ALLOWED,                                            /* 3 */
+  TAPI_OP_GEN_ERR_OPER_NOT_SUPPORTED,                                          /* 4 */
+  TAPI_OP_GEN_ERR_PH_SIM_PIN_REQU,                                             /* 5 */
+  TAPI_OP_GEN_ERR_PH_FSIM_PIN_REQU,                                            /* 6 */
+  TAPI_OP_GEN_ERR_PH_FSIM_PUK_REQU,                                            /* 7 */
+  TAPI_OP_GEN_ERR_SIM_NOT_INSERTED     =10,                                    /* 10 */
+  TAPI_OP_GEN_ERR_SIM_PIN_REQU,                                                        /* 11 */
+  TAPI_OP_GEN_ERR_SIM_PUK_REQU,                                                        /* 12 */
+  TAPI_OP_GEN_ERR_SIM_FAILURE,                                                 /* 13 */
+  TAPI_OP_GEN_ERR_SIM_BUSY,                                                            /* 14 */
+  TAPI_OP_GEN_ERR_SIM_WRONG,                                                           /* 15 */
+  TAPI_OP_GEN_ERR_INCORRECT_PW,                                                        /* 16 */
+  TAPI_OP_GEN_ERR_SIM_PIN2_REQU,                                                       /* 17 */
+  TAPI_OP_GEN_ERR_SIM_PUK2_REQU,                                                       /* 18 */
+  TAPI_OP_GEN_ERR_MEM_FULL     = 20,                                                   /* 20 */
+  TAPI_OP_GEN_ERR_INVALID_INDEX,                                                       /* 21 */
+  TAPI_OP_GEN_ERR_NOT_FOUND,                                                           /* 22 */
+  TAPI_OP_GEN_ERR_MEM_FAILURE,                                                 /* 23 */
+  TAPI_OP_GEN_ERR_TEXT_STR_TOO_LONG,                                           /* 24 */
+  TAPI_OP_GEN_ERR_INVALID_CHARACTERS_IN_TEXT_STR,                      /* 25 */
+  TAPI_OP_GEN_ERR_DIAL_STR_TOO_LONG,                                           /* 26 */
+  TAPI_OP_GEN_ERR_INVALID_CHARACTERS_IN_DIAL_STR,                      /* 27 */
+  TAPI_OP_GEN_ERR_NO_NET_SVC   = 30,                                           /* 30 */
+  TAPI_OP_GEN_ERR_NET_TIMEOUT,                                                 /* 31 */
+  TAPI_OP_GEN_ERR_NET_NOT_ALLOWED_EMERGENCY_CALLS_ONLY,        /* 32 */
+  TAPI_OP_GEN_ERR_NET_PERS_PIN_REQU    = 40,                                   /* 40 */
+  TAPI_OP_GEN_ERR_NET_PERS_PUK_REQU,                                           /* 41 */
+  TAPI_OP_GEN_ERR_NET_SUBSET_PERS_PIN_REQU,                            /* 42 */
+  TAPI_OP_GEN_ERR_NET_SUBSET_PERS_PUK_REQU,                            /* 43 */
+  TAPI_OP_GEN_ERR_SVC_PROVIDER_PERS_PIN_REQU,                          /* 44 */
+  TAPI_OP_GEN_ERR_SVC_PROVIDER_PERS_PUK_REQU,                          /* 45 */
+  TAPI_OP_GEN_ERR_CORPORATE_PERS_PIN_REQU,                             /* 46 */
+  TAPI_OP_GEN_ERR_CORPORATE_PERS_PUK_REQU,                             /* 47 */
+  TAPI_OP_GEN_ERR_HIDDEN_KEY_REQU,                                             /* 48 */
+  TAPI_OP_GEN_ERR_UNKNOWN      = 100,                                          /* 100 */
+
+  /* Errors related to a failure to perform an Attach */
+  TAPI_OP_GEN_ERR_ILLEGAL_MS   = 103,                                  /* 103 */
+  TAPI_OP_GEN_ERR_ILLEGAL_ME   = 106,                                  /* 106 */
+  TAPI_OP_GEN_ERR_GPRS_SVC_NOT_ALLOWED,                                        /* 107 */
+  TAPI_OP_GEN_ERR_PLMN_NOT_ALLOWED     = 111,                          /* 111 */
+  TAPI_OP_GEN_ERR_LOCATION_AREA_NOT_ALLOWED,                           /* 112 */
+  TAPI_OP_GEN_ERR_ROAMING_NOT_ALLOWED_IN_THIS_LOCATION_AREA,/* 113 */
+
+  /* Errors related to a failure to Activate a Context */
+  TAPI_OP_GEN_ERR_SVC_OPT_NOT_SUPPORTED        = 132,                  /* 132 */
+  TAPI_OP_GEN_ERR_REQ_SVC_OPT_NOT_SUBSCRIBED,                          /* 133 */
+  TAPI_OP_GEN_ERR_SVC_OPT_TEMPORARILY_OUT_OF_ORDER,            /* 134 */
+  TAPI_OP_GEN_ERR_UNSPECIFIED_GPRS_ERR = 148,                  /* 148 */
+  TAPI_OP_GEN_ERR_PDP_AUTHENTICATION_FAILURE,                          /* 149 */
+  TAPI_OP_GEN_ERR_INVALID_MOBILE_CLASS,                                        /* 150 */
+
+  /* VBS / VGCS and eMLPP -related errors */
+  TAPI_OP_GEN_ERR_VBS_VGCS_NOT_SUPPORTED_BY_THE_NET    = 151,  /* 151 */
+  TAPI_OP_GEN_ERR_NO_SVC_SUBSCRIPTION_ON_SIM,                          /* 152 */
+  TAPI_OP_GEN_ERR_NO_SUBSCRIPTION_FOR_GROUP_ID,                        /* 153 */
+  TAPI_OP_GEN_ERR_GROUP_ID_NOT_ACTIVATED_ON_SIM,                       /* 154 */
+  TAPI_OP_GEN_ERR_NO_MATCHING_NOTI     = 155,                          /* 155 */
+  TAPI_OP_GEN_ERR_VBS_VGCS_CALL_ALREADY_PRESENT,                       /* 156 */
+  TAPI_OP_GEN_ERR_CONGESTION,                                                          /* 157 */
+  TAPI_OP_GEN_ERR_NET_FAILURE,                                                 /* 158 */
+  TAPI_OP_GEN_ERR_UPLINK_BUSY,                                                 /* 159 */
+  TAPI_OP_GEN_ERR_NO_ACCESS_RIGHTS_FOR_SIM_FILE        = 160,  /* 160 */
+  TAPI_OP_GEN_ERR_NO_SUBSCRIPTION_FOR_PRIORITY,                        /* 161 */
+  TAPI_OP_GEN_ERR_OPER_NOT_APPLICABLE_OR_NOT_POSSIBLE, /* 162 */
+
+
+  /************************************************************
+  **                           SAMSUNG ADDED ERRORS
+  ************************************************************/
+  TAPI_OP_GEN_ERR_NONE = 0x8000,                               /* 0x8000 : No Errors */
+
+  /* General Common Errors : 0x8000 - 0x80FF */
+  TAPI_OP_GEN_ERR_INVALID_FORMAT,                                                      /* 0x8001 : Invalid Parameter or Format */
+  TAPI_OP_GEN_ERR_PHONE_OFFLINE,                                                       /* 0x8002 : */
+  TAPI_OP_GEN_ERR_CMD_NOT_ALLOWED,                                             /* 0x8003 : */
+  TAPI_OP_GEN_ERR_PHONE_IS_INUSE,                                                      /* 0x8004 : */
+  TAPI_OP_GEN_ERR_INVALID_STATE        = 0x8005,                                       /* 0x8005 : */
+
+  TAPI_OP_GEN_ERR_NO_BUFFER,                                                           /* 0x8006 :  No internal free buffers */
+  TAPI_OP_GEN_ERR_OPER_REJ,                                                            /* 0x8007 :  Operation Rejected */
+  TAPI_OP_GEN_ERR_INSUFFICIENT_RESOURCE,                                       /* 0x8008 : insufficient resource */
+  TAPI_OP_GEN_ERR_NET_NOT_RESPOND,                                             /* 0x8009 : Network not responding */
+  TAPI_OP_GEN_ERR_SIM_PIN_ENABLE_REQ   = 0x800A,                       /* 0x800A : SIM Pin Enable Required */
+  TAPI_OP_GEN_ERR_SIM_PERM_BLOCKED,                                    /* 0x800B : SIM Permanent Blocked */
+  TAPI_OP_GEN_ERR_SIM_PHONEBOOK_RESTRICTED,                            /*0x800C: SIM Phonebook Restricted*/
+  TAPI_OP_GEM_ERR_FIXED_DIALING_NUMBER_ONLY,                           /*0x800D: Restricted By FDN Mode */
+
+  /* Reserved : 0x800E ~ 0x80FF */
+  TAPI_OP_GEN_ERR_800E_RESERVED_START  = 0x800E,                       /* 0x800E */
+
+  TAPI_OP_GEN_ERR_80FF_RESERVED_END    = 0x80ff,                               /* 0x80FF */
+
+  /* the other errors */
+  TAPI_OP_GEN_ERR_OTHERS                               = 0xFFFE,                                 /* 0xFFFE */
+
+  TAPI_OP_GEN_ERR_MAX                                  = 0xFFFF
+
+}tapi_phone_err_t;
+
+
+/*==================================================================================================
+                                 STRUCTURES AND OTHER TYPEDEFS
+==================================================================================================*/
+
+
+/*==================================================================================================
+                                     FUNCTION PROTOTYPES
+==================================================================================================*/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _TEL_ERR_H_
+
+/**
+* @}
+*/
+
diff --git a/include/s_call.h b/include/s_call.h
new file mode 100755 (executable)
index 0000000..c13017a
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * tel-plugin-samsung
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of SAMSUNG ELECTRONICS ("Confidential Information").
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement you entered into with SAMSUNG ELECTRONICS.
+ * SAMSUNG make no representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement.
+ * SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ */
+
+#ifndef __S_CALL_H__
+#define __S_CALL_H__
+
+gboolean s_call_init(TcorePlugin *p, TcoreHal *h);
+void s_call_exit(TcorePlugin *p);
+
+#endif
+
diff --git a/include/s_common.h b/include/s_common.h
new file mode 100755 (executable)
index 0000000..ab7709b
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __S_COMMON_H__
+#define __S_COMMON_H__
+
+#include <tcore.h>
+#include <glib.h>
+#include <user_request.h>
+
+
+#define EVENT_SYS_NOTI_MODEM_POWER          "system_power"
+#define EVENT_NOTI_MODEM_POWER          "modem_power"
+#define EVENT_NOTI_MODEM_PHONE_STATE    "modem_phone_state"
+#define EVENT_NOTI_MODEM_PIN_CTRL          "ps_pin_control"
+
+#define EVENT_NOTI_CALL_STATUS                 "call_status"
+#define EVENT_NOTI_CALL_INCOMING               "call_incoming"
+#define EVENT_NOTI_CALL_WAITING                        "call_waiting"
+#define EVENT_NOTI_CALL_SOUND_WBAMR_REPORT "call_sound_wbamr_report"
+#define EVENT_NOTI_CALL_SOUND_TWO_MIC  "call_sound_two_mic"
+#define EVENT_NOTI_CALL_SOUND_DHA              "call_sound_dha"
+
+#define EVENT_NOTI_SS_INFO                             "ss_info"
+#define EVENT_NOTI_SS_USSD                             "ss_ussd"
+
+#define EVENT_NOTI_PS_CALL_STATUS       "ps_call_status"
+#define EVENT_NOTI_PS_DATA_COUNTER      "ps_data_counter"
+#define EVENT_NOTI_PS_IPCONFIGURATION   "ps_ipconfiguration"
+#define EVENT_NOTI_PS_HSDPA_STATUS      "ps_hsdpa_status"
+#define EVENT_NOTI_PS_ATTACH_DETACH     "ps_attach_detach"
+#define EVENT_NOTI_PS_EXTERNAL_CALL     "ps_external_call"
+
+#define EVENT_NOTI_SAP_STATUS           "sap_status"
+#define EVENT_NOTI_SAP_DISCONNECT       "sap_disconnect"
+
+#define EVENT_NOTI_SIM_PIN_STATUS       "sim_pin_status"
+
+#define EVENT_NOTI_SAT_ENVELOPE_RESP       "sat_envelope_response"
+#define EVENT_NOTI_SAT_REFRESH_STATUS       "sat_refresh_status"
+#define EVENT_NOTI_SAT_PROACTIVE_COMMAND       "sat_proactive_command"
+#define EVENT_NOTI_SAT_CONTROL_RESULT       "sat_control_result"
+
+#define EVENT_NOTI_NETWORK_REGISTRATION "network_regist"
+#define EVENT_NOTI_NETWORK_ICON_INFO    "network_icon_info"
+#define EVENT_NOTI_NETWORK_TIME_INFO    "network_time_info"
+#define EVENT_NOTI_NETWORK_IDENTITY     "network_identity"
+
+#define EVENT_NOTI_SMS_INCOM_MSG        "sms_incom_msg"
+#define EVENT_NOTI_SMS_SEND_ACK         "sms_send_ack"
+#define EVENT_NOTI_SMS_MEMORY_STATUS    "sms_memory_status"
+#define EVENT_NOTI_SMS_CB_INCOM_MSG     "sms_cb_incom_msg"
+#define EVENT_NOTI_SMS_DELETE_MSG_CNF   "sms_delete_msg_cnf"
+#define EVENT_NOTI_SMS_WRITE_MSG_CNF    "sms_write_msg_cnf"
+#define EVENT_NOTI_SMS_DELIVERY_RPT_CNF "sms_deliver_rpt_cnf"
+#define EVENT_NOTI_SMS_DEVICE_READY     "sms_device_ready"
+
+#define EVENT_NOTI_PHONEBOOK_STATUS       "phonebook_status"
+#define EVENT_NOTI_PHONEBOOK_FIRST_INDEX        "phonebook_first_index"
+
+#define EVENT_NOTI_GPS_ASSIST_DATA       "gps_assist_data"
+#define EVENT_IND_GPS_MEASURE_POSITION   "gps_measure_position"
+#define EVENT_NOTI_RESET_ASSIST_DATA     "gps_reset_assist_data"
+
+enum direction_e {
+       RX,
+       TX
+};
+
+struct global_data {
+       unsigned int msg_auto_id_current;
+       unsigned int msg_auto_id_start;
+       unsigned int msg_auto_id_end;
+       
+       TcoreHal *hal;
+};
+
+struct work_queue_data {
+       unsigned int id;
+       UserRequest *ur;
+};
+
+#define UTIL_ID(hdr)           ((hdr).main_cmd << 8 | (hdr).sub_cmd)
+#define UTIL_IDP(hdr)          ((hdr)->main_cmd << 8 | (hdr)->sub_cmd)
+
+void                   hook_hex_dump(enum direction_e d, int size, const void *data);
+unsigned int   util_assign_message_sequence_id(TcorePlugin *p);
+gboolean               util_add_waiting_job(GQueue *queue, unsigned int id, UserRequest *ur);
+UserRequest*   util_pop_waiting_job(GQueue *queue, unsigned int id);
+void                   util_hex_dump(char *pad, int size, const void *data);
+unsigned char  util_hexCharToInt(char c);
+char*          util_hexStringToBytes(char * s);
+
+#endif
diff --git a/include/s_dispatch.h b/include/s_dispatch.h
new file mode 100755 (executable)
index 0000000..305da2a
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * tel-plugin-samsung
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of SAMSUNG ELECTRONICS ("Confidential Information").
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement you entered into with SAMSUNG ELECTRONICS.
+ * SAMSUNG make no representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement.
+ * SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ */
+
+#ifndef __S_DISPATCH_H__
+#define __S_DISPATCH_H__
+
+void do_factory(TcoreHal *h, const ipc_message_type *ipc);
+void do_notification_message(TcorePlugin *p, const ipc_message_type *ipc);
+void do_notification_sys_message(TcorePlugin *p, const void *data);
+
+#endif
diff --git a/include/s_gps.h b/include/s_gps.h
new file mode 100755 (executable)
index 0000000..5772cec
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __S_GPS_H__
+#define __S_GPS_H__
+
+
+gboolean s_gps_init(TcorePlugin *p, TcoreHal *h);
+void s_gps_exit(TcorePlugin *p);
+
+#endif
diff --git a/include/s_modem.h b/include/s_modem.h
new file mode 100755 (executable)
index 0000000..6fcc84c
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __S_MODEM_H__
+#define __S_MODEM_H__
+
+gboolean on_event_modem_power(TcoreAT *at, const char *line, TcorePlugin *p);
+
+gboolean s_modem_init(TcorePlugin *p, TcoreHal *h);
+void s_modem_exit(TcorePlugin *p);
+
+gboolean s_modem_send_poweron(TcorePlugin *p);
+#endif
diff --git a/include/s_network.h b/include/s_network.h
new file mode 100755 (executable)
index 0000000..8a7ac8e
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __S_NETWORK_H__
+#define __S_NETWORK_H__
+
+
+gboolean s_network_init(TcorePlugin *p, TcoreHal *h);
+void s_network_exit(TcorePlugin *p);
+
+#endif
diff --git a/include/s_phonebook.h b/include/s_phonebook.h
new file mode 100755 (executable)
index 0000000..f3f0bc6
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef S_PHONEBOOK_H_
+#define S_PHONEBOOK_H_
+
+gboolean s_phonebook_init(TcorePlugin *p, TcoreHal *h);
+void s_phonebook_exit(TcorePlugin *p);
+
+#endif /* S_PHONEBOOK_H_ */
diff --git a/include/s_ps.h b/include/s_ps.h
new file mode 100755 (executable)
index 0000000..669052c
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __S_PS_H__
+#define __S_PS_H__
+
+gboolean s_ps_init(TcorePlugin *p,TcoreHal *hal);
+void s_ps_exit(TcorePlugin *p);
+
+
+#endif/*__S_PS_H__*/
diff --git a/include/s_sap.h b/include/s_sap.h
new file mode 100755 (executable)
index 0000000..ec7dd0e
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef S_SAP_H_
+#define S_SAP_H_
+
+gboolean s_sap_init(TcorePlugin *p, TcoreHal *h);
+void s_sap_exit(TcorePlugin *p);
+
+#endif /* S_SAP_H_ */
diff --git a/include/s_sat.h b/include/s_sat.h
new file mode 100755 (executable)
index 0000000..b4497bb
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef S_SAT_H_
+#define S_SAT_H_
+
+gboolean s_sat_init(TcorePlugin *p, TcoreHal *h);
+void s_sat_exit(TcorePlugin *p);
+
+#endif /* S_SAT_H_ */
diff --git a/include/s_sim.h b/include/s_sim.h
new file mode 100755 (executable)
index 0000000..524ba2e
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * tel-plugin-samsung
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of SAMSUNG ELECTRONICS ("Confidential Information").
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement you entered into with SAMSUNG ELECTRONICS.
+ * SAMSUNG make no representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement.
+ * SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ */
+
+#ifndef __S_SIM_H__
+#define __S_SIM_H__
+
+
+gboolean s_sim_init(TcorePlugin *p, TcoreHal *h);
+void s_sim_exit(TcorePlugin *p);
+
+#endif
diff --git a/include/s_sms.h b/include/s_sms.h
new file mode 100755 (executable)
index 0000000..c8b0ef9
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __S_SMS_H__
+#define __S_SMS_H__
+
+
+gboolean s_sms_init(TcorePlugin *p, TcoreHal *h);
+void s_sms_exit(TcorePlugin *p);
+
+#endif
diff --git a/include/s_ss.h b/include/s_ss.h
new file mode 100755 (executable)
index 0000000..e88ca1b
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __S_SS_H__
+#define __S_SS_H__
+
+
+gboolean       s_ss_init(TcorePlugin *p, TcoreHal *h);
+void           s_ss_exit(TcorePlugin *p);
+
+
+
+#endif
diff --git a/packaging/tel-plugin-imc.spec b/packaging/tel-plugin-imc.spec
new file mode 100755 (executable)
index 0000000..14a4a26
--- /dev/null
@@ -0,0 +1,58 @@
+#sbs-git:slp/pkgs/t/tel-plugin-imc
+Name:       tel-plugin-imc
+Summary:    imc plugin for telephony
+Version:    0.1.1
+Release:    1
+Group:      System/Libraries
+License:    Apache
+Source0:    tel-plugin-imc-%{version}.tar.gz
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(tcore)
+BuildRequires:  pkgconfig(db-util)
+
+%description
+IMC plugin for telephony
+
+%prep
+%setup -q
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+make %{?jobs:-j%jobs}
+
+%post
+/sbin/ldconfig
+mkdir -p /opt/dbspace
+
+if [ ! -f /opt/dbspace/.mcc_mnc_oper_list.db ]
+then
+       sqlite3 /opt/dbspace/.mcc_mnc_oper_list.db < /tmp/mcc_mnc_oper_list.sql
+fi
+
+rm -f /tmp/mcc_mnc_oper_list.sql
+
+if [ -f /opt/dbspace/.mcc_mnc_oper_list.db ]
+then
+       chmod 600 /opt/dbspace/.mcc_mnc_oper_list.db
+fi
+if [ -f /opt/dbspace/.mcc_mnc_oper_list.db-journal ]
+then
+       chmod 644 /opt/dbspace/.mcc_mnc_oper_list.db-journal
+fi
+
+%postun -p /sbin/ldconfig
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%files
+#%manifest tel-plugin-imc.manifest
+%defattr(-,root,root,-)
+#%doc COPYING
+%{_libdir}/telephony/plugins/*
+/tmp/mcc_mnc_oper_list.sql
diff --git a/res/convert_to_sql.c b/res/convert_to_sql.c
new file mode 100755 (executable)
index 0000000..1d142f5
--- /dev/null
@@ -0,0 +1,122 @@
+/**
+ * tel-plugin-samsung
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of SAMSUNG ELECTRONICS ("Confidential Information").
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement you entered into with SAMSUNG ELECTRONICS.
+ * SAMSUNG make no representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement.
+ * SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#define TABLE_NAME "mcc_mnc_oper_list"
+#define TABLE_SCHEMA "create table " TABLE_NAME " (id integer primary key, country char(3), mcc integer, mnc char(3), oper char(45));"
+
+#define dbg(fmt,args...) fprintf(stderr, fmt, ##args);
+
+int main(int argc, char *argv[])
+{
+       FILE *fp_in;
+
+       char buf[255];
+       char brand[255];
+       char oper[255];
+       char *pos1, *pos2;
+       char country[10];
+       char mnc[10];
+       char *oper_select;
+       int mcc;
+
+       if (argc != 2) {
+               printf("%s filename.csv\n", argv[0]);
+               return -1;
+       }
+
+       fp_in = fopen(argv[1], "r");
+       if (fp_in == NULL) {
+               printf("faild.\n");
+               return -1;
+       }
+
+       printf("%s\n", TABLE_SCHEMA);
+
+       printf("BEGIN;\n");
+       while (1) {
+               fgets (buf, 255, fp_in);
+
+               if (feof(fp_in))  {
+                       break;
+               }
+
+               // remove '\n'
+               buf[strlen(buf)-1] = '\0';
+
+               dbg("\n%s\n", buf);
+
+               pos1 = strchr (buf, ',');
+               memset (country, 0, 10);
+               memcpy(country, buf, pos1-buf);
+
+               dbg("country=[%s]\n", country);
+
+               sscanf (pos1+1, "%d", &mcc);
+               dbg("mcc=[%d]\n", mcc);
+
+               // get mnc
+               pos1 = strchr (pos1+1, ',');
+               pos2 = strchr (pos1+1, ',');
+
+               dbg("mnc=[%s]\n", pos1+1);
+
+               memset (mnc, 0, 10);
+               strncpy (mnc, pos1+1, pos2-pos1-1);
+
+               // get brand
+               pos1 = pos2;
+               pos2 = strchr (pos1+1, ',');
+
+               dbg("brand=[%s]\n", pos1+1);
+
+               memset (brand, 0, 255);
+               strncpy (brand, pos1+1, pos2-pos1-1);
+
+               // get oper
+               pos1 = pos2;
+               pos2 = strchr (pos1+1, ',');
+
+               dbg("oper=[%s]\n", pos1+1);
+
+               memset (oper, 0, 255);
+               strcpy (oper, pos1+1);
+
+               oper_select = brand;
+               if (strlen(brand) == 0)
+                       oper_select = oper;
+
+               if (oper_select[0] == '\"') {
+                       memset(buf, 0, 255);
+                       snprintf(buf, strlen(oper_select)-2, "%s", oper_select+1);
+                       snprintf(oper_select, 255, "%s", buf);
+               }
+
+               snprintf(buf, 255, "insert into %s "
+                               " (country, mcc, mnc, oper) "
+                               " values (\"%s\", %d, \"%s\", \"%s\");",
+                               TABLE_NAME, country, mcc, mnc, oper_select);
+               printf("%s\n",buf);
+       }
+       printf("COMMIT;\n");
+
+       fclose(fp_in);
+}
diff --git a/res/wiki_mcc_mnc_oper_list.csv b/res/wiki_mcc_mnc_oper_list.csv
new file mode 100755 (executable)
index 0000000..6c6edf6
--- /dev/null
@@ -0,0 +1,1517 @@
+Country,MCC,MNC,Brand,Operator
+__,001,01,TEST,Test Network
+GE,289,67,Aquafon,Aquafon
+GE,289,88,A-Mobile,A-Mobile
+AF,412,01,AWCC,Afghan Wireless Communication Company
+AF,412,20,Roshan,Telecom Development Company Afghanistan Ltd.
+AF,412,40,MTN,MTN Group Afghanistan
+AF,412,50,Etisalat,Etisalat Afghanistan
+AL,76,01,AMC,Albanian Mobile Communications
+AL,276,02,Vodafone,Vodafone Albania
+AL,276,03,Eagle Mobile,Eagle Mobile
+AL,276,04,Plus Communication,Plus Communication
+DZ,603,01,Mobilis,ATM Mobilis
+DZ,603,02,Djezzy,Orascom Telecom Algerie Spa
+DZ,603,03,Nedjma,Wataniya Telecom Algerie
+AS,44,11,Bluesky,Bluesky
+AD,213,03,Mobiland,Servei De Tele. DAndorra
+AO,631,02,UNITEL,UNITEL S.a.r.l.
+AO,631,04,MOVICEL,MOVICEL Telecommunications S.a.
+AI,365,010,,Weblinks Limited
+AI,365,840,,Cable & Wireless
+AG,344,030,APUA,Antigua Public Utilities Authority
+AG,344,920,LIME,Cable & Wireless Caribbean Cellular (Antigua) Limited
+AG,338,050,Digicel,Antigua Wireless Ventures Limited
+AR,722,010,Movistar,Telefonica Móviles Argentina SA
+AR,722,020,Nextel,NII Holdings
+AR,722,070,Movistar,Telefonica Móviles Argentina SA
+AR,722,310,Claro,AMX Argentina S.A
+AR,722,320,Claro,AMX Argentina S.A
+AR,722,330,Claro,AMX Argentina S.A
+AR,722,34,Personal,Telecom Personal SA
+AR,722,341,Personal,Telecom Personal SA
+AR,722,350,,Hutchinson (PORT HABLE)
+AR,722,36,Personal,Telecom Personal SA
+AM,283,01,Beeline,ArmenTel
+AM,283,05,VivaCell-MTS,K Telecom CJSC
+AM,283,10,Orange,
+AW,363,01,SETAR,Servicio di Telecomunicacion di Aruba
+AW,363,02,Digicel,
+AU,505,01,Telstra,Telstra Corporation Limited
+AU,505,02,Optus,Singtel Optus Proprietary Limited
+AU,505,03,Vodafone,Vodafone Hutchison Australia Proprietary Limited
+AU,505,04,,Department of Defence
+AU,505,05,Ozitel,
+AU,505,06,3,Vodafone Hutchison Australia Proprietary Limited
+AU,505,08,One.Tel,One.Tel Limited
+AU,505,09,Airnet,
+AU,505,12,3,Vodafone Hutchison Australia Proprietary Limited
+AU,505,13,Railcorp,Rail Corporation New South Wales
+AU,505,14,AAPT,Telecom New Zealand
+AU,505,15,3GIS,
+AU,505,16,Victorian Rail Track,
+AU,505,21,SOUL,TPG Telecom Limited
+AU,505,24,Advance Communications Technologies Pty. Ltd.,
+AU,505,38,Crazy John's,Vodafone Hutchison Australia Proprietary Limited
+AU,505,71,Telstra,Telstra Corporation Limited
+AU,505,72,Telstra,Telstra Corporation Limited
+AU,505,88,Localstar Holding Pty. Ltd.,
+AU,505,90,Optus,Singtel Optus Proprietary Limited
+AU,505,99,One.Tel,One.Tel
+AT,232,01,A1,A1 Telekom Austria
+AT,232,03,T-Mobile,T-Mobile Austria
+AT,232,05,Orange,Orange Austria
+AT,232,07,tele.ring,T-Mobile Austria
+AT,232,09,A1,A1 Telekom Austria
+AT,232,10,3,Hutchison 3G
+AT,232,11,bob,A1 Telekom Austria
+AT,232,12,yesss,yesss
+AT,232,14,3,Hutchison 3G
+AT,232,15,Barablu,Barablu Mobile Ltd.
+AT,232,91,GSM-R A,ÖBB
+AZ,400,01,Azercell,
+AZ,400,02,Bakcell,
+AZ,400,03,FONEX,CATEL
+AZ,400,04,Nar Mobile,Azerfon
+BS,364,390,BaTelCo,The Bahamas Telecommunications Company Ltd
+BH,426,01,Batelco,Bahrain Telecommunications Company
+BH,426,02,zain BH,Zain Bahrain
+BH,426,04,VIVA,Viva Bahrain
+BD,470,01,Grameenphone,GrameenPhone Ltd
+BD,470,02,Robi,Axiata Bangladesh Ltd.
+BD,470,03,Banglalink,Orascom Telecom Holding
+BD,470,04,TeleTalk,
+BD,470,05,Citycell,
+BD,470,06,Airtel formerly Warid Telcom,Bharti airtel Bangladesh Ltd.
+BB,342,600,LIME,LIME (formerly known as Cable & Wireless)
+BB,342,750,Digicel,Digicel (Barbados) Limited
+BB,342,820,,Sunbeach Communications
+BY,257,01,velcom,
+BY,257,02,MTS,Mobile TeleSystems
+BY,257,03,DIALLOG,BelCel
+BY,257,04,life:),Belarussian Telecommunications Network
+BY,257,501,BelCel JV,
+BE,206,01,Proximus,Belgacom Mobile
+BE,206,05,Telenet,Telenet
+BE,206,10,Mobistar,France Telecom
+BE,206,20,BASE,KPN
+BZ,702,67,DigiCell,Belize Telemedia
+BZ,702,99,Smart,SpeedNet Communications Limited
+BJ,616,01,Libercom,Benin Telecoms Mobile
+BJ,616,02,Moov,Telecel Benin
+BJ,616,03,MTN,Spacetel Benin
+BJ,616,04,BBCOM,Bell Benin Communications
+BJ,616,05,Glo,Glo Communication Benin
+BM,350,01,Digicel Bermuda,Telecommunications (Bermuda & West Indies) Ltd
+BM,350,02,Mobility,M3 Wireless
+BM,338,050,Digicel Bermuda,
+BM,310,59,Cellular One,
+BT,402,11,B-Mobile,B-Mobile
+BT,402,77,TashiCell,Tashi InfoComm Limited
+BO,736,01,Nuevatel,Nuevatel PCS De Bolivia SA
+BO,736,02,Entel,Entel SA
+BO,736,03,Tigo,Telefonica Celular De Bolivia S.A
+BA,218,03,HT-ERONET,Public Enterprise Croatian Telecom Ltd.
+BA,218,05,m:tel,RS Telecommunications JSC Banja Luka
+BA,218,90,BH Mobile,BH Telecom
+BW,652,01,Mascom,Mascom Wireless (Pty) Limited
+BW,652,02,Orange,Orange (Botswana) Pty Limited
+BW,652,04,BTC Mobile,Botswana Telecommunications Corporation
+BR,724,00,Nextel,"NII Holdings, Inc."
+BR,724,02,TIM,Telecom Italia Mobile
+BR,724,03,TIM,Telecom Italia Mobile
+BR,724,04,TIM,Telecom Italia Mobile
+BR,724,05,Claro BR,Claro
+BR,724,06,Vivo,Vivo S.A.
+BR,724,07,Sercomtel,Sercomtel Celular
+BR,724,10,Vivo,Vivo S.A.
+BR,724,11,Vivo,Vivo S.A.
+BR,724,15,CTBC Celular,CTBC Celular S.A.
+BR,724,16,Brasil Telecom GSM,Brasil Telecom GSM
+BR,724,23,Vivo,Vivo S.A.
+BR,724,31,Oi,TNL PCS
+BR,724,32,CTBC Celular,CTBC Celular S.A.
+BR,724,33,CTBC Celular,CTBC Celular S.A.
+BR,724,34,CTBC Celular,CTBC Celular S.A.
+BR,724,39,Nextel,"NII Holdings, Inc."
+VG,348,170,LIME,Cable & Wireless
+VG,348,570,CCT Boatphone,Caribbean Cellular Telephone
+VG,348,770,Digicel,Digicel (BVI) Limited
+BN,528,01,,Jabatan Telekom Brunei
+BN,528,02,B-Mobile,B-Mobile Communications Sdn Bhd
+BN,528,11,DSTCom,Data Stream Technology
+BG,284,01,M-Tel,Mobiltel
+BG,284,03,Vivacom,BTC
+BG,284,04,Undisclosed,Undisclosed
+BG,284,05,GLOBUL,Cosmo Bulgaria Mobile
+BF,613,01,Telmob,Onatal
+BF,613,02,Zain,Celtel Burkina Faso
+BF,613,03,Telecel Faso,Telecel Faso SA
+BI,642,01,Spacetel,Econet Wireless Burundi PLC
+BI,642,02,Africell,Africell PLC
+BI,642,03,Onatel,Onatel
+BI,642,07,Smart Mobile,LACELL SU
+BI,642,08,HiTs Telecom,HiTs Telecom
+BI,642,82,U-COM Burundi,U-COM Burundi S.A.
+KH,456,01,Mobitel,CamGSM
+KH,456,02,hello,Telekom Malaysia International (Cambodia) Co. Ltd
+KH,456,03,,S Telecom
+KH,456,04,qb,Cambodia Advance Communications Co. Ltd
+KH,456,05,Star-Cell,APPLIFONE CO. LTD.
+KH,456,06,Smart Mobile,"Latelz Co., Ltd"
+KH,456,18,Mfone,Camshin / Shinawatra
+KH,456,11,Excell,
+KH,456,09,Beeline,Sotelco Ltd.
+KH,456,08,Metfone,Viettel
+CM,624,01,MTN Cameroon,Mobile Telephone Network Cameroon Ltd
+CM,624,02,Orange,Orange Cameroun S.A.
+CA,302,220,Telus,Telus Mobility
+CA,302,221,Telus,Telus Mobility
+CA,302,270,unknown,EastLink
+CA,302,290,,Airtel Wireless
+CA,302,320,Mobilicity,DAVE Wireless
+CA,302,350,FIRST,FIRST Networks Operations
+CA,302,360,MiKe,Telus Mobility
+CA,302,361,Telus,Telus Mobility
+CA,302,370,Fido,Fido Solutions (Rogers Wireless)
+CA,302,380,DMTS,Dryden Mobility
+CA,302,490,WIND Mobile,Globalive Communications
+CA,302,500,Videotron,Videotron
+CA,302,510,Videotron,Videotron
+CA,302,610,Bell,Bell Mobility
+CA,302,610,Bell,Virgin Mobile Canada
+CA,302,620,ICE Wireless,ICE Wireless
+CA,302,640,Bell,Bell Mobility
+CA,302,652,,BC Tel Mobility (Telus)
+CA,302,653,Telus,Telus Mobility
+CA,302,655,MTS,MTS Mobility
+CA,302,656,TBay,Thunder Bay Telephone Mobility
+CA,302,657,Telus,Telus Mobility
+CA,302,660,MTS,MTS Mobility
+CA,302,680,SaskTel,SaskTel Mobility
+CA,302,701,,MB Tel Mobility
+CA,302,702,,MT&T Mobility (Aliant)
+CA,302,703,,New Tel Mobility (Aliant)
+CA,302,710,Globalstar,
+CA,302,720,Rogers Wireless,Rogers Communications
+CA,302,780,SaskTel,SaskTel Mobility
+CA,302,880,Bell / Telus / SaskTel,"Shared Telus, Bell, and SaskTel"
+CV,625,01,CVMOVEL,"CVMovel, S.A."
+CV,625,02,T+,T+
+KY,346,140,LIME,Cable & Wireless (Cayman Islands) Limited
+KY,346,50,Digicel,Digicel Cayman Ltd.
+CF,623,01,CTP,Centrafrique Telecom Plus
+CF,623,02,TC,Telecel Centrafrique
+CF,623,03,Orange,Orange RCA
+CF,623,04,Nationlink,Nationlink Telecom RCA
+TD,622,01,Airtel,Bharti Airtel SA
+TD,622,02,,Tchad Mobile
+TD,622,03,,TIGO - Millicom
+TD,622,04,Salam,Sotel Mobile
+CL,730,01,entel,Entel PCS Telecomunicaciones S.A.
+CL,730,02,movistar,Telefónica Móvil de Chile
+CL,730,03,Claro,Claro Chile S.A.
+CL,730,04,Nextel,Centennial Cayman Corp. Chile
+CL,730,08,VTR Móvil,VTR S.A.
+CL,730,09,Nextel,Centennial Cayman Corp. Chile
+CL,730,10,entel,Entel Telefonía Móvil S.A.
+CL,730,99,Will,WILL Telefonía
+CN,460,00,China Mobile,China Mobile
+CN,460,01,China Unicom,China Unicom
+CN,460,02,China Mobile,China Mobile
+CN,460,03,China Telecom,China Telecom
+CN,460,05,China Telecom,China Telecom
+CN,460,06,China Unicom,China Unicom
+CN,460,07,China Mobile,China Mobile
+CN,460,20,China Tietong,China Tietong
+CO,732,001,,Colombia Telecomunicaciones S.A.
+CO,732,002,Edatel,Edatel S.A.
+CO,732,101,Comcel,Comcel Colombia
+CO,732,102,movistar,Bellsouth Colombia
+CO,732,103,Tigo,Colombia Móvil
+CO,732,111,Tigo,Colombia Móvil
+CO,732,123,movistar,Telefónica Móviles Colombia
+KM,654,01,,HURI - SNPT
+CG,629,01,Airtel,Celtel Congo
+CG,629,10,Libertis Telecom,MTN CONGO S.A
+CG,629,07,,Warid Telecom
+CK,548,01,,Telecom Cook
+CR,712,01,Kolbi ICE,Instituto Costarricense de Electricidad
+CR,712,02,Kolbi ICE,Instituto Costarricense de Electricidad
+CR,712,03,Claro,Claro CR Telecomunicaciones
+CR,712,04,movistar,Telefonica Móviles Costa Rica
+HR,219,01,T-Mobile,T-Mobile Croatia
+HR,219,02,Tele2,Tele2
+HR,219,10,Vip,Vipnet
+CU,368,01,CUBACEL,"Empresa de Telecomunicaciones de Cuba, SA"
+CY,280,01,Cytamobile-Vodafone,Cyprus Telecommunications Auth
+CY,280,10,MTN,Areeba Ltd
+CZ,230,01,T-Mobile,T-Mobile Czech Republic
+CZ,230,02,O2,Telefónica Czech Republic
+CZ,230,03,Vodafone,Vodafone Czech Republic
+CZ,230,04,U:fon,"MobilKom, a. s."
+CZ,230,05,,"TRAVEL TELEKOMMUNIKATION, s.r.o."
+CZ,230,06,,"OSNO TELECOMUNICATION, s.r.o."
+CZ,230,98,,"Správa železniční dopravní cesty, s.o."
+CZ,230,99,Vodafone,Vodafone Czech Republic
+CD,630,01,Vodacom,Vodacom Congo RDC sprl
+CD,630,02,Zain,Celtel Congo
+CD,630,04,,Cellco
+CD,630,05,Supercell,Supercell SPRL
+CD,630,10,Libertis Telecom,
+CD,630,86,CCT,Congo-Chine Telecom s.a.r.l.
+CD,630,89,SAIT Telecom,OASIS SPRL
+DK,238,01,TDC,TDC A/S
+DK,238,02,Telenor,Telenor Denmark
+DK,238,03,,MIGway A/S
+DK,238,05,,ApS KBUS
+DK,238,06,3,Hi3G Denmark ApS
+DK,238,07,,Barablu Mobile Ltd.
+DK,238,09,,Dansk Beredskabskommunikation A/S
+DK,238,10,TDC,TDC A/S
+DK,238,11,,Dansk Beredskabskommunikation A/S
+DK,238,12,,Lycamobile Denmark Ltd
+DK,238,20,Telia,
+DK,238,30,Telia,Telia Nättjänster Norden AB
+DK,238,40,,Ericsson Danmark A/S
+DK,238,77,Telenor,Telenor Denmark
+DJ,638,01,Evatis,Djibouti Telecom SA
+DM,366,020,Digicel,Digicel Group Limited
+DM,366,110,,Cable & Wireless
+DO,370,01,Orange,Orange Dominicana
+DO,370,02,Claro,"Compañía Dominicana de Teléfonos, C por"
+DO,370,03,Tricom,Tricom S.A.
+DO,370,04,Viva,"Trilogy Dominicana, S.A."
+TL,514,02,,Timor Telecom
+EC,740,00,Movistar,Otecel S.A.
+EC,740,01,Claro,CONECEL S.A.
+EC,740,02,Alegro,Corporación Nacional de Telecomunicaciones CNT EP
+EG,602,01,Mobinil,ECMS-Mobinil
+EG,602,02,Vodafone,Vodafone Egypt
+EG,602,03,Etisalat,Etisalat Egypt
+SV,706,01,CTE Telecom Personal,CTE Telecom Personal SA de CV
+SV,706,02,digicel,Digicel Group
+SV,706,03,Tigo,Telemovil EL Salvador S.A.
+SV,706,04,movistar,Telefónica Móviles El Salvador
+SV,706,11,Claro,América Móvil
+GQ,627,01,Orange GQ,GETESA
+GQ,627,03,Hits GQ,HiTs EG.SA
+ER,657,01,Eritel,Eritrea Telecommunications Services Corporation
+EE,248,01,EMT,Estonian Mobile Telecom
+EE,248,02,Elisa,Elisa Eesti
+EE,248,03,Tele 2,Tele 2 Eesti
+EE,248,04,,OY Top Connect
+EE,248,05,,AS Bravocom Mobiil
+EE,248,06,,Progroup Holding
+ET,636,01,ETH-MTN,Ethio Telecom
+FO,288,01,Faroese Telecom,Faroese Telecom
+FO,288,02,Vodafone,Vodafone Faroe Islands
+FJ,542,01,Vodafone,Vodafone Fiji
+FJ,542,02,Digicel,Digicel Fiji
+FI,244,03,DNA,DNA Oy
+FI,244,05,Elisa,Elisa Oyj
+FI,244,07,Nokia,Nokia Test Network
+FI,244,08,,Unknown
+FI,244,10,,TDC Oy
+FI,244,11,VIRVE,Suomen Erillisverkot Oy
+FI,244,12,DNA,DNA Oy
+FI,244,14,AMT,Ålands Mobiltelefon
+FI,244,15,SAMK,Samk student network
+FI,244,21,Saunalahti,Elisa Oyj
+FI,244,29,,Scnl Truphone
+FI,244,91,Sonera,TeliaSonera Finland Oyj
+FR,208,00,Orange,France Télécom
+FR,208,01,Orange,France Télécom
+FR,208,02,Orange,France Télécom
+FR,208,05,,Globalstar Europe
+FR,208,06,,Globalstar Europe
+FR,208,07,,Globalstar Europe
+FR,208,10,SFR,Vivendi
+FR,208,11,SFR,Vivendi
+FR,208,13,SFR,Vivendi
+FR,208,14,Free Mobile,Iliad
+FR,208,15,Free Mobile,Iliad
+FR,208,20,Bouygues,Bouygues Telecom
+FR,208,21,Bouygues,Bouygues Telecom
+FR,208,22,Transatel Mobile,Transatel
+FR,208,88,Bouygues,Bouygues Telecom
+PF,547,20,Vini,Tikiphone SA
+GA,628,01,Libertis,Gabon Telecom & Libertis S.A.
+GA,628,02,Moov,Atlantique Télécom (Etisalat Group) Gabon S.A.
+GA,628,03,Airtel,Airtel Gabon S.A.
+GA,628,04,Azur,USAN Gabon S.A.
+GM,607,01,Gamcel,Gamcel
+GM,607,02,Africel,Africel
+GM,607,03,Comium,Comium
+GM,607,04,QCell,QCell Gambia
+GE,282,01,Geocell,Geocell Limited
+GE,282,02,MagtiCom,Magticom GSM
+GE,282,03,MagtiCom,Magtifix
+GE,282,04,Beeline,Mobitel LLC
+GE,282,05,Silknet,Silknet CDMA
+DE,262,01,T-Mobile,T-Mobile Deutschland GmbH
+DE,262,02,Vodafone,Vodafone D2 GmbH
+DE,262,03,E-Plus,E-Plus Mobilfunk
+DE,262,04,Vodafone,
+DE,262,05,E-Plus,E-Plus Mobilfunk
+DE,262,06,T-Mobile,
+DE,262,07,O2,O2 (Germany) GmbH & Co. OHG
+DE,262,08,O2,
+DE,262,09,Vodafone,
+DE,262,10,,Arcor AG & Co
+DE,262,11,O2,
+DE,262,12,,Dolphin Telecom
+DE,262,13,,Mobilcom Multimedia
+DE,262,14,,Group 3G UMTS
+DE,262,15,Airdata,
+DE,262,16,Vistream,
+DE,262,42,27C3,Chaos Computer Club
+DE,262,43,LYCA,Lycamobile
+DE,262,60,,DB Telematik
+DE,262,76,,Siemens AG
+DE,262,77,E-Plus,
+DE,262,92,Nash Technologies,
+DE,262,901,Debitel,
+GH,620,01,MTN,MTN Group
+GH,620,02,Vodafone,Vodafone Group
+GH,620,03,tiGO,Millicom Ghana
+GH,620,04,Expresso,Kasapa / Hutchison Telecom
+GH,620,06,Airtel,Airtel
+GI,266,01,GibTel,Gibraltar Telecoms
+GI,266,06,CTS Mobile,CTS Gibraltar
+GR,202,01,Cosmote,COSMOTE - Mobile Telecommunications S.A.
+GR,202,05,Vodafone,Vodafone Greece
+GR,202,09,Wind,Wind Hellas Telecommunications S.A. (Q-Telecom)
+GR,202,10,Wind,Wind Hellas Telecommunications S.A.
+GL,290,01,,TELE Greenland A/S
+GD,352,030,Digicel,Digicel Grenada Ltd.
+GD,352,110,Cable & Wireless,Cable & Wireless Grenada Ltd.
+GP,340,01,Orange,Orange Caraïbe Mobiles
+GP,340,02,Outremer,Outremer Telecom
+GP,340,03,Telcell,Saint Martin et Saint Barthelemy Telcell Sarl
+GP,340,08,Dauphin,Dauphin Telecom
+GP,340,20,Digicel,DIGICEL Antilles Française Guyane
+GU,310,032,IT&E Wireless,"IT&E Overseas, Inc"
+GU,310,033,,Guam Telephone Authority
+GU,310,140,mPulse,GTA Wireless
+GU,310,370,docomo,docomo Pacific
+GU,311,250,i CAN_GSM,Wave Runner LLC
+GU,310,470,docomo,docomo Pacific
+GT,704,01,Claro,Servicios de Comunicaciones Personales Inalambricas (SERCOM)
+GT,704,02,Comcel / Tigo,Millicom / Local partners
+GT,704,03,movistar,Telefonica Móviles Guatemala (Telefónica)
+GB,234,55,Sure Mobile,Cable & Wireless Guernsey
+GB,234,50,Wave Telecom,Wave Telecom (JT-Wave)
+GB,234,03,Airtel Vodafone,Guernsey Airtel Ltd
+GN,611,01,Orange S.A.,Orange
+GN,611,02,Sotelgui,Sotelgui Lagui
+GN,611,03,Telecel Guinee,INTERCEL Guinée
+GN,611,04,MTN,Areeba Guinea
+GN,611,05,Cellcom,Cellcom
+GW,632,02,Areeba,Spacetel Guiné-Bissau S.A.
+GW,632,03,Orange,
+GY,738,01,Digicel,U-Mobile (Cellular) Inc.
+GY,738,02,GT&T Cellink Plus,Guyana Telephone & Telegraph Co.
+HT,372,01,Voila,Communication Cellulaire d'Haiti S.A.
+HT,372,02,Digicel,Unigestion Holding S.A.
+HT,372,03,NATCOM,Telecommunication S.A.
+HN,708,01,Claro,Servicios de Comunicaciones de Honduras S.A. de C.V.
+HN,708,02,Tigo,Celtel / Tigo
+HN,708,30,Hondutel,Empresa Hondureña de Telecomunicaciones
+HN,708,40,DIGICEL,Digicel de Honduras
+HK,454,00,1O1O / One2Free,CSL Limited merged New World
+HK,454,01,,CITIC Telecom 1616
+HK,454,02,,CSL Limited
+HK,454,03,3 (3G),Hutchison Telecom
+HK,454,04,3 (2G),Hutchison Telecom
+HK,454,05,3 (CDMA),Hutchison Telecom
+HK,454,06,SmarTone,SmarTone Mobile Communications Limited
+HK,454,07,,China Unicom (Hong Kong) Limited
+HK,454,08,,Trident Telecom
+HK,454,09,,China Motion Telecom
+HK,454,10,New World Mobility,CSL Limited
+HK,454,11,,China-Hong Kong Telecom
+HK,454,12,CMCC HK,China Mobile Hong Kong Company Limited
+HK,454,14,,Hutchison Telecom
+HK,454,15,,SmarTone Mobile Communications Limited
+HK,454,16,PCCW Mobile (2G),PCCW Limited
+HK,454,17,,SmarTone Mobile Communications Limited
+HK,454,18,,CSL Limited
+HK,454,19,PCCW Mobile (3G),PCCW Limited
+HK,454,29,PCCW Mobile (CDMA),PCCW Limited
+HU,216,01,Telenor,Telenor Magyarország Zrt.
+HU,216,30,T-Mobile,Magyar Telekom Plc
+HU,216,70,Vodafone,Vodafone Magyarország Zrt.
+IS,274,01,Síminn,Iceland Telecom
+IS,274,02,Vodafone,Og fjarskipti hf
+IS,274,03,Vodafone,Vodafone Iceland
+IS,274,04,Viking,IMC Island ehf
+IS,274,06,,Núll níu ehf
+IS,274,07,IceCell,IceCell ehf
+IS,274,08,On-waves,Iceland Telecom
+IS,274,11,Nova,Nova ehf
+IS,274,12,Tal,Tal hf
+IN,404,01,Vodafone IN,Haryana
+IN,404,02,AirTel,Punjab
+IN,404,03,AirTel,Himachal Pradesh
+IN,404,04,IDEA,Delhi & NCR
+IN,404,05,Vodafone IN,Gujarat
+IN,404,07,IDEA,Andhra Pradesh
+IN,404,09,Reliance,Assam
+IN,404,10,AirTel,Delhi & NCR
+IN,404,11,Vodafone IN,Delhi & NCR
+IN,404,12,IDEA,Haryana
+IN,404,13,Vodafone IN,Andhra Pradesh
+IN,404,14,IDEA,Punjab
+IN,404,15,Vodafone IN,Uttar Pradesh (East)
+IN,404,17,AIRCEL,West Bengal
+IN,404,19,IDEA,Kerala
+IN,404,20,Vodafone IN,Mumbai
+IN,404,21,Loop Mobile,Mumbai
+IN,404,22,IDEA,Maharashtra & Goa
+IN,404,24,IDEA,Gujarat
+IN,404,25,AIRCEL,Bihar
+IN,404,27,Vodafone IN,Maharashtra & Goa
+IN,404,28,AIRCEL,Orissa
+IN,404,29,AIRCEL,Assam
+IN,404,30,Vodafone IN,Kolkata
+IN,404,31,AirTel,Kolkata
+IN,404,34,CellOne,Haryana
+IN,404,36,Reliance,Bihar & Jharkhand
+IN,404,37,Aircel,Jammu & Kashmir
+IN,404,38,CellOne,Assam
+IN,404,41,Aircel,Chennai
+IN,404,42,Aircel,Tamil Nadu
+IN,404,44,IDEA,Karnataka
+IN,404,45,Airtel,Karnataka
+IN,404,46,Vodafone IN,Kerala
+IN,404,48,Dishnet Wireless,Unknown
+IN,404,49,Airtel,Andhra Pradesh
+IN,404,51,CellOne,Himachal Pradesh
+IN,404,52,Reliance,Orissa
+IN,404,53,CellOne,Punjab
+IN,404,54,CellOne,Uttar Pradesh (West)
+IN,404,55,CellOne,Uttar Pradesh (East)
+IN,404,71,CellOne,Karnataka (Bangalore)
+IN,404,56,IDEA,Uttar Pradesh (West)
+IN,404,57,CellOne,Gujarat
+IN,404,58,CellOne,Madhya Pradesh & Chhattisgarh
+IN,404,59,CellOne,Rajasthan
+IN,404,60,Vodafone IN,Rajasthan
+IN,404,62,CellOne,Jammu & Kashmir
+IN,404,64,CellOne,Chennai
+IN,404,66,CellOne,Maharashtra & Goa
+IN,404,67,Reliance GSM,Madhya Pradesh & Chhattisgarh
+IN,404,68,DOLPHIN,Delhi & NCR
+IN,404,69,DOLPHIN,Mumbai
+IN,404,72,CellOne,Kerala
+IN,404,74,CellOne,West Bengal
+IN,404,76,CellOne,Orissa
+IN,404,78,Idea Cellular Ltd,Madhya Pradesh & Chattishgarh
+IN,404,80,BSNL MOBILE,Bharat Sanchar Nigam Limited
+IN,404,81,CellOne,Kolkata
+IN,404,82,Idea,Himachal Pradesh
+IN,404,83,Reliance Smart GSM,Kolkata
+IN,404,84,Vodafone IN,Chennai
+IN,404,85,Reliance,West Bengal
+IN,404,86,Vodafone IN,Karnataka
+IN,404,87,Idea,Rajisthan
+IN,404,88,Vodafone IN,Vodafone Punjab
+IN,404,89,Idea,Uttar Pradesh (East)
+IN,404,90,AirTel,Maharashtra & Goa
+IN,404,91,AIRCEL,Kolkata
+IN,404,92,AirTel,Mumbai
+IN,404,93,AirTel,Madhya Pradesh
+IN,404,96,AirTel,Haryana
+IN,405,01,Reliance,Andhra Pradesh
+IN,405,03,Reliance,Bihar
+IN,405,04,Reliance,Chennai
+IN,405,05,Reliance,Delhi & NCR
+IN,405,09,Reliance,Jammu & Kashmir
+IN,405,10,Reliance,Karnataka
+IN,405,13,Reliance,Maharashtra & Goa
+IN,405,025,TATA Teleservice,Andhra Pradesh
+IN,405,026,TATA Teleservice,Assam
+IN,405,027,TATA Teleservice,Bihar/Jharkhand
+IN,405,029,TATA Teleservice,Delhi
+IN,405,030,TATA Teleservice,Gujarat
+IN,405,031,TATA Teleservice,Haryana
+IN,405,032,TATA Teleservice,Himachal Pradesh
+IN,405,033,TATA Teleservice,Jammu & Kashmir
+IN,405,034,TATA Teleservice,Karnataka
+IN,405,035,TATA Teleservice,Kerala
+IN,405,036,TATA Teleservice,Kolkata
+IN,405,037,TATA Teleservice,Maharashtra & Goa
+IN,405,038,TATA Teleservice,Madhya Pradesh
+IN,405,039,TATA Teleservice,Mumbai
+IN,405,041,TATA Teleservice,Orissa
+IN,405,042,TATA Teleservice,Punjab
+IN,405,043,TATA Teleservice,Rajasthan
+IN,405,044,TATA Teleservice,Tamil Nadu including Chennai
+IN,405,045,TATA Teleservice,[Uttar Pradesh (E)]
+IN,405,046,TATA Teleservice,[Uttar Pradesh (W) & Uttarkhand ]
+IN,405,047,TATA Teleservice,[West Bengal]
+IN,405,51,AirTel,West Bengal
+IN,405,52,AirTel,Bihar & Jharkhand
+IN,405,54,AirTel,Uttar Pradesh (East)
+IN,405,55,Airtel,Jammu & Kashmir
+IN,405,56,AirTel,Assam
+IN,405,66,Vodafone IN,Uttar Pradesh (West)
+IN,405,70,IDEA,Bihar & Jharkhand
+IN,405,750,Vodafone IN,Jammu & Kashmir
+IN,405,751,Vodafone IN,Assam
+IN,405,752,Vodafone IN,Bihar & Jharkhand
+IN,405,753,Vodafone IN,Orissa
+IN,405,754,Vodafone IN,Himachal Pradesh
+IN,405,755,Vodafone IN,North East
+IN,405,756,Vodafone IN,Madhya Pradesh & Chhattisgarh
+IN,405,799,IDEA,Mumbai
+IN,405,800,AIRCEL,Delhi & NCR
+IN,405,801,AIRCEL,Andhra Pradesh
+IN,405,802,AIRCEL,Gujarat
+IN,405,803,AIRCEL,Karnataka
+IN,405,804,AIRCEL,Maharashtra & Goa
+IN,405,805,AIRCEL,Mumbai
+IN,405,806,AIRCEL,Rajasthan
+IN,405,807,AIRCEL,Haryana
+IN,405,808,AIRCEL,Madhya Pradesh
+IN,405,809,AIRCEL,Kerala
+IN,405,810,AIRCEL,Uttar Pradesh (East)
+IN,405,811,AIRCEL,Uttar Pradesh (West)
+IN,405,812,AIRCEL,Punjab
+IN,405,819,Uninor,Andhra Pradesh
+IN,405,818,Uninor,Uttar Pradesh (West)
+IN,405,820,Uninor,Karnataka
+IN,405,821,Uninor,Kerala
+IN,405,822,Uninor,Kolkata
+IN,405,824,Videocon Datacom,Assam
+IN,405,827,Videocon Datacom,Gujarat
+IN,405,834,Videocon Datacom,Madhya Pradesh
+IN,405,844,Uninor,Delhi & NCR
+IN,405,845,IDEA,Assam
+IN,405,86,IDEA,Jammu & Kashmir
+IN,405,848,IDEA,Kolkata
+IN,405,850,IDEA,Orissa
+IN,405,855,Loop Mobile,Assam
+IN,405,864,Loop Mobile,Kolkata
+IN,405,865,Loop Mobile,Madhya Pradesh
+IN,405,875,Uninor,Assam
+IN,405,880,Uninor,West Bengal
+IN,405,881,S Tel,Assam
+IN,405,912,Etisalat DB(cheers),Andhra Pradesh
+IN,405,913,Etisalat DB(cheers),Delhi & NCR
+IN,405,914,Etisalat DB(cheers),Gujarat
+IN,405,917,Etisalat DB(cheers),Kerala
+IN,404,927,Uninor,Gujarat
+IN,405,929,Uninor,Maharashtra
+ID,510,00,PSN,PT Pasifik Satelit Nusantara (ACeS)
+ID,510,01,INDOSAT,PT Indonesian Satellite Corporation Tbk (INDOSAT)
+ID,510,03,StarOne,PT Indosat Tbk
+ID,510,07,TelkomFlexi,PT Telkom
+ID,510,08,AXIS,PT Natrindo Telepon Seluler
+ID,510,09,SMART,PT Smart Telecom
+ID,510,10,Telkomsel,PT Telekomunikasi Selular
+ID,510,11,XL,PT XL Axiata Tbk
+ID,510,20,TELKOMMobile,PT Telkom Indonesia Tbk
+ID,510,21,IM3,PT Indonesian Satellite Corporation Tbk (INDOSAT)
+ID,510,27,Ceria,PT Sampoerna Telekomunikasi Indonesia
+ID,510,28,Fren/Hepi,PT Mobile-8 Telecom
+ID,510,89,3,PT Hutchison CP Telecommunications
+ID,510,99,Esia,PT Bakrie Telecom
+IR,432,11,IR-MCI,Mobile Communications Company of Iran
+IR,432,14,TKC,KFZO
+IR,432,19,MTCE,Mobile Telecommunications Company of Esfahan
+IR,432,32,Taliya,Rafsanjan Industrial Complex
+IR,432,35,Irancell,Irancell Telecommunications Services Company
+IR,432,70,TCI,Telephone Communications Company of Iran
+IR,432,93,Iraphone,Iraphone
+IQ,418,05,Asia Cell,Asia Cell Telecommunications Company
+IQ,418,08,SanaTel,
+IQ,418,20,Zain,Zain Iraq
+IQ,418,30,Zain,Zain Iraq
+IQ,418,40,Korek,Korek Telecom Ltd
+IQ,418,45,Mobitel,Mobitel Co. Ltd.
+IQ,418,92,Omnnea,Omnnea Wireless
+IE,272,01,Vodafone,Vodafone Ireland
+IE,272,02,O2,O2 Ireland
+IE,272,03,Meteor,Meteor Mobile Communications
+IE,272,04,,Access Telecom
+IE,272,05,3,Hutchison 3G Ireland limited
+IE,272,07,Eircom,Eircom Mobile
+IE,272,09,,Clever Communications
+IE,272,11,,Liffey Telecom
+IM,234,58,Pronto GSM,Manx Telecom
+IM,234,09,Sure Mobile,Cable & Wireless Isle of Man Ltd.
+IL,425,01,Orange,Partner Communications Company Ltd
+IL,425,02,Cellcom,
+IL,425,03,Pelephone,
+IL,425,77,Mirs,
+IT,222,01,TIM,Telecom Italia SpA
+IT,222,02,Elsacom,
+IT,222,07,Noverca,
+IT,222,10,Vodafone,Vodafone Omnitel N.V.
+IT,222,30,RFI,Rete Ferroviaria Italiana
+IT,222,77,IPSE 2000,
+IT,222,88,Wind,Wind Telecomunicazioni SpA
+IT,222,98,Blu,
+IT,222,99,3 Italia,Hutchison 3G
+CI,612,01,,Cora de Comstar
+CI,612,02,Moov,
+CI,612,03,Orange,
+CI,612,04,KoZ,Comium Ivory Coast Inc
+CI,612,05,MTN,
+CI,612,06,ORICEL,ORICEL
+JM,338,020,LIME,Cable & Wireless
+JM,338,050,Digicel,Digicel (Jamaica) Limited
+JM,338,070,Claro,Oceanic Digital Jamaica Limited
+JM,338,180,LIME,Cable & Wireless
+JP,440,00,eMobile,EMOBILE Limited
+JP,440,01,NTT docomo,NTT docomo
+JP,440,02,NTT docomo,NTT DoCoMo Kansai
+JP,440,03,NTT docomo,NTT DoCoMo Hokuriku
+JP,440,04,SoftBank,SoftBank Mobile Corp
+JP,440,06,SoftBank,SoftBank Mobile Corp
+JP,440,07,KDDI,KDDI Corporation
+JP,440,08,KDDI,KDDI Corporation
+JP,440,09,NTT docomo,NTT DoCoMo Kansai
+JP,440,10,NTT docomo,NTT DoCoMo Kansai
+JP,440,11,NTT docomo,NTT DoCoMo Tokai
+JP,440,12,NTT docomo,NTT DoCoMo
+JP,440,13,NTT docomo,NTT DoCoMo
+JP,440,14,NTT docomo,NTT DoCoMo Tohoku
+JP,440,15,NTT docomo,NTT DoCoMo
+JP,440,16,NTT docomo,NTT DoCoMo
+JP,440,17,NTT docomo,NTT DoCoMo
+JP,440,18,NTT docomo,NTT DoCoMo Tokai
+JP,440,19,NTT docomo,NTT DoCoMo Hokkaido
+JP,440,20,SoftBank,SoftBank Mobile Corp
+JP,440,21,NTT docomo,NTT DoCoMo
+JP,440,22,NTT docomo,NTT DoCoMo Kansai
+JP,440,23,DoCoMo,NTT DoCoMo Tokai
+JP,440,24,DoCoMo,NTT DoCoMo Chugoku
+JP,440,25,DoCoMo,NTT DoCoMo Hokkaido
+JP,440,26,DoCoMo,NTT DoCoMo Kyushu
+JP,440,27,DoCoMo,NTT DoCoMoTohoku
+JP,440,28,DoCoMo,NTT DoCoMo Shikoku
+JP,440,29,DoCoMo,NTT DoCoMo
+JP,440,30,DoCoMo,NTT DoCoMo
+JP,440,31,DoCoMo,NTT DoCoMo Kansai
+JP,440,32,DoCoMo,NTT DoCoMo
+JP,440,33,DoCoMo,NTT DoCoMo Tokai
+JP,440,34,DoCoMo,NTT DoCoMo Kyushu
+JP,440,35,DoCoMo,NTT DoCoMo Kansai
+JP,440,36,DoCoMo,NTT DoCoMo
+JP,440,37,DoCoMo,NTT DoCoMo
+JP,440,38,DoCoMo,NTT DoCoMo
+JP,440,39,DoCoMo,NTT DoCoMo
+JP,440,40,SoftBank,SoftBank Mobile Corp
+JP,440,41,SoftBank,SoftBank Mobile Corp
+JP,440,42,SoftBank,SoftBank Mobile Corp
+JP,440,43,SoftBank,SoftBank Mobile Corp
+JP,440,44,SoftBank,SoftBank Mobile Corp
+JP,440,45,SoftBank,SoftBank Mobile Corp
+JP,440,46,SoftBank,SoftBank Mobile Corp
+JP,440,47,SoftBank,SoftBank Mobile Corp
+JP,440,48,SoftBank,SoftBank Mobile Corp
+JP,440,49,DoCoMo,NTT DoCoMo
+JP,440,50,KDDI,KDDI Corporation
+JP,440,51,KDDI,KDDI Corporation
+JP,440,52,KDDI,KDDI Corporation
+JP,440,53,KDDI,KDDI Corporation
+JP,440,54,KDDI,KDDI Corporation
+JP,440,55,KDDI,KDDI Corporation
+JP,440,56,KDDI,KDDI Corporation
+JP,440,58,DoCoMo,NTT DoCoMo Kansai
+JP,440,60,DoCoMo,NTT DoCoMo Kansai
+JP,440,61,DoCoMo,NTT DoCoMo Chugoku
+JP,440,62,DoCoMo,NTT DoCoMo Kyushu
+JP,440,63,DoCoMo,NTT DoCoMo
+JP,440,64,DoCoMo,NTT DoCoMo
+JP,440,65,DoCoMo,NTT DoCoMo Shikoku
+JP,440,66,DoCoMo,NTT DoCoMo
+JP,440,67,DoCoMo,NTT DoCoMo Tohoku
+JP,440,68,DoCoMo,NTT DoCoMo Kyushu
+JP,440,69,DoCoMo,NTT DoCoMo
+JP,440,70,au,KDDI Corporation
+JP,440,71,KDDI,KDDI Corporation
+JP,440,72,KDDI,KDDI Corporation
+JP,440,73,KDDI,KDDI Corporation
+JP,440,74,KDDI,KDDI Corporation
+JP,440,75,KDDI,KDDI Corporation
+JP,440,76,KDDI,KDDI Corporation
+JP,440,77,KDDI,KDDI Corporation
+JP,440,78,,Okinawa Cellular Telephone
+JP,440,79,KDDI,KDDI Corporation
+JP,440,80,TU-KA,TU-KA Cellular Tokyo
+JP,440,81,TU-KA,TU-KA Cellular Tokyo
+JP,440,82,TU-KA,TU-KA Phone Kansai
+JP,440,83,TU-KA,TU-KA Cellular Tokai
+JP,440,84,TU-KA,TU-KA Phone Kansai
+JP,440,85,TU-KA,TU-KA Cellular Tokai
+JP,440,86,TU-KA,TU-KA Cellular Tokyo
+JP,440,87,DoCoMo,NTT DoCoMo Chugoku
+JP,440,88,KDDI,KDDI Corporation
+JP,440,89,KDDI,KDDI Corporation
+JP,440,90,SoftBank,SoftBank Mobile Corp
+JP,440,92,SoftBank,SoftBank Mobile Corp
+JP,440,93,SoftBank,SoftBank Mobile Corp
+JP,440,94,SoftBank,SoftBank Mobile Corp
+JP,440,95,SoftBank,SoftBank Mobile Corp
+JP,440,96,SoftBank,SoftBank Mobile Corp
+JP,440,97,SoftBank,SoftBank Mobile Corp
+JP,440,98,SoftBank,SoftBank Mobile Corp
+JP,440,99,DoCoMo,NTT DoCoMo
+JE,234,50,JT-Wave,Jersey Telecom (JT-Wave)
+JE,234,55,Sure Mobile,Cable & Wireless Jersey Limited
+JE,234,03,Airtel Vodafone,JERSEY AIRTEL LIMITED
+JO,416,01,zain JO,Jordan Mobile Telephone Services
+JO,416,02,XPress Telecom,
+JO,416,03,Umniah,Umniah Mobile Company
+JO,416,77,Orange,Petra Jordanian Mobile Telecommunications Company (MobileCom)
+KZ,401,01,Beeline,KaR-Tel LLP
+KZ,401,02,Kcell,GSM Kazakhstan Ltd
+KZ,401,07,Dalacom,
+KZ,401,08,Kazakhtelecom,
+KZ,401,77,Mobile Telecom Service,Mobile Telecom Service LLP
+KE,639,02,Safaricom,Safaricom Limited
+KE,639,03,Airtel,B Airtel
+KE,639,07,Orange Kenya,Telkom Kenya
+KE,639,05,yu,Econet Wireless Kenya
+KI,545,09,Kiribati Frigate,Telecom Services Kiribati Ltd
+KP,467,192,Koryolink,Cheo Technology Jv Company
+KP,467,193,SunNet,Korea Posts and Telecommunications Corporation
+KR,450,02,KT,KT
+KR,450,03,Power 017,"Shinsegi Telecom, Inc."
+KR,450,04,KT,KT
+KR,450,05,SKT,SK Telecom
+KR,450,06,LGU+,LG Telecom
+KR,450,08,olleh,KT
+RKS,212,01,Vala,PTK - Directory of Post of Kosovo
+RKS,293,41,IPKO,IPKO
+RKS,212,01,Z Mobile,Dardaphone
+KW,419,02,zain KW,Zain Kuwait
+KW,419,03,Wataniya,National Mobile Telecommunications
+KW,419,04,Viva,Kuwait Telecommunication Company
+KG,437,01,Beeline,Sky Mobile LLC
+KG,437,03,Fonex,Aktel Ltd
+KG,437,05,MegaCom,Alfa Telecom CJSC
+KG,437,09,O!,NurTelecom LLC
+LA,457,01,LaoTel,Lao Shinawatra Telecom
+LA,457,02,ETL,Enterprise of Telecommunications Lao
+LA,457,03,Unitel,"Star Telecom Co., Ltd"
+LA,457,08,Tigo,Millicom Lao Co Ltd
+LV,247,01,LMT,Latvian Mobile Telephone
+LV,247,02,Tele2,Tele2
+LV,247,03,TRIATEL,Telekom Baltija
+LV,247,05,Bite,Bite Latvija
+LV,247,06,,Rigatta
+LV,247,07,MTS,Master Telecom
+LV,247,08,IZZI,IZZI
+LV,247,09,Camel Mobile,Camel Mobile
+LB,415,01,Alfa,MIC 1
+LB,415,03,mtc touch,MIC 2
+LB,415,05,Ogero Mobile,Ogero Telecom
+LS,651,01,Vodacom,Vodacom Lesotho (Pty) Ltd
+LS,651,02,,Econet Ezin-cel
+LR,618,01,Lonestar Cell,Lonestar Communications Corporation
+LR,618,02,Libercell,Atlantic Wireless (Liberia) Inc.
+LR,618,04,Comium,Comium Liberia
+LR,618,07,Cellcom,"Cellcom Telecommunications, Inc"
+LR,618,20,LIBTELCO,Liberia Telecommunications Corporation
+LY,606,00,Libyana,Libyana
+LY,606,01,Madar,Al-Madar Al-Jadeed
+LY,606,02,Al-Jeel Phone,Al-Jeel Al-Jadeed
+LY,606,03,Libya Phone,Libya Telecom and Technology (LTT)
+LY,606,06,Hatef Libya,Hatef Libya
+LI,295,01,Swisscom,Swisscom Schweiz AG
+LI,295,02,Orange,Orange Liechtenstein AG
+LI,295,05,FL1,Mobilkom Liechtenstein AG
+LI,295,77,Alpmobil,Alpcom AG
+LI,295,04,Cubic Telecom,Cubic Telecom AG
+LT,246,01,Omnitel,
+LT,246,02,BITE,UAB Bité Lietuva
+LT,246,03,Tele 2,
+LT,246,05,LitRail,Lithuanian Railways
+LT,246,06,Mediafon,UAB Mediafon
+LU,270,01,LuxGSM,P&T Luxembourg
+LU,270,77,Tango,Tango SA
+LU,270,99,Orange,Orange S.A.
+MO,455,00,SmarTone,SmarTone Macao
+MO,455,01,CTM,C.T.M. Telemovel+
+MO,455,02,China Telecom,China Telecom
+MO,455,03,3,Hutchison Telecom
+MO,455,04,CTM,C.T.M. Telemovel+
+MO,455,05,3,Hutchison Telecom
+MK,294,01,T-Mobile MK,T-Mobile Macedonia
+MK,294,02,ONE,One
+MK,294,03,Vip MK,VIP Operator
+MG,646,01,Airtel,Bharti Airtel
+MG,646,02,Orange,Orange Madagascar S.A.
+MG,646,03,Sacel,Sacel Madagascar S.A.
+MG,646,04,Telma,Telma Mobile S.A.
+MW,650,01,TNM,Telecom Network Malawi
+MW,650,10,Airtel,Bharti Airtel Limited
+MY,502,01,ATUR 450,Telekom Malaysia Bhd
+MY,502,10,,DiGi Telecommunications
+MY,502,11,TM Homeline,Telekom Malaysia Bhd [78]
+MY,502,12,Maxis,Maxis Mobile Services SDN Berhad
+MY,502,13,Celcom,Celcom Axiata Berhad
+MY,502,14,,Telekom Malaysia Berhad for PSTN SMS
+MY,502,16,DiGi,DiGi Telecommunications
+MY,502,17,Hotlink,Maxis Prepaid
+MY,502,18,U Mobile,U Mobile Sdn Bhd
+MY,502,18,TM Homeline,Telekom Malaysia Bhd
+MY,502,19,Celcom,Celcom Axiata Berhad
+MY,502,20,,Electcoms Wireless Sdn Bhd
+MY,502,150,Tune Talk,Tune Talk Sdn Bhd
+MY,502,151,,Baraka Telecom Sdn Bhd (MVNE)
+MY,502,152,Yes,YTL Communications Sdn Bhd
+MV,472,01,Dhiraagu,Dhivehi Raajjeyge Gulhun
+MV,472,02,Wataniya,Wataniya Telecom Maldives
+ML,610,01,Malitel,Malitel SA
+ML,610,02,Orange,Orange Mali SA
+MT,278,01,Vodafone,Vodafone Malta
+MT,278,21,GO,Mobisle Communications Limited
+MT,278,77,Melita,Melita Plc
+MQ,340,01,Orange,Orange Caraïbe Mobiles
+MQ,340,02,Outremer,Outremer Telecom
+MQ,340,20,Digicel,DIGICEL Antilles Française Guyane
+MR,609,01,Mattel,Mattel
+MR,609,02,Chinguitel,Chinguitel
+MR,609,10,Mauritel,Mauritel Mobiles
+MU,617,01,Orange,Cellplus Mobile Communications Ltd.
+MU,617,02,MTML,Mahanagar Telephone (Mauritius) Ltd.
+MU,617,10,Emtel,Emtel Ltd
+MX,334,010,Nextel,Nextel México
+MX,334,020,Telcel,América Móvil / Mextel
+MX,334,030,movistar,Pegaso Comunicaciones y Sistemas
+MX,334,040,Iusacell / Unefon,Iusacell / Unefon
+MX,334,050,Iusacell,Iusacell
+FM,550,01,,FSM EMMANUEL
+MD,259,01,Orange,Orange Moldova
+MD,259,02,Moldcell,
+MD,259,03,IDC,Interdnestrcom
+MD,259,03,Unité,Moldtelecom
+MD,259,04,Eventis,Eventis Telecom
+MD,259,05,Unité,Moldtelecom
+MD,259,99,Unité,Moldtelecom
+MC,212,01,Office des Telephones,Monaco Telecom
+MN,428,99,MobiCom,Mobicom Corporation
+MN,428,88,Unitel,Unitel LLC
+MN,428,91,Skytel,Skytel LLC
+MN,428,98,G.Mobile,G-Mobile LLC
+ME,297,01,Telenor,Telenor Montenegro
+ME,297,02,T-Mobile,T-Mobile Montenegro LLC
+ME,297,03,m:tel CG,MTEL CG
+ME,297,04,T-Mobile,T-Mobile Montenegro
+MA,604,00,Méditel,Medi Telecom
+MA,604,01,IAM,Ittissalat Al Maghrib (Maroc Telecom)
+MA,604,05,INWI,WANA - Groupe ONA
+MZ,643,01,mCel,Mocambique Celular S.A.
+MZ,643,04,Vodacom,"Vodacom Mozambique, S.A."
+MM,414,01,MPT,Myanmar Post and Telecommunication
+NA,649,01,MTC,MTC Namibia
+NA,649,02,switch,Telecom Namibia
+NA,649,03,Leo,Orascom Telecom Holding
+NR,536,02,Digicel,Digicel (Nauru) Corporation
+NP,429,01,Namaste / NT Mobile,Nepal Telecom
+NP,429,02,Ncell,Ncell Pvt. Ltd. Spice Nepal
+NP,429,04,SmartCell,Smart Telecom Pvt. Ltd.
+NP,429,03,Sky/C-Phone,Nepal Telecom
+NL,204,01,,VastMobiel B.V.
+NL,204,02,Tele2,Tele2 Nederland B.V.
+NL,204,03,,Voiceworks B.V.
+NL,204,04,Vodafone,hollandsnieuwe
+NL,204,05,,Elephant Talk Communications Premium Rate Services
+NL,204,06,,Mundio Mobile (Netherlands) Ltd
+NL,204,07,,Teleena (MVNE)
+NL,204,08,KPN,KPN Mobile The Netherlands B.V.
+NL,204,09,Lycamobile,Lycamobile Netherlands Limited
+NL,204,10,KPN,KPN B.V.
+NL,204,12,Telfort,KPN Mobile The Netherlands B.V.
+NL,204,13,,Unica Installatietechniek B.V.
+NL,204,14,6Gmobile,6GMOBILE B.V.
+NL,204,15,,Ziggo B.V.
+NL,204,16,T-Mobile,T-Mobile Netherlands B.V
+NL,204,17,,Intercity Mobile Communications B.V.
+NL,204,18,,UPC Nederland B.V.
+NL,204,19,,Mixe Communication Solutions B.V.
+NL,204,20,T-Mobile,T-Mobile Netherlands B.V
+NL,204,21,,ProRail B.V.
+NL,204,22,,Ministerie van Defensie
+NL,204,23,,ASPIDER Solutions Nederland B.V.
+NL,204,24,,Private Mobility Nederland B.V.
+NL,204,25,,CapX B.V.
+NL,204,26,,SpeakUp B.V.
+NL,204,27,,Breezz Nederland B.V.
+NL,204,67,,RadioAccess B.V.
+NL,204,68,,Unify Group Holding B.V.
+NL,204,69,,KPN Mobile The Netherlands B.V.
+AN,362,51,Telcell,Telcell N.V.
+AN,362,69,Digicel,Curaçao Telecom N.V.
+AN,362,91,UTS,Setel N.V.
+AN,362,95,MIO,E.O.C.G. Wireless
+AN,362,94,Bayòs,Bòbò Frus N.V.
+NC,546,01,Mobilis,OPT New Caledonia
+NZ,530,00,Telecom,Telecom New Zealand
+NZ,530,01,Vodafone,Vodafone New Zealand
+NZ,530,02,Telecom,Telecom New Zealand
+NZ,530,03,Woosh,Woosh Wireless New Zealand
+NZ,530,04,TelstraClear,TelstraClear New Zealand
+NZ,530,05,XT Mobile Network,Telecom New Zealand
+NZ,530,24,2degrees,2degrees
+NI,710,21,Claro,"Empresa Nicaragüense de Telecomunicaciones, S.A."
+NI,710,30,movistar,Telefónica Móviles de Nicaragua S.A.
+NI,710,73,SERCOM,Servicios de Comunicaciones S.A.
+NE,614,01,SahelCom,
+NE,614,02,Airtel,Bharti Airtel Limited
+NE,614,03,Telecel,Telecel Niger SA
+NE,614,04,Orange,Orange Niger
+NG,621,20,Airtel,Bharti Airtel Limited
+NG,621,30,MTN,MTN Nigeria Communications Limited
+NG,621,40,M-Tel,Nigerian Mobile Telecommunications Limited
+NG,621,50,Glo,Globacom Ltd
+NG,621,60,Etisalat,Emerging Markets Telecommunication Services Ltd (Etisalat)
+NG,621,25,Visafone,Visafone Communications Ltd.
+NU,555,01,Telecom Niue,Telecom Niue
+NF,505,10,Norfolk Telecom,Norfolk Telecom
+NO,242,01,Telenor,
+NO,242,02,NetCom,NetCom GSM
+NO,242,03,Teletopia,Teletopia
+NO,242,04,Tele2,Mobile Norway AS
+NO,242,05,Network Norway,Mobile Norway AS
+NO,242,06,Ice,Nordisk Mobiltelefon
+NO,242,07,Ventelo,Ventelo AS
+NO,242,08,TDC,TDC Mobil AS
+NO,242,09,Com4,Com4 AS [106]
+NO,242,11,SystemNet,SystemNet AS [107]
+NO,242,20,,Jernbaneverket AS
+NO,242,23,Lyca,Lyca Mobile Ltd
+OM,422,02,Oman Mobile,Oman Telecommunications Company
+OM,422,03,Nawras,Omani Qatari Telecommunications Company SAOC
+PK,410,01,Mobilink,Mobilink-PMCL
+PK,410,03,Ufone,Pakistan Telecommunication Mobile Ltd
+PK,410,04,Zong,China Mobile
+PK,410,06,Telenor,Telenor Pakistan
+PK,410,07,Warid,WaridTel
+PW,552,01,PNCC,Palau National Communications Corp.
+PW,552,80,Palau Mobile,Palau Mobile Corporation
+PS,425,05,Jawwal,"Palestine Cellular Communications, Ltd."
+PS,425,06,Wataniya,Wataniya Palestine Mobile Telecommunications Company
+PA,714,01,Cable & Wireless,Cable & Wireless Panama S.A.
+PA,714,02,movistar,"Telefonica Moviles Panama S.A, Bell South Corp. (BSC)"
+PA,714,04,Digicel,Digicel Group
+PA,714,03,Claro,América Móvil
+PG,537,01,B-Mobile,Pacific Mobile Communications
+PG,537,03,Digicel,Digicel PNG
+PY,744,01,VOX,Hola Paraguay S.A
+PY,744,02,Claro,AMX Paraguay S.A.
+PY,744,04,Tigo,Telefonica Celular Del Paraguay S.A. (Telecel)
+PY,744,05,Personal,Núcleo S.A
+PY,744,06,Copaco,Copaco S.A.
+PE,716,06,Movistar,Telefónica Móviles Perú
+PE,716,07,NEXTEL,NII Holdings
+PE,716,10,Claro,América Móvil Perú
+PH,515,01,Islacom,Globe Telecom via Innove Communications
+PH,515,02,Globe,Globe Telecom
+PH,515,03,Smart,PLDT via Smart Communications
+PH,515,05,Sun,Digital Telecommunications Philippines
+PH,515,11,,PLDT via ACeS Philippines
+PH,515,18,Cure,PLDT via Smart's Connectivity Unlimited Resources Enterprise
+PH,515,88,,Nextel
+PL,260,01,Plus,Polkomtel S.A.
+PL,260,02,T-Mobile,Polska Telefonia Cyfrowa Sp. z o.o.
+PL,260,03,Orange,Polska Telefonia Komórkowa Centertel Sp. z o.o.
+PL,260,04,,not in use
+PL,260,05,,Polska Telefonia Komórkowa Centertel Sp. z o.o.
+PL,260,06,Play,P4 Sp. z o.o.
+PL,260,07,Netia,Netia S.A.
+PL,260,08,,E-Telko Sp. z o.o.
+PL,260,09,,Telekomunikacja Kolejowa Sp. z o.o.
+PL,260,10,Sferia,Sferia S.A.
+PL,260,11,Nordisk Polska,Nordisk Polska Sp. z o.o.
+PL,260,12,Cyfrowy Polsat,Cyfrowy Polsat S.A.
+PL,260,15,CenterNet,CenterNet S.A.
+PL,260,16,Mobyland,Mobyland Sp. z o.o.
+PL,260,17,Aero2,Aero 2 Sp. z o.o.
+PT,268,01,Vodafone,Vodafone Portugal
+PT,268,03,Optimus,"Sonaecom – Serviços de Comunicações, S.A."
+PT,268,06,TMN,Telecomunicações Móveis Nacionais
+PT,268,21,Zapp,Zapp Portugal
+PR,330,110,Claro,Puerto Rico Telephone Company
+PR,330,00,Open Mobile,PR Wireless
+QA,427,01,Qtel,Qtel
+QA,427,02,Vodafone,Vodafone Qatar
+QA,427,05,Ministry of Interior,Ministry of Interior
+RE,647,00,Orange,Orange La Réunion
+RE,647,02,Outremer,Outremer Telecom
+RE,647,10,SFR Reunion,Societe Reunionnaise de Radiotelephone
+RO,226,01,Vodafone,Vodafone România
+RO,226,02,Romtelecom,Romtelecom
+RO,226,03,Cosmote,Cosmote România
+RO,226,04,Cosmote,Cosmote România
+RO,226,05,Digi.Mobil,RCS&RDS
+RO,226,06,Cosmote,Cosmote România
+RO,226,10,Orange,Orange România
+RO,226,11,Enigma-System,Enigma-System
+RU,250,01,MTS,Mobile TeleSystems
+RU,250,02,MegaFon,MegaFon OJSC - previously known as North-West GSM
+RU,250,03,NCC,Nizhegorodskaya Cellular Communications
+RU,250,04,Sibchallenge,Sibchallenge
+RU,250,05,ETK,Yeniseytelecom
+RU,250,06,Skylink [10],CJSC Saratov System of Cellular Communications
+RU,250,07,SMARTS,Zao SMARTS
+RU,250,09,Skylink,Khabarovsky Cellular Phone
+RU,250,10,DTC,Dontelekom
+RU,250,11,,Orensot
+RU,250,12,Baykalwestcom,Baykal Westcom / New Telephone Company / Far Eastern Cellular
+RU,250,12,Akos,
+RU,250,13,KUGSM,Kuban GSM
+RU,250,15,SMARTS,"SMARTS Ufa, SMARTS Uljanovsk"
+RU,250,16,NTC,New Telephone Company
+RU,250,17,Utel,JSC Uralsvyazinform
+RU,250,19,INDIGO,INDIGO
+RU,250,20,Tele2,Tele2
+RU,250,23,Mobicom - Novosibirsk,Mobicom - Novosibirsk
+RU,250,28,Beeline,Beeline
+RU,250,35,MOTIV,MOTIV
+RU,250,38,Tambov GSM,Central Telecommunication Company
+RU,250,39,Utel,Uralsvyazinform
+RU,250,44,,Stavtelesot / North Caucasian GSM
+RU,250,92,,Primtelefon
+RU,250,93,,Telecom XXI
+RU,250,99,Beeline,OJSC Vimpel-Communications
+RW,635,10,MTN,MTN Rwandacell SARL
+RW,635,12,Rwandatel,Rwandatel S.A.
+RW,635,13,Tigo,TIGO RWANDA S.A
+SKN,356,050,Digicel,
+SKN,356,110,,LIME
+SKN,356,070,Chippie,UTS
+LC,358,050,Digicel[citation needed],
+LC,358,110,,Cable & Wireless
+PM,308,01,Ameris,St. Pierre-et-Miquelon Télécom
+VC,360,070,Digicel,
+VC,360,100,Cingular Wireless,
+VC,360,110,Cable & Wireless,Cable & Wireless
+WS,549,01,Digicel,Digicel Pacific Ltd.
+WS,549,27,SamoaTel,SamoaTel Ltd
+SM,292,01,PRIMA,San Marino Telecom
+ST,626,01,CSTmovel,Companhia Santomese de Telecomunicaçôe
+SA,420,01,Al Jawal,Saudi Telecom Company
+SA,420,03,Mobily,Etihad Etisalat Company
+SA,420,04,Zain SA,Zain Saudi Arabia
+SN,608,01,Orange,Sonatel
+SN,608,02,Tigo,Millicom International Cellular S.A.
+SN,608,03,Expresso,Sudatel
+RS,220,01,Telenor,Telenor Serbia
+RS,220,02,Telenor,Telenor Montenegro
+RS,220,03,mt:s,Telekom Srbija
+RS,220,05,VIP,VIP Mobile
+SC,633,01,Cable & Wireless,Cable & Wireless Seychelles
+SC,633,02,Mediatech International,Mediatech International
+SC,633,10,Airtel,Telecom Seychelles Ltd
+SL,619,01,Airtel,Bharti Airtel Limited
+SL,619,02,Tigo,Millicom (SL) Limited
+SL,619,03,Africell,Lintel Sierra Leone Limited
+SL,619,04,Comium,Comium Sierra leone INC
+SL,619,05,Africell,Lintel Sierra Leone Limited
+SL,619,25,Mobitel,Mobitel
+SG,525,01,SingTel,Singapore Telecom
+SG,525,02,SingTel-G18,Singapore Telecom
+SG,525,03,M1,MobileOne Asia
+SG,525,05,StarHub,StarHub Mobile
+SG,525,12,,Digital Trunked Radio Network
+SK,231,01,Orange,Orange Slovensko
+SK,231,02,T-Mobile,T-Mobile Slovensko
+SK,231,03,,Unient Communications
+SK,231,04,T-Mobile,T-Mobile Slovensko
+SK,231,06,O2,Telefónica O2 Slovakia
+SK,231,99,ŽSR,Železnice Slovenskej Republiky
+SI,293,40,Si.mobil,SI.MOBIL d.d.
+SI,293,41,Mobitel,Mobitel D.D.
+SI,293,64,T-2,T-2 d.o.o.
+SI,293,70,Tušmobil,Tušmobil d.o.o.
+SB,540,01,BREEZE,Solomon Telekom Co Ltd
+SO,637,60,Nationlink Telecom,Nationlink Telecom
+SO,637,01,Telesom,Telesom
+SO,637,04,Somafone,Somafone FZLLC
+SO,637,10,Nationlink,NationLink Telecom
+SO,637,25,Hormuud,Hormuud Telecom Somalia Inc
+SO,637,30,Golis,Golis Telecom Somalia
+SO,637,82,Telcom,Telcom Somalia
+ZA,655,01,Vodacom,Vodacom
+ZA,655,02,Telkom Mobile / 8.ta,Telkom
+ZA,655,06,Sentech,
+ZA,655,07,Cell C,Cell C
+ZA,655,10,MTN,MTN Group
+ZA,655,11,,South African Police Service Gauteng
+ZA,655,13,Neotel,
+ZA,655,21,,Cape Town Metropolitan Council
+ZA,655,30,,Bokamoso Consortium
+ZA,655,31,,Karabo Telecoms (Pty) Ltd.
+ZA,655,32,,Ilizwi Telecommunications
+ZA,655,33,,Thinta Thinta Telecommunications
+__,250,30,Megafon,Ostelecom
+ES,214,01,Vodafone,Vodafone Spain
+ES,214,03,Orange,France Telecom España SA
+ES,214,04,Yoigo,Xfera Moviles SA
+ES,214,05,TME,Telefónica Móviles España
+ES,214,06,Vodafone,Vodafone Spain
+ES,214,07,movistar,Telefónica Móviles España
+ES,214,08,Euskaltel,
+ES,214,09,Orange,France Telecom España SA
+ES,214,15,BT,BT Group España Compañia de Servicios Globales de Telecomunicaciones S.A.U.
+ES,214,16,TeleCable,Telecable de Asturias S.A.U.
+ES,214,17,Móbil R,R Cable y Telecomunicaciones Galicia S.A.
+ES,214,18,ONO,Cableuropa S.A.U.
+ES,214,19,Simyo,E-PLUS Moviles Virtuales España S.L.U.
+ES,214,20,Fonyou,Fonyou Telecom S.L.
+ES,214,21,Jazztel,Jazz Telecom S.A.U.
+ES,214,22,DigiMobil,Best Spain Telecom
+ES,214,23,Barablu,Barablu Móvil España
+ES,214,24,Eroski,Eroski Móvil España
+ES,214,25,LycaMobile,LycaMobile S.L.
+LK,413,01,Mobitel,Sri Lanka Telecom Mobitel
+LK,413,02,Dialog,Dialog Axiata
+LK,413,03,Etisalat,Emirates Telecommunication Corporation
+LK,413,05,Airtel,Bharti Airtel
+LK,413,08,Hutch,Hutchison Telecommunications Lanka
+SD,634,01,Zain SD,Zain Group - Sudan
+SD,634,02,MTN,MTN Sudan
+SD,634,05,Vivacell,Wawat Securities
+SD,634,07,Sudani One,Sudatel Group
+SR,746,02,Telesur,Telecommunications Company Suriname (Telesur)
+SR,746,03,Digicel,Digicel Group Limited
+SR,746,04,Uniqa,Intelsur N.V. / UTS N.V.
+SZ,653,10,,Swazi MTN
+SE,240,01,Telia,SwedenTeliaSonera
+SE,240,02,3,Hutchison 3G
+SE,240,03,Ice.net,Nordisk Mobiltelefon
+SE,240,04,,3G Infrastructure Services
+SE,240,05,Sweden 3G,Svenska UMTS-Nät
+SE,240,06,Telenor,Telenor Sweden
+SE,240,07,Tele2,Tele2 Sweden
+SE,240,08,Telenor,Telenor Sweden
+SE,240,09,djuice,Telenor Sweden
+SE,240,10,Spring Mobil,Tele2
+SE,240,11,,Lindholmen Science Park
+SE,240,12,,Barablu Mobile Scandinavia
+SE,240,13,,Ventelo Sverige
+SE,240,14,,TDC Mobil
+SE,240,15,,Wireless Maingate Nordic
+SE,240,16,,42IT
+SE,240,17,Gotanet,Götalandsnätet
+SE,240,20,,Wireless Maingate Message Services
+SE,240,21,MobiSir,Trafikverket (formerly Banverket)
+SE,240,24,Sweden 2G,Net4Mobility
+SE,240,25,,DigiTelMobile
+SE,240,26,,Beepsend
+SE,240,33,,Mobile Arts AB
+CH,228,01,Swisscom,Swisscom Ltd
+CH,228,02,Sunrise,Sunrise Communications AG
+CH,228,03,Orange,Orange Communications SA
+CH,228,05,,Togewanet AG (Comfone)
+CH,228,06,SBB-CFF-FFS,SBB AG
+CH,228,07,IN&Phone,IN&Phone SA
+CH,228,08,Tele2,Tele2 Telecommunications AG
+CH,228,50,,3G Mobile AG
+CH,228,51,,BebbiCell AG
+SY,417,01,Syriatel,Syriatel Mobile Telecom
+SY,417,02,MTN,MTN Syria
+TW,466,01,FarEasTone,Far EasTone Telecommunications Co Ltd
+TW,466,05,APTG,Asia Pacific Telecom
+TW,466,06,Tuntex,Tuntex Telecom
+TW,466,11,Chunghwa LDM,LDTA/Chungwa Telecom
+TW,466,88,KG Telecom,KG Telecom
+TW,466,89,VIBO,VIBO Telecom
+TW,466,92,Chungwa,Chunghwa
+TW,466,93,MobiTai,Mobitai Communications
+TW,466,97,Taiwan Mobile,Taiwan Mobile Co. Ltd
+TW,466,99,TransAsia,TransAsia Telecoms
+TJ,436,01,Tcell,JV Somoncom
+TJ,436,02,Tcell,Indigo Tajikistan
+TJ,436,03,MLT,TT Mobile
+TJ,436,04,Babilon-M,Babilon-Mobile
+TJ,436,05,Beeline,Vimpelcom
+TJ,436,12,Tcell,Indigo
+TZ,640,02,tiGO,MIC Tanzania Limited
+TZ,640,03,Zantel,Zanzibar Telecom Ltd
+TZ,640,04,Vodacom,Vodacom Tanzania Limited
+TZ,640,05,Airtel,Bharti Airtel
+TZ,640,06,Sasatel,Dovetel Limited
+TZ,640,07,TTCL Mobile,Tanzania Telecommunication Company LTD (TTCL)
+TZ,640,08,Benson Online (BOL),Benson Informatics Limited
+TZ,640,09,Hits,ExcellentCom Tanzania Limited
+TZ,640,11,SmileCom,Smile Telecoms Holdings Ltd.
+TH,520,00,my CAT 3G+,CAT Telecom
+TH,520,01,AIS,Advanced Info Service
+TH,520,02,CAT CDMA,CAT Telecom
+TH,520,10,,WCS IQ
+TH,520,15,TOT 3G,Telephone Organization of Thailand (TOT)
+TH,520,18,dtac,Total Access Communication
+TH,520,23,AIS GSM 1800,Digital Phone (AIS)
+TH,520,99,True Move,True Corporation
+TG,615,01,Togo Cell,Togo Telecom
+TG,615,03,Moov,Moov Togo
+TO,539,01,,Tonga Communications Corporation
+TO,539,43,,Shoreline Communication
+TO,539,88,Digicel,
+TT,374,12,bmobile,TSTT
+TT,374,130,Digicel,Digicel (Trinidad & Tobago) Limited
+TN,605,01,Orange,Orange Tunisie
+TN,605,02,Tunicell,Tunisie Telecom
+TN,605,03,Tunisiana,Orascom Telecom Tunisie
+TR,286,01,Turkcell,Turkcell Iletisim Hizmetleri A.S.
+TR,286,02,Vodafone,Vodafone Turkey
+TR,286,03,Avea,
+TR,286,04,,Aycell
+TM,438,01,MTS,Barash Communication Technologies
+TM,438,02,TM-Cell,Altyn Asyr
+TC,376,350,C&W,Cable & Wireless West Indies Ltd (Turks & Caicos)
+TC,376,352,Islandcom,Islandcom Telecommunications
+TC,338,05,Digicel,Digicel (Turks & Caicos) Limited
+TV,553,01,TTC,Tuvalu Telecom
+UG,641,01,Airtel,Bharti Airtel
+UG,641,10,MTN,MTN Uganda
+UG,641,11,UTL,Uganda Telecom Ltd.
+UG,641,14,Orange,Orange Uganda
+UG,641,22,Warid Telecom,Warid Telecom
+UA,255,01,MTS,Ukrainian Mobile Communications
+UA,255,02,Beeline,Ukrainian Radio Systems
+UA,255,03,Kyivstar,Kyivstar GSM JSC
+UA,255,04,IT,Intertelecom
+UA,255,05,Golden Telecom,Golden Telecom
+UA,255,06,life:),Astelit
+UA,255,07,Ukrtelecom,Ukrtelecom
+UA,255,21,PEOPLEnet,Telesystems of Ukraine
+UA,255,23,CDMA Ukraine,ITC
+AE,424,02,Etisalat,E mirates Telecom Corp
+AE,424,03,du,Emirates Integrated Telecommunications Company
+UK,234,00,BT,BT Group
+UK,234,01,Vectone Mobile,Mundio Mobile Limited
+UK,234,02,O2,Telefónica O2 UK Limited
+UK,234,03,Airtel-Vodafone,Jersey Airtel Limited
+UK,234,04,FMS Solutions Ltd,FMS Solutions Ltd
+UK,234,05,,COLT Mobile Telecommunications Limited
+UK,234,06,,Internet Computer Bureau Limited
+UK,234,07,,Cable & Wireless UK
+UK,234,08,,OnePhone (UK) Ltd
+UK,234,09,,Tismi BV
+UK,234,10,O2,Telefónica O2 UK Limited
+UK,234,11,O2,Telefónica Europe
+UK,234,12,Railtrack,Network Rail Infrastructure Ltd
+UK,234,13,Railtrack,Network Rail Infrastructure Ltd
+UK,234,14,Hay Systems Ltd,Hay Systems Ltd
+UK,234,15,Vodafone,Vodafone United Kingdom
+UK,234,16,Talk Talk,TalkTalk Communications Limited
+UK,234,17,,FleXtel Limited
+UK,234,18,Cloud9,Cloud9
+UK,234,19,Private Mobile Networks PMN,Teleware plc
+UK,234,20,Three,Hutchison 3G UK Ltd
+UK,234,22,RoutoMessaging,Routo Telecommunications Limited
+UK,234,24,Greenfone,Stour Marine
+UK,234,25,Truphone,Software Cellular Network Ltd
+UK,234,30,T-Mobile,Everything Everywhere Limited (TM)
+UK,234,31,Virgin,Virgin Mobile
+UK,234,32,Virgin,Virgin Mobile
+UK,234,33,Orange,Everything Everywhere Limited (TM)
+UK,234,34,Orange,Everything Everywhere Limited (TM)
+UK,234,35,,JSC Ingenium (UK) Limited
+UK,234,36,,Cable and Wireless Isle of Man Limited
+UK,234,37,,Synectiv Ltd
+UK,234,50,JT-Wave,Jersey Telecom
+UK,234,55,,Cable & Wireless Guernsey / Sure Mobile (Jersey)
+UK,234,58,,Manx Telecom
+UK,234,76,BT,BT Group
+UK,234,78,Airwave,Airwave (communications network)[citation needed]
+UK,235,00,,Mundio Mobile Limited
+UK,235,01,,Everything Everywhere Limited (TM)
+UK,235,02,,Everything Everywhere Limited (TM)
+UK,235,77,BT,BT Group
+UK,235,91,,Vodafone United Kingdom
+UK,235,92,,Cable & Wireless UK
+UK,235,94,,Hutchison 3G UK Ltd
+UK,235,95,,Network Rail Infrastructure Limited
+US,310,053,,Virgin Mobile US
+US,310,054,,Alltel US
+US,310,066,,U.S. Cellular
+US,310,004,Verizon,Verizon Wireless
+US,310,005,Verizon,Verizon Wireless
+US,310,010,,MCI
+US,310,012,Verizon,Verizon Wireless
+US,310,013,MobileTel,
+US,310,014,,Testing
+US,310,016,,Cricket Communications
+US,310,017,,North Sight Communications Inc.
+US,310,020,,Union Telephone Company
+US,310,026,T-Mobile,
+US,310,030,Centennial,Centennial Communications
+US,310,034,Airpeak,
+US,310,040,Concho,"Concho Cellular Telephone Co., Inc."
+US,310,046,SIMMETRY,TMP Corp
+US,310,060,,Consolidated Telcom
+US,310,070,,Highland Cellular
+US,310,080,Corr,Corr Wireless Communications LLC
+US,310,090,AT&T,AT&T Mobility
+US,310,100,Plateau Wireless,New Mexico RSA 4 East Ltd. Partnership
+US,310,110,PTI Pacifica,PTI Pacifica Inc.
+US,310,120,Sprint,
+US,310,150,AT&T,AT&T Mobility
+US,310,160,,T-Mobile
+US,310,170,,T-Mobile
+US,310,180,West Central,West Central Wireless
+US,310,190,Dutch Harbor,"Alaska Wireless Communications, LLC"
+US,310,200,,T-Mobile
+US,310,210,,T-Mobile
+US,310,220,,T-Mobile
+US,310,230,,T-Mobile
+US,310,240,,T-Mobile
+US,310,250,,T-Mobile
+US,310,260,,T-Mobile
+US,310,270,,T-Mobile
+US,310,280,,T-Mobile
+US,310,290,,T-Mobile
+US,310,300,iSmart Mobile,Smart Call (Truphone)
+US,310,310,,T-Mobile
+US,310,311,,Farmers Wireless
+US,310,320,Cellular One,"Smith Bagley, Inc."
+US,310,330,T-Mobile,
+US,310,340,Westlink,Westlink Communications
+US,310,350,,Carolina Phone
+US,310,380,AT&T,AT&T Mobility
+US,310,390,Cellular One of East Texas,"TX-11 Acquisition, LLC"
+US,310,400,i CAN_GSM,Wave Runner LLC (Guam)
+US,310,410,AT&T,AT&T Mobility
+US,310,420,Cincinnati Bell,Cincinnati Bell Wireless
+US,310,430,,Alaska Digitel
+US,310,440,Cellular One,
+US,310,450,Viaero,Viaero Wireless
+US,310,460,Simmetry,TMP Corporation
+US,310,470,nTelos,
+US,310,480,,Choice Phone
+US,310,490,T-Mobile,
+US,310,500,Alltel,
+US,310,510,Airtel,Airtel Wireless
+US,310,520,VeriSign,
+US,310,530,,West Virginia Wireless
+US,310,540,Oklahoma Western,Oklahoma Western Telephone Company
+US,310,560,AT&T,AT&T Mobility
+US,310,570,Cellular One,"MTPCS, LLC"
+US,310,580,T-Mobile,
+US,310,590,Alltel,Alltel Communications Inc
+US,310,610,Epic Touch,Elkhart Telephone Co.
+US,310,620,Coleman County Telecom,Coleman County Telecommunications
+US,310,630,AmeriLink PCS,Choice Wireless
+US,310,640,Airadigm,Airadigm Communications
+US,310,650,Jasper,"Jasper Wireless, inc"
+US,310,660,T-Mobile,
+US,310,670,Northstar,
+US,310,680,AT&T,AT&T Mobility
+US,310,690,Conestoga,Conestoga Wireless Company
+US,310,730,SeaMobile,
+US,310,740,Convey,Convey Communications Inc.
+US,310,760,Panhandle,Panhandle Telecommunications Systems Inc.
+US,310,770,i wireless,Iowa Wireless Services
+US,310,780,,Airlink PCS
+US,310,790,PinPoint,PinPoint Communications
+US,310,800,,T-Mobile
+US,310,830,Caprock,Caprock Cellular
+US,310,840,telna Mobile,"Telecom North America Mobile, Inc."
+US,310,850,Aeris,"Aeris Communications, Inc."
+US,310,870,PACE,Kaplan Telephone Company
+US,310,880,Advantage,Advantage Cellular Systems
+US,310,890,Unicel,Rural Cellular Corporation
+US,310,900,Mid-Rivers Wireless,Mid-Rivers Communications
+US,310,910,First Cellular,First Cellular of Southern Illinois
+US,310,940,,Iris Wireless LLC
+US,310,950,XIT Wireless,Texas RSA 1 dba XIT Cellular
+US,310,960,Plateau Wireless,
+US,310,970,Globalstar,
+US,310,980,,AT&T Mobility
+US,310,990,,AT&T Mobility
+US,311,000,,Mid-Tex Cellular
+US,311,010,Chariton Valley,Chariton Valley Communications
+US,311,020,,Missouri RSA 5 Partnership
+US,311,030,,Indigo Wireless
+US,311,040,,Commnet Wireless
+US,311,050,,Wikes Cellular
+US,311,060,Farmers Cellular,Farmers Cellular Telephone
+US,311,070,Easterbrooke,Easterbrooke Cellular Corporation
+US,311,080,Pine Cellular,Pine Telephone Company
+US,311,090,Long Lines Wireless,Long Lines Wireless LLC
+US,311,100,,High Plains Wireless
+US,311,110,,High Plains Wireless
+US,311,120,,Choice Phone
+US,311,130,,Cell One Amarillo
+US,311,140,Sprocket,MBO Wireless
+US,311,150,,Wilkes Cellular
+US,311,160,,Endless Mountains Wireless
+US,311,170,PetroCom,Broadpoint Inc
+US,311,180,,Cingular Wireless
+US,311,190,,Cellular Properties
+US,311,210,,Emery Telcom Wireless
+US,311,220,,U.S. Cellular
+US,311,230,,C Spire Wireless
+US,311,330,Bug Tussel Wireless,Bug Tussel Wireless
+US,311,480,Verizon,Verizon Wireless
+US,311,660,metroPCS,metroPCS
+US,316,010,Nextel,Nextel Communications
+US,316,011,,Southern Communications Services
+UY,748,01,Antel,Compania estatal (ANTEL)
+UY,748,07,Movistar,Telefónica Móviles Uruguay
+UY,748,10,Claro UY,AM Wireless Uruguay S.A.
+UZ,434,01,,Buztel
+UZ,434,02,,Uzmacom
+UZ,434,04,Beeline,Unitel LLC
+UZ,434,05,Ucell,Coscom
+UZ,434,06,,Perfectum Mobile
+UZ,434,07,MTS,Uzdunrobita
+VU,541,01,SMILE,Telecom Vanuatu Ltd
+VE,734,01,Digitel,Corporacion Digitel C.A.
+VE,734,02,Digitel,Corporacion Digitel C.A.
+VE,734,03,Digitel,Corporacion Digitel C.A.
+VE,734,04,movistar,Telefónica Móviles Venezuela
+VE,734,06,Movilnet,Telecomunicaciones Movilnet
+VN,452,01,MobiFone,Vietnam Mobile Telecom Services Company (VMS)
+VN,452,02,Vinaphone,Vietnam Telecom Services Company
+VN,452,03,S-Fone,S-Telecom
+VN,452,04,Viettel Mobile,Viettel Telecom
+VN,452,05,Vietnamobile,Hanoi Telecom
+VN,452,06,EVNTelecom,EVNTelecom - EVN
+VN,452,08,3G EVNTelecom,EVNTelecom - EVN
+VN,452,07,Beeline VN,GTEL Mobile JSC
+YE,421,01,SabaFon,
+YE,421,02,MTN,SpaceTel
+YE,421,03,Yemen Mobile,Yemen Mobile
+YE,421,04,HiTS-UNITEL,Y
+ZM,645,01,Airtel,Bharti Airtel
+ZM,645,02,MTN,MTN Group
+ZM,645,03,ZAMTEL,Zambia Telecommunications Company Ltd
+ZW,648,01,Net*One,Net*One Cellular (Pvt) Ltd
+ZW,648,03,Telecel,Telecel Zimbabwe (PVT) Ltd
+ZW,648,04,Econet,Econet Wireless (Private) Limited
+__,901,01,ICO,ICO Satellite Management
+__,901,02,,Sense Communications International
+__,901,03,Iridium,
+__,901,04,Globalstar,
+__,901,05,,Thuraya RMSS Network
+__,901,06,,Thuraya Satellite Telecommunications Company
+__,901,07,Ellipso,
+__,901,08,,
+__,901,09,,Tele1 Europe
+__,901,10,ACeS,
+__,901,11,Inmarsat,
+__,901,12,Telenor,Maritime Communications Partner AS
+__,901,13,GSM.AQ,Global Networks Switzerland Inc.
+__,901,14,,AeroMobile AS
+__,901,15,,OnAir Switzerland Sarl
+__,901,16,,Jasper Systems
+__,901,17,Navitas,
+__,901,18,Cellular @Sea,AT&T Mobility
+__,901,19,,Vodafone Malta Maritime
+__,901,21,Seanet,Seanet Maritime Communications
+__,901,23,,Beeline
+__,901,24,iNum,Voxbone
+__,901,26,TIM,Telecom Italia
+__,901,29,Telenor,
+__,901,32,Sky High,MegaFon
diff --git a/res/wiki_mcc_mnc_oper_list.db b/res/wiki_mcc_mnc_oper_list.db
new file mode 100755 (executable)
index 0000000..fefb8b6
Binary files /dev/null and b/res/wiki_mcc_mnc_oper_list.db differ
diff --git a/res/wiki_mcc_mnc_oper_list.sql b/res/wiki_mcc_mnc_oper_list.sql
new file mode 100755 (executable)
index 0000000..b1a9bb9
--- /dev/null
@@ -0,0 +1,1519 @@
+create table mcc_mnc_oper_list (id integer primary key, country char(3), mcc integer, mnc char(3), oper char(45) );
+BEGIN;
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 1, "01", "TEST");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GE", 289, "67", "Aquafon");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GE", 289, "88", "A-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AF", 412, "01", "AWCC");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AF", 412, "20", "Roshan");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AF", 412, "40", "MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AF", 412, "50", "Etisalat");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AL", 76, "01", "AMC");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AL", 276, "02", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AL", 276, "03", "Eagle Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AL", 276, "04", "Plus Communication");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DZ", 603, "01", "Mobilis");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DZ", 603, "02", "Djezzy");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DZ", 603, "03", "Nedjma");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AS", 44, "11", "Bluesky");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AD", 213, "03", "Mobiland");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AO", 631, "02", "UNITEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AO", 631, "04", "MOVICEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AI", 365, "010", "Weblinks Limited");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AI", 365, "840", "Cable & Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AG", 344, "030", "APUA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AG", 344, "920", "LIME");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AG", 338, "050", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AR", 722, "010", "Movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AR", 722, "020", "Nextel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AR", 722, "070", "Movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AR", 722, "310", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AR", 722, "320", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AR", 722, "330", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AR", 722, "34", "Personal");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AR", 722, "341", "Personal");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AR", 722, "350", "Hutchinson (PORT HABLE)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AR", 722, "36", "Personal");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AM", 283, "01", "Beeline");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AM", 283, "05", "VivaCell-MTS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AM", 283, "10", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AW", 363, "01", "SETAR");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AW", 363, "02", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "01", "Telstra");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "02", "Optus");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "03", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "04", "Department of Defence");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "05", "Ozitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "06", "3");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "08", "One.Tel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "09", "Airnet");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "12", "3");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "13", "Railcorp");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "14", "AAPT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "15", "3GIS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "16", "Victorian Rail Track");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "21", "SOUL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "24", "Advance Communications Technologies Pty. Ltd.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "38", "Crazy John's");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "71", "Telstra");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "72", "Telstra");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "88", "Localstar Holding Pty. Ltd.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "90", "Optus");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AU", 505, "99", "One.Tel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AT", 232, "01", "A1");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AT", 232, "03", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AT", 232, "05", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AT", 232, "07", "tele.ring");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AT", 232, "09", "A1");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AT", 232, "10", "3");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AT", 232, "11", "bob");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AT", 232, "12", "yesss");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AT", 232, "14", "3");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AT", 232, "15", "Barablu");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AT", 232, "91", "GSM-R A");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AZ", 400, "01", "Azercell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AZ", 400, "02", "Bakcell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AZ", 400, "03", "FONEX");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AZ", 400, "04", "Nar Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BS", 364, "390", "BaTelCo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BH", 426, "01", "Batelco");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BH", 426, "02", "zain BH");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BH", 426, "04", "VIVA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BD", 470, "01", "Grameenphone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BD", 470, "02", "Robi");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BD", 470, "03", "Banglalink");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BD", 470, "04", "TeleTalk");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BD", 470, "05", "Citycell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BD", 470, "06", "Airtel formerly Warid Telcom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BB", 342, "600", "LIME");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BB", 342, "750", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BB", 342, "820", "Sunbeach Communications");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BY", 257, "01", "velcom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BY", 257, "02", "MTS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BY", 257, "03", "DIALLOG");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BY", 257, "04", "life:)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BY", 257, "501", "BelCel JV");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BE", 206, "01", "Proximus");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BE", 206, "05", "Telenet");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BE", 206, "10", "Mobistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BE", 206, "20", "BASE");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BZ", 702, "67", "DigiCell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BZ", 702, "99", "Smart");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BJ", 616, "01", "Libercom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BJ", 616, "02", "Moov");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BJ", 616, "03", "MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BJ", 616, "04", "BBCOM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BJ", 616, "05", "Glo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BM", 350, "01", "Digicel Bermuda");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BM", 350, "02", "Mobility");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BM", 338, "050", "Digicel Bermuda");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BM", 310, "59", "Cellular One");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BT", 402, "11", "B-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BT", 402, "77", "TashiCell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BO", 736, "01", "Nuevatel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BO", 736, "02", "Entel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BO", 736, "03", "Tigo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BA", 218, "03", "HT-ERONET");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BA", 218, "05", "m:tel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BA", 218, "90", "BH Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BW", 652, "01", "Mascom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BW", 652, "02", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BW", 652, "04", "BTC Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "00", "Nextel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "02", "TIM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "03", "TIM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "04", "TIM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "05", "Claro BR");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "06", "Vivo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "07", "Sercomtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "10", "Vivo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "11", "Vivo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "15", "CTBC Celular");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "16", "Brasil Telecom GSM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "23", "Vivo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "31", "Oi");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "32", "CTBC Celular");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "33", "CTBC Celular");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "34", "CTBC Celular");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BR", 724, "39", "Nextel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VG", 348, "170", "LIME");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VG", 348, "570", "CCT Boatphone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VG", 348, "770", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BN", 528, "01", "Jabatan Telekom Brunei");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BN", 528, "02", "B-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BN", 528, "11", "DSTCom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BG", 284, "01", "M-Tel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BG", 284, "03", "Vivacom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BG", 284, "04", "Undisclosed");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BG", 284, "05", "GLOBUL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BF", 613, "01", "Telmob");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BF", 613, "02", "Zain");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BF", 613, "03", "Telecel Faso");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BI", 642, "01", "Spacetel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BI", 642, "02", "Africell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BI", 642, "03", "Onatel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BI", 642, "07", "Smart Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BI", 642, "08", "HiTs Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("BI", 642, "82", "U-COM Burundi");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KH", 456, "01", "Mobitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KH", 456, "02", "hello");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KH", 456, "03", "S Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KH", 456, "04", "qb");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KH", 456, "05", "Star-Cell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KH", 456, "06", "Smart Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KH", 456, "18", "Mfone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KH", 456, "11", "Excell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KH", 456, "09", "Beeline");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KH", 456, "08", "Metfone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CM", 624, "01", "MTN Cameroon");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CM", 624, "02", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "220", "Telus");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "221", "Telus");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "270", "unknown");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "290", "Airtel Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "320", "Mobilicity");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "350", "FIRST");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "360", "MiKe");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "361", "Telus");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "370", "Fido");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "380", "DMTS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "490", "WIND Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "500", "Videotron");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "510", "Videotron");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "610", "Bell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "610", "Bell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "620", "ICE Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "640", "Bell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "652", "BC Tel Mobility (Telus)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "653", "Telus");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "655", "MTS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "656", "TBay");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "657", "Telus");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "660", "MTS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "680", "SaskTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "701", "MB Tel Mobility");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "702", "MT&T Mobility (Aliant)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "703", "New Tel Mobility (Aliant)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "710", "Globalstar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "720", "Rogers Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "780", "SaskTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CA", 302, "880", "Bell / Telus / SaskTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CV", 625, "01", "CVMOVEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CV", 625, "02", "T+");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KY", 346, "140", "LIME");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KY", 346, "50", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CF", 623, "01", "CTP");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CF", 623, "02", "TC");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CF", 623, "03", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CF", 623, "04", "Nationlink");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TD", 622, "01", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TD", 622, "02", "Tchad Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TD", 622, "03", "TIGO - Millicom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TD", 622, "04", "Salam");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CL", 730, "01", "entel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CL", 730, "02", "movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CL", 730, "03", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CL", 730, "04", "Nextel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CL", 730, "08", "VTR Móvil");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CL", 730, "09", "Nextel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CL", 730, "10", "entel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CL", 730, "99", "Will");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CN", 460, "00", "China Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CN", 460, "01", "China Unicom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CN", 460, "02", "China Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CN", 460, "03", "China Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CN", 460, "05", "China Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CN", 460, "06", "China Unicom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CN", 460, "07", "China Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CN", 460, "20", "China Tietong");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CO", 732, "001", "Colombia Telecomunicaciones S.A.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CO", 732, "002", "Edatel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CO", 732, "101", "Comcel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CO", 732, "102", "movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CO", 732, "103", "Tigo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CO", 732, "111", "Tigo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CO", 732, "123", "movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KM", 654, "01", "HURI - SNPT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CG", 629, "01", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CG", 629, "10", "Libertis Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CG", 629, "07", "Warid Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CK", 548, "01", "Telecom Cook");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CR", 712, "01", "Kolbi ICE");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CR", 712, "02", "Kolbi ICE");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CR", 712, "03", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CR", 712, "04", "movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HR", 219, "01", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HR", 219, "02", "Tele2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HR", 219, "10", "Vip");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CU", 368, "01", "CUBACEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CY", 280, "01", "Cytamobile-Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CY", 280, "10", "MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CZ", 230, "01", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CZ", 230, "02", "O2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CZ", 230, "03", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CZ", 230, "04", "U:fon");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CZ", 230, "05", "TRAVEL TELEKOMMUNIKATION, s.r.o");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CZ", 230, "06", "OSNO TELECOMUNICATION, s.r.o");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CZ", 230, "98", "Správa železniční dopravní cesty, s.o");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CZ", 230, "99", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CD", 630, "01", "Vodacom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CD", 630, "02", "Zain");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CD", 630, "04", "Cellco");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CD", 630, "05", "Supercell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CD", 630, "10", "Libertis Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CD", 630, "86", "CCT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CD", 630, "89", "SAIT Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DK", 238, "01", "TDC");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DK", 238, "02", "Telenor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DK", 238, "03", "MIGway A/S");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DK", 238, "05", "ApS KBUS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DK", 238, "06", "3");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DK", 238, "07", "Barablu Mobile Ltd.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DK", 238, "09", "Dansk Beredskabskommunikation A/S");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DK", 238, "10", "TDC");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DK", 238, "11", "Dansk Beredskabskommunikation A/S");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DK", 238, "12", "Lycamobile Denmark Ltd");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DK", 238, "20", "Telia");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DK", 238, "30", "Telia");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DK", 238, "40", "Ericsson Danmark A/S");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DK", 238, "77", "Telenor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DJ", 638, "01", "Evatis");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DM", 366, "020", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DM", 366, "110", "Cable & Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DO", 370, "01", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DO", 370, "02", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DO", 370, "03", "Tricom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DO", 370, "04", "Viva");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TL", 514, "02", "Timor Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("EC", 740, "00", "Movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("EC", 740, "01", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("EC", 740, "02", "Alegro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("EG", 602, "01", "Mobinil");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("EG", 602, "02", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("EG", 602, "03", "Etisalat");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SV", 706, "01", "CTE Telecom Personal");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SV", 706, "02", "digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SV", 706, "03", "Tigo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SV", 706, "04", "movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SV", 706, "11", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GQ", 627, "01", "Orange GQ");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GQ", 627, "03", "Hits GQ");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ER", 657, "01", "Eritel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("EE", 248, "01", "EMT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("EE", 248, "02", "Elisa");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("EE", 248, "03", "Tele 2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("EE", 248, "04", "OY Top Connect");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("EE", 248, "05", "AS Bravocom Mobiil");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("EE", 248, "06", "Progroup Holding");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ET", 636, "01", "ETH-MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FO", 288, "01", "Faroese Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FO", 288, "02", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FJ", 542, "01", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FJ", 542, "02", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FI", 244, "03", "DNA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FI", 244, "05", "Elisa");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FI", 244, "07", "Nokia");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FI", 244, "08", "Unknown");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FI", 244, "10", "TDC Oy");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FI", 244, "11", "VIRVE");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FI", 244, "12", "DNA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FI", 244, "14", "AMT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FI", 244, "15", "SAMK");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FI", 244, "21", "Saunalahti");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FI", 244, "29", "Scnl Truphone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FI", 244, "91", "Sonera");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FR", 208, "00", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FR", 208, "01", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FR", 208, "02", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FR", 208, "05", "Globalstar Europe");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FR", 208, "06", "Globalstar Europe");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FR", 208, "07", "Globalstar Europe");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FR", 208, "10", "SFR");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FR", 208, "11", "SFR");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FR", 208, "13", "SFR");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FR", 208, "14", "Free Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FR", 208, "15", "Free Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FR", 208, "20", "Bouygues");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FR", 208, "21", "Bouygues");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FR", 208, "22", "Transatel Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FR", 208, "88", "Bouygues");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PF", 547, "20", "Vini");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GA", 628, "01", "Libertis");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GA", 628, "02", "Moov");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GA", 628, "03", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GA", 628, "04", "Azur");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GM", 607, "01", "Gamcel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GM", 607, "02", "Africel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GM", 607, "03", "Comium");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GM", 607, "04", "QCell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GE", 282, "01", "Geocell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GE", 282, "02", "MagtiCom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GE", 282, "03", "MagtiCom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GE", 282, "04", "Beeline");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GE", 282, "05", "Silknet");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "01", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "02", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "03", "E-Plus");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "04", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "05", "E-Plus");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "06", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "07", "O2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "08", "O2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "09", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "10", "Arcor AG & Co");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "11", "O2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "12", "Dolphin Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "13", "Mobilcom Multimedia");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "14", "Group 3G UMTS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "15", "Airdata");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "16", "Vistream");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "42", "27C3");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "43", "LYCA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "60", "DB Telematik");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "76", "Siemens AG");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "77", "E-Plus");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "92", "Nash Technologies");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("DE", 262, "901", "Debitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GH", 620, "01", "MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GH", 620, "02", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GH", 620, "03", "tiGO");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GH", 620, "04", "Expresso");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GH", 620, "06", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GI", 266, "01", "GibTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GI", 266, "06", "CTS Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GR", 202, "01", "Cosmote");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GR", 202, "05", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GR", 202, "09", "Wind");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GR", 202, "10", "Wind");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GL", 290, "01", "TELE Greenland A/S");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GD", 352, "030", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GD", 352, "110", "Cable & Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GP", 340, "01", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GP", 340, "02", "Outremer");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GP", 340, "03", "Telcell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GP", 340, "08", "Dauphin");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GP", 340, "20", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GU", 310, "032", "IT&E Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GU", 310, "033", "Guam Telephone Authority");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GU", 310, "140", "mPulse");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GU", 310, "370", "docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GU", 311, "250", "i CAN_GSM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GU", 310, "470", "docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GT", 704, "01", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GT", 704, "02", "Comcel / Tigo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GT", 704, "03", "movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GB", 234, "55", "Sure Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GB", 234, "50", "Wave Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GB", 234, "03", "Airtel Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GN", 611, "01", "Orange S.A.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GN", 611, "02", "Sotelgui");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GN", 611, "03", "Telecel Guinee");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GN", 611, "04", "MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GN", 611, "05", "Cellcom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GW", 632, "02", "Areeba");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GW", 632, "03", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GY", 738, "01", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("GY", 738, "02", "GT&T Cellink Plus");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HT", 372, "01", "Voila");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HT", 372, "02", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HT", 372, "03", "NATCOM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HN", 708, "01", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HN", 708, "02", "Tigo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HN", 708, "30", "Hondutel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HN", 708, "40", "DIGICEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "00", "1O1O / One2Free");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "01", "CITIC Telecom 1616");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "02", "CSL Limited");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "03", "3 (3G)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "04", "3 (2G)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "05", "3 (CDMA)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "06", "SmarTone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "07", "China Unicom (Hong Kong) Limited");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "08", "Trident Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "09", "China Motion Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "10", "New World Mobility");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "11", "China-Hong Kong Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "12", "CMCC HK");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "14", "Hutchison Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "15", "SmarTone Mobile Communications Limited");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "16", "PCCW Mobile (2G)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "17", "SmarTone Mobile Communications Limited");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "18", "CSL Limited");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "19", "PCCW Mobile (3G)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HK", 454, "29", "PCCW Mobile (CDMA)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HU", 216, "01", "Telenor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HU", 216, "30", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("HU", 216, "70", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IS", 274, "01", "Síminn");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IS", 274, "02", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IS", 274, "03", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IS", 274, "04", "Viking");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IS", 274, "06", "Núll níu ehf");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IS", 274, "07", "IceCell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IS", 274, "08", "On-waves");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IS", 274, "11", "Nova");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IS", 274, "12", "Tal");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "01", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "02", "AirTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "03", "AirTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "04", "IDEA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "05", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "07", "IDEA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "09", "Reliance");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "10", "AirTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "11", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "12", "IDEA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "13", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "14", "IDEA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "15", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "17", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "19", "IDEA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "20", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "21", "Loop Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "22", "IDEA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "24", "IDEA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "25", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "27", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "28", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "29", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "30", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "31", "AirTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "34", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "36", "Reliance");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "37", "Aircel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "38", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "41", "Aircel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "42", "Aircel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "44", "IDEA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "45", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "46", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "48", "Dishnet Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "49", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "51", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "52", "Reliance");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "53", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "54", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "55", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "71", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "56", "IDEA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "57", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "58", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "59", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "60", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "62", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "64", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "66", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "67", "Reliance GSM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "68", "DOLPHIN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "69", "DOLPHIN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "72", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "74", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "76", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "78", "Idea Cellular Ltd");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "80", "BSNL MOBILE");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "81", "CellOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "82", "Idea");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "83", "Reliance Smart GSM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "84", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "85", "Reliance");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "86", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "87", "Idea");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "88", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "89", "Idea");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "90", "AirTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "91", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "92", "AirTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "93", "AirTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "96", "AirTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "01", "Reliance");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "03", "Reliance");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "04", "Reliance");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "05", "Reliance");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "09", "Reliance");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "10", "Reliance");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "13", "Reliance");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "025", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "026", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "027", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "029", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "030", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "031", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "032", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "033", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "034", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "035", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "036", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "037", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "038", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "039", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "041", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "042", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "043", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "044", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "045", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "046", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "047", "TATA Teleservice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "51", "AirTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "52", "AirTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "54", "AirTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "55", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "56", "AirTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "66", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "70", "IDEA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "750", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "751", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "752", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "753", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "754", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "755", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "756", "Vodafone IN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "799", "IDEA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "800", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "801", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "802", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "803", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "804", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "805", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "806", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "807", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "808", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "809", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "810", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "811", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "812", "AIRCEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "819", "Uninor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "818", "Uninor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "820", "Uninor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "821", "Uninor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "822", "Uninor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "824", "Videocon Datacom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "827", "Videocon Datacom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "834", "Videocon Datacom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "844", "Uninor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "845", "IDEA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "86", "IDEA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "848", "IDEA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "850", "IDEA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "855", "Loop Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "864", "Loop Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "865", "Loop Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "875", "Uninor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "880", "Uninor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "881", "S Tel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "912", "Etisalat DB(cheers)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "913", "Etisalat DB(cheers)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "914", "Etisalat DB(cheers)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "917", "Etisalat DB(cheers)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 404, "927", "Uninor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IN", 405, "929", "Uninor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ID", 510, "00", "PSN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ID", 510, "01", "INDOSAT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ID", 510, "03", "StarOne");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ID", 510, "07", "TelkomFlexi");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ID", 510, "08", "AXIS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ID", 510, "09", "SMART");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ID", 510, "10", "Telkomsel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ID", 510, "11", "XL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ID", 510, "20", "TELKOMMobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ID", 510, "21", "IM3");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ID", 510, "27", "Ceria");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ID", 510, "28", "Fren/Hepi");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ID", 510, "89", "3");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ID", 510, "99", "Esia");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IR", 432, "11", "IR-MCI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IR", 432, "14", "TKC");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IR", 432, "19", "MTCE");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IR", 432, "32", "Taliya");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IR", 432, "35", "Irancell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IR", 432, "70", "TCI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IR", 432, "93", "Iraphone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IQ", 418, "05", "Asia Cell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IQ", 418, "08", "SanaTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IQ", 418, "20", "Zain");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IQ", 418, "30", "Zain");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IQ", 418, "40", "Korek");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IQ", 418, "45", "Mobitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IQ", 418, "92", "Omnnea");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IE", 272, "01", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IE", 272, "02", "O2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IE", 272, "03", "Meteor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IE", 272, "04", "Access Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IE", 272, "05", "3");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IE", 272, "07", "Eircom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IE", 272, "09", "Clever Communications");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IE", 272, "11", "Liffey Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IM", 234, "58", "Pronto GSM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IM", 234, "09", "Sure Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IL", 425, "01", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IL", 425, "02", "Cellcom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IL", 425, "03", "Pelephone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IL", 425, "77", "Mirs");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IT", 222, "01", "TIM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IT", 222, "02", "Elsacom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IT", 222, "07", "Noverca");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IT", 222, "10", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IT", 222, "30", "RFI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IT", 222, "77", "IPSE 2000");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IT", 222, "88", "Wind");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IT", 222, "98", "Blu");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("IT", 222, "99", "3 Italia");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CI", 612, "01", "Cora de Comstar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CI", 612, "02", "Moov");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CI", 612, "03", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CI", 612, "04", "KoZ");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CI", 612, "05", "MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CI", 612, "06", "ORICEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JM", 338, "020", "LIME");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JM", 338, "050", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JM", 338, "070", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JM", 338, "180", "LIME");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "00", "eMobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "01", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "02", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "03", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "04", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "06", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "07", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "08", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "09", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "10", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "11", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "12", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "13", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "14", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "15", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "16", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "17", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "18", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "19", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "20", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "21", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "22", "NTT docomo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "23", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "24", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "25", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "26", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "27", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "28", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "29", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "30", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "31", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "32", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "33", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "34", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "35", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "36", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "37", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "38", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "39", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "40", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "41", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "42", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "43", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "44", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "45", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "46", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "47", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "48", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "49", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "50", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "51", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "52", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "53", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "54", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "55", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "56", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "58", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "60", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "61", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "62", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "63", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "64", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "65", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "66", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "67", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "68", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "69", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "70", "au");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "71", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "72", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "73", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "74", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "75", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "76", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "77", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "78", "Okinawa Cellular Telephone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "79", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "80", "TU-KA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "81", "TU-KA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "82", "TU-KA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "83", "TU-KA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "84", "TU-KA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "85", "TU-KA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "86", "TU-KA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "87", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "88", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "89", "KDDI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "90", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "92", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "93", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "94", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "95", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "96", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "97", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "98", "SoftBank");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JP", 440, "99", "DoCoMo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JE", 234, "50", "JT-Wave");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JE", 234, "55", "Sure Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JE", 234, "03", "Airtel Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JO", 416, "01", "zain JO");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JO", 416, "02", "XPress Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JO", 416, "03", "Umniah");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("JO", 416, "77", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KZ", 401, "01", "Beeline");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KZ", 401, "02", "Kcell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KZ", 401, "07", "Dalacom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KZ", 401, "08", "Kazakhtelecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KZ", 401, "77", "Mobile Telecom Service");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KE", 639, "02", "Safaricom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KE", 639, "03", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KE", 639, "07", "Orange Kenya");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KE", 639, "05", "yu");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KI", 545, "09", "Kiribati Frigate");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KP", 467, "192", "Koryolink");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KP", 467, "193", "SunNet");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KR", 450, "02", "KT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KR", 450, "03", "Power 017");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KR", 450, "04", "KT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KR", 450, "05", "SKT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KR", 450, "06", "LGU+");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KR", 450, "08", "olleh");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RKS", 212, "01", "Vala");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RKS", 293, "41", "IPKO");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RKS", 212, "01", "Z Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KW", 419, "02", "zain KW");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KW", 419, "03", "Wataniya");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KW", 419, "04", "Viva");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KG", 437, "01", "Beeline");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KG", 437, "03", "Fonex");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KG", 437, "05", "MegaCom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("KG", 437, "09", "O!");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LA", 457, "01", "LaoTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LA", 457, "02", "ETL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LA", 457, "03", "Unitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LA", 457, "08", "Tigo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LV", 247, "01", "LMT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LV", 247, "02", "Tele2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LV", 247, "03", "TRIATEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LV", 247, "05", "Bite");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LV", 247, "06", "Rigatta");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LV", 247, "07", "MTS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LV", 247, "08", "IZZI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LV", 247, "09", "Camel Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LB", 415, "01", "Alfa");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LB", 415, "03", "mtc touch");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LB", 415, "05", "Ogero Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LS", 651, "01", "Vodacom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LS", 651, "02", "Econet Ezin-cel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LR", 618, "01", "Lonestar Cell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LR", 618, "02", "Libercell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LR", 618, "04", "Comium");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LR", 618, "07", "Cellcom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LR", 618, "20", "LIBTELCO");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LY", 606, "00", "Libyana");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LY", 606, "01", "Madar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LY", 606, "02", "Al-Jeel Phone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LY", 606, "03", "Libya Phone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LY", 606, "06", "Hatef Libya");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LI", 295, "01", "Swisscom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LI", 295, "02", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LI", 295, "05", "FL1");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LI", 295, "77", "Alpmobil");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LI", 295, "04", "Cubic Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LT", 246, "01", "Omnitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LT", 246, "02", "BITE");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LT", 246, "03", "Tele 2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LT", 246, "05", "LitRail");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LT", 246, "06", "Mediafon");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LU", 270, "01", "LuxGSM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LU", 270, "77", "Tango");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LU", 270, "99", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MO", 455, "00", "SmarTone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MO", 455, "01", "CTM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MO", 455, "02", "China Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MO", 455, "03", "3");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MO", 455, "04", "CTM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MO", 455, "05", "3");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MK", 294, "01", "T-Mobile MK");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MK", 294, "02", "ONE");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MK", 294, "03", "Vip MK");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MG", 646, "01", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MG", 646, "02", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MG", 646, "03", "Sacel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MG", 646, "04", "Telma");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MW", 650, "01", "TNM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MW", 650, "10", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MY", 502, "01", "ATUR 450");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MY", 502, "10", "DiGi Telecommunications");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MY", 502, "11", "TM Homeline");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MY", 502, "12", "Maxis");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MY", 502, "13", "Celcom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MY", 502, "14", "Telekom Malaysia Berhad for PSTN SMS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MY", 502, "16", "DiGi");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MY", 502, "17", "Hotlink");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MY", 502, "18", "U Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MY", 502, "18", "TM Homeline");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MY", 502, "19", "Celcom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MY", 502, "20", "Electcoms Wireless Sdn Bhd");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MY", 502, "150", "Tune Talk");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MY", 502, "151", "Baraka Telecom Sdn Bhd (MVNE)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MY", 502, "152", "Yes");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MV", 472, "01", "Dhiraagu");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MV", 472, "02", "Wataniya");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ML", 610, "01", "Malitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ML", 610, "02", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MT", 278, "01", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MT", 278, "21", "GO");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MT", 278, "77", "Melita");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MQ", 340, "01", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MQ", 340, "02", "Outremer");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MQ", 340, "20", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MR", 609, "01", "Mattel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MR", 609, "02", "Chinguitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MR", 609, "10", "Mauritel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MU", 617, "01", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MU", 617, "02", "MTML");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MU", 617, "10", "Emtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MX", 334, "010", "Nextel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MX", 334, "020", "Telcel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MX", 334, "030", "movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MX", 334, "040", "Iusacell / Unefon");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MX", 334, "050", "Iusacell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("FM", 550, "01", "FSM EMMANUEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MD", 259, "01", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MD", 259, "02", "Moldcell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MD", 259, "03", "IDC");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MD", 259, "03", "Unité");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MD", 259, "04", "Eventis");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MD", 259, "05", "Unité");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MD", 259, "99", "Unité");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MC", 212, "01", "Office des Telephones");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MN", 428, "99", "MobiCom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MN", 428, "88", "Unitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MN", 428, "91", "Skytel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MN", 428, "98", "G.Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ME", 297, "01", "Telenor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ME", 297, "02", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ME", 297, "03", "m:tel CG");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ME", 297, "04", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MA", 604, "00", "Méditel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MA", 604, "01", "IAM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MA", 604, "05", "INWI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MZ", 643, "01", "mCel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MZ", 643, "04", "Vodacom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("MM", 414, "01", "MPT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NA", 649, "01", "MTC");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NA", 649, "02", "switch");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NA", 649, "03", "Leo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NR", 536, "02", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NP", 429, "01", "Namaste / NT Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NP", 429, "02", "Ncell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NP", 429, "04", "SmartCell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NP", 429, "03", "Sky/C-Phone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "01", "VastMobiel B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "02", "Tele2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "03", "Voiceworks B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "04", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "05", "Elephant Talk Communications Premium Rate Services");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "06", "Mundio Mobile (Netherlands) Ltd");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "07", "Teleena (MVNE)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "08", "KPN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "09", "Lycamobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "10", "KPN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "12", "Telfort");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "13", "Unica Installatietechniek B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "14", "6Gmobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "15", "Ziggo B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "16", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "17", "Intercity Mobile Communications B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "18", "UPC Nederland B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "19", "Mixe Communication Solutions B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "20", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "21", "ProRail B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "22", "Ministerie van Defensie");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "23", "ASPIDER Solutions Nederland B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "24", "Private Mobility Nederland B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "25", "CapX B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "26", "SpeakUp B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "27", "Breezz Nederland B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "67", "RadioAccess B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "68", "Unify Group Holding B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NL", 204, "69", "KPN Mobile The Netherlands B.V.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AN", 362, "51", "Telcell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AN", 362, "69", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AN", 362, "91", "UTS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AN", 362, "95", "MIO");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AN", 362, "94", "Bayòs");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NC", 546, "01", "Mobilis");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NZ", 530, "00", "Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NZ", 530, "01", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NZ", 530, "02", "Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NZ", 530, "03", "Woosh");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NZ", 530, "04", "TelstraClear");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NZ", 530, "05", "XT Mobile Network");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NZ", 530, "24", "2degrees");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NI", 710, "21", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NI", 710, "30", "movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NI", 710, "73", "SERCOM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NE", 614, "01", "SahelCom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NE", 614, "02", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NE", 614, "03", "Telecel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NE", 614, "04", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NG", 621, "20", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NG", 621, "30", "MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NG", 621, "40", "M-Tel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NG", 621, "50", "Glo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NG", 621, "60", "Etisalat");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NG", 621, "25", "Visafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NU", 555, "01", "Telecom Niue");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NF", 505, "10", "Norfolk Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NO", 242, "01", "Telenor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NO", 242, "02", "NetCom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NO", 242, "03", "Teletopia");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NO", 242, "04", "Tele2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NO", 242, "05", "Network Norway");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NO", 242, "06", "Ice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NO", 242, "07", "Ventelo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NO", 242, "08", "TDC");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NO", 242, "09", "Com4");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NO", 242, "11", "SystemNet");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NO", 242, "20", "Jernbaneverket AS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("NO", 242, "23", "Lyca");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("OM", 422, "02", "Oman Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("OM", 422, "03", "Nawras");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PK", 410, "01", "Mobilink");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PK", 410, "03", "Ufone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PK", 410, "04", "Zong");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PK", 410, "06", "Telenor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PK", 410, "07", "Warid");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PW", 552, "01", "PNCC");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PW", 552, "80", "Palau Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PS", 425, "05", "Jawwal");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PS", 425, "06", "Wataniya");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PA", 714, "01", "Cable & Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PA", 714, "02", "movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PA", 714, "04", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PA", 714, "03", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PG", 537, "01", "B-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PG", 537, "03", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PY", 744, "01", "VOX");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PY", 744, "02", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PY", 744, "04", "Tigo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PY", 744, "05", "Personal");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PY", 744, "06", "Copaco");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PE", 716, "06", "Movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PE", 716, "07", "NEXTEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PE", 716, "10", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PH", 515, "01", "Islacom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PH", 515, "02", "Globe");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PH", 515, "03", "Smart");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PH", 515, "05", "Sun");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PH", 515, "11", "PLDT via ACeS Philippines");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PH", 515, "18", "Cure");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PH", 515, "88", "Nextel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PL", 260, "01", "Plus");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PL", 260, "02", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PL", 260, "03", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PL", 260, "04", "not in use");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PL", 260, "05", "Polska Telefonia Komórkowa Centertel Sp. z o.o.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PL", 260, "06", "Play");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PL", 260, "07", "Netia");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PL", 260, "08", "E-Telko Sp. z o.o.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PL", 260, "09", "Telekomunikacja Kolejowa Sp. z o.o.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PL", 260, "10", "Sferia");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PL", 260, "11", "Nordisk Polska");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PL", 260, "12", "Cyfrowy Polsat");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PL", 260, "15", "CenterNet");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PL", 260, "16", "Mobyland");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PL", 260, "17", "Aero2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PT", 268, "01", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PT", 268, "03", "Optimus");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PT", 268, "06", "TMN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PT", 268, "21", "Zapp");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PR", 330, "110", "Claro");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PR", 330, "00", "Open Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("QA", 427, "01", "Qtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("QA", 427, "02", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("QA", 427, "05", "Ministry of Interior");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RE", 647, "00", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RE", 647, "02", "Outremer");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RE", 647, "10", "SFR Reunion");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RO", 226, "01", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RO", 226, "02", "Romtelecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RO", 226, "03", "Cosmote");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RO", 226, "04", "Cosmote");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RO", 226, "05", "Digi.Mobil");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RO", 226, "06", "Cosmote");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RO", 226, "10", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RO", 226, "11", "Enigma-System");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "01", "MTS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "02", "MegaFon");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "03", "NCC");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "04", "Sibchallenge");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "05", "ETK");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "06", "Skylink [10]");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "07", "SMARTS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "09", "Skylink");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "10", "DTC");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "11", "Orensot");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "12", "Baykalwestcom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "12", "Akos");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "13", "KUGSM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "15", "SMARTS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "16", "NTC");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "17", "Utel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "19", "INDIGO");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "20", "Tele2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "23", "Mobicom - Novosibirsk");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "28", "Beeline");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "35", "MOTIV");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "38", "Tambov GSM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "39", "Utel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "44", "Stavtelesot / North Caucasian GSM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "92", "Primtelefon");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "93", "Telecom XXI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RU", 250, "99", "Beeline");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RW", 635, "10", "MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RW", 635, "12", "Rwandatel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RW", 635, "13", "Tigo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SKN", 356, "050", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SKN", 356, "110", "LIME");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SKN", 356, "070", "Chippie");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LC", 358, "050", "Digicel[citation needed]");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LC", 358, "110", "Cable & Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("PM", 308, "01", "Ameris");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VC", 360, "070", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VC", 360, "100", "Cingular Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VC", 360, "110", "Cable & Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("WS", 549, "01", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("WS", 549, "27", "SamoaTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SM", 292, "01", "PRIMA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ST", 626, "01", "CSTmovel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SA", 420, "01", "Al Jawal");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SA", 420, "03", "Mobily");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SA", 420, "04", "Zain SA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SN", 608, "01", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SN", 608, "02", "Tigo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SN", 608, "03", "Expresso");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RS", 220, "01", "Telenor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RS", 220, "02", "Telenor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RS", 220, "03", "mt:s");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("RS", 220, "05", "VIP");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SC", 633, "01", "Cable & Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SC", 633, "02", "Mediatech International");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SC", 633, "10", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SL", 619, "01", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SL", 619, "02", "Tigo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SL", 619, "03", "Africell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SL", 619, "04", "Comium");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SL", 619, "05", "Africell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SL", 619, "25", "Mobitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SG", 525, "01", "SingTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SG", 525, "02", "SingTel-G18");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SG", 525, "03", "M1");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SG", 525, "05", "StarHub");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SG", 525, "12", "Digital Trunked Radio Network");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SK", 231, "01", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SK", 231, "02", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SK", 231, "03", "Unient Communications");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SK", 231, "04", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SK", 231, "06", "O2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SK", 231, "99", "ŽSR");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SI", 293, "40", "Si.mobil");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SI", 293, "41", "Mobitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SI", 293, "64", "T-2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SI", 293, "70", "Tušmobil");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SB", 540, "01", "BREEZE");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SO", 637, "60", "Nationlink Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SO", 637, "01", "Telesom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SO", 637, "04", "Somafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SO", 637, "10", "Nationlink");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SO", 637, "25", "Hormuud");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SO", 637, "30", "Golis");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SO", 637, "82", "Telcom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZA", 655, "01", "Vodacom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZA", 655, "02", "Telkom Mobile / 8.ta");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZA", 655, "06", "Sentech");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZA", 655, "07", "Cell C");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZA", 655, "10", "MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZA", 655, "11", "South African Police Service Gauteng");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZA", 655, "13", "Neotel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZA", 655, "21", "Cape Town Metropolitan Council");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZA", 655, "30", "Bokamoso Consortium");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZA", 655, "31", "Karabo Telecoms (Pty) Ltd.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZA", 655, "32", "Ilizwi Telecommunications");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZA", 655, "33", "Thinta Thinta Telecommunications");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 250, "30", "Megafon");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "01", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "03", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "04", "Yoigo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "05", "TME");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "06", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "07", "movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "08", "Euskaltel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "09", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "15", "BT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "16", "TeleCable");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "17", "Móbil R");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "18", "ONO");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "19", "Simyo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "20", "Fonyou");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "21", "Jazztel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "22", "DigiMobil");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "23", "Barablu");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "24", "Eroski");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ES", 214, "25", "LycaMobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LK", 413, "01", "Mobitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LK", 413, "02", "Dialog");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LK", 413, "03", "Etisalat");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LK", 413, "05", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("LK", 413, "08", "Hutch");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SD", 634, "01", "Zain SD");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SD", 634, "02", "MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SD", 634, "05", "Vivacell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SD", 634, "07", "Sudani One");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SR", 746, "02", "Telesur");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SR", 746, "03", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SR", 746, "04", "Uniqa");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SZ", 653, "10", "Swazi MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "01", "Telia");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "02", "3");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "03", "Ice.net");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "04", "3G Infrastructure Services");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "05", "Sweden 3G");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "06", "Telenor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "07", "Tele2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "08", "Telenor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "09", "djuice");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "10", "Spring Mobil");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "11", "Lindholmen Science Park");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "12", "Barablu Mobile Scandinavia");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "13", "Ventelo Sverige");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "14", "TDC Mobil");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "15", "Wireless Maingate Nordic");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "16", "42IT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "17", "Gotanet");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "20", "Wireless Maingate Message Services");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "21", "MobiSir");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "24", "Sweden 2G");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "25", "DigiTelMobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "26", "Beepsend");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SE", 240, "33", "Mobile Arts AB");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CH", 228, "01", "Swisscom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CH", 228, "02", "Sunrise");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CH", 228, "03", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CH", 228, "05", "Togewanet AG (Comfone)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CH", 228, "06", "SBB-CFF-FFS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CH", 228, "07", "IN&Phone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CH", 228, "08", "Tele2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CH", 228, "50", "3G Mobile AG");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("CH", 228, "51", "BebbiCell AG");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SY", 417, "01", "Syriatel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("SY", 417, "02", "MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TW", 466, "01", "FarEasTone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TW", 466, "05", "APTG");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TW", 466, "06", "Tuntex");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TW", 466, "11", "Chunghwa LDM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TW", 466, "88", "KG Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TW", 466, "89", "VIBO");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TW", 466, "92", "Chungwa");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TW", 466, "93", "MobiTai");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TW", 466, "97", "Taiwan Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TW", 466, "99", "TransAsia");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TJ", 436, "01", "Tcell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TJ", 436, "02", "Tcell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TJ", 436, "03", "MLT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TJ", 436, "04", "Babilon-M");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TJ", 436, "05", "Beeline");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TJ", 436, "12", "Tcell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TZ", 640, "02", "tiGO");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TZ", 640, "03", "Zantel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TZ", 640, "04", "Vodacom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TZ", 640, "05", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TZ", 640, "06", "Sasatel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TZ", 640, "07", "TTCL Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TZ", 640, "08", "Benson Online (BOL)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TZ", 640, "09", "Hits");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TZ", 640, "11", "SmileCom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TH", 520, "00", "my CAT 3G+");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TH", 520, "01", "AIS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TH", 520, "02", "CAT CDMA");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TH", 520, "10", "WCS IQ");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TH", 520, "15", "TOT 3G");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TH", 520, "18", "dtac");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TH", 520, "23", "AIS GSM 1800");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TH", 520, "99", "True Move");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TG", 615, "01", "Togo Cell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TG", 615, "03", "Moov");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TO", 539, "01", "Tonga Communications Corporation");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TO", 539, "43", "Shoreline Communication");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TO", 539, "88", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TT", 374, "12", "bmobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TT", 374, "130", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TN", 605, "01", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TN", 605, "02", "Tunicell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TN", 605, "03", "Tunisiana");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TR", 286, "01", "Turkcell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TR", 286, "02", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TR", 286, "03", "Avea");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TR", 286, "04", "Aycell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TM", 438, "01", "MTS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TM", 438, "02", "TM-Cell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TC", 376, "350", "C&W");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TC", 376, "352", "Islandcom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TC", 338, "05", "Digicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("TV", 553, "01", "TTC");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UG", 641, "01", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UG", 641, "10", "MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UG", 641, "11", "UTL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UG", 641, "14", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UG", 641, "22", "Warid Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UA", 255, "01", "MTS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UA", 255, "02", "Beeline");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UA", 255, "03", "Kyivstar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UA", 255, "04", "IT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UA", 255, "05", "Golden Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UA", 255, "06", "life:)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UA", 255, "07", "Ukrtelecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UA", 255, "21", "PEOPLEnet");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UA", 255, "23", "CDMA Ukraine");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AE", 424, "02", "Etisalat");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("AE", 424, "03", "du");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "00", "BT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "01", "Vectone Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "02", "O2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "03", "Airtel-Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "04", "FMS Solutions Ltd");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "05", "COLT Mobile Telecommunications Limited");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "06", "Internet Computer Bureau Limited");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "07", "Cable & Wireless UK");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "08", "OnePhone (UK) Ltd");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "09", "Tismi BV");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "10", "O2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "11", "O2");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "12", "Railtrack");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "13", "Railtrack");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "14", "Hay Systems Ltd");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "15", "Vodafone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "16", "Talk Talk");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "17", "FleXtel Limited");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "18", "Cloud9");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "19", "Private Mobile Networks PMN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "20", "Three");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "22", "RoutoMessaging");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "24", "Greenfone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "25", "Truphone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "30", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "31", "Virgin");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "32", "Virgin");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "33", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "34", "Orange");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "35", "JSC Ingenium (UK) Limited");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "36", "Cable and Wireless Isle of Man Limited");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "37", "Synectiv Ltd");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "50", "JT-Wave");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "55", "Cable & Wireless Guernsey / Sure Mobile (Jersey)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "58", "Manx Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "76", "BT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 234, "78", "Airwave");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 235, "00", "Mundio Mobile Limited");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 235, "01", "Everything Everywhere Limited (TM)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 235, "02", "Everything Everywhere Limited (TM)");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 235, "77", "BT");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 235, "91", "Vodafone United Kingdom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 235, "92", "Cable & Wireless UK");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 235, "94", "Hutchison 3G UK Ltd");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UK", 235, "95", "Network Rail Infrastructure Limited");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "053", "Virgin Mobile US");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "054", "Alltel US");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "066", "U.S. Cellular");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "004", "Verizon");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "005", "Verizon");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "010", "MCI");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "012", "Verizon");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "013", "MobileTel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "014", "Testing");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "016", "Cricket Communications");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "017", "North Sight Communications Inc.");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "020", "Union Telephone Company");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "026", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "030", "Centennial");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "034", "Airpeak");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "040", "Concho");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "046", "SIMMETRY");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "060", "Consolidated Telcom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "070", "Highland Cellular");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "080", "Corr");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "090", "AT&T");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "100", "Plateau Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "110", "PTI Pacifica");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "120", "Sprint");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "150", "AT&T");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "160", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "170", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "180", "West Central");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "190", "Dutch Harbor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "200", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "210", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "220", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "230", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "240", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "250", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "260", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "270", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "280", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "290", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "300", "iSmart Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "310", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "311", "Farmers Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "320", "Cellular One");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "330", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "340", "Westlink");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "350", "Carolina Phone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "380", "AT&T");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "390", "Cellular One of East Texas");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "400", "i CAN_GSM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "410", "AT&T");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "420", "Cincinnati Bell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "430", "Alaska Digitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "440", "Cellular One");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "450", "Viaero");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "460", "Simmetry");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "470", "nTelos");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "480", "Choice Phone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "490", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "500", "Alltel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "510", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "520", "VeriSign");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "530", "West Virginia Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "540", "Oklahoma Western");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "560", "AT&T");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "570", "Cellular One");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "580", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "590", "Alltel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "610", "Epic Touch");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "620", "Coleman County Telecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "630", "AmeriLink PCS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "640", "Airadigm");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "650", "Jasper");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "660", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "670", "Northstar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "680", "AT&T");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "690", "Conestoga");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "730", "SeaMobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "740", "Convey");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "760", "Panhandle");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "770", "i wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "780", "Airlink PCS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "790", "PinPoint");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "800", "T-Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "830", "Caprock");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "840", "telna Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "850", "Aeris");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "870", "PACE");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "880", "Advantage");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "890", "Unicel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "900", "Mid-Rivers Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "910", "First Cellular");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "940", "Iris Wireless LLC");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "950", "XIT Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "960", "Plateau Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "970", "Globalstar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "980", "AT&T Mobility");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 310, "990", "AT&T Mobility");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "000", "Mid-Tex Cellular");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "010", "Chariton Valley");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "020", "Missouri RSA 5 Partnership");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "030", "Indigo Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "040", "Commnet Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "050", "Wikes Cellular");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "060", "Farmers Cellular");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "070", "Easterbrooke");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "080", "Pine Cellular");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "090", "Long Lines Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "100", "High Plains Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "110", "High Plains Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "120", "Choice Phone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "130", "Cell One Amarillo");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "140", "Sprocket");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "150", "Wilkes Cellular");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "160", "Endless Mountains Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "170", "PetroCom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "180", "Cingular Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "190", "Cellular Properties");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "210", "Emery Telcom Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "220", "U.S. Cellular");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "230", "C Spire Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "330", "Bug Tussel Wireless");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "480", "Verizon");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 311, "660", "metroPCS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 316, "010", "Nextel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("US", 316, "011", "Southern Communications Services");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UY", 748, "01", "Antel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UY", 748, "07", "Movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UY", 748, "10", "Claro UY");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UZ", 434, "01", "Buztel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UZ", 434, "02", "Uzmacom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UZ", 434, "04", "Beeline");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UZ", 434, "05", "Ucell");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UZ", 434, "06", "Perfectum Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("UZ", 434, "07", "MTS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VU", 541, "01", "SMILE");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VE", 734, "01", "Digitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VE", 734, "02", "Digitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VE", 734, "03", "Digitel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VE", 734, "04", "movistar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VE", 734, "06", "Movilnet");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VN", 452, "01", "MobiFone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VN", 452, "02", "Vinaphone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VN", 452, "03", "S-Fone");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VN", 452, "04", "Viettel Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VN", 452, "05", "Vietnamobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VN", 452, "06", "EVNTelecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VN", 452, "08", "3G EVNTelecom");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("VN", 452, "07", "Beeline VN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("YE", 421, "01", "SabaFon");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("YE", 421, "02", "MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("YE", 421, "03", "Yemen Mobile");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("YE", 421, "04", "HiTS-UNITEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZM", 645, "01", "Airtel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZM", 645, "02", "MTN");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZM", 645, "03", "ZAMTEL");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZW", 648, "01", "Net*One");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZW", 648, "03", "Telecel");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("ZW", 648, "04", "Econet");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "01", "ICO");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "02", "Sense Communications International");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "03", "Iridium");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "04", "Globalstar");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "05", "Thuraya RMSS Network");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "06", "Thuraya Satellite Telecommunications Company");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "07", "Ellipso");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "08", "");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "09", "Tele1 Europe");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "10", "ACeS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "11", "Inmarsat");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "12", "Telenor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "13", "GSM.AQ");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "14", "AeroMobile AS");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "15", "OnAir Switzerland Sarl");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "16", "Jasper Systems");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "17", "Navitas");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "18", "Cellular @Sea");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "19", "Vodafone Malta Maritime");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "21", "Seanet");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "23", "Beeline");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "24", "iNum");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "26", "TIM");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "29", "Telenor");
+insert into mcc_mnc_oper_list  (country, mcc, mnc, oper)  values ("__", 901, "32", "Sky High");
+COMMIT;
diff --git a/src/desc.c b/src/desc.c
new file mode 100755 (executable)
index 0000000..152474e
--- /dev/null
@@ -0,0 +1,224 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/utsname.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <plugin.h>
+#include <hal.h>
+#include <server.h>
+#include <at.h>
+
+#include "s_common.h"
+#include "s_network.h"
+#include "s_modem.h"
+#include "s_sim.h"
+#include "s_sap.h"
+#include "s_ps.h"
+#include "s_call.h"
+#include "s_ss.h"
+#include "s_sms.h"
+#include "s_sat.h"
+#include "s_phonebook.h"
+#include "s_gps.h"
+
+static char *cp_name;
+
+static enum tcore_hook_return on_hal_send(TcoreHal *hal, unsigned int data_len, void *data, void *user_data)
+{
+       hook_hex_dump(TX, data_len, data);
+       return TCORE_HOOK_RETURN_CONTINUE;
+}
+
+static void on_hal_recv(TcoreHal *hal, unsigned int data_len, const void *data, void *user_data)
+{
+       msg("=== RX data DUMP =====");
+       util_hex_dump("          ", data_len, data);
+       msg("=== RX data DUMP =====");
+}
+
+static gboolean on_load()
+{
+       dbg("i'm load!");
+
+       return TRUE;
+}
+
+static int _get_cp_name(char** name)
+{
+       struct utsname u;
+
+       char *svnet1_models[] = { "F1", "S1", "M2", "H2", "H2_SDK",
+               "CRESPO", "STEALTHV", "SLP45", "Kessler", "P1P2",
+               "U1SLP", "U1HD", "SLP7_C210", "SLP10_C210", NULL };
+
+       char *svnet2_models[] = { "SMDK4410", "SMDK4212", "SLP_PQ", "SLP_PQ_LTE", "SLP_NAPLES", "REDWOOD", "TRATS", NULL };
+
+       char* tty_models[] = {"QCT MSM8X55 SURF" , "QCT MSM7x27a FFA", NULL };
+
+       int i=0;
+
+       if (*name) {
+               dbg("[ error ] name is not empty");
+               return FALSE;
+       }
+
+       memset(&u, '\0', sizeof(struct utsname));
+
+       uname(&u);
+
+       dbg("u.nodename : [ %s ]", u.nodename);
+
+       for(i=0; svnet1_models[i]; i++) {
+               if (!strcmp(u.nodename, svnet1_models[i])) {
+                       *name = g_new0(char, 5);
+                       strcpy(*name, "6260");
+                       return 5;
+               }
+       }
+
+       for(i=0; svnet2_models[i]; i++) {
+               if (!strcmp(u.nodename, svnet2_models[i])) {
+                       *name = g_new0(char, 5);
+                       strcpy(*name, "6262");
+                       return 5;
+               }
+       }
+
+       for(i=0; tty_models[i]; i++) {
+               if (!strcmp(u.nodename, tty_models[i])) {
+                       *name = g_new0(char, 6);
+                       strcpy(*name, "dpram");
+                       return 6;
+               }
+       }
+
+       dbg("[ error ] unknown model : (%s)", u.nodename);
+
+       return 0;
+}
+
+static gboolean on_response_default(TcoreAT *at, const char *line, void *user_data)
+{
+       /* TODO:  */
+       dbg("[ TODO ] on_response_default ");
+       return TRUE;
+}
+
+static gboolean on_init(TcorePlugin *p)
+{
+       TcoreHal *h;
+       struct global_data *gd;
+       //char *cp_name = 0;
+       int len = 0;
+
+       if (!p)
+               return FALSE;
+
+       gd = calloc(sizeof(struct global_data), 1);
+       if (!gd)
+               return FALSE;
+
+       dbg("i'm init!");
+
+       gd->msg_auto_id_current = 0;
+       gd->msg_auto_id_start = 1;
+       gd->msg_auto_id_end = 255;
+
+       len = _get_cp_name(&cp_name);
+       if (!len) {
+               dbg("[ error ] unsupport cp (name : %s)", cp_name);
+               return FALSE;
+       }
+
+       /* FIXME: HAL will reside in Co-object.
+        * This HAL is just used as default before MUX setup.
+        * Each HAL has AT pasre functionality.
+        */
+       h = tcore_server_find_hal(tcore_plugin_ref_server(p), cp_name);
+       if (!h)  {
+               g_free(cp_name);
+               return FALSE;
+       }
+
+       //set physical hal into plugin's userdata       
+       gd->hal = h;
+
+       tcore_plugin_link_user_data(p, gd);
+
+       tcore_hal_add_send_hook(h, on_hal_send, p);
+       tcore_hal_add_recv_callback(h, on_hal_recv, p);
+
+       dbg("skip _register_unsolicited_messages() - this should be done in each co-object");
+
+       /* Register Unsolicited msg handler */
+       //_register_unsolicited_messages(p);
+
+       s_modem_init(p, h);
+       s_sim_init(p, h);
+       s_sat_init(p, h);
+       s_network_init(p, h);
+//     s_sap_init(p, h);
+       s_ps_init(p, h);
+       s_call_init(p, h);
+       s_ss_init(p, h);
+       s_sms_init(p, h);
+//     s_phonebook_init(p, h);
+//     s_gps_init(p, h);
+
+       g_free(cp_name);
+
+       tcore_hal_set_power(h, TRUE);
+       /* SEND CPAS command to invoke modem power on. */
+       s_modem_send_poweron(p);
+
+       return TRUE;
+}
+
+static void on_unload(TcorePlugin *p)
+{
+       struct global_data *gd;
+
+       if (!p)
+               return;
+
+       dbg("i'm unload");
+
+       gd = tcore_plugin_ref_user_data(p);
+       if (gd) {
+               free(gd);
+       }
+}
+
+struct tcore_plugin_define_desc plugin_define_desc =
+{
+       .name = "IMC",
+       .priority = TCORE_PLUGIN_PRIORITY_MID,
+       .version = 1,
+       .load = on_load,
+       .init = on_init,
+       .unload = on_unload
+};
diff --git a/src/s_call.c b/src/s_call.c
new file mode 100755 (executable)
index 0000000..c1aae7f
--- /dev/null
@@ -0,0 +1,3979 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <hal.h>
+#include <core_object.h>
+#include <plugin.h>
+#include <queue.h>
+#include <co_call.h>
+#include <user_request.h>
+#include <server.h>
+#include <at.h>
+
+#include "s_common.h"
+#include "s_call.h"
+
+
+#define STATUS_INCOMING           4
+#define STATUS_WAITING    5
+#define STATUS_CONNECTED   7
+#define COMMA                     0X2c
+
+static gboolean setsoundpath = FALSE;
+static gboolean soundvolume = FALSE;
+
+/* End Cause field
+  * Call state end cause
+*/
+typedef enum {
+       TIZEN_CALL_END_NO_CAUSE,
+       /*
+        * These definitions are taken from GSM 04.08 Table 10.86
+        */
+       TIZEN_CC_CAUSE_UNASSIGNED_NUMBER,
+       TIZEN_CC_CAUSE_NO_ROUTE_TO_DEST,
+       TIZEN_CC_CAUSE_CHANNEL_UNACCEPTABLE,
+       TIZEN_CC_CAUSE_OPERATOR_DETERMINED_BARRING,
+       TIZEN_CC_CAUSE_NORMAL_CALL_CLEARING,
+       TIZEN_CC_CAUSE_USER_BUSY,
+       TIZEN_CC_CAUSE_NO_USER_RESPONDING,
+       TIZEN_CC_CAUSE_USER_ALERTING_NO_ANSWER,
+       TIZEN_CC_CAUSE_CALL_REJECTED,
+       TIZEN_CC_CAUSE_NUMBER_CHANGED,
+       TIZEN_CC_CAUSE_NON_SELECTED_USER_CLEARING,
+       TIZEN_CC_CAUSE_DESTINATION_OUT_OF_ORDER,
+       TIZEN_CC_CAUSE_INVALID_NUMBER_FORMAT,
+       TIZEN_CC_CAUSE_FACILITY_REJECTED,
+       TIZEN_CC_CAUSE_RESPONSE_TO_STATUS_ENQUIRY,
+       TIZEN_CC_CAUSE_NORMAL_UNSPECIFIED,
+       TIZEN_CC_CAUSE_NO_CIRCUIT_CHANNEL_AVAILABLE,
+       TIZEN_CC_CAUSE_NETWORK_OUT_OF_ORDER,
+       TIZEN_CC_CAUSE_TEMPORARY_FAILURE,
+       TIZEN_CC_CAUSE_SWITCHING_EQUIPMENT_CONGESTION,
+       TIZEN_CC_CAUSE_ACCESS_INFORMATION_DISCARDED,
+       TIZEN_CC_CAUSE_REQUESTED_CIRCUIT_CHANNEL_NOT_AVAILABLE,
+       TIZEN_CC_CAUSE_RESOURCES_UNAVAILABLE_UNSPECIFIED,
+       TIZEN_CC_CAUSE_QUALITY_OF_SERVICE_UNAVAILABLE,
+       TIZEN_CC_CAUSE_REQUESTED_FACILITY_NOT_SUBSCRIBED,
+       TIZEN_CC_CAUSE_INCOMING_CALL_BARRED_WITHIN_CUG,
+       TIZEN_CC_CAUSE_BEARER_CAPABILITY_NOT_AUTHORISED,
+       TIZEN_CC_CAUSE_BEARER_CAPABILITY_NOT_PRESENTLY_AVAILABLE,
+       TIZEN_CC_CAUSE_SERVICE_OR_OPTION_NOT_AVAILABLE,
+       TIZEN_CC_CAUSE_BEARER_SERVICE_NOT_IMPLEMENTED,
+       TIZEN_CC_CAUSE_ACM_GEQ_ACMMAX,
+       TIZEN_CC_CAUSE_REQUESTED_FACILITY_NOT_IMPLEMENTED,
+       TIZEN_CC_CAUSE_ONLY_RESTRICTED_DIGITAL_INFO_BC_AVAILABLE,
+       TIZEN_CC_CAUSE_SERVICE_OR_OPTION_NOT_IMPLEMENTED,
+       TIZEN_CC_CAUSE_INVALID_TRANSACTION_ID_VALUE,
+       TIZEN_CC_CAUSE_USER_NOT_MEMBER_OF_CUG,
+       TIZEN_CC_CAUSE_INCOMPATIBLE_DESTINATION,
+       TIZEN_CC_CAUSE_INVALID_TRANSIT_NETWORK_SELECTION,
+       TIZEN_CC_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE,
+       TIZEN_CC_CAUSE_INVALID_MANDATORY_INFORMATION,
+       TIZEN_CC_CAUSE_MESSAGE_TYPE_NON_EXISTENT,
+       TIZEN_CC_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROT_STATE,
+       TIZEN_CC_CAUSE_IE_NON_EXISTENT_OR_NOT_IMPLEMENTED,
+       TIZEN_CC_CAUSE_CONDITIONAL_IE_ERROR,
+       TIZEN_CC_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE,
+       TIZEN_CC_CAUSE_RECOVERY_ON_TIMER_EXPIRY,
+       TIZEN_CC_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
+       TIZEN_CC_CAUSE_INTERWORKING_UNSPECIFIED,
+       TIZEN_CC_CAUSE_END = 128,
+
+       /* Reject causes*/
+       TIZEN_REJECT_CAUSE_IMSI_UNKNOWN_IN_HLR,
+       TIZEN_REJECT_CAUSE_ILLEGAL_MS,
+       TIZEN_REJECT_CAUSE_IMSI_UNKNOWN_IN_VLR,
+       TIZEN_REJECT_CAUSE_IMEI_NOT_ACCEPTED,
+       TIZEN_REJECT_CAUSE_ILLEGAL_ME,
+       TIZEN_REJECT_CAUSE_GPRS_SERVICES_NOT_ALLOWED,
+       TIZEN_REJECT_CAUSE_GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED,
+       TIZEN_REJECT_CAUSE_MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK,
+       TIZEN_REJECT_CAUSE_IMPLICITLY_DETACHED,
+       TIZEN_REJECT_CAUSE_PLMN_NOT_ALLOWED,
+       TIZEN_REJECT_CAUSE_LA_NOT_ALLOWED,
+       TIZEN_REJECT_CAUSE_NATIONAL_ROAMING_NOT_ALLOWED,
+       TIZEN_REJECT_CAUSE_GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN,
+       TIZEN_REJECT_CAUSE_NO_SUITABLE_CELLS_IN_LA,
+       TIZEN_REJECT_CAUSE_MSC_TEMPORARILY_NOT_REACHABLE,
+       TIZEN_REJECT_CAUSE_NETWORK_FAILURE ,
+       TIZEN_REJECT_CAUSE_MAC_FAILURE,
+       TIZEN_REJECT_CAUSE_SYNCH_FAILURE,
+       TIZEN_REJECT_CAUSE_CONGESTTION,
+       TIZEN_REJECT_CAUSE_GSM_AUTH_UNACCEPTED,
+       TIZEN_REJECT_CAUSE_SERVICE_OPTION_NOT_SUPPORTED,
+       TIZEN_REJECT_CAUSE_REQ_SERV_OPT_NOT_SUBSCRIBED,
+       TIZEN_REJECT_CAUSE_SERVICE_OPT__OUT_OF_ORDER,
+       TIZEN_REJECT_CAUSE_CALL_CANNOT_BE_IDENTIFIED,
+       TIZEN_REJECT_CAUSE_NO_PDP_CONTEXT_ACTIVATED,
+       TIZEN_REJECT_CAUSE_RETRY_UPON_ENTRY_INTO_A_NEW_CELL_MIN_VALUE,
+       TIZEN_REJECT_CAUSE_RETRY_UPON_ENTRY_INTO_A_NEW_CELL_MAX_VALUE,
+       TIZEN_REJECT_CAUSE_SEMANTICALLY_INCORRECT_MSG,
+       TIZEN_REJECT_CAUSE_INVALID_MANDATORY_INFO,
+       TIZEN_REJECT_CAUSE_MESSAGE_TYPE_NON_EXISTANT,
+       TIZEN_REJECT_CAUSE_MESSAGE_TYPE_NOT_COMP_PRT_ST,
+       TIZEN_REJECT_CAUSE_IE_NON_EXISTANT,
+       TIZEN_REJECT_CAUSE_MSG_NOT_COMPATIBLE_PROTOCOL_STATE,
+
+
+       /* Connection Management establishment rejection cause */
+       TIZEN_REJECT_CAUSE_REJ_UNSPECIFIED,
+
+       /* AS reject causes */
+       TIZEN_REJECT_CAUSE_AS_REJ_RR_REL_IND,
+       TIZEN_REJECT_CAUSE_AS_REJ_RR_RANDOM_ACCESS_FAILURE,
+       TIZEN_REJECT_CAUSE_AS_REJ_RRC_REL_IND,
+       TIZEN_REJECT_CAUSE_AS_REJ_RRC_CLOSE_SESSION_IND,
+       TIZEN_REJECT_CAUSE_AS_REJ_RRC_OPEN_SESSION_FAILURE,
+       TIZEN_REJECT_CAUSE_AS_REJ_LOW_LEVEL_FAIL,
+       TIZEN_REJECT_CAUSE_AS_REJ_LOW_LEVEL_FAIL_REDIAL_NOT_ALLOWED,
+       TIZEN_REJECT_CAUSE_AS_REJ_LOW_LEVEL_IMMED_RETRY,
+
+       /* MM reject causes */
+       TIZEN_REJECT_CAUSE_MM_REJ_INVALID_SIM,
+       TIZEN_REJECT_CAUSE_MM_REJ_NO_SERVICE,
+       TIZEN_REJECT_CAUSE_MM_REJ_TIMER_T3230_EXP,
+       TIZEN_REJECT_CAUSE_MM_REJ_NO_CELL_AVAILABLE,
+       TIZEN_REJECT_CAUSE_MM_REJ_WRONG_STATE,
+       TIZEN_REJECT_CAUSE_MM_REJ_ACCESS_CLASS_BLOCKED,
+
+       /* Definitions for release ind causes between MM  and CNM*/
+       TIZEN_REJECT_CAUSE_ABORT_MSG_RECEIVED,
+       TIZEN_REJECT_CAUSE_OTHER_CAUSE,
+
+       /* CNM reject causes */
+       TIZEN_REJECT_CAUSE_CNM_REJ_TIMER_T303_EXP,
+       TIZEN_REJECT_CAUSE_CNM_REJ_NO_RESOURCES,
+       TIZEN_REJECT_CAUSE_CNM_MM_REL_PENDING,
+       TIZEN_REJECT_CAUSE_CNM_INVALID_USER_DATA,
+       TIZEN_CALL_END_CAUSE_MAX = 255
+}tizen_call_end_cause_e_type;
+
+
+struct CLCC_call_t {
+       struct CLCC_call_info_t {
+               int id;
+               enum tcore_call_direction       direction;
+               enum tcore_call_status          status;
+               enum tcore_call_type            type;
+               int mpty;
+               int num_len;
+               int num_type;
+       } info;
+       char number[90];
+};
+
+/**************************************************************************
+  *                                                    Local Function Prototypes
+  **************************************************************************/
+/*************************             REQUESTS                ***************************/
+static void _call_status_idle(TcorePlugin *p, CallObject *co);
+static void _call_status_active(TcorePlugin *p, CallObject *co);
+static void _call_status_dialing(TcorePlugin *p, CallObject *co);
+static void _call_status_alert(TcorePlugin *p, CallObject *co);
+static void _call_status_incoming(TcorePlugin *p, CallObject *co);
+static void _call_status_waiting(TcorePlugin *p, CallObject *co);
+
+static TReturn _call_list_get(CoreObject *o, gboolean *event_flag);
+static int _callFromCLCCLine(char *line, struct CLCC_call_t *p_call);
+static TReturn _set_dtmf_tone_duration(CoreObject *o, UserRequest *ur);
+
+/*************************             CONFIRMATION            ***************************/
+static void on_confirmation_call_message_send(TcorePending *p, gboolean result, void *user_data); // from Kernel
+static void on_confirmation_call_hold(TcorePending *p, int data_len, const void *data, void *user_data);
+static void on_confirmation_call_swap(TcorePending *p, int data_len, const void *data, void *user_data);
+static void on_confirmation_call_split(TcorePending *p, int data_len, const void *data, void *user_data);
+static void on_confirmation_call_hold_and_accept(TcorePending *p, int data_len, const void *data, void *user_data);
+
+static void _on_confirmation_call_release(TcorePending *p, int data_len, const void *data, void *user_data, int type);
+static void _on_confirmation_call(TcorePending *p, int data_len, const void *data, void *user_data, int type);
+static void _on_confirmation_dtmf_tone_duration(TcorePending *p, int data_len, const void *data, void *user_data);
+
+/*************************             RESPONSES               ***************************/
+static void on_response_call_list_get(TcorePending *p, int data_len, const void *data, void *user_data);
+
+/*************************             NOTIIFICATIONS          ***************************/
+static void on_notification_call_waiting(CoreObject *o, const void *data, void *user_data);
+static void on_notification_call_incoming(CoreObject *o, const void *data, void *user_data);
+static void on_notification_call_status(CoreObject *o, const void *data, void *user_data);
+static gboolean on_notification_call_info(CoreObject *o, const void *data, void *user_data);
+static gboolean on_notification_call_clip_info(CoreObject *o, const void *data, void *user_data);
+
+
+/**************************************************************************
+  *                                                    Local Utility Function Prototypes
+  **************************************************************************/
+static gboolean _call_request_message(TcorePending *pending, CoreObject *o, UserRequest* ur, void* on_resp, void* user_data);
+
+static void _call_branch_by_status(TcorePlugin *p, CallObject *co, unsigned int status);
+
+/**************************************************************************
+  *                                                    Local Function Definitions
+  **************************************************************************/
+static enum tcore_call_cli_mode _get_clir_status(char *num)
+{
+       enum tcore_call_cli_mode clir = CALL_CLI_MODE_DEFAULT;
+       dbg("Entry");
+
+       if(!strncmp(num, "*31#", 4)) {
+               dbg("CLI mode restricted");
+               return TCORE_CALL_CLI_MODE_RESTRICT;
+       }
+
+       if(!strncmp(num, "#31#", 4)) {
+               dbg("CLI mode allowed");
+               return TCORE_CALL_CLI_MODE_PRESENT;
+       }
+
+       err("Exit");
+       return clir;
+}
+
+static enum tcore_call_status _call_status(unsigned int status)
+{
+       dbg("Entry");
+
+       switch(status)
+       {
+               case 0:
+                       return TCORE_CALL_STATUS_ACTIVE;
+               case 1:
+                       return TCORE_CALL_STATUS_HELD;
+               case 2:
+                       return TCORE_CALL_STATUS_DIALING;
+               case 3:
+                       return TCORE_CALL_STATUS_ALERT;
+               case 4:
+                       return TCORE_CALL_STATUS_INCOMING;
+               case 5:
+                       return TCORE_CALL_STATUS_WAITING;
+               case 6:         /* DISCONNECTED state */        /* FALL THROUGH */
+               default:
+                       return TCORE_CALL_STATUS_IDLE;
+       }
+}
+
+static gboolean _call_is_in_mpty(int mpty)
+{
+       dbg("Entry");
+
+       switch(mpty)
+       {
+               case 0:
+                       return FALSE;
+               case 1:
+                       return TRUE;
+               default:
+                       break;
+       }
+
+       return FALSE;
+}
+
+static enum tcore_call_type tizen_call_type(int type)
+{
+       dbg("Entry");
+
+       switch (type)
+       {
+               case 0:
+                       return TCORE_CALL_TYPE_VOICE;
+               case 1:
+                       return TCORE_CALL_TYPE_VIDEO;
+               default:
+                       break;
+       }
+
+       return TCORE_CALL_TYPE_VOICE;
+}
+
+static gboolean on_notification_call_clip_info(CoreObject *o, const void *data, void *user_data)
+{
+       dbg("Entry");
+
+       /* TODO */
+
+       return TRUE;
+ }
+
+
+static gboolean on_notification_call_info(CoreObject *o, const void *data, void *user_data)
+{
+       GSList *tokens=NULL;
+       GSList *lines = NULL;
+       const char *line = NULL;
+       char *pStat;
+
+       int status;
+       dbg("Entry");
+
+       lines = (GSList*)data;
+       if (1 != g_slist_length(lines)) {
+               err("Unsolicited message, BUT multiple lines present");
+               goto OUT;
+       }
+
+       line = (char*)(lines->data);
+       tokens = tcore_at_tok_new(line);
+
+       pStat = g_slist_nth_data(tokens, 1);
+       if(!pStat) {
+               dbg("Stat is missing from %XCALLSTAT indiaction");
+       }
+       else {
+               status  = atoi(pStat);
+
+               switch(status)
+               {
+                       case STATUS_INCOMING:
+                               dbg("calling on_notification_call_incoming");
+                               on_notification_call_incoming(o, line, user_data);
+                       break;
+                       case STATUS_WAITING:
+                               dbg("calling on_notification_call_waiting");
+                               on_notification_call_waiting(o, line, user_data);
+                       break;
+                       case STATUS_CONNECTED: /*igonre Connected state. */
+                               dbg("Connected state");
+                       break;
+                       default:
+                               dbg("calling on_notification_call_status");
+                               on_notification_call_status(o, line, user_data);
+                       break;
+               }
+       }
+
+       /* Free tokens */
+       tcore_at_tok_free(tokens);
+
+OUT:
+       dbg("Exit");
+       return TRUE;
+}
+
+static gboolean _call_request_message(TcorePending *pending,
+                                                                               CoreObject *o,
+                                                                               UserRequest *ur,
+                                                                               void* on_resp,
+                                                                               void* user_data)
+{
+       TcoreHal *hal = NULL;
+       TReturn ret;
+       dbg("Entry");
+
+       tcore_pending_set_timeout(pending, 0);
+       tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT);
+
+       if (on_resp) {
+               tcore_pending_set_response_callback(pending, on_resp, user_data);
+       }
+
+       tcore_pending_set_send_callback(pending, on_confirmation_call_message_send, NULL);
+
+       if (ur) {
+               tcore_pending_link_user_request(pending, ur);
+       }
+       else {
+               err("User Request is NULL, is this internal request??");
+       }
+
+       /* HAL */
+       hal = tcore_object_get_hal(o);
+
+       /* Send request to HAL */
+       ret = tcore_hal_send_request(hal, pending);
+       if(TCORE_RETURN_SUCCESS != ret) {
+               err("Request send failed");
+               return FALSE;
+       }
+
+       dbg("Exit");
+       return TRUE;
+}
+
+static void _call_status_idle(TcorePlugin *p, CallObject *co)
+{
+       CoreObject *o = NULL;
+       struct tnoti_call_status_idle data;
+       dbg("Entry");
+
+       o = tcore_plugin_ref_core_object(p, "call");
+       dbg("Call ID [%d], Call Status [%d]", tcore_call_object_get_id(co), tcore_call_object_get_status(co));
+
+       if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_IDLE) {
+               data.type = tcore_call_object_get_type(co);
+               dbg("data.type : [%d]", data.type);
+
+               data.id = tcore_call_object_get_id(co);
+               dbg("data.id : [%d]", data.id);
+
+               /* Set Status */
+               tcore_call_object_set_status(co, TCORE_CALL_STATUS_IDLE);
+
+               /* Send Notification to TAPI */
+               tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                               o,
+                                                                               TNOTI_CALL_STATUS_IDLE,
+                                                                               sizeof(struct tnoti_call_status_idle),
+                                                                               (void*)&data);
+
+               /* Free Call object */
+               tcore_call_object_free(o, co);
+       }
+       else {
+               err("Call object was not free");
+               tcore_call_object_free(o, co);
+       }
+
+       dbg("Exit");
+       return;
+}
+
+
+static void _call_status_dialing(TcorePlugin *p, CallObject *co)
+{
+       struct tnoti_call_status_dialing data;
+       dbg("Entry");
+
+       if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_DIALING) {
+               data.type = tcore_call_object_get_type(co);
+               dbg("data.type : [%d]", data.type);
+
+               data.id = tcore_call_object_get_id(co);
+               dbg("data.id : [%d]", data.id);
+
+               /* Set Status */
+               tcore_call_object_set_status(co, TCORE_CALL_STATUS_DIALING);
+
+               /* Send notification to TAPI */
+               tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                               tcore_plugin_ref_core_object(p, "call"),
+                                                                               TNOTI_CALL_STATUS_DIALING,
+                                                                               sizeof(struct tnoti_call_status_dialing),
+                                                                               (void*)&data);
+
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void _call_status_alert(TcorePlugin *p, CallObject *co)
+{
+       struct tnoti_call_status_alert data;
+       dbg("Entry");
+
+       /* Alerting has just 1 data 'CALL ID' */
+       if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_ALERT) {
+               data.type = tcore_call_object_get_type(co);
+               dbg("data.type : [%d]", data.type);
+
+               data.id = tcore_call_object_get_id(co);
+               dbg("data.id : [%d]", data.id);
+
+               /* Set Status */
+               tcore_call_object_set_status(co, TCORE_CALL_STATUS_ALERT);
+
+               /* Send notification to TAPI */
+               tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                               tcore_plugin_ref_core_object(p, "call"),
+                                                                               TNOTI_CALL_STATUS_ALERT,
+                                                                               sizeof(struct tnoti_call_status_alert),
+                                                                               (void*)&data);
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void _call_status_active(TcorePlugin *p, CallObject *co)
+{
+       struct tnoti_call_status_active data;
+       dbg("Entry");
+
+       if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_ACTIVE) {
+               data.type = tcore_call_object_get_type(co);
+               dbg("data.type : [%d]", data.type);
+
+               data.id = tcore_call_object_get_id(co);
+               dbg("data.id : [%d]", data.id);
+
+               /* Set Status */
+               tcore_call_object_set_status(co, TCORE_CALL_STATUS_ACTIVE);
+
+               /* Send notification to TAPI */
+               tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                               tcore_plugin_ref_core_object(p, "call"),
+                                                                               TNOTI_CALL_STATUS_ACTIVE,
+                                                                               sizeof(struct tnoti_call_status_active),
+                                                                               (void*)&data);
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void _call_status_held(TcorePlugin *p, CallObject *co)
+{
+       struct tnoti_call_status_held data;
+       dbg("Entry");
+
+       if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_HELD) {
+               data.type = tcore_call_object_get_type(co);
+               dbg("data.type : [%d]", data.type);
+
+               data.id = tcore_call_object_get_id(co);
+               dbg("data.id : [%d]", data.id);
+
+               /* Set Status */
+               tcore_call_object_set_status(co, TCORE_CALL_STATUS_HELD);
+
+               /* Send notification to TAPI  */
+               tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_STATUS_HELD,
+                                                                       sizeof(struct tnoti_call_status_held),
+                                                                       (void*)&data);
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void _call_status_incoming(TcorePlugin *p, CallObject *co)
+{
+       struct tnoti_call_status_incoming data;
+       dbg("Entry");
+
+       if (tcore_call_object_get_status(co) != TCORE_CALL_STATUS_INCOMING) {
+               tcore_call_object_set_status(co, TCORE_CALL_STATUS_INCOMING);
+
+               data.type = tcore_call_object_get_type(co);
+               dbg("data.type : [%d]", data.type);
+
+               data.id = tcore_call_object_get_id(co);
+               dbg("data.id : [%d]", data.id);
+
+               data.cli.mode = tcore_call_object_get_cli_mode(co);
+               dbg("data.cli.mode : [%d]", data.cli.mode);
+
+               tcore_call_object_get_number(co, data.cli.number);
+               dbg("data.cli.number : [%s]", data.cli.number);
+
+               data.cna.mode = tcore_call_object_get_cna_mode(co);
+               dbg("data.cna.mode : [%d]", data.cna.mode);
+
+               tcore_call_object_get_name(co, data.cna.name);
+               dbg("data.cna.name : [%s]", data.cna.name);
+
+               data.forward = FALSE; /* this is tmp code */
+
+               data.active_line = tcore_call_object_get_active_line(co);
+               dbg("data.active_line : [%d]", data.active_line);
+
+               /* Send notification to TAPI */
+               tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                               tcore_plugin_ref_core_object(p, "call"),
+                                                                               TNOTI_CALL_STATUS_INCOMING,
+                                                                               sizeof(struct tnoti_call_status_incoming),
+                                                                               (void*)&data);
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void _call_status_waiting(TcorePlugin *p, CallObject *co)
+{
+       dbg("Entry");
+       _call_status_incoming(p, co);
+
+       dbg("Exit");
+       return;
+}
+
+static void _call_branch_by_status(TcorePlugin *p, CallObject *co, unsigned int status)
+{
+       dbg("Entry");
+
+       dbg("Call Status is %d", status);
+       switch (status)
+       {
+               case TCORE_CALL_STATUS_IDLE:
+                       _call_status_idle(p, co);
+                       break;
+
+               case TCORE_CALL_STATUS_ACTIVE:
+                       _call_status_active(p, co);
+                       break;
+
+               case TCORE_CALL_STATUS_HELD:
+                       _call_status_held(p, co);
+                       break;
+
+               case TCORE_CALL_STATUS_DIALING:
+                       _call_status_dialing(p, co);
+                       break;
+
+               case TCORE_CALL_STATUS_ALERT:
+                       _call_status_alert(p, co);
+                       break;
+
+               case TCORE_CALL_STATUS_INCOMING:
+                       _call_status_incoming(p, co);
+                       break;
+
+               case TCORE_CALL_STATUS_WAITING:
+                       _call_status_waiting(p, co);
+                       break;
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static TReturn _call_list_get(CoreObject *o, gboolean *event_flag)
+{
+       UserRequest* ur = NULL;
+       TcorePending *pending = NULL;
+
+       char *cmd_str = NULL;
+       TcoreATRequest *req = NULL;
+
+       gboolean ret = FALSE;
+       dbg("Entry");
+
+       if (!o) {
+               err("Core Object is NULL");
+               return TCORE_RETURN_FAILURE;
+       }
+
+       /* Create new User Request */
+       ur = tcore_user_request_new(NULL, NULL);
+
+       /* Command string */
+       cmd_str = g_strdup("AT+CLCC\r");
+
+       /* Create new Pending Request */
+       pending = tcore_pending_new(o, 0);
+       req = tcore_at_request_new(cmd_str, "+CLCC", TCORE_AT_MULTILINE);
+
+       /* Free memory */
+       g_free(cmd_str);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+
+       ret = _call_request_message (pending, o, ur, on_response_call_list_get, event_flag);
+       if (!ret) {
+               err("AT request (%s) sending failed", req->cmd);
+               return TCORE_RETURN_FAILURE;
+       }
+
+       dbg("AT request sent success");
+       return TCORE_RETURN_SUCCESS;
+}
+
+// CONFIRMATION
+static void on_confirmation_call_message_send(TcorePending *p, gboolean result, void *user_data)
+{
+       dbg("Entry");
+
+       if (result == FALSE) {  /* Fail */
+               dbg("SEND FAIL");
+       }
+       else {
+               dbg("SEND OK");
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void on_confirmation_call_outgoing(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur = NULL;
+
+       GSList *tokens = NULL;
+       const char *line = NULL;
+
+       const TcoreATResponse* response = data;
+       struct tresp_call_dial resp;
+
+       int error;
+       dbg("Entry");
+
+       ur = tcore_pending_ref_user_request(p);
+       if (ur) {
+               if (response->success > 0) {
+                       dbg("RESPONSE OK");
+                       resp.err = TCORE_RETURN_SUCCESS;
+               }
+               else {
+                       dbg("RESPONSE NOT OK");
+
+                       line = (const char*)response->final_response;
+                       tokens = tcore_at_tok_new(line);
+
+                       if (g_slist_length(tokens) < 1) {
+                               err("Unspecified error cause OR string corrupted");
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+                       else {
+                               error = atoi(g_slist_nth_data(tokens, 0));
+
+                               /* TODO: CMEE error mapping is required. */
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+
+                       /* Free tokens */
+                       tcore_at_tok_free(tokens);
+               }
+
+               /* Send Response to TAPI */
+               tcore_user_request_send_response(ur, TRESP_CALL_DIAL, sizeof(struct tresp_call_dial), &resp);
+       }
+       else {
+               err("User Request is NULL");
+       }
+
+       dbg("Exit")
+       return;
+}
+
+static void on_confirmation_call_accept(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur = NULL;
+
+       GSList *tokens = NULL;
+       const char *line = NULL;
+
+       const TcoreATResponse* response = data;
+       struct tresp_call_answer resp;
+
+       int error;
+       dbg("Entry");
+
+       ur = tcore_pending_ref_user_request(p);
+       if (ur) {
+               if (response->success > 0) {
+                       dbg("RESPONSE OK");
+                       resp.err = TCORE_RETURN_SUCCESS;
+               }
+               else {
+                       dbg("RESPONSE NOT OK");
+
+                       line = (const char*)response->final_response;
+                       tokens = tcore_at_tok_new(line);
+
+                       if (g_slist_length(tokens) < 1) {
+                               err("Unspecified error cause OR string corrupted");
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+                       else {
+                               error = atoi(g_slist_nth_data(tokens, 0));
+
+                               /* TODO: CMEE error mapping is required. */
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+
+                       /* Free tokens */
+                       tcore_at_tok_free(tokens);
+               }
+
+               resp.id =   tcore_call_object_get_id((CallObject*)user_data);
+
+               /* Send Response to TAPI */
+               tcore_user_request_send_response(ur, TRESP_CALL_ANSWER, sizeof(struct tresp_call_answer), &resp);
+       }
+       else {
+               err("User Request is NULL");
+       }
+
+       dbg("Exit");
+       return;
+}
+
+
+static void on_confirmation_call_reject(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur = NULL;
+
+       GSList *tokens = NULL;
+       const char *line = NULL;
+
+       const TcoreATResponse* response = data;
+       struct tresp_call_answer resp;
+
+       int error;
+       dbg("Entry");
+
+       ur = tcore_pending_ref_user_request(p);
+       if (ur) {
+               if (response->success > 0) {
+                       dbg("RESPONSE OK");
+                       resp.err = TCORE_RETURN_SUCCESS;
+               }
+               else {
+                       dbg("RESPONSE NOT OK");
+
+                       line = (const char*)response->final_response;
+                       tokens = tcore_at_tok_new(line);
+
+                       if (g_slist_length(tokens) < 1) {
+                                       err("Unspecified error cause OR string corrupted");
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+                       else {
+                               error = atoi(g_slist_nth_data(tokens, 0));
+
+                               /* TODO: CMEE error mapping is required. */
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+
+                       /* Free tokens */
+                       tcore_at_tok_free(tokens);
+               }
+
+               resp.id =   tcore_call_object_get_id((CallObject*)user_data);
+
+               /* Send Response to TAPI */
+               tcore_user_request_send_response(ur, TRESP_CALL_ANSWER, sizeof(struct tresp_call_answer), &resp);
+       }
+       else {
+               err("User Request is NULL");
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void on_confirmation_call_replace(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur = NULL;
+
+       GSList *tokens = NULL;
+       const char *line = NULL;
+
+       const TcoreATResponse* response = data;
+       struct tresp_call_answer resp;
+
+       int error;
+       dbg("Entry");
+
+       ur = tcore_pending_ref_user_request(p);
+       if (ur) {
+               if (response->success > 0) {
+                       dbg("RESPONSE OK");
+                       resp.err = TCORE_RETURN_SUCCESS;
+               }
+               else {
+                       dbg("RESPONSE NOT OK");
+
+                       line = (const char*)response->final_response;
+                       tokens = tcore_at_tok_new(line);
+
+                       if (g_slist_length(tokens) < 1) {
+                               err("Unspecified error cause OR string corrupted");
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+                       else {
+                               error = atoi(g_slist_nth_data(tokens, 0));
+
+                               /* TODO: CMEE error mapping is required. */
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+
+                       /* Free tokens */
+                       tcore_at_tok_free(tokens);
+               }
+
+               resp.id =   tcore_call_object_get_id((CallObject*)user_data);
+
+               /* Send Response to TAPI */
+               tcore_user_request_send_response(ur, TRESP_CALL_ANSWER, sizeof(struct tresp_call_answer), &resp);
+       }
+       else {
+               dbg("User Request is NULL");
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void on_confirmation_call_hold_and_accept(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       CoreObject *o = NULL;
+       UserRequest *ur = NULL;
+
+       GSList *tokens = NULL;
+       const char *line = NULL;
+
+       const TcoreATResponse* response = data;
+       struct tresp_call_answer resp;
+
+       int error;
+       dbg("Entry");
+
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+       resp.id  =  tcore_call_object_get_id((CallObject*)user_data);
+
+       if (ur) {
+               if (response->success > 0) {
+                       dbg("RESPONSE OK");
+                       resp.err = TCORE_RETURN_SUCCESS;
+               }
+               else {
+                       err("RESPONSE NOT OK");
+
+                       line = (const char*)response->final_response;
+                       tokens = tcore_at_tok_new(line);
+
+                       if (g_slist_length(tokens) < 1) {
+                               err("Unspecified error cause OR string corrupted");
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+                       else {
+                               error = atoi(g_slist_nth_data(tokens, 0));
+
+                               /* TODO: CMEE error mapping is required. */
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+
+                       /* Free tokens */
+                       tcore_at_tok_free(tokens);
+               }
+
+               /* Send response to TAPI */
+               tcore_user_request_send_response(ur, TRESP_CALL_ANSWER, sizeof(struct tresp_call_answer), &resp);
+               if (!resp.err) {
+                       GSList *l = 0;
+                       CallObject *co = NULL;
+
+                       /* Active Call */
+                       l = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_ACTIVE);
+                       if (!l) {
+                               err("Can't find active Call");
+                               return;
+                       }
+
+                       co = (CallObject*)l->data;
+                       if (!co) {
+                               err("Can't get active Call object");
+                               return;
+                       }
+
+                       /* Set Call Status */
+                       tcore_call_object_set_status(co, TCORE_CALL_STATUS_HELD);
+                       dbg("Call status is set to HELD");
+               }
+       }
+       else {
+               err("User Request is NULL");
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void _on_confirmation_call_release(TcorePending *p, int data_len, const void *data, void *user_data, int type)
+{
+       CoreObject *o = NULL;
+       UserRequest *ur = NULL;
+       struct tresp_call_end resp;
+       GSList *tokens = NULL;
+       const char *line = NULL;
+       int error;
+
+       const TcoreATResponse* response = data;
+
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+
+       if (ur) {
+               if (response->success > 0) {
+                       dbg("RESPONSE OK");
+                       resp.err = TCORE_RETURN_SUCCESS;
+               }
+               else {
+                       err("RESPONSE NOT OK");
+
+                       line = (const char*)response->final_response;
+                       tokens = tcore_at_tok_new(line);
+
+                       if (g_slist_length(tokens) < 1) {
+                               err("Unspecified error cause OR string corrupted");
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+                       else {
+                               error = atoi(g_slist_nth_data(tokens, 0));
+
+                               /* TODO: CMEE error mapping is required. */
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+                       tcore_at_tok_free(tokens);
+               }
+
+               resp.type = type;
+               resp.id =   tcore_call_object_get_id((CallObject*)user_data);
+               dbg("resp.type = %d  resp.id= %d", resp.type,resp.id);
+
+               /* Send reponse to TAPI */
+               tcore_user_request_send_response(ur, TRESP_CALL_END, sizeof(struct tresp_call_end), &resp);
+       }
+       else {
+               err("User Request is NULL");
+       }
+
+       dbg("Exit");
+       return;
+}
+
+// RESPONSE
+static void on_confirmation_call_endall(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       /* skip response handling - actual result will be handled in on_confirmation_call_release_all */
+       const TcoreATResponse* response = data;
+       dbg("Entry");
+
+       if (response->success > 0) {
+               dbg("RESPONSE OK");
+       }
+       else {
+               err("RESPONSE NOT OK");
+       }
+
+       dbg("Exit");
+       return;
+}
+
+
+static void on_confirmation_call_release_all(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+       _on_confirmation_call_release(p, data_len, data, user_data, CALL_END_TYPE_ALL);
+
+       return;
+}
+
+
+static void on_confirmation_call_release_specific(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+       _on_confirmation_call_release(p, data_len, data, user_data, CALL_END_TYPE_DEFAULT);
+
+       return;
+}
+
+static void on_confirmation_call_release_all_active(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+       _on_confirmation_call_release(p, data_len, data, user_data, CALL_END_TYPE_ACTIVE_ALL);
+
+       return;
+}
+
+static void on_confirmation_call_release_all_held(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+        _on_confirmation_call_release(p, data_len, data, user_data, CALL_END_TYPE_HOLD_ALL);
+
+        return;
+}
+
+static void _on_confirmation_call(TcorePending *p, int data_len, const void *data, void *user_data, int type)
+{
+       UserRequest *ur = NULL;
+
+       GSList *tokens = NULL;
+       const char *line = NULL;
+
+       const TcoreATResponse *response = NULL;
+
+       int error;
+       dbg("Entry");
+
+       ur = tcore_pending_ref_user_request(p);
+
+       response = (TcoreATResponse *)data;
+
+       if (response->success > 0) {
+               dbg("RESPONSE OK");
+               error = TCORE_RETURN_SUCCESS;
+       }
+       else {
+               err("RESPONSE NOT OK");
+
+               line = (const char*)response->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1) {
+                       err("Unspecified error cause OR string corrupted");
+                       error = TCORE_RETURN_3GPP_ERROR;
+               }
+               else {
+                       error = atoi(g_slist_nth_data(tokens, 0));
+
+                       /* TODO: CMEE error mapping is required. */
+                       error = TCORE_RETURN_3GPP_ERROR;
+               }
+
+               /* Free tokens */
+               tcore_at_tok_free(tokens);
+       }
+
+       dbg("Response Call type -%d", type);
+       switch(type)
+       {
+               case TRESP_CALL_HOLD:
+               {
+                       struct tresp_call_hold resp;
+
+                       resp.err = error;
+                       resp.id = tcore_call_object_get_id((CallObject*)user_data);
+             dbg("call hold response");
+                       /* Send reponse to TAPI */
+                       tcore_user_request_send_response(ur, TRESP_CALL_HOLD, sizeof(struct tresp_call_hold), &resp);
+               }
+               break;
+               case TRESP_CALL_ACTIVE:
+               {
+                       struct tresp_call_active resp;
+
+                       resp.err = error;
+                       resp.id = tcore_call_object_get_id((CallObject*)user_data);
+            dbg("call active response");
+                       /* Send reponse to TAPI */
+                       tcore_user_request_send_response(ur, TRESP_CALL_ACTIVE, sizeof(struct tresp_call_active), &resp);
+               }
+               break;
+               case TRESP_CALL_JOIN:
+               {
+                       struct tresp_call_join resp;
+
+                       resp.err = error;
+                       resp.id = tcore_call_object_get_id((CallObject*)user_data);
+            dbg("call join response");
+
+                       /* Send reponse to TAPI */
+                       tcore_user_request_send_response(ur, TRESP_CALL_JOIN, sizeof(struct tresp_call_join), &resp);
+               }
+               break;
+               case TRESP_CALL_SPLIT:
+               {
+                       struct tresp_call_split resp;
+
+                       resp.err = error;
+                       resp.id = tcore_call_object_get_id((CallObject*)user_data);
+            dbg("call split response");
+                       /* Send reponse to TAPI */
+                       tcore_user_request_send_response(ur, TRESP_CALL_SPLIT, sizeof(struct tresp_call_split), &resp);
+               }
+               break;
+               case TRESP_CALL_DEFLECT:
+               {
+                       struct tresp_call_deflect resp;
+
+                       resp.err = error;
+                       resp.id = tcore_call_object_get_id((CallObject*)user_data);
+            dbg("call deflect response");
+                       /* Send reponse to TAPI */
+                       tcore_user_request_send_response(ur, TRESP_CALL_DEFLECT, sizeof(struct tresp_call_deflect), &resp);
+               }
+
+               break;
+               case TRESP_CALL_TRANSFER:
+               {
+                       struct tresp_call_transfer resp;
+
+                       resp.err = error;
+                       resp.id = tcore_call_object_get_id((CallObject*)user_data);
+            dbg("call transfer response");
+                       /* Send reponse to TAPI */
+                       tcore_user_request_send_response(ur, TRESP_CALL_TRANSFER, sizeof(struct tresp_call_transfer), &resp);
+               }
+               break;
+               case TRESP_CALL_SEND_DTMF:
+               {
+                       struct tresp_call_dtmf resp;
+
+                       resp.err = error;
+            dbg("call dtmf response");
+                       /* Send reponse to TAPI */
+                       tcore_user_request_send_response(ur, TRESP_CALL_SEND_DTMF, sizeof(struct tresp_call_dtmf), &resp);
+               }
+               break;
+               default:
+               {
+                       dbg("type not supported");
+                       return;
+               }
+       }
+
+       if ((type == TRESP_CALL_HOLD)
+               || (type == TRESP_CALL_ACTIVE)
+               || (type == TRESP_CALL_JOIN)
+               || (type == TRESP_CALL_SPLIT)) {
+               if (!error) {
+                       CoreObject *o = NULL;
+                       gboolean *eflag = g_new0(gboolean, 1);
+
+                       o  = tcore_pending_ref_core_object(p);
+                       *eflag = FALSE;
+
+                       dbg("Calling _call_list_get");
+                       _call_list_get(o, eflag);
+               }
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void on_confirmation_call_hold(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+       _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_HOLD);
+
+       return;
+}
+
+static void on_confirmation_call_active(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+       _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_ACTIVE);
+
+       return;
+}
+
+static void on_confirmation_call_join(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+       _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_JOIN);
+
+       return;
+}
+
+static void on_confirmation_call_split(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+       _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_SPLIT);
+
+       return;
+}
+
+static void on_confirmation_call_deflect(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+       _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_DEFLECT);
+
+       return;
+}
+
+static void on_confirmation_call_transfer(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+       _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_TRANSFER);
+
+       return;
+}
+
+static void on_confirmation_call_dtmf(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+       _on_confirmation_call(p, data_len, data, user_data, TRESP_CALL_SEND_DTMF);
+
+       return;
+}
+
+static void _on_confirmation_dtmf_tone_duration(TcorePending * p, int data_len, const void * data, void * user_data)
+{
+       GSList *tokens = NULL;
+       const char *line = NULL;
+
+       const TcoreATResponse* response = data;
+
+       int error;
+       dbg("Entry");
+
+       if (response->success > 0) {
+               dbg("RESPONSE OK");
+               error  = TCORE_RETURN_SUCCESS;
+       }
+       else {
+               err("RESPONSE NOT OK");
+
+               line = (const char*)response->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1) {
+                       err("err cause not specified or string corrupted");
+                       error = TCORE_RETURN_3GPP_ERROR;
+               }
+               else {
+                       error = atoi(g_slist_nth_data(tokens, 0));
+
+                       /* TODO: CMEE error mapping is required. */
+               }
+
+               /* Free tokens */
+               tcore_at_tok_free(tokens);
+       }
+
+       dbg("Set dtmf tone duration response - %d", error);
+       return;
+}
+
+static void on_confirmation_call_swap(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       CoreObject *o = NULL;
+       UserRequest *ur = NULL;
+
+       const TcoreATResponse* response = data;
+       struct tresp_call_swap resp;
+
+       GSList *tokens = NULL;
+       const char *line = NULL;
+       dbg("Entry");
+
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+
+       if (ur) {
+               if (response->success > 0) {
+                       dbg("RESPONSE OK");
+                       resp.err = TCORE_RETURN_SUCCESS;
+               }
+               else {
+                       err("RESPONSE NOT OK");
+
+                       line = (const char*)response->final_response;
+                       tokens = tcore_at_tok_new(line);
+
+                       if (g_slist_length(tokens) < 1) {
+                               err("err cause not specified or string corrupted");
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+                       else {
+                               resp.err = atoi(g_slist_nth_data(tokens, 0));
+
+                               /* TODO: CMEE error mapping is required. */
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+
+                       /* Free tokens */
+                       tcore_at_tok_free(tokens);
+               }
+
+               resp.id = tcore_call_object_get_id((CallObject*)user_data);
+               dbg("resp.id = %d", resp.id);
+
+               /* Send response to TAPI */
+               tcore_user_request_send_response(ur, TRESP_CALL_SWAP, sizeof(struct tresp_call_swap), &resp);
+               if (!resp.err) {
+                       GSList *active = NULL;
+                       GSList *held = NULL;
+                       CallObject *co = NULL;
+                       gboolean *eflag = NULL;
+
+                       held = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_HELD);
+                       if (!held) {
+                               err("Can't find held Call");
+                               return;
+                       }
+
+                       active = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_ACTIVE);
+                       if (!active) {
+                               dbg("Can't find active Call");
+                               return;
+                       }
+
+                       while (held) {
+                               co = (CallObject*)held->data;
+                               if (!co) {
+                                       err("Can't get held Call object");
+                                       return;
+                               }
+
+                               resp.id =  tcore_call_object_get_id(co);
+
+                               /* Send response to TAPI */
+                               tcore_user_request_send_response(ur, TRESP_CALL_ACTIVE, sizeof(struct tresp_call_active), &resp);
+
+                               held = g_slist_next(held);
+                       }
+
+                       while (active) {
+                               co = (CallObject*)active->data;
+                               if (!co) {
+                                       err("[ error ] can't get active call object");
+                                       return;
+                               }
+
+                               resp.id = tcore_call_object_get_id(co);
+
+                               /* Send response to TAPI */
+                               tcore_user_request_send_response(ur, TRESP_CALL_HOLD, sizeof(struct tresp_call_hold), &resp);
+
+                               active = g_slist_next(active);
+                       }
+
+                       eflag = g_new0(gboolean, 1);
+                       *eflag = FALSE;
+
+                       dbg("calling _call_list_get");
+                       _call_list_get(o, eflag);
+               }
+       }
+       else {
+               err("User Request is NULL");
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void on_confirmation_call_set_source_sound_path(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       CoreObject *o = NULL;
+       UserRequest *ur = NULL;
+
+       GSList *tokens = NULL;
+       const char *line = NULL;
+
+       const TcoreATResponse* response = data;
+       char *pResp = NULL;
+       struct tresp_call_sound_set_path resp;
+
+       int error;
+       dbg("Entry");
+
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+
+       // +XDRV: <group_id>,<function_id>,<xdrv_result>[,<response_n>]\ 3
+       if (!response) {
+               err("Input data is NULL");
+               return;
+       }
+
+       if (response->success > 0) {
+               dbg("RESPONSE OK");
+
+               line  = (const char*) (((GSList*)response->lines)->data);
+               tokens = tcore_at_tok_new(line);
+
+               pResp = g_slist_nth_data(tokens, 0);
+               if(!g_slist_nth_data(tokens, 0)) {
+                       err("group_id is missing");
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+                       goto OUT;
+               }
+
+               if(!g_slist_nth_data(tokens, 1)) {
+                       err(" function_id is missing");
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+                       goto OUT;
+               }
+
+               pResp  = g_slist_nth_data(tokens, 2);
+
+               if(pResp) {
+                       error = atoi(pResp);
+                       if(0 == error) {
+                               dbg("Response is Success");
+                               resp.err = TCORE_RETURN_SUCCESS;
+                       }
+                       else {
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+               }
+OUT:
+               /* Free tokens */
+               tcore_at_tok_free(tokens);
+       }
+       else {
+               dbg("RESPONSE NOT OK");
+
+               line = (const char*)response->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1) {
+                       err("err cause not specified or string corrupted");
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               else {
+                       error = atoi(g_slist_nth_data(tokens, 0));
+
+                       /* TODO: CMEE error mapping is required. */
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+
+               /* Free tokens */
+               tcore_at_tok_free(tokens);
+       }
+
+       if (ur) {
+               if(resp.err != TCORE_RETURN_SUCCESS) {  /* Send only failed notification . success notification send when destination device is set. */
+                       /* Send notification to TAPI */
+                       tcore_user_request_send_response(ur, TRESP_CALL_SET_SOUND_PATH, sizeof(struct tresp_call_sound_set_path), &resp);
+            setsoundpath = TRUE;
+               }
+       }
+       else {
+               err("User Request is NULL");
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void on_confirmation_call_set_destination_sound_path(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       CoreObject *o = NULL;
+       UserRequest *ur = NULL;
+
+       GSList *tokens = NULL;
+       const char *line = NULL;
+       char *pResp = NULL ;
+
+       struct tresp_call_sound_set_path resp;
+
+       const TcoreATResponse* response = data;
+
+       int error;
+       dbg("Entry");
+
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+
+
+       // +XDRV: <group_id>,<function_id>,<xdrv_result>[,<response_n>]\ 3
+
+       if (!response) {
+               err("Input data is NULL");
+               return;
+       }
+
+       if (ur) {
+               if (response->success > 0) {
+                       dbg("RESPONSE OK");
+
+                       line  = (const char*) (((GSList*)response->lines)->data);
+                       tokens = tcore_at_tok_new(line);
+
+                       pResp = g_slist_nth_data(tokens, 0);
+                       if(!g_slist_nth_data(tokens, 0)) {
+                               dbg("group_id is missing");
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                               goto OUT;
+                       }
+
+                       if(!g_slist_nth_data(tokens, 1)) {
+                               dbg("function_id is missing");
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                               goto OUT;
+                       }
+
+                       pResp  = g_slist_nth_data(tokens, 2);
+
+                       if(pResp) {
+                               error = atoi(pResp);
+
+                               if(0 == error) {
+                                       dbg("Response is Success");
+                                       resp.err = TCORE_RETURN_SUCCESS;
+                               }
+                               else {
+                                       resp.err = TCORE_RETURN_3GPP_ERROR;
+                               }
+                       }
+
+OUT:
+                       /* Free tokens */
+                       tcore_at_tok_free(tokens);
+               }
+               else {
+                       dbg("RESPONSE NOT OK");
+
+                       line = (const char*)response->final_response;
+                       tokens = tcore_at_tok_new(line);
+
+                       if (g_slist_length(tokens) < 1) {
+                               err("err cause not specified or string corrupted");
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+                       else {
+                               error = atoi(g_slist_nth_data(tokens, 0));
+                               /* TODO: CMEE error mapping is required. */
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+
+                       /* Free tokens */
+                       tcore_at_tok_free(tokens);
+               }
+
+        if(setsoundpath == TRUE)
+        {
+            setsoundpath = FALSE;
+        }
+        else
+        {
+                   /* Send response to TAPI */
+                   tcore_user_request_send_response(ur, TRESP_CALL_SET_SOUND_PATH, sizeof(struct tresp_call_sound_set_path), &resp);
+        }
+       }
+       else {
+               dbg("User Request is NULL");
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void on_confirmation_call_set_source_sound_volume_level(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       CoreObject *o = NULL;
+       UserRequest *ur = NULL;
+
+       GSList *tokens = NULL;
+       const char *line = NULL;
+
+       const TcoreATResponse* response = data;
+       char *pResp = NULL;
+       struct tresp_call_sound_set_volume_level resp;
+
+       int error;
+       dbg("Entry");
+
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+
+       // +XDRV: <group_id>,<function_id>,<xdrv_result>[,<response_n>]\ 3
+
+       if (!response) {
+               err("Input data is NULL");
+               return;
+       }
+
+       if (response->success > 0) {
+               dbg("RESPONSE OK");
+
+               line  = (const char*) (((GSList*)response->lines)->data);
+               tokens = tcore_at_tok_new(line);
+
+               pResp = g_slist_nth_data(tokens, 0);
+               if(!g_slist_nth_data(tokens, 0)) {
+                       err("group_id is missing");
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+                       goto OUT;
+               }
+
+               if(!g_slist_nth_data(tokens, 1)) {
+                       err("function_id is missing");
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+                       goto OUT;
+               }
+
+               pResp  = g_slist_nth_data(tokens, 2);
+               if(pResp) {
+                       error = atoi(pResp);
+
+                       if(0 == error) {
+                               dbg("Response is Success ");
+                               resp.err = TCORE_RETURN_SUCCESS;
+                       }
+                       else {
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+               }
+
+OUT:
+               /* Free tokens */
+               tcore_at_tok_free(tokens);
+       }
+       else {
+               dbg("RESPONSE NOT OK");
+
+               line = (const char*)response->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1) {
+                       err("err cause not specified or string corrupted");
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               else {
+                       error = atoi(g_slist_nth_data(tokens, 0));
+
+                       /* TODO: CMEE error mapping is required. */
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+
+               /* Free tokens */
+               tcore_at_tok_free(tokens);
+       }
+
+       if (ur) {
+               if(resp.err && soundvolume == FALSE) {          /* Send only failed notification . success notification send when destination device is set. */
+                       /* Send reposne to TAPI */
+                       tcore_user_request_send_response(ur, TRESP_CALL_SET_SOUND_VOLUME_LEVEL, sizeof(struct tresp_call_sound_set_volume_level), &resp);
+            soundvolume = TRUE;
+               }
+       }
+       else {
+               err("User Request is NULL");
+       }
+
+       dbg("Exit");
+       return;
+}
+
+
+static void on_confirmation_call_set_destination_sound_volume_level(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       CoreObject *o = NULL;
+       UserRequest *ur = NULL;
+
+       GSList *tokens = NULL;
+       const char *line = NULL;
+
+       char *pResp = NULL;
+       const TcoreATResponse* response = data;
+       struct tresp_call_sound_set_volume_level resp;
+
+       int error;
+       dbg("Entry");
+
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+
+       // +XDRV: <group_id>,<function_id>,<xdrv_result>[,<response_n>]\ 3
+
+       if (!response) {
+               err("Input data is NULL");
+               return;
+       }
+
+       if (ur) {
+               if (response->success > 0) {
+                       dbg("RESPONSE OK");
+
+                       line  = (const char*) (((GSList*)response->lines)->data);
+                       tokens = tcore_at_tok_new(line);
+
+                       pResp = g_slist_nth_data(tokens, 0);
+                       if(!g_slist_nth_data(tokens, 0)) {
+                               err("group_id is missing");
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                               goto OUT;
+                       }
+
+                       if(!g_slist_nth_data(tokens, 1)) {
+                               err("function_id is missing");
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                               goto OUT;
+                       }
+
+                       pResp  = g_slist_nth_data(tokens, 2);
+
+                       if(pResp) {
+                               error = atoi(pResp);
+
+                               if(0 == error) {
+                                       dbg("Response is Success");
+                                       resp.err = TCORE_RETURN_SUCCESS;
+                               }
+                               else {
+                                       resp.err = TCORE_RETURN_3GPP_ERROR;
+                               }
+                       }
+
+OUT:
+                       /* Free tokens */
+                       tcore_at_tok_free(tokens);
+               }
+               else {
+                       dbg("RESPONSE NOT OK");
+
+                       line = (const char*)response->final_response;
+                       tokens = tcore_at_tok_new(line);
+
+                       if (g_slist_length(tokens) < 1) {
+                               err("err cause not specified or string corrupted");
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+                       else {
+                               error = atoi(g_slist_nth_data(tokens, 0));
+
+                               /* TODO: CMEE error mapping is required. */
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+
+                       tcore_at_tok_free(tokens);
+               }
+
+        if(soundvolume == TRUE)
+        {
+            soundvolume = FALSE;
+        }
+        else
+        {
+                   /* Send reposne to TAPI */
+                   tcore_user_request_send_response(ur, TRESP_CALL_SET_SOUND_VOLUME_LEVEL, sizeof(struct tresp_call_sound_set_volume_level), &resp);
+        }
+       }
+       else {
+               err("User Request is NULL");
+       }
+
+       dbg("Exit");
+       return;
+}
+
+
+static void on_confirmation_call_mute(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       CoreObject *o = NULL;
+       UserRequest *ur = NULL;
+
+       GSList *tokens = NULL;
+       const char *line = NULL;
+    char *pResp  = NULL;
+
+       struct tresp_call_mute resp;
+       const TcoreATResponse* response = data;
+
+       int error;
+       dbg("Entry");
+
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+
+    if (!response) {
+               err("Input data is NULL");
+               return;
+       }
+
+       if (response->success > 0) {
+               dbg("RESPONSE OK");
+
+               line  = (const char*) (((GSList*)response->lines)->data);
+               tokens = tcore_at_tok_new(line);
+
+               pResp = g_slist_nth_data(tokens, 0);
+               if(!g_slist_nth_data(tokens, 0)) {
+                       err("group_id is missing");
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+                       goto OUT;
+               }
+
+               if(!g_slist_nth_data(tokens, 1)) {
+                       err(" function_id is missing");
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+                       goto OUT;
+               }
+
+               pResp  = g_slist_nth_data(tokens, 2);
+
+               if(pResp) {
+                       error = atoi(pResp);
+                       if(0 == error) {
+                               dbg("Response is Success");
+                               resp.err = TCORE_RETURN_SUCCESS;
+                       }
+                       else {
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+               }
+OUT:
+               /* Free tokens */
+               tcore_at_tok_free(tokens);
+       }
+       else {
+               dbg("RESPONSE NOT OK");
+
+               line = (const char*)response->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1) {
+                       err("err cause not specified or string corrupted");
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               else {
+                       error = atoi(g_slist_nth_data(tokens, 0));
+
+                       /* TODO: CMEE error mapping is required. */
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+
+               /* Free tokens */
+               tcore_at_tok_free(tokens);
+       }
+
+       if (ur)
+    {
+                  tcore_user_request_send_response(ur, TRESP_CALL_MUTE, sizeof(struct tresp_call_mute), &resp);
+    }
+       else
+    {
+               err("User Request is NULL");
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void on_confirmation_call_unmute(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *response = NULL;
+       struct tresp_call_unmute resp;
+
+       GSList *tokens = NULL;
+       const char *line = NULL;
+
+       UserRequest *ur = NULL;
+    char *pResp  = NULL;
+
+       int error;
+       dbg("Entry");
+
+       response = (TcoreATResponse *)data;
+       ur = tcore_pending_ref_user_request(p);
+
+     if (!response) {
+               err("Input data is NULL");
+               return;
+       }
+
+       if (response->success > 0) {
+               dbg("RESPONSE OK");
+
+               line  = (const char*) (((GSList*)response->lines)->data);
+               tokens = tcore_at_tok_new(line);
+
+               pResp = g_slist_nth_data(tokens, 0);
+               if(!g_slist_nth_data(tokens, 0)) {
+                       err("group_id is missing");
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+                       goto OUT;
+               }
+
+               if(!g_slist_nth_data(tokens, 1)) {
+                       err(" function_id is missing");
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+                       goto OUT;
+               }
+
+               pResp  = g_slist_nth_data(tokens, 2);
+
+               if(pResp) {
+                       error = atoi(pResp);
+                       if(0 == error) {
+                               dbg("Response is Success");
+                               resp.err = TCORE_RETURN_SUCCESS;
+                       }
+                       else {
+                               resp.err = TCORE_RETURN_3GPP_ERROR;
+                       }
+               }
+OUT:
+               /* Free tokens */
+               tcore_at_tok_free(tokens);
+       }
+       else {
+               dbg("RESPONSE NOT OK");
+
+               line = (const char*)response->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1) {
+                       err("err cause not specified or string corrupted");
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               else {
+                       error = atoi(g_slist_nth_data(tokens, 0));
+
+                       /* TODO: CMEE error mapping is required. */
+                       resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+
+               /* Free tokens */
+               tcore_at_tok_free(tokens);
+       }
+
+       if (ur)
+    {
+                  tcore_user_request_send_response(ur, TRESP_CALL_UNMUTE, sizeof(struct tresp_call_unmute), &resp);
+    }
+       else
+    {
+               err("User Request is NULL");
+       }
+
+       dbg("Exit");
+       return;
+}
+
+// RESPONSE
+static void on_response_call_list_get(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       TcorePlugin *plugin = NULL;
+       CoreObject *o = NULL;
+       CallObject *co = NULL;
+
+       struct CLCC_call_t *call_list = NULL;
+
+       gboolean *event_flag = (gboolean*)user_data;
+       const TcoreATResponse *response = data;
+       GSList *pRespData = NULL;
+
+       char *line = NULL;
+
+       int i = 0, countCalls = 0, countValidCalls = 0;
+       int error = 0;
+       dbg("Entry");
+
+       plugin = tcore_pending_ref_plugin(p);
+       o = tcore_pending_ref_core_object(p);
+
+       if(response->success > 0) {
+               dbg("RESPONCE OK");
+               if(response->lines) {
+                       pRespData =  (GSList*)response->lines;
+                       countCalls = g_slist_length(pRespData);
+                       dbg("Total records : %d",countCalls);
+               }
+               else {
+                       countCalls  = 0;
+                       err("No active status - return to user");
+               }
+
+               if (0 == countCalls) {
+                       err("Call count is zero");
+                       return;
+               }
+
+               call_list = g_new0(struct CLCC_call_t, countCalls);
+
+               for (countValidCalls = 0; pRespData != NULL ; pRespData = pRespData->next) {
+                       line  = (char*)(pRespData->data);
+
+                       error = _callFromCLCCLine(line, call_list + countValidCalls);
+                       if (0 != error) {
+                               continue;
+                       }
+
+                       co = tcore_call_object_find_by_id(o, call_list[i].info.id);
+                       if (!co) {
+                               co = tcore_call_object_new(o, call_list[i].info.id);
+                               if (!co) {
+                                       err("error : tcore_call_object_new [ id : %d ]", call_list[i].info.id);
+                                       continue;
+                               }
+                       }
+
+                       /* Call set parameters */
+                       tcore_call_object_set_type(co, tizen_call_type(call_list[i].info.type));
+                       tcore_call_object_set_direction(co, call_list[i].info.direction);
+                       tcore_call_object_set_multiparty_state(co, _call_is_in_mpty(call_list[i].info.mpty));
+                       tcore_call_object_set_cli_info(co, CALL_CLI_MODE_DEFAULT, call_list[i].number);
+                       tcore_call_object_set_active_line(co, 0);
+
+                       if (*event_flag) {
+                               dbg("Call status before calling _call_branch_by_status() : (%d)", call_list[i].info.status);
+                               _call_branch_by_status(plugin, co, call_list[i].info.status);
+                       }
+                       else {
+                               /* Set Status */
+                               tcore_call_object_set_status(co, call_list[i].info.status);
+
+                               dbg("Call id : (%d)", call_list[i].info.id);
+                               dbg("Call direction : (%d)", call_list[i].info.direction);
+                               dbg("Call type : (%d)", call_list[i].info.type);
+                               dbg("Call mpty : (%d)", call_list[i].info.mpty);
+                               dbg("Call number : (%s)", call_list[i].number);
+                               dbg("Call status : (%d)", call_list[i].info.status);
+                       }
+               }
+
+               /* Free Call list */
+               g_free(call_list);
+       }
+
+       /* Free User data */
+       g_free(event_flag);
+
+       dbg("Exit");
+       return;
+}
+
+
+static int _callFromCLCCLine(char *line, struct CLCC_call_t*p_call)
+{
+       //+CLCC: 1,0,2,0,0,\"18005551212\",145
+       //[+CLCC: <id1>, <dir>, <stat>, <mode>,<mpty>[,<number>,<type>[,<alpha>[,<priority>]]]
+       int state;
+       int mode;
+       int isMT;
+       char *num = NULL;
+    unsigned int numcount,tempcount = 0;
+
+       GSList *tokens = NULL;
+       char *pResp = NULL;
+       dbg("Entry");
+
+       tokens = tcore_at_tok_new(line);
+
+       /* parse <id> */
+       pResp = g_slist_nth_data(tokens, 0);
+       if(!pResp) {
+               err("InValid ID");
+               goto ERROR;
+       }
+       p_call->info.id  = atoi(pResp);
+       dbg("id : [%d]\n", p_call->info.id);
+
+       /* parse <dir> */
+       pResp = g_slist_nth_data(tokens, 1);
+       if(!pResp) {
+               err("InValid Dir");
+               goto ERROR;
+       }
+       isMT = atoi(pResp);
+       if(0 == isMT) {
+               p_call->info.direction = TCORE_CALL_DIRECTION_OUTGOING;
+       }
+       else {
+               p_call->info.direction = TCORE_CALL_DIRECTION_INCOMING;
+       }
+       dbg("Direction : [ %d ]\n", p_call->info.direction);
+
+       /* parse <stat> */
+       pResp = g_slist_nth_data(tokens, 2);
+       if(!pResp) {
+               err("InValid Stat");
+               goto ERROR;
+       }
+       state = atoi(pResp);
+       dbg("Call state : %d", state);
+       switch(state)
+       {
+               case 0: //active
+                       p_call->info.status = TCORE_CALL_STATUS_ACTIVE;
+               break;
+               case 1:
+                       p_call->info.status = TCORE_CALL_STATUS_HELD;
+               break;
+               case 2:
+                       p_call->info.status = TCORE_CALL_STATUS_DIALING;
+               break;
+               case 3:
+                       p_call->info.status = TCORE_CALL_STATUS_ALERT;
+               break;
+               case 4:
+                       p_call->info.status = TCORE_CALL_STATUS_INCOMING;
+               break;
+               case 5:
+                       p_call->info.status = TCORE_CALL_STATUS_WAITING;
+               break;
+       }
+       dbg("Status : [%d]\n", p_call->info.status);
+
+       /* parse <mode> */
+       pResp = g_slist_nth_data(tokens, 3);
+       if(!pResp) {
+               err("InValid Mode");
+               goto ERROR;
+       }
+       mode = atoi(pResp);
+       switch(mode)
+       {
+               case 0:
+                       p_call->info.type       = TCORE_CALL_TYPE_VOICE;
+               break;
+               case 1:
+                       p_call->info.type       = TCORE_CALL_TYPE_VIDEO;
+               break;
+               default:        // only Voice/VT call is supported in CS. treat other unknown calls as error
+                       dbg("invalid type : [%d]\n", mode);
+                       goto ERROR;
+       }
+       dbg("Call type : [%d]\n", p_call->info.type);
+
+       /* parse <mpty> */
+       pResp  = g_slist_nth_data(tokens, 4);
+       if(!pResp) {
+               err("InValid Mpty");
+               goto ERROR;
+       }
+
+       p_call->info.mpty = atoi(pResp);
+       dbg("Mpty : [ %d ]\n",  p_call->info.mpty);
+
+       /* parse <num> */
+       num = g_slist_nth_data(tokens, 5);
+       dbg("Incoming number - %s and its len  - %d", num, strlen(num));
+
+       /* tolerate null here */
+       if (!num) {
+               err("Number is NULL");
+               goto ERROR;
+       }
+
+       for (numcount  = 0; numcount < strlen(num); numcount++, tempcount++)
+       {
+               if(num[numcount] == '\"') {
+                       p_call->number[tempcount] =     num[numcount+1];
+                       numcount++;
+
+               }
+               else{
+                               p_call->number[tempcount] =     num[numcount];
+
+               }
+       }
+
+       p_call->number[tempcount] = '\0';
+
+
+
+       //memcpy(p_call->number, num, strlen(num));
+       dbg("number after copying into CLCC [ %s ]\n", p_call->number);
+
+       p_call->info.num_len = strlen(num);
+       dbg("num_len : [0x%x]\n", p_call->info.num_len);
+
+       /* parse <num type> */
+       pResp = g_slist_nth_data(tokens, 6);
+       if(!pResp) {
+               dbg("InValid Num type");
+               goto ERROR;
+       }
+       p_call->info.num_type = atoi(pResp);
+       dbg("num_type : [0x%x]\n", p_call->info.num_type);
+
+       /* Free tokens */
+       tcore_at_tok_free(tokens);
+
+       dbg("Exit");
+       return 0;
+
+ERROR:
+       err("Invalid CLCC line");
+
+       /* Free tokens */
+       tcore_at_tok_free(tokens);
+
+       err("Exit");
+       return -1;
+}
+
+// NOTIFICATION
+static void on_notification_call_waiting(CoreObject *o, const void *data, void *user_data)
+{
+    GSList *tokens = NULL;
+       const char *line = NULL;
+    char *pId;
+    int call_id;
+    gboolean *eflag;
+    GSList* pList = NULL;
+    CallObject *co = NULL, *dupco = NULL;
+
+    dbg("function entrance");
+    // check call with waiting status already exist
+       pList = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_WAITING);
+
+       if(pList != NULL)
+    {
+               dbg("[error]Waiting call already exist. skip");
+               return;
+       }
+    // check call with incoming status already exist
+       pList = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_INCOMING);
+
+       if(pList != NULL)
+    {
+               dbg("[error]incoming call already exist. skip");
+               return;
+       }
+    line  = (char*)data;
+    tokens = tcore_at_tok_new(line);
+
+    pId = g_slist_nth_data(tokens, 0);
+    if(!pId)
+    {
+        dbg("[error]:Call id is missing from +XCALLSTAT indication");
+        return;
+    }
+
+    call_id  = atoi(pId);
+
+    dupco = tcore_call_object_find_by_id(o, call_id);
+       if(dupco!= NULL)
+    {
+               dbg("co with same id already exist. skip");
+               return;
+       }
+    co = tcore_call_object_new(o, call_id);
+    if (!co)
+    {
+        dbg("[ error ] co is NULL");
+        return ;
+    }
+
+    tcore_at_tok_free(tokens);
+
+    eflag = g_new0(gboolean, 1);
+       *eflag = TRUE;
+       dbg("calling _call_list_get");
+    _call_list_get(o, eflag);
+
+}
+
+static void on_notification_call_incoming(CoreObject *o, const void *data, void *user_data)
+{
+    GSList *tokens = NULL;
+       const char *line = NULL;
+    char *pId;
+    int call_id;
+    gboolean *eflag;
+    GSList* pList = NULL;
+    CallObject *co = NULL, *dupco = NULL;
+
+    dbg("function entrance");
+    // check call with incoming status already exist
+       pList = tcore_call_object_find_by_status(o, TCORE_CALL_STATUS_INCOMING);
+
+       if(pList != NULL)
+    {
+               dbg("incoming call already exist. skip");
+               return;
+       }
+
+    line  = (char*)data;
+    tokens = tcore_at_tok_new(line);
+
+    pId = g_slist_nth_data(tokens, 0);
+    if(!pId)
+    {
+        dbg("Error:Call id is missing from %XCALLSTAT indication");
+        return;
+    }
+
+    call_id  = atoi(pId);
+
+    dupco = tcore_call_object_find_by_id(o, call_id);
+       if(dupco!= NULL)
+    {
+               dbg("co with same id already exist. skip");
+               return;
+       }
+
+    co = tcore_call_object_new(o, call_id);
+    if (!co)
+    {
+        dbg("[ error ] co is NULL");
+        return ;
+    }
+
+    dbg("freeing  at token")
+    tcore_at_tok_free(tokens);
+
+    eflag = g_new0(gboolean, 1);
+       *eflag = TRUE;
+
+       dbg("calling  _call_list_get");
+    _call_list_get(o, eflag);
+
+
+}
+
+static void on_notification_call_status(CoreObject *o, const void *data, void *user_data)
+{
+    char* cmd = NULL;
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = -1, status, type;
+       char *pStat, *pCallId;
+    GSList *tokens = NULL;
+
+       enum tcore_call_status co_status;
+
+       dbg("function entrance");
+       p       = tcore_object_ref_plugin(o);
+       cmd = (char*)data;
+
+    tokens = tcore_at_tok_new(cmd);
+
+    // parse <Call Id>
+
+    pCallId = g_slist_nth_data(tokens, 0);
+    if(!pCallId)
+    {
+        dbg("pCallId is missing from %XCALLSTAT indiaction");
+
+    }
+    else
+    {
+        id  = atoi(pCallId);
+        dbg("call id = %d", id);
+        //parse <Stat>
+        if ((pStat = g_slist_nth_data(tokens, 1)))
+        {
+            status = atoi(pStat);
+        }
+        dbg("call status = %d", status);
+    }
+
+    tcore_at_tok_free(tokens);
+
+       co_status = _call_status(status);
+
+       dbg("co_status = %d", co_status);
+       switch (co_status)
+     {
+               case CALL_STATUS_ACTIVE:
+         {
+               dbg("call(%d) status : [ ACTIVE ]", id);
+               co      = tcore_call_object_find_by_id(o,id);
+               if (!co)
+            {
+                       dbg("co is NULL");
+                       return ;
+               }
+               _call_status_active(p, co);
+
+               }
+        break;
+
+               case CALL_STATUS_HELD:
+                       dbg("call(%d) status : [ held ]", id);
+               break;
+
+               case CALL_STATUS_DIALING:
+               {
+               dbg("call(%d) status : [ dialing ]", id);
+               co      = tcore_call_object_find_by_id(o,id);
+               if (!co)
+            {
+                       co = tcore_call_object_new(o, id);
+                       if (!co)
+                {
+                               dbg("error : tcore_call_object_new [ id : %d ]", id);
+                               return ;
+                       }
+               }
+
+               tcore_call_object_set_type(co, tizen_call_type(type));
+               tcore_call_object_set_direction(co, TCORE_CALL_DIRECTION_OUTGOING);
+               _call_status_dialing(p, co);
+
+
+       }
+               break;
+
+               case CALL_STATUS_ALERT:
+               {
+               dbg("call(%d) status : [ alert ]", id);
+               co      = tcore_call_object_find_by_id(o, id);
+               if (!co)
+            {
+                       dbg("co is NULL");
+                       return ;
+               }
+            _call_status_alert(p, co);
+
+       //      _call_list_get(o, co);
+
+               }
+        break;
+               case CALL_STATUS_INCOMING:
+               case CALL_STATUS_WAITING:
+                       dbg("call(%d) status : [ incoming ]", id);
+               break;
+               case CALL_STATUS_IDLE:
+        {
+
+                               dbg("call(%d) status : [ release ]", id);
+
+                               co      = tcore_call_object_find_by_id(o, id);
+                               if (!co)
+                               {
+                                       dbg("co is NULL");
+                    return ;
+                               }
+
+                               p       = tcore_object_ref_plugin(o);
+                               if (!p)
+                               {
+                                       dbg("plugin is NULL");
+                    return ;
+                               }
+
+                               _call_status_idle(p, co);
+
+               }
+        break;
+
+               default:
+                       dbg("invalid call status", id);
+                       break;
+               }
+}
+
+static TReturn s_call_outgoing(CoreObject *o, UserRequest *ur)
+{
+       TcorePlugin* p = NULL;
+       struct treq_call_dial*  data = 0;
+       char* raw_str= NULL;
+       char*cmd_str = NULL;
+    const char *cclir;
+       enum tcore_call_cli_mode clir = CALL_CLI_MODE_DEFAULT;
+
+       TcorePending *pending = NULL;
+       TcoreATRequest *req;
+       gboolean ret = FALSE;
+
+       dbg("function entrance");
+
+       data    = (struct treq_call_dial*)tcore_user_request_ref_data(ur, 0);
+       p               = tcore_object_ref_plugin(o);
+
+       clir = _get_clir_status(data->number);
+
+    //Compose ATD Cmd string
+       switch (clir)
+       {
+               case TCORE_CALL_CLI_MODE_PRESENT:
+                       dbg("CALL_CLI_MODE_PRESENT");
+                       cclir = "I";
+               break;  /*invocation*/
+               case TCORE_CALL_CLI_MODE_RESTRICT:
+                       dbg("CALL_CLI_MODE_RESTRICT");
+                       cclir = "i";
+               break;  /*suppression*/
+               case TCORE_CALL_CLI_MODE_DEFAULT:
+               default:
+                       cclir = "";
+                       dbg("CALL_CLI_MODE_DEFAULT");
+               break;   /*subscription default*/
+       }
+
+       dbg("data->number = %s",data->number);
+
+       raw_str = g_strdup_printf("ATD%s%s;", data->number, cclir);
+       cmd_str = g_strdup_printf("%s%s",raw_str,"\r");
+
+    dbg("request command : %s", cmd_str);
+
+       pending = tcore_pending_new(o, 0);
+
+       req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+
+       ret = _call_request_message (pending, o, ur, on_confirmation_call_outgoing, NULL);
+
+       g_free(raw_str);
+       g_free(cmd_str);
+
+       if (!ret)
+    {
+               dbg("AT request(%s) sent failed", req->cmd);
+               return TCORE_RETURN_FAILURE;
+       }
+
+       dbg("AT request(%s) sent success",req->cmd);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_call_answer(CoreObject *o, UserRequest *ur)
+{
+    CallObject*                                        co = NULL;
+       struct treq_call_answer*        data = 0;
+       char*                           cmd_str = NULL;
+       TcorePending *pending = NULL;
+       TcoreATRequest *req;
+       gboolean ret = FALSE;
+
+       dbg("function entrance");
+
+       data = (struct treq_call_answer*)tcore_user_request_ref_data(ur, 0);
+
+       co = tcore_call_object_find_by_id(o, data->id);
+
+       if (data->type == CALL_ANSWER_TYPE_ACCEPT)
+    {
+               dbg(" request type CALL_ANSWER_TYPE_ACCEPT");
+
+               cmd_str = g_strdup_printf("%s%s","ATA","\r");
+
+           pending = tcore_pending_new(o, 0);
+
+           req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+           dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+           tcore_pending_set_request_data(pending, 0, req);
+
+               ret = _call_request_message (pending, o, ur, on_confirmation_call_accept, co);
+
+               g_free(cmd_str);
+
+               if (!ret)
+               {
+                       dbg("AT request(%s) sent failed", req->cmd);
+                       return TCORE_RETURN_FAILURE;
+               }
+
+       }
+    else
+    {
+
+               switch (data->type)
+        {
+                       case CALL_ANSWER_TYPE_REJECT:
+            {
+                               dbg("call answer reject");
+                               tcore_call_control_answer_reject(o, ur, on_confirmation_call_reject, co);
+                       } break;
+
+                       case CALL_ANSWER_TYPE_REPLACE:
+            {
+                               dbg("call answer replace");
+                               tcore_call_control_answer_replace(o, ur, on_confirmation_call_replace, co);
+                       } break;
+
+                       case CALL_ANSWER_TYPE_HOLD_ACCEPT:
+            {
+                               dbg("call answer hold and accept");
+                               tcore_call_control_answer_hold_and_accept(o, ur, on_confirmation_call_hold_and_accept, co);
+                       } break;
+
+                       default :
+                               dbg("[ error ] wrong answer type [ %d ]", data->type);
+                               return TCORE_RETURN_FAILURE;
+               }
+       }
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_call_release(CoreObject *o, UserRequest *ur)
+{
+    CallObject* co = NULL;
+       struct treq_call_end* data = 0;
+       UserRequest* ur_dup = NULL;
+       char* chld0_cmd = NULL;
+       char* chld1_cmd = NULL;
+
+       TcorePending *pending = NULL, *pending1 = NULL;
+       TcoreATRequest *req, *req1;
+       gboolean ret = FALSE;
+
+       dbg("function entrance");
+       data = (struct treq_call_end*)tcore_user_request_ref_data(ur, 0);
+
+       co = tcore_call_object_find_by_id(o, data->id);
+
+       dbg("type of release call = %d" , data->type);
+
+       if (data->type == CALL_END_TYPE_ALL)
+    {
+
+       //releaseAll do not exist on legacy request. send CHLD=0, CHLD=1 in sequence
+       chld0_cmd = g_strdup("AT+CHLD=0\r");
+       chld1_cmd = g_strdup("AT+CHLD=1\r");
+
+           pending = tcore_pending_new(o, 0);
+
+           req = tcore_at_request_new(chld0_cmd, NULL, TCORE_AT_NO_RESULT);
+
+               dbg("input command is %s",chld0_cmd);
+
+           dbg("req-cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+           tcore_pending_set_request_data(pending, 0, req);
+
+               ur_dup = tcore_user_request_new(NULL, NULL);
+
+               ret = _call_request_message(pending ,o, ur_dup,  on_confirmation_call_endall, NULL);
+               g_free(chld0_cmd);
+
+               if (!ret)
+               {
+                       dbg("AT request %s has failed ",req->cmd);
+                       return TCORE_RETURN_FAILURE;
+               }
+
+        pending1 = tcore_pending_new(o, 0);
+
+        req1 = tcore_at_request_new(chld1_cmd, NULL, TCORE_AT_NO_RESULT);
+
+               dbg("input command is %s",chld1_cmd);
+
+           dbg("req-cmd : %s, prefix(if any) :%s, cmd_len : %d", req1->cmd, req1->prefix, strlen(req1->cmd));
+
+           tcore_pending_set_request_data(pending1, 0, req1);
+
+               ret = _call_request_message(pending1, o, ur, on_confirmation_call_release_all, co);
+               g_free(chld1_cmd);
+
+               if (!ret)
+               {
+                       dbg("AT request %s has failed ",req->cmd);
+                       return TCORE_RETURN_FAILURE;
+               }
+
+       }
+    else
+    {
+
+               switch (data->type)
+        {
+                       case CALL_END_TYPE_DEFAULT:
+            {
+                               int id = 0;
+                               id = tcore_call_object_get_id(co);
+
+                               dbg("call end call id [%d]", id);
+                               tcore_call_control_end_specific(o, ur, id, on_confirmation_call_release_specific, co);
+                       } break;
+
+                       case CALL_END_TYPE_ACTIVE_ALL:
+            {
+
+                               dbg("call end all active");
+                               tcore_call_control_end_all_active(o, ur, on_confirmation_call_release_all_active, co);
+                       } break;
+
+                       case CALL_END_TYPE_HOLD_ALL:
+            {
+
+                               dbg("call end all held");
+                               tcore_call_control_end_all_held(o, ur, on_confirmation_call_release_all_held, co);
+                       } break;
+
+                       default :
+                               dbg("[ error ] wrong end type [ %d ]", data->type);
+                               return TCORE_RETURN_FAILURE;
+               }
+
+       }
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_call_hold(CoreObject *o, UserRequest *ur)
+{
+       struct treq_call_hold *hold = 0;
+       CallObject *co = NULL;
+
+       dbg("function entrance");
+
+       hold = (struct treq_call_hold*)tcore_user_request_ref_data(ur, 0);
+
+       dbg("call id : [ %d ]", hold->id);
+
+       co = tcore_call_object_find_by_id(o, hold->id);
+
+       tcore_call_control_hold(o, ur, on_confirmation_call_hold, co);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_call_active(CoreObject *o, UserRequest *ur)
+{
+       struct treq_call_active *active = 0;
+       CallObject *co = NULL;
+
+       active = (struct treq_call_active*)tcore_user_request_ref_data(ur, 0);
+
+       dbg("call id : [ %d ]", active->id);
+
+       co = tcore_call_object_find_by_id(o, active->id);
+
+       tcore_call_control_active(o, ur, on_confirmation_call_active, co);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_call_swap(CoreObject *o, UserRequest *ur)
+{
+       struct treq_call_swap *swap = NULL;
+       CallObject *co = NULL;
+       swap = (struct treq_call_swap*)tcore_user_request_ref_data(ur, 0);
+
+       dbg("call id : [ %d ]", swap->id);
+
+       co = tcore_call_object_find_by_id(o, swap->id);
+
+       tcore_call_control_swap(o, ur, on_confirmation_call_swap, co);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_call_join(CoreObject *o, UserRequest *ur)
+{
+       struct treq_call_join *join = 0;
+       CallObject *co = NULL;
+
+       join = (struct treq_call_join*)tcore_user_request_ref_data(ur, 0);
+
+       dbg("call id : [ %d ]", join->id);
+
+       co = tcore_call_object_find_by_id(o, join->id);
+
+       tcore_call_control_join(o, ur, on_confirmation_call_join, co);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_call_split(CoreObject *o, UserRequest *ur)
+{
+       struct treq_call_split *split = 0;
+       CallObject *co = NULL;
+
+       split = (struct treq_call_split*)tcore_user_request_ref_data(ur, 0);
+
+       co = tcore_call_object_find_by_id (o, split->id);
+
+       dbg("call id : [ %d ]", split->id);
+
+       tcore_call_control_split(o, ur, split->id, on_confirmation_call_split, co);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_call_deflect(CoreObject *o, UserRequest *ur)
+{
+       struct treq_call_deflect *deflect = 0;
+       CallObject *co = NULL;
+
+       deflect = (struct treq_call_deflect*)tcore_user_request_ref_data(ur, 0);
+
+       co = tcore_call_object_find_by_number(o, deflect->number);
+
+       dbg("deflect number: [ %s ]", deflect->number);
+
+       tcore_call_control_deflect(o, ur, deflect->number, on_confirmation_call_deflect, co);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_call_transfer(CoreObject *o, UserRequest *ur)
+{
+       struct treq_call_transfer *transfer = 0;
+       CallObject *co = NULL;
+
+       transfer = (struct treq_call_transfer*)tcore_user_request_ref_data(ur, 0);
+
+       dbg("call id : [ %d ]", transfer->id);
+
+       co = tcore_call_object_find_by_id(o, transfer->id);
+
+       tcore_call_control_transfer(o, ur, on_confirmation_call_transfer, co);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_call_send_dtmf(CoreObject *o, UserRequest *ur)
+{
+       char*cmd_str = NULL;
+       TcorePending *pending = NULL;
+       TcoreATRequest *req;
+    UserRequest *dup;
+       gboolean ret = FALSE;
+       struct treq_call_dtmf *dtmf = 0;
+       char *pDtmf = NULL, *ptmp_dtmf =  NULL;
+       unsigned int dtmf_count;
+
+       dbg("Function enter");
+
+    dup  = tcore_user_request_new(NULL, NULL);
+
+    (void)_set_dtmf_tone_duration(o, dup);
+
+       dtmf = (struct treq_call_dtmf*)tcore_user_request_ref_data(ur, 0);
+       pDtmf =   g_malloc0((MAX_CALL_DTMF_DIGITS_LEN * 2)+ 1); // DTMF digits + comma for each dtmf digit.
+
+       if(pDtmf == NULL)
+       {
+               dbg("Memory allocation failed");
+               return TCORE_RETURN_FAILURE;
+       }
+
+       ptmp_dtmf =  pDtmf;
+
+       for(dtmf_count = 0; dtmf_count < strlen(dtmf->digits); dtmf_count++)
+       {
+               *ptmp_dtmf = dtmf->digits[dtmf_count];
+                ptmp_dtmf ++;
+
+               *ptmp_dtmf =  COMMA;
+                ptmp_dtmf++;
+       }
+
+       //last digit is having COMMA , overwrite it with '\0' .
+       *(--ptmp_dtmf) = '\0';
+    dbg("Input DTMF string(%s)",pDtmf);
+
+       //AT+VTS = <d1>,<d2>,<d3>,<d4>,<d5>,<d6>, ..... <d32>
+       cmd_str = g_strdup_printf("AT+VTS=%s%s",pDtmf,"\r");
+
+       dbg("request command : %s", cmd_str);
+
+       pending = tcore_pending_new(o, 0);
+
+       req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+
+       ret = _call_request_message (pending, o, ur, on_confirmation_call_dtmf, NULL);
+
+       g_free(pDtmf);
+       g_free(cmd_str);
+
+       if (!ret)
+       {
+
+               dbg("AT request sent failed")
+               return TCORE_RETURN_FAILURE;
+       }
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_call_set_sound_path(CoreObject *o, UserRequest *ur)
+{
+
+    UserRequest *ur_dup = NULL;
+
+       TcorePending *pending = NULL , *pending1 =  NULL;
+       TcoreATRequest *req , *req1;
+    char *cmd_str = NULL , *cmd_str1 = NULL;
+
+       gboolean ret = FALSE;
+
+       dbg("function entrance");
+
+    //hard coded value for speaker.
+    cmd_str = g_strdup_printf("%s%s","AT+XDRV=40,4,3,0,0,0,0,0,1,0,1,0,1","\r"); //source type.
+    cmd_str1 = g_strdup_printf("%s%s","AT+XDRV=40,5,2,0,0,0,0,0,1,0,1,0,1","\r"); //destination type
+
+       pending = tcore_pending_new(o, 0);
+
+       req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+
+    ur_dup = tcore_user_request_ref(ur);
+
+       ret = _call_request_message (pending, o, ur_dup, on_confirmation_call_set_source_sound_path, NULL);
+
+       g_free(cmd_str);
+
+       if (!ret)
+    {
+               dbg("At request(%s) sent failed",req->cmd);
+               return TCORE_RETURN_FAILURE;
+       }
+
+    pending1 = tcore_pending_new(o, 0);
+
+    req1 = tcore_at_request_new(cmd_str1,"+XDRV", TCORE_AT_SINGLELINE);
+
+       dbg("input command is %s",cmd_str1);
+
+    dbg("req-cmd : %s, prefix(if any) :%s, cmd_len : %d", req1->cmd, req1->prefix, strlen(req1->cmd));
+
+    tcore_pending_set_request_data(pending1, 0, req1);
+
+       ret = _call_request_message(pending1, o, ur, on_confirmation_call_set_destination_sound_path, NULL);
+
+       g_free(cmd_str1);
+
+       if (!ret)
+       {
+               dbg("AT request %s has failed ",req1->cmd);
+               return TCORE_RETURN_FAILURE;
+       }
+
+    return TCORE_RETURN_SUCCESS;
+
+}
+
+static TReturn s_call_set_sound_volume_level(CoreObject *o, UserRequest *ur)
+{
+       UserRequest *src_ur = NULL;
+       UserRequest *dest_ur = NULL;
+
+       TcorePending *src_pending = NULL;
+       TcorePending *dest_pending = NULL;
+
+       TcoreATRequest *src_req = NULL;
+       TcoreATRequest *dest_req = NULL;
+
+       char *cmd_str = NULL;
+
+       gboolean ret = FALSE;
+       dbg("Entry");
+
+       /* Hard-coded values for MIC & Speakers */
+
+       /* Source volume */
+       dbg("Set Source volume");
+
+       cmd_str = g_strdup_printf("%s%s", "AT+XDRV=40,7,3,88", "\r");   /* Source type */
+       dbg("Request command string: %s", cmd_str);
+
+       /* Create new Pending request */
+       src_pending = tcore_pending_new(o, 0);
+
+       /* Create new AT-Command request */
+       src_req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE);
+       dbg("Command: %s, prefix(if any): %s, Command length: %d", src_req->cmd, src_req->prefix, strlen(src_req->cmd));
+
+       /* Free Command string */
+       g_free(cmd_str);
+
+       tcore_pending_set_request_data(src_pending, 0, src_req);
+       src_ur = tcore_user_request_ref(ur);
+
+       /* Send request */
+       ret = _call_request_message (src_pending, o, src_ur, on_confirmation_call_set_source_sound_volume_level, NULL);
+       if (!ret) {
+               err("Failed to send AT-Command request");
+               return TCORE_RETURN_FAILURE;
+       }
+
+       cmd_str = g_strdup_printf("%s%s", "AT+XDRV=40,7,0,88", "\r");   /* Destination type */
+       dbg("Request command string: %s", cmd_str);
+
+       /* Create new Pending request */
+       src_pending = tcore_pending_new(o, 0);
+
+       /* Create new AT-Command request */
+       src_req = tcore_at_request_new(cmd_str,"+XDRV", TCORE_AT_SINGLELINE);
+       dbg("Command: %s, prefix(if any): %s, Command length: %d", src_req->cmd, src_req->prefix, strlen(src_req->cmd));
+
+       /* Free Command string */
+       g_free(cmd_str);
+
+       tcore_pending_set_request_data(src_pending, 0, src_req);
+
+       src_ur= tcore_user_request_ref(ur);
+
+       /* Send request */
+       ret = _call_request_message(src_pending, o, src_ur, on_confirmation_call_set_source_sound_volume_level, NULL);
+       if (!ret) {
+               err("Failed to send AT-Command request");
+               return TCORE_RETURN_FAILURE;
+       }
+
+       /* Destination volume */
+       dbg("Set Source volume");
+
+       cmd_str = g_strdup_printf("%s%s", "AT+XDRV=40,8,0,88", "\r");   /* Source type */
+       dbg("Request command string: %s", cmd_str);
+
+       /* Create new Pending request */
+       dest_pending = tcore_pending_new(o, 0);
+
+       /* Create new AT-Command request */
+       dest_req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE);
+       dbg("Command: %s, prefix(if any): %s, Command length: %d", dest_req->cmd, dest_req->prefix, strlen(dest_req->cmd));
+
+       /* Free Command string */
+       g_free(cmd_str);
+
+       tcore_pending_set_request_data(dest_pending, 0, dest_req);
+       dest_ur = tcore_user_request_ref(ur);
+
+       /* Send request */
+       ret = _call_request_message (dest_pending, o, dest_ur, on_confirmation_call_set_source_sound_volume_level, NULL);
+       if (!ret) {
+               err("Failed to send AT-Command request");
+               return TCORE_RETURN_FAILURE;
+       }
+
+       cmd_str = g_strdup_printf("%s%s", "AT+XDRV=40,8,2,88", "\r");   /* Destination type */
+       dbg("Request command string: %s", cmd_str);
+
+       /* Create new Pending request */
+       dest_pending = tcore_pending_new(o, 0);
+
+       /* Create new AT-Command request */
+       dest_req = tcore_at_request_new(cmd_str,"+XDRV", TCORE_AT_SINGLELINE);
+       dbg("Command: %s, prefix(if any): %s, Command length: %d", dest_req->cmd, dest_req->prefix, strlen(dest_req->cmd));
+
+       /* Free Command string */
+       g_free(cmd_str);
+
+       tcore_pending_set_request_data(dest_pending, 0, dest_req);
+
+       /* Send request */
+       ret = _call_request_message(dest_pending, o, ur, on_confirmation_call_set_destination_sound_volume_level, NULL);
+       if (!ret) {
+               err("Failed to send AT-Command request");
+               return TCORE_RETURN_FAILURE;
+       }
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+
+static TReturn s_call_get_sound_volume_level(CoreObject *o, UserRequest *ur)
+{
+       dbg("Entry");
+
+       dbg("Exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_call_mute(CoreObject *o, UserRequest *ur)
+{
+       char *cmd_str = NULL;
+       TcorePending *pending = NULL;
+       TcoreATRequest *req = NULL;
+       gboolean ret = FALSE;
+       dbg("Entry");
+
+    cmd_str = g_strdup_printf("%s%s","AT+XDRV=40,8,0,0,0","\r");
+
+       dbg("Request command string: %s", cmd_str);
+
+       /* Create new Pending request */
+       pending = tcore_pending_new(o, 0);
+
+       /* Create new AT-Command request */
+       req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE);
+       dbg("Command: %s, prefix(if any): %s, Command length: %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       /* Free command string */
+       g_free(cmd_str);
+
+       /* Set request data (AT command) to Pending request */
+       tcore_pending_set_request_data(pending, 0, req);
+
+       /* Send request */
+       ret = _call_request_message (pending, o, ur, on_confirmation_call_mute, NULL);
+       if (!ret) {
+               err("Failed to send AT-Command request");
+               return TCORE_RETURN_FAILURE;
+       }
+
+       dbg("Exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_call_unmute(CoreObject *o, UserRequest *ur)
+{
+       char *cmd_str = NULL;
+       TcorePending *pending = NULL;
+       TcoreATRequest *req = NULL;
+       gboolean ret = FALSE;
+       dbg("Entry");
+
+    cmd_str = g_strdup_printf("%s%s","AT+XDRV=40,8,0,0,88","\r");
+
+       dbg("Request command string: %s", cmd_str);
+
+       /* Create new Pending request */
+       pending = tcore_pending_new(o, 0);
+
+       /* Create new AT-Command request */
+       req = tcore_at_request_new(cmd_str, "+XDRV", TCORE_AT_SINGLELINE);
+       dbg("Command: %s, prefix(if any): %s, Command length: %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       /* Free command string */
+       g_free(cmd_str);
+
+       /* Set request data (AT command) to Pending request */
+       tcore_pending_set_request_data(pending, 0, req);
+
+       /* Send request */
+       ret = _call_request_message (pending, o, ur, on_confirmation_call_unmute, NULL);
+       if (!ret) {
+               err("Failed to send AT-Command request");
+               return TCORE_RETURN_FAILURE;
+       }
+
+       dbg("Exit");
+       return TCORE_RETURN_SUCCESS;
+
+}
+
+
+static TReturn s_call_get_mute_status(CoreObject *o, UserRequest *ur)
+{
+       dbg("Entry");
+
+       dbg("Exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn _set_dtmf_tone_duration(CoreObject *o, UserRequest *ur)
+{
+       char *cmd_str = NULL;
+       TcorePending *pending = NULL;
+       TcoreATRequest *req = NULL;
+       gboolean ret = FALSE;
+       dbg("Entry");
+
+       cmd_str = g_strdup_printf("%s%s", "AT+VTD=3", "\r"); /* ~300 mili secs. +VTD= n, where  n = (0 - 255) * 1/10 secs. */
+       dbg("Request command string: %s", cmd_str);
+
+       /* Create new Pending request */
+       pending = tcore_pending_new(o, 0);
+
+       /* Create new AT-Command request */
+       req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+       dbg("Command: %s, prefix(if any): %s, Command length: %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       /* Free command string */
+       g_free(cmd_str);
+
+       /* Set request data (AT command) to Pending request */
+       tcore_pending_set_request_data(pending, 0, req);
+
+       /* Send request */
+       ret = _call_request_message (pending, o, ur, _on_confirmation_dtmf_tone_duration, NULL);
+       if (!ret) {
+               err("Failed to send AT-Command request");
+               return TCORE_RETURN_FAILURE;
+       }
+
+       dbg("Exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+/* Call Operations */
+static struct tcore_call_operations call_ops = {
+       .dial                                       = s_call_outgoing,
+       .answer                                     = s_call_answer,
+       .end                                        = s_call_release,
+       .hold                                       = s_call_hold,
+       .active                                     = s_call_active,
+       .swap                                       = s_call_swap,
+       .join                                       = s_call_join,
+       .split                                      = s_call_split,
+       .deflect                                    = s_call_deflect,
+       .transfer                                   = s_call_transfer,
+       .send_dtmf                                  = s_call_send_dtmf,
+       .set_sound_path                     = s_call_set_sound_path,
+       .set_sound_volume_level     = s_call_set_sound_volume_level,
+       .get_sound_volume_level     = s_call_get_sound_volume_level,
+       .mute                                       = s_call_mute,
+       .unmute                                     = s_call_unmute,
+       .get_mute_status                    = s_call_get_mute_status,
+       .set_sound_recording        = NULL,
+       .set_sound_equalization     = NULL,
+       .set_sound_noise_reduction      = NULL,
+};
+
+static void s_call_info_mo_waiting(CoreObject *o)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_current_on_mo_processing(o);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_WAITING,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_mo_forwarded(CoreObject *o)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_current_on_mo_processing(o);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_FORWARDED,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_mo_barred_incoming(CoreObject *o)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_current_on_mo_processing(o);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_BARRED_INCOMING,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_mo_barred_outgoing(CoreObject *o)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_current_on_mo_processing(o);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_BARRED_OUTGOING,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_mo_deflected(CoreObject *o)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_current_on_mo_processing(o);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_DEFLECTED,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_mo_clir_suppression_reject(CoreObject *o)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_current_on_mo_processing(o);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_CLIR_SUPPRESSION_REJECT,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_mo_cfu(CoreObject *o)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_current_on_mo_processing(o);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_FORWARD_UNCONDITIONAL,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_mo_cfc(CoreObject *o)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_current_on_mo_processing(o);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_FORWARD_CONDITIONAL,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_mt_cli(CoreObject *o, enum tcore_call_cli_mode mode, char* number)
+{
+       CallObject *co = NULL;
+       dbg("Entry");
+
+       /* Call Core object */
+       co = tcore_call_object_current_on_mt_processing(o);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Set CLI information */
+       tcore_call_object_set_cli_info(co, mode, number);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_mt_cna(CoreObject *o, enum tcore_call_cna_mode mode, char* name, int dcs)
+{
+       CallObject *co = NULL;
+       dbg("Entry");
+
+       /* Call Core object */
+       co = tcore_call_object_current_on_mt_processing(o);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Set CNA information */
+       tcore_call_object_set_cna_info(co, mode, name, dcs);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_mt_forwarded_call(CoreObject *o, char* number)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_find_by_number(o, number);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_FORWARDED_CALL,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_mt_deflected_call(CoreObject *o, char* number)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_find_by_number(o, number);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_DEFLECTED_CALL,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_mt_transfered(CoreObject *o, char* number)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_find_by_number(o, number);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_TRANSFERED_CALL,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_held(CoreObject *o, char* number)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_find_by_number(o, number);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_HELD,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_active(CoreObject *o, char* number)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_find_by_number(o, number);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_ACTIVE,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_joined(CoreObject *o, char* number)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_find_by_number(o, number);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_JOINED,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_released_on_hold(CoreObject *o, char* number)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_find_by_number(o, number);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_RELEASED_ON_HOLD,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_transfer_alert(CoreObject *o, char* number)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_find_by_number(o, number);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_TRANSFER_ALERT,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_transfered(CoreObject *o, char* number)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_find_by_number(o, number);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_TRANSFERED,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+static void s_call_info_cf_check_message(CoreObject *o, char* number)
+{
+       TcorePlugin *p = NULL;
+       CallObject *co = NULL;
+       int id = 0;
+       dbg("Entry");
+
+       /* Parent plugin */
+       p = tcore_object_ref_plugin(o);
+
+       /* Call Core object */
+       co = tcore_call_object_find_by_number(o, number);
+       if (!co) {
+               err("Failed to find Call Core object!");
+               return;
+       }
+
+       /* Call ID */
+       id = tcore_call_object_get_id(co);
+
+       /* Send notification to TAPI */
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                                                                       tcore_plugin_ref_core_object(p, "call"),
+                                                                       TNOTI_CALL_INFO_CF_CHECK_MESSAGE,
+                                                                       sizeof(unsigned int),
+                                                                       (void*)&id);
+
+       dbg("Exit");
+       return;
+}
+
+/* Call Information Operations */
+static struct tcore_call_information_operations call_information_ops = {
+       .mo_call_col                            = 0,
+       .mo_call_waiting                        = s_call_info_mo_waiting,
+       .mo_call_cug                            = 0,
+       .mo_call_forwarded                  = s_call_info_mo_forwarded,
+       .mo_call_barred_incoming        = s_call_info_mo_barred_incoming,
+       .mo_call_barred_outgoing        = s_call_info_mo_barred_outgoing,
+       .mo_call_deflected                      = s_call_info_mo_deflected,
+       .mo_call_clir_suppression_reject = s_call_info_mo_clir_suppression_reject,
+       .mo_call_cfu                            = s_call_info_mo_cfu,
+       .mo_call_cfc                            = s_call_info_mo_cfc,
+       .mt_call_cli                            = s_call_info_mt_cli,
+       .mt_call_cna                            = s_call_info_mt_cna,
+       .mt_call_forwarded_call         = s_call_info_mt_forwarded_call,
+       .mt_call_cug_call                       = 0,
+       .mt_call_deflected_call         = s_call_info_mt_deflected_call,
+       .mt_call_transfered                     = s_call_info_mt_transfered,
+       .call_held                                      = s_call_info_held,
+       .call_active                            = s_call_info_active,
+       .call_joined                            = s_call_info_joined,
+       .call_released_on_hold          = s_call_info_released_on_hold,
+       .call_transfer_alert            = s_call_info_transfer_alert,
+       .call_transfered                        = s_call_info_transfered,
+       .call_cf_check_message          = s_call_info_cf_check_message,
+};
+
+gboolean s_call_init(TcorePlugin *p, TcoreHal *h)
+{
+       CoreObject *o = NULL;
+       struct property_call_info *data = NULL;
+       dbg("Entry");
+
+       /* Creating Call COre object */
+       o = tcore_call_new(p, "call", &call_ops, h);
+       if (!o) {
+               err("Failed to create Call Core Object");
+               return FALSE;
+       }
+
+       /* Set Call Operations */
+       tcore_call_information_set_operations(o, &call_information_ops);
+
+       /* Add Callbacks */
+       tcore_object_add_callback(o, "+XCALLSTAT", on_notification_call_info, NULL);
+       tcore_object_add_callback(o, "+CLIP", on_notification_call_clip_info, NULL);
+
+       /* User Data */
+       data = calloc(sizeof(struct property_call_info *), 1);
+       tcore_plugin_link_property(p, "CALL", data);
+
+       dbg("Exit");
+       return TRUE;
+}
+
+void s_call_exit(TcorePlugin *p)
+{
+       CoreObject *o = NULL;
+       struct property_network_info *data = NULL;
+       dbg("Entry");
+
+       o = tcore_plugin_ref_core_object(p, "call");
+
+       /* Free Call Core Object */
+       tcore_call_free(o);
+
+       /* Free 'CALL' property */
+       data = tcore_plugin_ref_property(p, "CALL");
+       if (data) {
+               g_free(data);
+       }
+
+       dbg("Exit");
+       return;
+}
diff --git a/src/s_common.c b/src/s_common.c
new file mode 100755 (executable)
index 0000000..f9a6075
--- /dev/null
@@ -0,0 +1,199 @@
+/**
+ * tel-plugin-samsung
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of SAMSUNG ELECTRONICS ("Confidential Information").
+ * You shall not disclose such Confidential Information and shall
+ * use it only in accordance with the terms of the license agreement you entered into with SAMSUNG ELECTRONICS.
+ * SAMSUNG make no representations or warranties about the suitability
+ * of the software, either express or implied, including but not
+ * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement.
+ * SAMSUNG shall not be liable for any damages suffered by licensee as
+ * a result of using, modifying or distributing this software or its derivatives.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <glib.h>
+
+
+#include "s_common.h"
+
+#include <plugin.h>
+
+
+void util_hex_dump(char *pad, int size, const void *data)
+{
+       char buf[255] = {0, };
+       char hex[4] = {0, };
+       int i;
+       unsigned char *p;
+
+       if (size <= 0) {
+               msg("%sno data", pad);
+               return;
+       }
+
+       p = (unsigned char *)data;
+
+       snprintf(buf, 255, "%s%04X: ", pad, 0);
+       for (i = 0; i<size; i++) {
+               snprintf(hex, 4, "%02X ", p[i]);
+               strcat(buf, hex);
+
+               if ((i + 1) % 8 == 0) {
+                       if ((i + 1) % 16 == 0) {
+                               msg("%s", buf);
+                               memset(buf, 0, 255);
+                               snprintf(buf, 255, "%s%04X: ", pad, i + 1);
+                       }
+                       else {
+                               strcat(buf, "  ");
+                       }
+               }
+       }
+
+       msg("%s", buf);
+}
+
+void hook_hex_dump(enum direction_e d, int size, const void *data)
+{
+       msg("=== TX data DUMP =====");
+       util_hex_dump("          ", size, data);
+       msg("=== TX data DUMP =====");
+
+}
+
+unsigned int util_assign_message_sequence_id(TcorePlugin *p)
+{
+       struct global_data *gd;
+
+       if (!p) {
+               dbg("plugin is NULL");
+               return -1;
+       }
+
+       gd = tcore_plugin_ref_user_data(p);
+       if (!gd) {
+               dbg("global data is NULL");
+               return -1;
+       }
+
+       if (gd->msg_auto_id_current == 0) {
+               gd->msg_auto_id_current = gd->msg_auto_id_start;
+               dbg("pending_auto_id_current is 0, reset to start");
+       }
+       else if (gd->msg_auto_id_current >= gd->msg_auto_id_end) {
+               gd->msg_auto_id_current = gd->msg_auto_id_start;
+               dbg("pending_auto_id_current is over, reset to start");
+       }
+       else {
+               gd->msg_auto_id_current++;
+       }
+
+       dbg("message_sequence_id = %d", gd->msg_auto_id_current);
+
+       return gd->msg_auto_id_current;
+}
+
+gboolean util_add_waiting_job(GQueue *queue, unsigned int id, UserRequest *ur)
+{
+       struct work_queue_data *wqd;
+
+       if (!queue)
+               return FALSE;
+
+       wqd = calloc(sizeof(struct work_queue_data), 1);
+       if (!wqd)
+               return FALSE;
+
+       wqd->id = id;
+       wqd->ur = tcore_user_request_ref(ur);
+       g_queue_push_tail(queue, wqd);
+
+       dbg("id = %d, ur = 0x%x", wqd->id, wqd->ur);
+       return TRUE;
+}
+
+UserRequest *util_pop_waiting_job(GQueue *queue, unsigned int id)
+{
+       int i = 0;
+       UserRequest *ur;
+       struct work_queue_data *wqd;
+
+       if (!queue)
+               return NULL;
+
+
+       dbg("before waiting job count: %d", g_queue_get_length(queue));
+
+       do {
+               wqd = g_queue_peek_nth(queue, i);
+               if (!wqd)
+                       return NULL;
+
+               if (wqd->id == id) {
+                       wqd = g_queue_pop_nth(queue, i);
+                       break;
+               }
+
+               i++;
+       } while (wqd != NULL);
+
+       dbg("after  waiting job count: %d", g_queue_get_length(queue));
+
+       if (!wqd)
+               return NULL;
+
+       ur = wqd->ur;
+       free(wqd);
+
+       return ur;
+}
+
+unsigned char util_hexCharToInt(char c)
+{
+    if (c >= '0' && c <= '9')
+        return (c - '0');
+    else if (c >= 'A' && c <= 'F')
+        return (c - 'A' + 10);
+    else if (c >= 'a' && c <= 'f')
+        return (c - 'a' + 10);
+    else
+    {
+        dbg("invalid charater!!");
+        return -1;
+    }
+}
+
+char * util_hexStringToBytes(char * s)
+{
+    char * ret;
+    int     i;
+    int         sz;
+
+    if(s == NULL)
+        return NULL;
+
+        sz = strlen(s);
+
+    ret = malloc(sz /2);
+
+    dbg("Convert String to Binary!!");
+
+    for(i = 0; i < sz; i += 2)
+    {
+        ret[i/2] = (char)((util_hexCharToInt(s[i]) << 4) | util_hexCharToInt(s[i + 1]));
+        dbg("[%02x]", ret[i/2]);
+    }
+
+    return ret;
+}
+
diff --git a/src/s_modem.c b/src/s_modem.c
new file mode 100755 (executable)
index 0000000..d11cdd4
--- /dev/null
@@ -0,0 +1,961 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <hal.h>
+#include <core_object.h>
+#include <plugin.h>
+#include <queue.h>
+#include <co_modem.h>
+#include <storage.h>
+#include <server.h>
+#include <at.h>
+
+#include "s_common.h"
+#include "s_modem.h"
+
+#define ID_RESERVED_AT 0x0229
+
+#define MAX_VERSION_LEN        32
+#define TAPI_MISC_ME_SN_LEN_MAX                                32
+#define TAPI_MISC_PRODUCT_CODE_LEN_MAX         32
+#define TAPI_MISC_MODEL_ID_LEN_MAX                     17
+#define TAPI_MISC_PRL_ERI_VER_LEN_MAX          17
+
+#define CPAS_RES_READY                 0
+#define CPAS_RES_UNAVAIL               1
+#define CPAS_RES_UNKNOWN               2
+#define CPAS_RES_RINGING               3
+#define CPAS_RES_CALL_PROGRESS 4
+#define CPAS_RES_ASLEEP           5
+#define AT_VER_LEN 20
+
+
+enum cp_state {
+       CP_STATE_OFFLINE,
+       CP_STATE_CRASH_RESET,
+       CP_STATE_CRASH_EXIT,
+       CP_STATE_BOOTING,
+       CP_STATE_ONLINE,
+       CP_STATE_NV_REBUILDING,
+       CP_STATE_LOADER_DONE,
+};
+
+typedef enum {
+       TAPI_MISC_ME_IMEI = 0x00, /**< 0x00: IMEI, GSM/UMTS device */
+       TAPI_MISC_ME_ESN = 0x01, /**< 0x01: ESN(Electronic Serial Number), It`s essentially run out. CDMA device */
+       TAPI_MISC_ME_MEID = 0x02, /**< 0x02: MEID, This value can have hexa decimal digits. CDMA device */
+       TAPI_MISC_ME_MAX = 0xff /**< 0xff: reserved */
+} TelMiscSNIndexType_t;
+
+typedef struct {
+       TelMiscSNIndexType_t sn_index; /**< serial number index */
+       int sn_len; /**< Length */
+       unsigned char szNumber[TAPI_MISC_ME_SN_LEN_MAX]; /**< Number */
+} TelMiscSNInformation;
+
+/**
+ * Mobile Equipment Version Information
+ */
+typedef struct {
+       unsigned char ver_mask; /**< version mask  - 0x01:SW_ver, 0x02:HW_ver, 0x04:RF_CAL_date, 0x08:Product_code, 0x10:Model_ID, 0x20:PRL, 0x04:ERI, 0xff:all */
+       unsigned char szSwVersion[MAX_VERSION_LEN]; /**< Software version, null termination */
+       unsigned char szHwVersion[MAX_VERSION_LEN]; /**< Hardware version, null termination */
+       unsigned char szRfCalDate[MAX_VERSION_LEN]; /**< Calculation Date, null termination */
+       unsigned char szProductCode[TAPI_MISC_PRODUCT_CODE_LEN_MAX]; /**< product code, null termination */
+       unsigned char szModelId[TAPI_MISC_MODEL_ID_LEN_MAX]; /**< model id (only for CDMA), null termination */
+       unsigned char prl_nam_num; /**< number of PRL NAM fields */
+       unsigned char szPrlVersion[TAPI_MISC_PRL_ERI_VER_LEN_MAX * 3];/**< prl version (only for CDMA), null termination */
+       unsigned char eri_nam_num; /**< number of PRL NAM fields */
+       unsigned char szEriVersion[TAPI_MISC_PRL_ERI_VER_LEN_MAX * 3];/**< eri version (only for CDMA), null termination */
+} TelMiscVersionInformation;
+
+void prepare_and_send_pending_request(TcorePlugin *plugin, char *co_name, const char *at_cmd, const char* prefix, enum tcore_at_command_type at_cmd_type, TcorePendingResponseCallback callback);
+static void on_confirmation_modem_message_send(TcorePending *p, gboolean result, void *user_data); // from Kernel
+void on_response_bootup_subscription(TcorePending *p, gboolean result, void *user_data);
+void on_response_last_bootup_subscription(TcorePending *p, gboolean result, void *user_data);
+static void on_timeout_modem_poweron(TcorePending *p, void *user_data);
+
+static void on_timeout_modem_poweron(TcorePending *p, void *user_data)
+{
+       unsigned int data_len = 0;
+       char data[] = "AT+CPAS\r";                      
+       dbg("TIMEOUT for 1st AT Command !!!!! NO Response for initial AT command. Resending it");       
+       data_len = sizeof(data);
+       
+       /* Retransmit 1st AT command directly via HAL, don't disturb pending queue. */
+       /* HAL was passed as user_data, re-use it */
+       if (user_data) 
+       {
+               tcore_hal_send_data(user_data, data_len, (void *)data); 
+       }
+}
+
+static void on_confirmation_modem_message_send(TcorePending *p, gboolean result, void *user_data)
+{
+       dbg("on_confirmation_modem_message_send - msg out from queue.\n");
+
+       if (result == FALSE) {
+               /* Fail */
+               dbg("SEND FAIL");
+       }
+       else {
+               dbg("SEND OK");
+       }
+}
+
+void prepare_and_send_pending_request(TcorePlugin *plugin, char *co_name, const char *at_cmd, const char* prefix, enum tcore_at_command_type at_cmd_type, TcorePendingResponseCallback callback)
+{
+       TcoreATRequest *req = NULL;
+       TcoreHal *hal;
+       CoreObject *o= NULL;
+       TcorePending *pending = NULL;
+       TReturn ret;
+       
+       o = tcore_plugin_ref_core_object(plugin, co_name);
+       hal = tcore_object_get_hal(o);
+       
+       pending = tcore_pending_new(o, 0);
+       if(!pending)
+               dbg("Pending is NULL");
+       req = tcore_at_request_new(at_cmd, prefix, at_cmd_type);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, callback, NULL);
+       tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL);
+       tcore_pending_link_user_request(pending, NULL); //set user request to NULL - this is intenal request
+       ret = tcore_hal_send_request(hal, pending);
+       return;
+}
+
+void on_response_bootup_subscription(TcorePending *p, gboolean result, void *user_data)
+{      
+       dbg("enry of on_response_bootup_subscription() - response comes\n");
+
+       if (result == FALSE) {
+               /* Fail */
+               dbg("result ERROR");
+       }
+       else {
+               dbg("result OK");
+       }
+}
+
+void on_response_last_bootup_subscription(TcorePending *p, gboolean result, void *user_data)
+{
+       dbg("enry of on_response_last_bootup_subscription() - final response comes\n");
+
+       if (result == FALSE) {
+               /* Fail */
+               dbg("SEND FAIL");
+       }
+       else {
+               dbg("SEND OK");
+       }
+       
+       dbg("Response for AT+CLIP. Boot-up configration completed for IMC modem. Bring CP to online based on Flightmode status\n");
+       on_event_modem_power(NULL, NULL, tcore_pending_ref_plugin(p));
+}
+
+
+
+static void on_response_power_off(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       CoreObject *o = 0;
+       TcoreHal *h = 0;
+       o = tcore_pending_ref_core_object(p);
+       h = tcore_object_get_hal(o);
+
+       dbg("modem power off");
+
+       tcore_hal_set_power_state(h, FALSE);
+}
+
+static void on_response_set_flight_mode(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       CoreObject *o = user_data;
+       UserRequest *ur = NULL;
+       const TcoreATResponse *resp = data;
+       GSList *tokens=NULL;
+       const char *line;
+       struct tresp_modem_set_flightmode res;
+       GQueue *queue;
+       int err;
+       int response;
+       struct tnoti_modem_flight_mode modem_flight_mode;
+
+       o = tcore_pending_ref_core_object(p);
+
+       
+       if(resp->success > 0){
+               dbg("RESPONSE OK - flight mode operation finished");
+               res.result = TCORE_RETURN_SUCCESS;
+       }
+       else    {
+               dbg("RESPONSE NOK");
+               line = (const char*)resp->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1) {
+                       dbg("err cause not specified or string corrupted");
+                       res.result = TCORE_RETURN_3GPP_ERROR;
+               }
+               else    {
+                       response = atoi(g_slist_nth_data(tokens, 0));
+                       /* TODO: CMEE error mapping is required. */
+                       res.result = TCORE_RETURN_3GPP_ERROR;
+               }
+       }
+
+       ur = tcore_pending_ref_user_request(p);
+       if(NULL == ur){
+               dbg("No user request ");
+       }
+       else    {
+               tcore_user_request_send_response(ur, TRESP_MODEM_SET_FLIGHTMODE, sizeof(struct tresp_modem_set_flightmode), &res);
+       }
+
+       if(resp->success > 0){  
+               modem_flight_mode.enable = tcore_modem_get_flight_mode_state(o);
+               
+               dbg("sucess case - Sending Flight Mode Notification (%d) to Server",modem_flight_mode.enable);
+               
+               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_MODEM_FLIGHT_MODE,
+                               sizeof(struct tnoti_modem_flight_mode), &modem_flight_mode);
+       }
+       
+       tcore_at_tok_free(tokens);
+}
+
+static void on_response_imei(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse* resp = data;
+       TcorePlugin *plugin;
+       struct tresp_modem_get_imei res;
+       TelMiscSNInformation *imei_property;
+       UserRequest* ur = NULL;
+       GSList *tokens=NULL;
+       const char *line;
+       int response;
+       int err;
+
+       memset(&res, 0, sizeof(struct tresp_modem_get_imei));
+
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) != 1) {
+                               msg("invalid message");
+                               goto OUT;
+                       }
+               }
+               res.result = TCORE_RETURN_SUCCESS;
+               strncpy(res.imei, g_slist_nth_data(tokens, 0), 16);
+
+               dbg("imei = [%s]", res.imei);
+
+               plugin = tcore_pending_ref_plugin(p);
+               imei_property = tcore_plugin_ref_property(plugin, "IMEI");
+               if (imei_property)
+               {
+                       imei_property->sn_index = TAPI_MISC_ME_IMEI;
+                       imei_property->sn_len = strlen(res.imei);
+                       memcpy(imei_property->szNumber, res.imei, imei_property->sn_len);
+               }
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+               }
+
+               memset(&res, 0, sizeof(struct tresp_modem_get_version));
+
+
+               if (g_slist_length(tokens) < 1) {
+                       dbg("err cause not specified or string corrupted");
+                   res.result = TCORE_RETURN_3GPP_ERROR;
+               }
+               else
+               {
+                       response = atoi(g_slist_nth_data(tokens, 0));
+                       /* TODO: CMEE error mapping is required. */
+               res.result = TCORE_RETURN_3GPP_ERROR;
+               }
+       }
+
+       ur = tcore_pending_ref_user_request(p); 
+       tcore_user_request_send_response(ur, TRESP_MODEM_GET_IMEI, sizeof(struct tresp_modem_get_imei), &res);  
+
+OUT:
+       tcore_at_tok_free(tokens);
+
+}
+
+static void on_response_version(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       TcorePlugin *plugin;
+       TelMiscVersionInformation *vi;
+       TelMiscVersionInformation *vi_property;
+       struct tresp_modem_get_version res;
+       UserRequest *ur;
+       GSList* tokens = NULL;
+       const char* line=NULL;
+       char *swver= NULL,*hwver=NULL, *caldate=NULL,*pcode=NULL,*id=NULL;
+
+       int response, err;
+
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) != 5) {
+                               msg("invalid message");
+                               goto OUT;
+                       }
+               }
+
+               swver = g_slist_nth_data(tokens, 0);
+               hwver = g_slist_nth_data(tokens, 1);
+               caldate = g_slist_nth_data(tokens, 2);
+               pcode = g_slist_nth_data(tokens, 3);
+               id = g_slist_nth_data(tokens, 4);
+
+               dbg("version: sw=[%s], hw=[%s], rf_cal=[%s], product_code=[%s], model_id=[%s]", swver, hwver, caldate, pcode, id);
+
+               vi = calloc(sizeof(TelMiscVersionInformation), 1);
+               if(NULL!=swver)
+                       memcpy(vi->szSwVersion, swver, strlen(swver));
+               if(NULL!=hwver)
+                       memcpy(vi->szHwVersion, hwver, strlen(hwver));
+               if(NULL!=caldate)
+                       memcpy(vi->szRfCalDate, caldate, strlen(caldate));
+               if(NULL!=pcode)
+                       memcpy(vi->szProductCode, pcode,strlen(pcode));
+               if(NULL!=id)
+                       memcpy(vi->szModelId, id, strlen(id));
+
+               memset(&res, 0, sizeof(struct tresp_modem_get_version));
+
+               if(NULL!=swver)         
+                       snprintf(res.software, (AT_VER_LEN >strlen(swver) ?strlen(swver):AT_VER_LEN), "%s", swver);
+               if(NULL!=hwver)
+                       snprintf(res.hardware, (AT_VER_LEN >strlen(hwver) ?strlen(hwver):AT_VER_LEN), "%s", hwver);
+
+               plugin = tcore_pending_ref_plugin(p);
+               vi_property = tcore_plugin_ref_property(plugin, "VERSION");
+               memcpy(vi_property, vi, sizeof(TelMiscVersionInformation));
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+               }
+
+               memset(&res, 0, sizeof(struct tresp_modem_get_version));
+
+
+               if (g_slist_length(tokens) < 1) {
+                       dbg("err cause not specified or string corrupted");
+                   res.result = TCORE_RETURN_3GPP_ERROR;
+               }
+               else
+               {
+                       response = atoi(g_slist_nth_data(tokens, 0));
+                       /* TODO: CMEE error mapping is required. */
+               res.result = TCORE_RETURN_3GPP_ERROR;
+               }
+       }
+
+       ur = tcore_pending_ref_user_request(p);
+       tcore_user_request_send_response(ur, TRESP_MODEM_GET_VERSION, sizeof(struct tresp_modem_get_version), &res);
+
+OUT:
+       tcore_at_tok_free(tokens);
+
+}
+
+static gboolean on_event_bootup_sim_status(CoreObject *o, const void *event_info, void *user_data)
+{
+       GSList *tok = NULL;
+       GSList *lines = NULL;
+       int value = -1;
+       char* line = NULL;
+
+       lines = (GSList*)event_info;
+       if (1 != g_slist_length(lines)) {
+               dbg("unsolicited msg but multiple line");
+           goto OUT;
+       }
+       line  = (char*)(lines->data);
+       dbg("on_bootup_event_sim_status notification : %s", line);
+
+       tok = tcore_at_tok_new(line);
+       value = atoi(g_slist_nth_data(tok, 0));
+
+       if(7 == value){
+               dbg("SIM ready. request COPS & remove callback");
+               prepare_and_send_pending_request(tcore_object_ref_plugin(o), "umts_network", "AT+COPS=0", NULL, TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+               return FALSE;
+       }
+
+OUT:
+       return TRUE;
+}
+
+
+
+gboolean on_event_modem_power(TcoreAT *at, const char *line, TcorePlugin *p)
+{
+       CoreObject *o;
+       struct treq_modem_set_flightmode flight_mode_set;
+       struct tnoti_modem_power modem_power;
+       TcoreHal *h;
+       Storage *strg;
+       
+       o = tcore_plugin_ref_core_object(p, "modem");
+       
+       strg = tcore_server_find_storage(tcore_plugin_ref_server(p), "vconf");
+       flight_mode_set.enable = tcore_storage_get_bool(strg, STORAGE_KEY_SETAPPL_FLIGHT_MODE_BOOL);
+
+       tcore_hal_set_power_state(h, TRUE);
+       
+       /* Set Flight mode as per AP settings */
+       if (flight_mode_set.enable)
+       { /* Radio Off */
+               prepare_and_send_pending_request(p, "modem", "AT+CFUN=4", NULL, TCORE_AT_NO_RESULT, on_response_set_flight_mode);
+               tcore_modem_set_flight_mode_state(o, TRUE);
+       }
+       else
+       {/* Radio On */
+               prepare_and_send_pending_request(p, "modem", "AT+CFUN=1", NULL, TCORE_AT_NO_RESULT, on_response_set_flight_mode);
+               tcore_modem_set_flight_mode_state(o, FALSE);
+       }
+               
+       /* Get IMEI */
+       prepare_and_send_pending_request(p, "modem", "AT+CGSN", NULL, TCORE_AT_NUMERIC, on_response_imei);
+
+       /* Get Version Number  */
+       prepare_and_send_pending_request(p, "modem", "AT+CGMR", NULL, TCORE_AT_SINGLELINE, on_response_version);
+       
+       tcore_modem_set_powered(o, TRUE);
+
+       modem_power.state = MODEM_STATE_ONLINE;
+
+       tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_MODEM_POWER,
+                       sizeof(struct tnoti_modem_power), &modem_power);
+
+       return TRUE;
+}
+
+
+#ifdef ENABLE_CMUX
+
+static void on_response_setupmux(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       TcorePlugin *plugin = NULL;
+       
+       plugin = tcore_pending_ref_plugin(p);
+       
+       /* TODO: Initialize MUX module.
+        *       Append each MUX HAL to each Co-Object while initialization.
+        * API: tcore_object_set_hal(CoreObject *o, TcoreHal *h)
+        *
+        * After MUX setup, AT parse functionality of PHY HAL
+        * should be disabled.
+        * e.g.) plugin = tcore_pending_ref_plugin((TcorePending*) p);
+        *       hal    = tcore_plugin_ref_hal((TcorePlugin*) plugin);
+        *       tcore_hal_disable_queue((TcoreHal*) hal);
+        */
+
+       /* TODO: Should be moved to ...
+        * Proceed power up noti process after MUX initialization.
+        */
+       s_modem_send_poweron(NULL, NULL, plugin);
+}
+
+
+
+static void setup_mux(CoreObject *o)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+
+
+       prepare_and_send_pending_request(p, "modem", "AT+CMUX=0,0,,1509,10,3,30,,", +CMUX, TCORE_AT_NO_RESULT, on_response_set_flight_mode);
+
+       /* HAL has type itself,
+        * e.g.) TCORE_HAL_MODE_AT
+        */
+       hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       /* Set Metainfo into TcorePending directly
+        * using TcoreATRequest
+        * command type: e.g.) SINGLELINE
+        * response prefix
+        */
+       req = tcore_at_request_new("AT+CMUX=0,0,,1509,10,3,30,,", "+CMUX", TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_setupmux, hal);
+       tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+}
+
+#endif
+       
+static void on_response_enable_logging(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       TcorePlugin *plugin = NULL;
+       
+       plugin = tcore_pending_ref_plugin(p);
+       
+       /* DELETE ME: only for DEBUG */
+       if (!resp)
+               dbg("no data");
+
+       dbg("response...(result = %d, final_response = '%s')", resp->success, resp->final_response);
+
+       if(resp->success){
+               dbg("RESPONSE OK");
+               dbg("Enabling CP logging is success !!!\n");
+
+       }else {
+               dbg("RESPONSE NOK");
+               dbg("Enabling CP logging is failed !!!\n");
+       }
+
+
+#ifdef ENABLE_CMUX
+       dbg("call setup_mux");
+       prepare_and_send_pending_request(plugin, "modem", "AT+CMUX=0,0,,1509,10,3,30,,", +CMUX, TCORE_AT_NO_RESULT, on_response_setupmux);
+       /*setup_mux(tcore_pending_ref_core_object(p));*/
+#else
+
+       /* XCALLSTAT subscription */
+       prepare_and_send_pending_request(plugin, "call", "at+xcallstat=1", NULL, TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+
+       /* XSIMSTATE subscription */
+       prepare_and_send_pending_request(plugin, "sim", "at+xsimstate=1", NULL, TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+       
+       /* CREG subscription */
+       prepare_and_send_pending_request(plugin, "umts_network", "at+creg=2", NULL, TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+
+       /* CGREG subscription */
+       prepare_and_send_pending_request(plugin, "umts_network", "at+cgreg=2", NULL, TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+
+       /* XMER subscription */
+       prepare_and_send_pending_request(plugin, "umts_network", "at+xmer=1", NULL, TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+
+       /* CGEREP subscription */
+       prepare_and_send_pending_request(plugin, "umts_ps", "at+cgerep=1", NULL, TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+
+       /* XDATASTAT subscription */
+       prepare_and_send_pending_request(plugin, "umts_ps", "at+xdatastat=1", NULL, TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+
+       /* CMGF subscription */
+       prepare_and_send_pending_request(plugin, "umts_sms", "at+cmgf=0", NULL, TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+
+       /* CSSN subscription */
+       prepare_and_send_pending_request(plugin, "call", "at+cssn=1,1", NULL, TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+
+       /* CUSD subscription */
+       prepare_and_send_pending_request(plugin, "call", "at+cusd=1", NULL, TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+
+       /* XDNS subscription */
+       prepare_and_send_pending_request(plugin, "umts_ps", "at+xdns=1,1", NULL, TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+
+       /* CLIP subscription */
+       prepare_and_send_pending_request(plugin, "call", "at+clip=1", NULL, TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+
+       /*CMEE subscription*/
+       prepare_and_send_pending_request(plugin,"umts_ps","at+cmee=2",NULL,TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+
+
+       /*incoming sms and cb subscription*/
+       prepare_and_send_pending_request(plugin,"umts_sms","at+cnmi=1,2,2,2,0",NULL,TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+
+       /*message service subscription*/
+       prepare_and_send_pending_request(plugin,"umts_sms","at+csms=1",NULL,TCORE_AT_NO_RESULT, on_response_bootup_subscription);
+
+       /* text/pdu mode subscription*/
+       prepare_and_send_pending_request(plugin,"umts_sms","at+cmgf=0",NULL,TCORE_AT_NO_RESULT, on_response_last_bootup_subscription);
+#if 0
+       /* Check for SIM PIN status */
+       prepare_and_send_pending_request(plugin, "sim", "at+cpin?", on_response_bootup_subscription);
+#endif
+       
+#endif
+}
+
+static void _send_enable_logging_command(CoreObject *o)
+{
+       TcoreATRequest *req;
+       TcoreHal *hal;
+       TcorePending *pending;
+       TReturn ret;
+       /* DLELTE ME */
+       dbg("Send Trace enabling command for CP logging. \n");
+
+       if(!o){
+               dbg("Co-object is Null !!\n");
+               //goto error;
+       }
+
+       hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+       req = tcore_at_request_new("at+xsystrace=1,\"digrf=1;bb_sw=1;3g_sw=1\",\"digrf=0x84\",\"oct=4\";+xsystrace=11;+trace=1", NULL, TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_enable_logging, hal);
+       tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL);
+
+       ret = tcore_hal_send_request(hal, pending);
+       if(ret != TCORE_RETURN_SUCCESS)
+               dbg("tcore_hal_send_request fail !!! (hal: 0x%x, pending: 0x%x)\n", hal, pending);
+
+}
+
+static void on_response_poweron(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       GSList*tokens=NULL;
+       const char *line=NULL;
+       gboolean bpoweron = FALSE;
+       int response = 0;
+       int err;
+       
+       if(resp->success){
+               dbg("RESPONSE OK");
+               /* Parse AT Response */
+               if (resp->lines) {
+                       line = (const char *)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) != 1) {
+                               dbg("invalid message");
+                               bpoweron = FALSE;
+                               goto error;
+                       }
+               }
+
+               response = atoi(g_slist_nth_data(tokens, 0));
+
+               dbg("CPAS: response %d",response);
+
+               switch(response)
+               {
+                       case CPAS_RES_READY:
+                       case CPAS_RES_RINGING:
+                       case CPAS_RES_CALL_PROGRESS:
+                       case CPAS_RES_ASLEEP:
+                               bpoweron = TRUE;
+                       break;
+
+                       case CPAS_RES_UNAVAIL:
+                       case CPAS_RES_UNKNOWN:
+                       default:
+                               dbg("unvail/unknown,but response received - CP can communicate - proceed bootup");
+                               //bpoweron = FALSE;
+                               bpoweron = TRUE;
+                       break;
+               }
+       }else{
+               dbg("CPAS: RESPONSE NOK");
+               bpoweron = FALSE;
+       }
+
+error:
+       /* DELE ME: AT request & response are freed after AT processing in HAL.
+        * ref.) _emit_pending_response (libtcore/src/at.c)
+        */
+        tcore_at_tok_free(tokens);
+
+       if(bpoweron == TRUE){
+               dbg("Power on NOTI received, (pending: 0x%x, co: 0x%x)\n", p, tcore_pending_ref_core_object(p));
+
+               _send_enable_logging_command(tcore_pending_ref_core_object(p));
+       }
+       else{
+               dbg("CP is not ready, send CPAS once again");
+               s_modem_send_poweron(tcore_object_ref_plugin(tcore_pending_ref_core_object(p)));
+       }
+}
+
+static TReturn power_on(CoreObject *o, UserRequest *ur)
+{
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn power_off(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+
+       /* FIXME: Before MUX setup, use PHY HAL directly. */
+       hal = tcore_object_get_hal(o);
+
+       pending = tcore_pending_new(o, 0);
+
+       /* TODO:
+        * Need to mapping or define AT command
+        * including prefix if neccessary otherwise NULL.
+        * Response type (e.g. TCORE_AT_SINGLELINE)
+        */
+       req = tcore_at_request_new("AT+CFUN=0", NULL, TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_power_off, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn power_reset(CoreObject *o, UserRequest *ur)
+{
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn get_imei(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+
+       hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       req = tcore_at_request_new("AT+CGSN", NULL, TCORE_AT_NUMERIC);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_imei, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+
+static TReturn get_version(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+
+       hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       req = tcore_at_request_new("AT+CGMR", NULL, TCORE_AT_SINGLELINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_version, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn set_flight_mode(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       const struct treq_modem_set_flightmode *req_data;
+       char* cmd_str = NULL;
+
+       hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       req_data = tcore_user_request_ref_data(ur, NULL);
+
+       if (req_data->enable) {
+               dbg("Flight mode on/n");
+               cmd_str = g_strdup("AT+CFUN=4\r");
+       }
+       else {
+               dbg("Flight mode off/n");
+               cmd_str = g_strdup("AT+CFUN=1\r");
+       }
+
+       req = tcore_at_request_new((const char*)cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_set_flight_mode, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+
+static struct tcore_modem_operations modem_ops =
+{
+       .power_on = power_on,
+       .power_off = power_off,
+       .power_reset = power_reset,
+       .set_flight_mode = set_flight_mode,
+       .get_imei = get_imei,
+       .get_version = get_version,
+       .get_sn = NULL,
+       .dun_pin_ctrl = NULL,
+};
+
+gboolean s_modem_init(TcorePlugin *p, TcoreHal *h)
+{
+       CoreObject *o;
+       GQueue *work_queue;
+       TelMiscVersionInformation *vi_property;
+       TelMiscSNInformation *imei_property;
+       TelMiscSNInformation *sn_property;
+
+       o = tcore_modem_new(p, "modem", &modem_ops, h);
+       if (!o)
+               return FALSE;
+
+       work_queue = g_queue_new();
+       tcore_object_link_user_data(o, work_queue);
+
+       vi_property = calloc(sizeof(TelMiscVersionInformation), 1);
+       tcore_plugin_link_property(p, "VERSION", vi_property);
+
+       imei_property = calloc(sizeof(TelMiscSNInformation), 1);
+       tcore_plugin_link_property(p, "IMEI", imei_property);
+
+       sn_property = calloc(sizeof(TelMiscSNInformation), 1);
+       tcore_plugin_link_property(p, "SN", sn_property);
+
+       tcore_object_add_callback(o, "+XSIM", on_event_bootup_sim_status, NULL);
+       return TRUE;
+}
+
+void s_modem_exit(TcorePlugin *p)
+{
+       CoreObject *o;
+       GQueue *work_queue;
+       TelMiscVersionInformation *vi_property;
+       TelMiscSNInformation *imei_property;
+       TelMiscSNInformation *sn_property;
+
+       if (!p)
+               return;
+
+       o = tcore_plugin_ref_core_object(p, "modem");
+
+       work_queue = tcore_object_ref_user_data(o);
+       g_queue_free(work_queue);
+
+       vi_property = tcore_plugin_ref_property(p, "VERSION");
+       if (vi_property)
+               free(vi_property);
+
+       imei_property = tcore_plugin_ref_property(p, "IMEI");
+       if (imei_property)
+               free(imei_property);
+
+       sn_property = tcore_plugin_ref_property(p, "SN");
+       if (sn_property)
+               free(sn_property);
+
+       tcore_modem_free(o);
+}
+
+gboolean s_modem_send_poweron(TcorePlugin *p)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       CoreObject *o;
+
+       o = tcore_plugin_ref_core_object(p, "modem");
+       hal = tcore_object_get_hal(o);
+       /* HAL has type itself,
+        * e.g.) TCORE_HAL_MODE_AT
+        */
+       pending = tcore_pending_new(o, 0);
+
+       /* Set Metainfo into TcorePending directly
+        * using TcoreATRequest
+        * command type: e.g.) SINGLELINE
+        * response prefix
+        */
+
+       req = tcore_at_request_new("AT+CPAS", "+CPAS", TCORE_AT_SINGLELINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_timeout(pending, 10);
+       tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT);    
+       tcore_pending_set_timeout_callback(pending, on_timeout_modem_poweron, hal);
+       
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_poweron, hal);
+       tcore_pending_set_send_callback(pending, on_confirmation_modem_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       return TRUE;
+}
diff --git a/src/s_network.c b/src/s_network.c
new file mode 100755 (executable)
index 0000000..93abe01
--- /dev/null
@@ -0,0 +1,1751 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <hal.h>
+#include <core_object.h>
+#include <plugin.h>
+#include <queue.h>
+#include <co_network.h>
+#include <co_ps.h>
+#include <server.h>
+#include <storage.h>
+#include <util.h>
+#include <at.h>
+
+#include "s_common.h"
+#include "s_network.h"
+
+#define AT_CREG_STAT_NOT_REG   0 /* not registered, MT is not currently searching a new operator to register to */
+#define AT_CREG_STAT_REG_HOME  1 /* registered, home network */
+#define AT_CREG_STAT_SEARCHING 2 /* not registered, but MT is currently searching a new operator to register to */
+#define AT_CREG_STAT_REG_DENIED        3 /* registration denied */
+#define AT_CREG_STAT_UNKNOWN   4 /* unknown */
+#define AT_CREG_STAT_REG_ROAM  5 /* registered, roaming */
+
+#define AT_COPS_MODE_AUTOMATIC 0 /* automatic (<oper> field is ignored) */
+#define AT_COPS_MODE_MANUAL    1 /* manual (<oper> field shall be present, and <AcT> optionally) */
+#define AT_COPS_MODE_DEREGISTER        2 /* deregister from network */
+#define AT_COPS_MODE_SET_ONLY  3 /* set only <format> */
+#define AT_COPS_MODE_MANUAL_AUTOMATIC 4 /*automatic - manual*/
+
+#define AT_COPS_FORMAT_LONG_ALPHANUMERIC       0 /* long format alphanumeric <oper> */
+#define AT_COPS_FORMAT_SHORT_ALPHANUMERIC      1 /* short format alphanumeric <oper> */
+#define AT_COPS_FORMAT_NUMERIC                 2 /* numeric <oper> */
+
+#define AT_COPS_ACT_GSM                        0       /* GSM */
+#define AT_COPS_ACT_GSM_COMPACT                1       /* GSM Compact */
+#define AT_COPS_ACT_UTRAN              2       /* UTRAN */
+#define AT_COPS_ACT_GSM_EGPRS          3       /* GSM w/EGPRS */
+#define AT_COPS_ACT_UTRAN_HSDPA                4       /* UTRAN w/HSDPA */
+#define AT_COPS_ACT_UTRAN_HSUPA                5       /* UTRAN w/HSUPA */
+#define AT_COPS_ACT_UTRAN_HSDPA_HSUPA  6       /* UTRAN w/HSDPA and HSUPA */
+#define AT_COPS_ACT_E_UTRAN            7       /* E-UTRAN */
+
+#define AT_XBANDSEL_0 0 
+#define AT_XBANDSEL_1800 1800
+#define AT_XBANDSEL_1900 1900
+#define AT_XBANDSEL_850 850
+#define AT_XBANDSEL_450 450
+#define AT_XBANDSEL_480 480
+#define AT_XBANDSEL_750 750
+#define AT_XBANDSEL_380 380
+#define AT_XBANDSEL_410 410
+
+#define MAX_NETWORKS_PREF_PLMN_SUPPORT 150
+#define MAX_NETWORKS_MANUAL_SEARCH_SUPPORT 20
+
+static unsigned int lookup_tbl_net_status[] = {
+               [AT_CREG_STAT_NOT_REG] = NETWORK_SERVICE_DOMAIN_STATUS_NO,
+               [AT_CREG_STAT_REG_HOME] = NETWORK_SERVICE_DOMAIN_STATUS_FULL,
+               [AT_CREG_STAT_SEARCHING] = NETWORK_SERVICE_DOMAIN_STATUS_SEARCH,
+               [AT_CREG_STAT_REG_DENIED] = NETWORK_SERVICE_DOMAIN_STATUS_EMERGENCY,
+               [AT_CREG_STAT_UNKNOWN] = NETWORK_SERVICE_DOMAIN_STATUS_NO,
+               [AT_CREG_STAT_REG_ROAM] = NETWORK_SERVICE_DOMAIN_STATUS_FULL,
+};
+
+static unsigned int lookup_tbl_access_technology[] = {
+       [AT_COPS_ACT_GSM]               = NETWORK_ACT_GSM,
+       [AT_COPS_ACT_GSM_COMPACT]       = NETWORK_ACT_GSM,
+       [AT_COPS_ACT_UTRAN]             = NETWORK_ACT_UTRAN,
+       [AT_COPS_ACT_GSM_EGPRS]         = NETWORK_ACT_EGPRS,
+       [AT_COPS_ACT_UTRAN_HSDPA]       = NETWORK_ACT_UTRAN,
+       [AT_COPS_ACT_UTRAN_HSUPA]       = NETWORK_ACT_UTRAN,
+       [AT_COPS_ACT_UTRAN_HSDPA_HSUPA] = NETWORK_ACT_UTRAN,
+       [AT_COPS_ACT_E_UTRAN]           = NETWORK_ACT_GSM_UTRAN,
+};
+
+static gboolean get_serving_network(CoreObject *o, UserRequest *ur);
+
+
+static void on_confirmation_network_message_send(TcorePending *p, gboolean result, void *user_data)
+{
+       dbg("on_confirmation_modem_message_send - msg out from queue.\n");
+
+       if (result == FALSE) {
+               /* Fail */
+               dbg("SEND FAIL");
+       }
+       else {
+               dbg("SEND OK");
+       }
+}
+
+static void nwk_prepare_and_send_pending_request(TcorePlugin *plugin, char *co_name, const char *at_cmd, const char* prefix,enum tcore_at_command_type at_cmd_type, TcorePendingResponseCallback callback)
+{
+       TcoreATRequest *req = NULL;
+       TcoreHal *hal;
+       CoreObject *o= NULL;
+       TcorePending *pending = NULL;
+       TReturn ret;
+       
+       o = tcore_plugin_ref_core_object(plugin, co_name);
+       hal = tcore_object_get_hal(o);
+       
+       pending = tcore_pending_new(o, 0);
+       req = tcore_at_request_new(at_cmd, prefix, at_cmd_type);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, callback, req->cmd);
+       tcore_pending_set_send_callback(pending, on_confirmation_network_message_send, NULL);
+
+       ret = tcore_hal_send_request(hal, pending);
+       return;
+}
+
+
+static void _insert_mcc_mnc_oper_list(TcorePlugin *p, CoreObject *o)
+{
+       Server *s;
+       Storage *strg;
+       void *handle;
+       char query[255] = {     0, };
+       GHashTableIter iter;
+       gpointer key, value;
+       GHashTable *result = NULL, *row = NULL;
+       struct tcore_network_operator_info *noi = NULL;
+       int count = 0;
+
+       s = tcore_plugin_ref_server(p);
+       strg = tcore_server_find_storage(s, "database");
+
+       handle = tcore_storage_create_handle(strg, "/opt/dbspace/.mcc_mnc_oper_list.db");
+       if (!handle) {
+               dbg("fail to create database handle");
+               return;
+       }
+
+       snprintf(query, 255, "select country, mcc, mnc, oper from mcc_mnc_oper_list");
+
+       result = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
+                       (GDestroyNotify) g_hash_table_destroy);
+
+       tcore_storage_read_query_database(strg, handle, query, NULL, result, 4);
+
+       g_hash_table_iter_init(&iter, result);
+       while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
+               row = value;
+
+               noi = calloc(sizeof(struct tcore_network_operator_info), 1);
+
+               snprintf(noi->mcc, 4, "%s", (char *)g_hash_table_lookup(row, "1"));
+               snprintf(noi->mnc, 4, "%s",  (char *)g_hash_table_lookup(row, "2"));
+               snprintf(noi->name, 41, "%s",  (char *)g_hash_table_lookup(row, "3"));
+               snprintf(noi->country, 4, "%s",  (char *)g_hash_table_lookup(row, "0"));
+
+               tcore_network_operator_info_add(o, noi);
+
+               count++;
+       }
+
+       dbg("count = %d", count);
+
+       g_hash_table_destroy(result);
+
+       tcore_storage_remove_handle(strg, handle);
+}
+
+static enum telephony_network_service_type _get_service_type(enum telephony_network_service_type prev_type,
+               int domain, int act, int cs_status, int ps_status)
+{
+       enum telephony_network_service_type ret;
+
+       ret = prev_type;
+
+       switch (act) {
+               case NETWORK_ACT_UNKNOWN:
+                       ret = NETWORK_SERVICE_TYPE_UNKNOWN;
+                       break;
+
+               case NETWORK_ACT_GSM:
+                       if (prev_type == NETWORK_SERVICE_TYPE_2_5G_EDGE && domain == NETWORK_SERVICE_DOMAIN_CS)
+                               ret = NETWORK_SERVICE_TYPE_2_5G_EDGE;
+                       else
+                               ret = NETWORK_SERVICE_TYPE_2G;
+                       break;
+
+               case NETWORK_ACT_EGPRS:
+                       return NETWORK_SERVICE_TYPE_2_5G_EDGE;
+                       break;
+
+               case NETWORK_ACT_UMTS:
+                       ret = NETWORK_SERVICE_TYPE_3G;
+                       break;
+
+       }
+
+       if (cs_status == NETWORK_SERVICE_DOMAIN_STATUS_NO && ps_status == NETWORK_SERVICE_DOMAIN_STATUS_NO) {
+               ret = NETWORK_SERVICE_TYPE_NO_SERVICE;
+       }
+       else if (cs_status == NETWORK_SERVICE_DOMAIN_STATUS_SEARCH || ps_status == NETWORK_SERVICE_DOMAIN_STATUS_SEARCH) 
+       {
+               if (cs_status == NETWORK_SERVICE_DOMAIN_STATUS_FULL || ps_status == NETWORK_SERVICE_DOMAIN_STATUS_FULL) 
+               {
+                       /* no change */
+               }
+               else 
+               {
+                       ret = NETWORK_SERVICE_TYPE_SEARCH;
+               }
+       }
+       else if (cs_status == NETWORK_SERVICE_DOMAIN_STATUS_EMERGENCY || ps_status == NETWORK_SERVICE_DOMAIN_STATUS_EMERGENCY) 
+       {
+               if (cs_status == NETWORK_SERVICE_DOMAIN_STATUS_FULL || ps_status == NETWORK_SERVICE_DOMAIN_STATUS_FULL) 
+               {
+                       /* no change */
+               }
+               else 
+               {
+                       ret = NETWORK_SERVICE_TYPE_EMERGENCY;
+               }
+       }
+
+       return ret;
+}
+
+static void _ps_set(TcorePlugin *p, int status)
+{
+       GSList *co_list = NULL;
+
+       co_list = tcore_plugin_get_core_objects_bytype(p, CORE_OBJECT_TYPE_PS);
+       do {
+               CoreObject *o = NULL;
+               o = (CoreObject *) co_list->data;
+               if (!o)
+                       break;
+
+               if (status == NETWORK_SERVICE_DOMAIN_STATUS_FULL) {
+                       tcore_ps_set_online(o, TRUE);
+               }
+               else {
+                       tcore_ps_set_online(o, FALSE);
+               }
+       } while ((co_list = g_slist_next(co_list)));
+
+       g_slist_free(co_list);
+}
+
+static void on_timeout_search_network(TcorePending *p, void *user_data)
+{
+       UserRequest *ur;
+       struct tresp_network_search resp;
+
+       dbg("TIMEOUT !!!!! pending=%p", p);
+
+       memset(&resp, 0, sizeof(struct tresp_network_search));
+
+       resp.list_count = 0;
+
+       ur = tcore_pending_ref_user_request(p);
+       if (ur) {
+               tcore_user_request_send_response(ur, TRESP_NETWORK_SEARCH, sizeof(struct tresp_network_search), &resp);
+       }
+}
+
+static void on_response_set_plmn_selection_mode(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur;
+       const TcoreATResponse *atResp = data;
+       //GSList *tokens = NULL;
+       //char * line = NULL;
+       struct tresp_network_set_plmn_selection_mode resp = {0};
+       
+       if(atResp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               resp.result = TCORE_RETURN_SUCCESS;
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               resp.result = TCORE_RETURN_FAILURE;
+       }
+
+       ur = tcore_pending_ref_user_request(p);
+       if (ur) {
+               tcore_user_request_send_response(ur, TRESP_NETWORK_SET_PLMN_SELECTION_MODE, sizeof(struct tresp_network_set_plmn_selection_mode), &resp);
+       }
+}
+
+static void on_response_get_plmn_selection_mode(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur;
+       struct tresp_network_get_plmn_selection_mode resp = {0};
+       const TcoreATResponse *atResp = data;
+       GSList *tokens = NULL;
+       char * line = NULL;
+       int mode = 0;
+
+       resp.result = TCORE_RETURN_FAILURE;
+
+       if(atResp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               /* Format of output 
+               +COPS: <mode>[,<format>,<oper>[,< AcT>]]
+               */
+               
+               if(atResp->lines)
+                       {
+                               line = (char*)atResp->lines->data;
+                               tokens = tcore_at_tok_new(line);
+                               if (g_slist_length(tokens) < 1){
+                               msg("invalid message");
+                               goto OUT;
+                               }
+                               mode = atoi(tcore_at_tok_nth(tokens, 0));
+                               dbg("mode = %d", mode);
+                       
+                               switch(mode) {
+                                       case AT_COPS_MODE_AUTOMATIC:
+                                               resp.mode = NETWORK_SELECT_MODE_GLOBAL_AUTOMATIC;
+                                               break;
+                                       case AT_COPS_MODE_MANUAL:
+                                       case AT_COPS_MODE_MANUAL_AUTOMATIC:
+                                               resp.mode = NETWORK_SELECT_MODE_GSM_MANUAL;
+                                               break;
+                                       case AT_COPS_MODE_DEREGISTER:
+                                       case AT_COPS_MODE_SET_ONLY:
+                                               resp.result = TCORE_RETURN_FAILURE;
+                                       goto OUT;
+                               }
+                       resp.result = TCORE_RETURN_SUCCESS;
+                       }
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               resp.result = TCORE_RETURN_FAILURE;
+       }
+
+OUT:
+       ur = tcore_pending_ref_user_request(p);
+       if (ur) {
+               tcore_user_request_send_response(ur, TRESP_NETWORK_GET_PLMN_SELECTION_MODE, sizeof(struct tresp_network_get_plmn_selection_mode), &resp);
+       }
+
+       if(tokens != NULL)
+               tcore_at_tok_free(tokens);
+
+       return;
+
+}
+
+static void on_response_search_network(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur;
+       struct tresp_network_search resp;
+       int i = 0, ctr =0;
+       char* line=NULL;
+       const TcoreATResponse *atResp = data;
+       GSList *tokens = NULL;
+       GSList *network_token = NULL;
+       int AcT=0 , stat = 0;
+       char* cp_plmn =NULL;
+       char* temp_plmn_info =NULL;
+       char *pResp = NULL;
+       int num_network_avail = 0;
+
+       memset(&resp, 0, sizeof(struct tresp_network_search));
+       resp.result = TCORE_RETURN_FAILURE;
+       resp.list_count = 0;
+
+       if(atResp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               if(atResp->lines) {
+                       line = (char*)atResp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       num_network_avail = g_slist_length(tokens);
+                       dbg(" length of tokens is %d\n", num_network_avail);
+                       if (num_network_avail < 1) {
+                               msg("invalid message");
+                               goto OUT;
+                       }
+               }
+                                       
+               resp.result = TCORE_RETURN_SUCCESS;
+               /*
+                *      +COPS: [list of supported (<stat>,long alphanumeric <oper>,short alphanumeric <oper>,numeric <oper>[,<AcT>])s]
+                *             [,,(list of supported <mode>s),(list of supported <format>s)]
+               */
+                       
+               /* (2,"IND airtel","airtel","40445",2,),(1,"IND airtel","airtel","40445",0,),(3,"TATA DOCOMO","TATA DO","405034",2,) */
+                       
+               for(i=0; ((i<num_network_avail) && (i<MAX_NETWORKS_MANUAL_SEARCH_SUPPORT)); i++)
+                       {
+                       /* (2,"IND airtel","airtel","40445",2,) */
+                       network_token = tcore_at_tok_new(g_slist_nth_data(tokens, i));
+
+                       pResp = (tcore_at_tok_nth(network_token, 0));
+                       if(pResp != NULL){
+                               dbg("status : %s",pResp);
+                               resp.list[i].status = (enum telephony_network_plmn_status)atoi(pResp);
+                       }
+
+                       if (pResp = (tcore_at_tok_nth(network_token, 1)))
+                       { /* Long Aplha name */
+                               dbg("Long Aplha name : %s",pResp);
+                               
+                               if(strlen(pResp) > 0)
+                                       /* Strip off starting quote & ending quote */
+                                       strncpy(resp.list[i].name, pResp+1, strlen(pResp)-2);
+                       }
+                       else if (pResp = (tcore_at_tok_nth(network_token, 2)))
+                       { 
+                               dbg("Short Aplha name : %s",pResp);
+                               /* Short Aplha name */
+                               /* Strip off starting quote & ending quote */
+                               if(strlen(pResp) > 0)
+                                       strncpy(resp.list[i].name, pResp+1, strlen(pResp)-2);
+                       }
+
+                       /* PLMN ID */
+                       pResp = tcore_at_tok_nth(network_token, 3);
+                       if(pResp != NULL)
+                       {
+                               dbg("PLMN ID : %s",pResp);
+                               if(strlen(pResp) > 0){
+                                       temp_plmn_info = malloc((strlen(pResp) - 2)+1); /* 1 extra character for NULL storage */
+                                       memset(temp_plmn_info, 0x00, strlen(pResp) -2+1);
+                                       
+                                       /* Strip off starting quotes & ending quotes */
+                                       strncpy(temp_plmn_info, pResp+1, strlen(pResp)-2);
+                               }
+                       }
+
+                       /* Decode PLMN ID from Hexa String to Hexa bytes */
+                       //cp_plmn = util_hexStringToBytes(temp_plmn_info);
+               
+                       memcpy(resp.list[i].plmn, temp_plmn_info, 6);
+                                       if (resp.list[i].plmn[5] == '#')
+                                               resp.list[i].plmn[5] = '\0';
+
+                       /* Parse Access Technology */
+                       if(pResp = tcore_at_tok_nth(tokens, 4))
+                       {
+                               if(strlen(pResp) > 0){
+                                       AcT = atoi(pResp);
+                               
+                                       if (0 == AcT)
+                                               resp.list[i].act = NETWORK_ACT_GSM;
+                                       else if(2 == AcT)
+                                               resp.list[i].act = NETWORK_ACT_UMTS;
+                               }
+                       }
+
+                       dbg("Operator [%d] :: stat = %d, Name =%s, plmnId = %s, AcT=%d\n", resp.list_count, resp.list[i].status, resp.list[i].name, resp.list[i].plmn, AcT);
+                       resp.list_count++;
+
+                       tcore_at_tok_free(network_token);
+                       free(temp_plmn_info);
+                       //free(cp_plmn);
+               }
+       }
+       else
+       {
+                       dbg("RESPONSE NOK");
+                       resp.result = TCORE_RETURN_FAILURE;
+       }
+
+OUT:
+       ur = tcore_pending_ref_user_request(p);
+       if (ur) {
+               tcore_user_request_send_response(ur, TRESP_NETWORK_SEARCH, sizeof(struct tresp_network_search), &resp);
+       }
+       tcore_at_tok_free(tokens);
+       return;
+}
+
+static void on_response_set_service_domain(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+
+       dbg("Exit");
+       return;
+}
+
+static void on_response_get_service_domain(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+
+       dbg("Exit");
+       return;
+}
+
+static void on_response_set_band(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur;
+       struct tresp_network_set_band resp;
+
+       char* line=NULL;
+       const TcoreATResponse *atResp = data;
+
+       dbg("On Response Set Band");
+       if(atResp->success > 0)
+       {
+               dbg("Response OK");
+               resp.result = TCORE_RETURN_SUCCESS;
+       }else
+       {
+               dbg("Response NOK");
+               resp.result = TCORE_RETURN_FAILURE;
+       }
+
+       ur = tcore_pending_ref_user_request(p);
+       if (ur) {
+               tcore_user_request_send_response(ur, TRESP_NETWORK_SET_BAND, sizeof(struct tresp_network_set_band), &resp);
+       }
+}
+
+static void on_response_get_band(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+
+       dbg("Exit");
+       return;
+}
+
+static void on_response_set_preferred_plmn(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+
+       dbg("Exit");
+       return;
+}
+
+static void on_response_get_preferred_plmn(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur;
+       int i = 0, ctr =0;
+       char* line=NULL;
+       const TcoreATResponse *atResp = data;
+       GSList *tokens = NULL;
+       char* cp_plmn =NULL;
+       char temp_plmn_info[17] = {0};
+       char *pResp = NULL;
+       int num_network_avail = 0;
+       int plmn_format = 0;
+       
+       struct tresp_network_get_preferred_plmn resp = {0};
+       int total_lines = 0;
+       int GSM_AcT2 = 0, GSM_Compact_AcT2= 0, UTRAN_AcT2 = 0;
+
+       dbg("Entry");
+
+       if(atResp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               if(atResp->lines) {
+                       total_lines = g_slist_length(atResp->lines);
+                       dbg("Total number of network present in Preferred PLMN list is %d\n", total_lines);
+
+                       if (total_lines < 1) {
+                               msg("invalid message");
+                               goto OUT;
+                       }
+
+                       if (total_lines >= MAX_NETWORKS_PREF_PLMN_SUPPORT)
+                               total_lines = MAX_NETWORKS_PREF_PLMN_SUPPORT;
+                       
+/*
++COPL: <index1>,<format>,<oper1>[,<GSM_AcT1>,<GSM_Compact_AcT1>,<UTRAN_AcT1>,<E-UTRAN_AcT1>] [<CR><LF>
++CPOL: <index2>,<format>,<oper2>[,<GSM_AcT2>,<GSM_Compact_AcT2>,<UTRAN_AcT2>,<E-UTRAN_AcT2>]
+*/
+
+                       resp.result = TCORE_RETURN_SUCCESS;
+
+                       for (i=0; i<total_lines; i++) {
+                               /* Take each line response at a time & parse it */
+                               line = tcore_at_tok_nth(atResp->lines, i);
+                               tokens = tcore_at_tok_new(line);
+
+                               /* <index2>,<format>,<oper2>[,<GSM_AcT2>,<GSM_Compact_AcT2>,<UTRAN_AcT2>,<E-UTRAN_AcT2>] */
+
+                               /* EF Index */
+                               if (pResp = tcore_at_tok_nth(tokens, 0))
+                               {
+                                       dbg("Index : %s",pResp);                                        
+                                       resp.list[i].ef_index = atoi(pResp);
+                               }
+                               /* Format */
+                               if(pResp = tcore_at_tok_nth(tokens, 1))
+                               {
+                                       dbg("format : %s",pResp);
+                                       plmn_format = atoi(pResp);
+                               }
+
+                               /* Operator PLMN ID */
+                               if(pResp = tcore_at_tok_nth(tokens, 2));
+                               {
+                                       dbg("plmn ID : %s",pResp);
+
+                                       if(strlen(pResp) > 0){
+                                               strncmp(temp_plmn_info, pResp+1, strlen(pResp)-2);
+                                       
+                                               //Get only PLMN ID
+                                               if (plmn_format == 2)
+                                               {
+                                                       //cp_plmn = util_hexStringToBytes(temp_plmn_info);
+                                               
+                                                       if (strncmp((char *)temp_plmn_info, "000000", 6) == 0)
+                                                               continue;
+                               
+                                                       memcpy(resp.list[i].plmn, temp_plmn_info, 6);
+                                                       if (resp.list[i].plmn[5] == '#')
+                                                               resp.list[i].plmn[5] = '\0';
+
+                                                       //free(cp_plmn);
+                                               }
+                                       }
+                               }
+
+                               if(pResp = tcore_at_tok_nth(tokens, 3)){
+                                       dbg("GSM_AcT2  : %s",pResp);
+                                       GSM_AcT2 = atoi(pResp);
+                               }
+                                       
+                               if(pResp = tcore_at_tok_nth(tokens, 4)){
+                                       dbg("GSM_Compact AcT2  : %s",pResp);
+                                       GSM_Compact_AcT2 = atoi(pResp);
+                               }
+       
+                               if(pResp = tcore_at_tok_nth(tokens, 5)){
+                                       dbg("UTRAN_AcT2  : %s",pResp);
+                                       UTRAN_AcT2 = atoi(pResp);
+                               }
+
+                               if(UTRAN_AcT2 && (GSM_AcT2 ||GSM_Compact_AcT2))
+                                       resp.list[i].act = NETWORK_ACT_GSM_UTRAN;
+                               else if (UTRAN_AcT2)
+                                       resp.list[i].act = NETWORK_ACT_UMTS;
+                               else if (GSM_AcT2 || GSM_Compact_AcT2)
+                                       resp.list[i].act = NETWORK_ACT_GPRS;
+
+                               (resp.list_count)++;
+
+                               tcore_at_tok_free(tokens);
+                       }
+               }
+       }
+OUT:
+       ur = tcore_pending_ref_user_request(p);
+       if (ur) {
+               tcore_user_request_send_response(ur, TRESP_NETWORK_GET_PREFERRED_PLMN, sizeof(struct tresp_network_get_preferred_plmn), &resp);
+       }
+       dbg("Exit");
+       return;
+}
+
+static void on_response_set_order(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+
+       dbg("Exit");
+       return;
+}
+
+static void on_response_get_order(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+
+       dbg("Exit");
+       return;
+}
+
+static void on_response_set_power_on_attach(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+
+       dbg("Exit");
+       return;
+}
+
+static void on_response_get_power_on_attach(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+
+       dbg("Exit");
+       return;
+}
+
+static void on_response_set_cancel_manual_search(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+
+       dbg("Exit");
+       return;
+}
+
+
+static void on_response_get_serving_network(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse* resp = data;
+       UserRequest *ur;
+       struct tresp_network_get_serving_network Tresp = {0};
+       char plmn[7] = {0};
+       char *long_plmn_name, *short_plmn_name = NULL;
+       CoreObject *o;
+       GSList *tokens=NULL;
+       const char *line;
+       int network_mode = -1;
+       int plmn_format = -1;
+       enum telephony_network_access_technology AcT = NETWORK_ACT_UNKNOWN;
+       struct tnoti_network_identity noti ={0};
+       char *pResp = NULL;
+       int nol, count =0;
+
+       o = tcore_pending_ref_core_object(p);
+
+       if(resp->success <= 0){
+               dbg("RESPONSE NOK");
+
+               ur = tcore_pending_ref_user_request(p);
+               if (ur) {
+                       Tresp.result = TCORE_RETURN_FAILURE;            
+                       tcore_user_request_send_response(ur, TRESP_NETWORK_GET_SERVING_NETWORK, sizeof(struct tresp_network_get_serving_network), &Tresp);
+               }
+
+               return;
+       }else{
+       dbg("RESPONSE OK");
+               nol = g_slist_length(resp->lines);
+               dbg("nol : %d", nol);
+
+               for(count =0; count < nol; count++){
+                       //parse each line 
+                               line = g_slist_nth_data(resp->lines, count);
+               tokens = tcore_at_tok_new(line);
+                       dbg("line %d start---------------",count);
+                       //mode
+               if (pResp = tcore_at_tok_nth(tokens, 0)){
+                       dbg("mode  : %s",pResp);
+                       network_mode = atoi(pResp);
+               }
+
+                       //format (optional)                     
+               if(pResp = tcore_at_tok_nth(tokens, 1))
+               {
+                       dbg("format  : %s",pResp);
+                                       if(strlen(pResp)>0)
+                       plmn_format = atoi(pResp);
+               }
+
+                       //plmn 
+               switch(plmn_format)
+               {
+                       case AT_COPS_FORMAT_LONG_ALPHANUMERIC: 
+                               if(pResp = tcore_at_tok_nth(tokens, 2))
+                               {               
+                                       dbg("long PLMN  : %s",pResp);
+                                       if(strlen(pResp) > 0){
+                                               long_plmn_name = malloc((strlen(pResp) - 2)+1); /* 1 extra character for NULL storage */
+                                               memset(long_plmn_name, 0x00, strlen(pResp) -2+1);
+                                               /* Strip off starting quotes & ending quotes */
+                                               strncpy(long_plmn_name, pResp+1, strlen(pResp)-2);
+
+                                               //set network name into po
+                                               tcore_network_set_network_name(o,TCORE_NETWORK_NAME_TYPE_FULL,long_plmn_name);
+                                       }
+                               }
+                               break;
+               
+                               case AT_COPS_FORMAT_SHORT_ALPHANUMERIC:
+                                       if(pResp = tcore_at_tok_nth(tokens, 2))
+                                       {
+                                               dbg("short PLMN  : %s",pResp);
+                                               if(strlen(pResp)>0){
+                                                       short_plmn_name = malloc((strlen(pResp) - 2)+1); /* 1 extra character for NULL storage */
+                                                       memset(short_plmn_name, 0x00, strlen(pResp) -2+1);
+                                                       /* Strip off starting quotes & ending quotes */
+                                                       strncpy(short_plmn_name, pResp+1, strlen(pResp)-2);
+                                                       
+                                                       //set network name into po                                                      
+                                                       tcore_network_set_network_name(o,TCORE_NETWORK_NAME_TYPE_SHORT,short_plmn_name);                                                        
+                                               }
+                                       }                                       
+                               break;
+
+                               case AT_COPS_FORMAT_NUMERIC:
+                                       if(pResp = tcore_at_tok_nth(tokens, 2))
+                                       {
+                                               dbg("numeric : %s", pResp);
+                                               if(strlen(pResp)>0){
+                                                       memset(plmn, 0, 7);
+                                                       /* Strip off starting quotes & ending quotes */
+                                                       strncpy(plmn, pResp+1, strlen(pResp)-2);                                                        
+
+                                                       tcore_network_set_plmn(o,plmn);
+                                               }
+                                       }
+                               break;
+       
+                               default:
+                               break;
+                       }
+
+                       //act 
+                       if(pResp = tcore_at_tok_nth(tokens, 3))
+                       {               
+                               if(strlen(pResp)>0){
+                                       dbg("act  : %s",pResp);                                         
+                                        AcT = lookup_tbl_access_technology[atoi(pResp)];
+                                       dbg("AcT  : %d",AcT);   
+
+                                       tcore_network_set_access_technology(o, AcT);
+                               }
+                       }
+
+                       tcore_at_tok_free(tokens);
+               }
+
+               memcpy(Tresp.plmn, plmn, 7);
+               tcore_network_get_access_technology(o, &(Tresp.act)); 
+               tcore_network_get_lac(o, &(Tresp.gsm.lac)); 
+
+               ur = tcore_pending_ref_user_request(p);
+               if (ur) {
+                       Tresp.result = TCORE_RETURN_SUCCESS;            
+                       tcore_user_request_send_response(ur, TRESP_NETWORK_GET_SERVING_NETWORK, sizeof(struct tresp_network_get_serving_network), &Tresp);
+               }
+               else
+               {
+                       /* Network change noti */
+                       struct tnoti_network_change network_change;
+
+                       memset(&network_change, 0, sizeof(struct tnoti_network_change));
+                       memcpy(network_change.plmn, plmn, 7);
+                       tcore_network_get_access_technology(o, &(network_change.act));
+                       tcore_network_get_lac(o, &(network_change.gsm.lac));
+
+                       tcore_server_send_notification(tcore_plugin_ref_server(tcore_pending_ref_plugin(p)), tcore_pending_ref_core_object(p),
+                               TNOTI_NETWORK_CHANGE, sizeof(struct tnoti_network_change), &network_change);
+
+                       dbg("dbg.. network_change.plmn  : %s",network_change.plmn);
+                       dbg("dbg.. network_change.act  : %d",network_change.act);                                               
+                       dbg("dbg.. network_change.gsm.lac  : %d",network_change.gsm.lac);
+
+
+                       if((AT_COPS_MODE_DEREGISTER !=network_mode) &&
+                               (AT_COPS_MODE_SET_ONLY != network_mode)){
+                               /*Network identity noti*/
+                               memset(&noti, 0, sizeof(struct tnoti_network_change));
+                               if(long_plmn_name)
+                                       memcpy(noti.full_name, long_plmn_name, MIN(33, strlen(long_plmn_name)) );
+                               if(short_plmn_name)
+                                       memcpy(noti.short_name, short_plmn_name, MIN(17, strlen(long_plmn_name)) );
+                               memcpy(noti.plmn, plmn,7);
+                               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), 
+                                       o, TNOTI_NETWORK_IDENTITY,      sizeof(struct tnoti_network_identity), &noti);          
+
+                               dbg("dbg.. noti.short_name  : %s",noti.short_name);
+                               dbg("dbg.. noti.full_name  : %s",noti.full_name);                                               
+                               dbg("dbg.. noti.plmn  : %s",noti.plmn); 
+                       }
+               }
+
+               if(long_plmn_name)
+                       free(long_plmn_name);
+               if(short_plmn_name)
+                       free(short_plmn_name);
+       }
+
+       return;
+
+}
+
+static gboolean on_event_ps_network_regist(CoreObject *o, const void *data, void *user_data)
+{
+       struct tnoti_network_registration_status regist_status;
+       enum telephony_network_service_domain_status cs_status;
+       enum telephony_network_service_domain_status ps_status;
+       enum telephony_network_service_type service_type;
+       enum telephony_network_access_technology act = NETWORK_ACT_UNKNOWN;
+       struct tnoti_network_location_cellinfo net_lac_cell_info = {0};
+       struct tnoti_ps_protocol_status noti = {0};
+       int ret;
+       unsigned char svc_domain = NETWORK_SERVICE_DOMAIN_PS;
+       int stat= 0, AcT=0;
+       unsigned int lac=0xffff, ci=0xffff;
+       unsigned int rac = 0xffff;
+       GSList* tokens = NULL;
+       char* pResp;
+       char *line = NULL;
+       GSList *lines = NULL;
+
+       lines = (GSList*)data;
+       if (1 != g_slist_length(lines)) {
+               dbg("unsolicited msg but multiple line");
+           goto OUT;
+       }
+       line  = (char*)(lines->data);
+       dbg("+CGREG NOTI RECEIVED");
+
+/*
++CREG: <stat> [[,<lac>,<ci>[AcT]]
+
+Possible values of <stat> can be
+0 Not registered, ME is not currently searching a new operator to register to
+1 Registered, home network
+2 Not registered, but ME is currently searching a new operator to register
+3 Registration denied
+4 Unknown
+5 Registered, in roaming
+
+<lac>
+string type; two byte location area code in hexadecimal format (e.g. �00C3�)
+
+<ci>
+string type; four byte cell ID in hexadecimal format (e.g. �0000A13F�)
+
+<ACT>
+0 GSM
+2 UTRAN
+3 GSM w/EGPRS
+4 UTRAN w/HSDPA
+5 UTRAN w/HSUPA
+6 UTRAN w/HSDPA and HSUPA
+Note: <Act> is supporting from R7 and above Protocol Stack.
+
+<rac>: is R7 and above feature, string type; one byte routing area code in hexadecimal format.
+*/
+       if (line!=NULL)
+       {
+               tokens = tcore_at_tok_new(line);
+               if(g_slist_length(tokens) < 1) {
+                       msg("invalid message");
+                       goto OUT;
+               }
+
+               if(!(pResp = g_slist_nth_data(tokens, 0)))
+               {
+                       dbg("No  STAT in +CGREG");
+                       goto OUT;
+               }
+               else
+               {
+                       stat = atoi(pResp);     
+                       if(pResp = g_slist_nth_data(tokens, 1))
+                               lac = atoi(pResp);
+
+                       if((pResp = g_slist_nth_data(tokens, 2)))
+                               ci = atoi(pResp);
+                       else
+                               dbg("No ci in +CGREG");
+                               
+                       if(pResp = g_slist_nth_data(tokens, 3))
+                               AcT = atoi(pResp);
+                       else
+                               dbg("No AcT in +CGREG");
+                       
+                       if(pResp = g_slist_nth_data(tokens, 4))
+                               rac = atoi(pResp);
+                       else
+                               dbg("No rac in +CGREG");
+               }
+
+
+               dbg("stat=%d, lac=0x%lx, ci=0x%lx, Act=%d, rac = 0x%x", stat, lac, ci, AcT, rac);
+
+               ps_status = lookup_tbl_net_status[stat];
+               
+               tcore_network_set_service_status(o, TCORE_NETWORK_SERVICE_DOMAIN_TYPE_PACKET, ps_status);
+               _ps_set(tcore_object_ref_plugin(o), ps_status);
+                       
+               tcore_network_get_service_status(o, TCORE_NETWORK_SERVICE_DOMAIN_TYPE_CIRCUIT, &cs_status);
+
+               act = lookup_tbl_access_technology[AcT];
+               tcore_network_set_access_technology(o, act);
+
+               if (stat == AT_CREG_STAT_REG_ROAM)
+                       tcore_network_set_roaming_state(o, TRUE);
+               else
+                       tcore_network_set_roaming_state(o, FALSE);
+
+               tcore_network_get_service_type(o, &service_type);
+               dbg("prev_service_type = 0x%x", service_type);
+               service_type = _get_service_type(service_type, svc_domain, act, cs_status, ps_status);
+               dbg("new_service_type = 0x%x", service_type);
+               tcore_network_set_service_type(o, service_type);
+
+               tcore_network_set_lac(o, lac);
+               tcore_network_set_cell_id(o, ci);
+               tcore_network_set_rac(o, rac);
+
+               net_lac_cell_info.lac = lac;
+               net_lac_cell_info.cell_id = ci;
+
+               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_NETWORK_LOCATION_CELLINFO,
+                               sizeof(struct tnoti_network_location_cellinfo), &net_lac_cell_info);
+
+               regist_status.cs_domain_status = cs_status;
+               regist_status.ps_domain_status = ps_status;
+               regist_status.service_type = service_type;
+               regist_status.roaming_status = tcore_network_get_roaming_state(o);
+
+               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o,
+                               TNOTI_NETWORK_REGISTRATION_STATUS, sizeof(struct tnoti_network_registration_status), &regist_status);
+
+               if(service_type == NETWORK_SERVICE_TYPE_HSDPA)
+                       noti.status = TELEPHONY_HSDPA_ON;
+               else
+                       noti.status = TELEPHONY_HSDPA_OFF;
+               
+               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_PS_PROTOCOL_STATUS,
+               sizeof(struct tnoti_ps_protocol_status), &noti);
+
+               /* Get PLMN ID needed to application */
+               //get_serving_network(o, NULL);
+
+
+       }
+       else
+       {
+               dbg("Response NOK");
+       }
+
+OUT:
+       if(NULL!=tokens)
+       tcore_at_tok_free(tokens);
+       return TRUE;
+}
+
+static gboolean on_event_cs_network_regist(CoreObject *o, const void *event_info, void *user_data)
+{
+       GSList *lines = NULL;
+       char *line = NULL;
+       struct tnoti_network_registration_status regist_status;
+       enum telephony_network_service_domain_status cs_status;
+       enum telephony_network_service_domain_status ps_status;
+       enum telephony_network_service_type service_type;
+       enum telephony_network_access_technology act = NETWORK_ACT_UNKNOWN;
+       struct tnoti_network_location_cellinfo net_lac_cell_info = {0};
+
+       int ret;
+       unsigned char svc_domain = NETWORK_SERVICE_DOMAIN_CS;
+       int stat= 0, AcT=0;
+       unsigned int lac=0xffff, ci=0xffff;
+       GSList* tokens = NULL;
+       char* pResp;
+
+       lines = (GSList*)event_info;
+       if (1 != g_slist_length(lines)) {
+               dbg("unsolicited msg but multiple line");
+           goto OUT;
+       }
+       line  = (char*)(lines->data);
+
+       dbg("+CREG NOTI RECEIVED");
+
+/*
++CREG: <stat> [[,<lac>,<ci>[AcT]]
+
+Possible values of <stat> can be
+0 Not registered, ME is not currently searching a new operator to register to
+1 Registered, home network
+2 Not registered, but ME is currently searching a new operator to register
+3 Registration denied
+4 Unknown
+5 Registered, in roaming
+
+<lac>
+string type; two byte location area code in hexadecimal format (e.g. �00C3�)
+
+<ci>
+string type; four byte cell ID in hexadecimal format (e.g. �0000A13F�)
+
+<ACT>
+0 GSM
+2 UTRAN
+3 GSM w/EGPRS
+4 UTRAN w/HSDPA
+5 UTRAN w/HSUPA
+6 UTRAN w/HSDPA and HSUPA
+Note: <Act> is supporting from R7 and above Protocol Stack.
+*/
+       if (line!=NULL)
+       {
+               tokens = tcore_at_tok_new(line);
+               if(g_slist_length(tokens) < 1) {
+                       msg("invalid message");
+                       goto OUT;
+               }
+
+               if(!(pResp = g_slist_nth_data(tokens, 0)))
+               {
+                       dbg("No  STAT in +CREG");
+                       goto OUT;
+               }
+               else
+               {
+                       stat = atoi(pResp);     
+                       if(pResp = g_slist_nth_data(tokens, 1))
+                               lac = atoi(pResp);
+
+                       if((pResp = g_slist_nth_data(tokens, 2)))
+                               ci = atoi(pResp);
+                       else
+                               dbg("No ci in +CREG");
+                               
+                       if(pResp = g_slist_nth_data(tokens, 3))
+                               AcT = atoi(pResp);
+                       else
+                               dbg("No AcT in +CREG");
+               }
+
+
+               dbg("stat=%d, lac=0x%lx, ci=0x%lx, Act=%d", stat, lac, ci, AcT);
+
+               cs_status = lookup_tbl_net_status[stat];
+               tcore_network_set_service_status(o, TCORE_NETWORK_SERVICE_DOMAIN_TYPE_CIRCUIT, cs_status);
+
+       //      tcore_network_get_service_status(o, TCORE_NETWORK_SERVICE_DOMAIN_TYPE_CIRCUIT, &cs_status);
+               tcore_network_get_service_status(o, TCORE_NETWORK_SERVICE_DOMAIN_TYPE_PACKET, &ps_status);
+
+               act = lookup_tbl_access_technology[AcT];
+               tcore_network_set_access_technology(o, act);
+
+               if (stat == AT_CREG_STAT_REG_ROAM)
+                       tcore_network_set_roaming_state(o, TRUE);
+               else
+                       tcore_network_set_roaming_state(o, FALSE);
+
+               tcore_network_get_service_type(o, &service_type);
+               dbg("prev_service_type = 0x%x", service_type);
+               service_type = _get_service_type(service_type, svc_domain, act, cs_status, ps_status);
+               dbg("new_service_type = 0x%x", service_type);
+               tcore_network_set_service_type(o, service_type);
+
+               tcore_network_set_lac(o, lac);
+               tcore_network_set_cell_id(o, ci);
+
+               net_lac_cell_info.lac = lac;
+               net_lac_cell_info.cell_id = ci;
+
+               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_NETWORK_LOCATION_CELLINFO,
+                               sizeof(struct tnoti_network_location_cellinfo), &net_lac_cell_info);
+
+               regist_status.cs_domain_status = cs_status;
+               regist_status.ps_domain_status = ps_status;
+               regist_status.service_type = service_type;
+               regist_status.roaming_status = tcore_network_get_roaming_state(o);
+
+               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o,
+                               TNOTI_NETWORK_REGISTRATION_STATUS, sizeof(struct tnoti_network_registration_status), &regist_status);
+
+               /* Get PLMN ID needed to application */
+               if((NETWORK_SERVICE_DOMAIN_STATUS_FULL == cs_status )||
+                       NETWORK_SERVICE_DOMAIN_STATUS_FULL ==ps_status )
+               get_serving_network(o, NULL);
+       }
+       else
+       {
+               dbg("Response NOK");
+       }
+
+OUT:
+       if(NULL!=tokens)
+       tcore_at_tok_free(tokens);
+       return TRUE;
+
+}
+
+static gboolean on_event_network_icon_info(CoreObject *o, const void *event_info, void *user_data)
+{
+       struct tnoti_network_icon_info net_icon_info = {0};
+       char *line = NULL;
+       
+       int rssi = 0, battery = 0;
+       char * rssiToken = NULL;
+       char *batteryToken = NULL;
+       GSList* tokens = NULL;
+       GSList *lines = NULL;
+
+       lines = (GSList*)event_info;
+       if (1 != g_slist_length(lines)) {
+               dbg("unsolicited msg but multiple line");
+           goto OUT;
+       }
+       line = (char*)(lines->data);
+       dbg("+XCIEV Network Icon Info Noti Recieve");
+       memset(&net_icon_info, 0, sizeof(struct tnoti_network_icon_info));
+
+       if(line != NULL)
+       {
+               dbg("Response OK");
+       
+               tokens = tcore_at_tok_new(line);
+               if (g_slist_length(tokens) != 2) {
+                       msg("invalid message");
+                       goto OUT;
+               }
+
+               rssiToken = (char *)g_slist_nth_data(tokens, 0);
+
+               if (strlen(rssiToken)>0)
+               {
+                       net_icon_info.type = NETWORK_ICON_INFO_RSSI;
+                       net_icon_info.rssi= atoi(g_slist_nth_data(tokens, 0));
+                       dbg("rssi level : %d",net_icon_info.rssi);
+               }
+               else
+               {
+                       dbg("No rssi value");
+               }
+               
+               batteryToken = (char *)g_slist_nth_data(tokens,1);
+               if (strlen(batteryToken)>0)
+               {
+                       net_icon_info.type = NETWORK_ICON_INFO_BATTERY;
+                       net_icon_info.battery= 1 + atoi(g_slist_nth_data(tokens, 1)); // 1 level added for proper battery indication
+                       dbg("battery level : %d",net_icon_info.battery);
+               }
+               else
+               {
+                       dbg("No battery level recieved");
+               }
+               
+               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_NETWORK_ICON_INFO,
+                               sizeof(struct tnoti_network_icon_info), &net_icon_info);
+       }
+       else
+       {
+               dbg("Response NOK");            
+       }
+
+
+OUT:
+       if(NULL!=tokens)
+       tcore_at_tok_free(tokens);
+       return TRUE;
+       
+}
+
+static gboolean on_event_network_time_info(CoreObject *o, const void *event_info, void *user_data)
+{
+       struct tnoti_network_timeinfo net_time_info = {0};
+       int gmtoff;
+       char *line = NULL;
+       GSList* tokens = NULL;
+       char *time= NULL, *time_zone_variance = NULL;
+       GSList *lines = NULL;
+
+       dbg("Network Time Info Noti Recieved");
+       memset(&net_time_info, 0, sizeof(struct tnoti_network_icon_info));
+
+       lines = (GSList*)event_info;
+       if (1 != g_slist_length(lines)) {
+               dbg("unsolicited msg but multiple line");
+           goto OUT;
+       }
+       line  = (char*)(lines->data);
+
+       /*
+       <time> string type value; format is \93yy/MM/dd,hh:mms\94, wherein characters indicates year, month, day, hour, minutes, seconds.
+       <timzone_variance> is a string \93GMT+HH:MM\94 or \93GMT-HH:MM\94 e.g. \93GMT+5:30\94
+       */
+       dbg("Network time info noti recieved");
+       
+       if (line != NULL)
+       {       
+               dbg("Response OK");
+                       dbg("noti line is %s", line);
+                       
+                       tokens = tcore_at_tok_new(line);
+                       strcpy(time, g_slist_nth_data(tokens, 0));
+                       strcpy(time_zone_variance , g_slist_nth_data(tokens, 1));
+
+                       strncpy(net_time_info.hour,time ,2);
+                       strncpy(net_time_info.month, time+3, 2);        
+                       strncpy(net_time_info.day, time+6, 2);
+                       strncpy(net_time_info.hour, time+9 ,2);
+                       strncpy(net_time_info.minute, time+12,3);
+               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_NETWORK_TIMEINFO, sizeof(struct tnoti_network_timeinfo), &net_time_info);
+       }
+       else
+       {       
+               dbg("line is  NULL");
+       }
+OUT:
+       if(NULL!=tokens)
+               tcore_at_tok_free(tokens);
+       return TRUE;
+}
+
+static gboolean on_event_network_identity(CoreObject *o, const void *event_info, void *user_data)
+{
+       struct tnoti_network_identity noti;
+       char plmn[7] = { 0, };
+       int type = 0;
+       char *tmp;
+       GSList *lines = NULL;
+       char *line = NULL;
+       GSList* tokens = NULL;
+
+       dbg("NOTI RECEIVED");
+       lines = (GSList*)event_info;
+
+       if (1 != g_slist_length(lines)) {
+               dbg("unsolicited msg but multiple line");
+           goto OUT;
+       }
+
+       line  = (char*)(lines->data);
+
+       memset(&noti, 0, sizeof(struct tnoti_network_identity));
+       dbg("Network identity noti recieved");
+
+       if(line!=NULL)
+       {
+               dbg("Response OK");
+                       dbg("noti line is %s", line);
+                       tokens = tcore_at_tok_new(line);
+                       //noti.type = 0;
+                       strcpy(noti.plmn, g_slist_nth_data(tokens, 0));
+                       tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_NETWORK_IDENTITY,  sizeof(struct tnoti_network_identity), &noti);                  
+       }
+       else
+       {
+               dbg("Response NOK");            
+       }
+
+OUT:
+       if(NULL!=tokens)
+               tcore_at_tok_free(tokens);
+       return TRUE;
+}
+
+
+static void on_sim_resp_hook_get_netname(UserRequest *ur, enum tcore_response_command command, unsigned int data_len,
+               const void *data, void *user_data)
+{
+       const struct tresp_sim_read *resp = data;
+       CoreObject *o = user_data;
+
+       if (command == TRESP_SIM_GET_SPN) {
+               dbg("OK SPN GETTING!!");
+               dbg("resp->result = 0x%x", resp->result);
+               dbg("resp->data.spn.display_condition = 0x%x", resp->data.spn.display_condition);
+               dbg("resp->data.spn.spn = [%s]", resp->data.spn.spn);
+
+               tcore_network_set_network_name(o, TCORE_NETWORK_NAME_TYPE_SPN, (const char *)resp->data.spn.spn);
+
+               /**
+                * display condition
+                *  bit[0]: 0 = display of registered PLMN name not required when registered PLMN is either HPLMN or a PLMN in the service provider PLMN list
+                *          1 = display of registered PLMN name required when registered PLMN is either HPLMN or a PLMN in the service provider PLMN list
+                *  bit[1]: 0 = display of the service provider name is required when registered PLMN is neither HPLMN nor a PLMN in the service provider PLMN list
+                *          1 = display of the service provider name is not required when registered PLMN is neither HPLMN nor a PLMN in the service provider PLMN list
+                */
+               if (resp->data.spn.display_condition & 0x01) {
+                       tcore_network_set_network_name_priority(o, TCORE_NETWORK_NAME_PRIORITY_NETWORK);
+               }
+               if ((resp->data.spn.display_condition & 0x02) == 0) {
+                       tcore_network_set_network_name_priority(o, TCORE_NETWORK_NAME_PRIORITY_SPN);
+               }
+               if ((resp->data.spn.display_condition & 0x03) == 0x01) {
+                       tcore_network_set_network_name_priority(o, TCORE_NETWORK_NAME_PRIORITY_ANY);
+               }
+       }
+}
+
+static enum tcore_hook_return on_hook_sim_init(Server *s, CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, void *data, void *user_data)
+{
+       const struct tnoti_sim_status *sim = data;
+       UserRequest *ur = NULL;
+
+       if (sim->sim_status == SIM_STATUS_INIT_COMPLETED) {
+               ur = tcore_user_request_new(NULL, NULL);
+               tcore_user_request_set_command(ur, TREQ_SIM_GET_SPN);
+               tcore_user_request_set_response_hook(ur, on_sim_resp_hook_get_netname, user_data);
+               tcore_object_dispatch_request(source, ur);
+       }
+
+       return TCORE_HOOK_RETURN_CONTINUE;
+}
+
+static TReturn search_network(CoreObject *o, UserRequest *ur)
+{
+       TcorePlugin *p = NULL;
+       TcoreHal *h = NULL;
+       TcorePending *pending = NULL;
+       TcoreATRequest *atreq = NULL;
+
+       char*cmd_str = NULL;
+       dbg("search_network - ENTER!!");
+       
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+
+       h = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       cmd_str = g_strdup_printf("AT+COPS=?\r");
+       atreq = tcore_at_request_new(cmd_str, "+COPS", TCORE_AT_SINGLELINE);
+       
+       tcore_pending_set_request_data(pending, 0, atreq);
+       //tcore_pending_set_timeout(pending, 60);
+       //tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT);
+       tcore_pending_set_response_callback(pending, on_response_search_network, NULL);
+       //tcore_pending_set_timeout_callback(pending, on_timeout_search_network, NULL);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_network_message_send, NULL);
+
+       tcore_hal_send_request(h, pending);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn set_plmn_selection_mode(CoreObject *o, UserRequest *ur)
+{
+       TcorePlugin *p = NULL;
+       TcoreHal *h = NULL;
+       TcorePending *pending = NULL;
+       TcoreATRequest *atreq;
+       char*cmd_str = NULL;
+       int format = 0; /* default value for long alphanumeric */
+       int mode = 0;
+       char plmn[7];
+       
+       const struct treq_network_set_plmn_selection_mode *req_data;
+
+
+       dbg("set_plmn_selection_mode - ENTER!!");
+
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+
+       req_data = tcore_user_request_ref_data(ur, NULL);
+       h = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       // Command Format - AT+COPS=[<mode>[,<format>[,<oper>[,< AcT>]]]]       
+       /* oper parameter format
+               - 0 <oper> format presentations are set to long alphanumeric. If Network name not available it displays combination of Mcc and MNC in string format.
+               - 1 <oper> format presentation is set to short alphanumeric.
+               - 2 <oper> format presentations set to numeric.
+       */
+       
+       switch(req_data->mode) {
+               case NETWORK_SELECT_MODE_GSM_MANUAL:
+               {
+                       mode = AT_COPS_MODE_MANUAL;
+                       format = AT_COPS_FORMAT_NUMERIC;
+
+                       memset(plmn, 0, 7);
+                       memcpy(plmn, req_data->plmn, 6);
+
+                       if (strlen(req_data->plmn) == 5) {
+                               plmn[5] = '#';
+                       }               
+
+                       cmd_str = g_strdup_printf("AT+COPS=%d,%d,%s\r", mode, format, plmn);
+               }
+               break;
+               
+               case NETWORK_SELECT_MODE_GLOBAL_AUTOMATIC:
+               default:
+                       cmd_str = g_strdup("AT+COPS=0\r");
+                       break;
+       }
+
+       
+       atreq = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       tcore_pending_set_request_data(pending, 0, atreq);
+       tcore_pending_set_response_callback(pending, on_response_set_plmn_selection_mode, NULL);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_network_message_send, NULL);
+
+
+       tcore_hal_send_request(h, pending);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn get_plmn_selection_mode(CoreObject *o, UserRequest *ur)
+{
+       TcorePlugin *p = NULL;
+       TcoreHal *h = NULL;
+       TcorePending *pending = NULL;
+       TcoreATRequest *atreq;
+       char*cmd_str = NULL;
+
+       dbg("get_plmn_selection_mode - ENTER!!");
+
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+
+       h = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       cmd_str = g_strdup_printf("AT+COPS?\r");
+       atreq = tcore_at_request_new(cmd_str, "+COPS", TCORE_AT_SINGLELINE);
+
+       tcore_pending_set_request_data(pending, 0, atreq);
+       tcore_pending_set_response_callback(pending, on_response_get_plmn_selection_mode, NULL);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_network_message_send, NULL);
+
+       tcore_hal_send_request(h, pending);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+
+static TReturn set_band(CoreObject *o, UserRequest *ur)
+{
+       TcorePlugin *p = NULL;
+       TcoreHal *h = NULL;
+       TcorePending *pending = NULL;
+       TcoreATRequest *atreq;
+       char*cmd_str = NULL;
+       const struct treq_network_set_band *req_data;
+       int band = 0;
+       dbg("set_band - ENTER!!");
+
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+
+       req_data = tcore_user_request_ref_data(ur, NULL);
+
+       h = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       switch (req_data->band)
+       {
+               case NETWORK_BAND_TYPE_GSM850:
+                       band = AT_XBANDSEL_850;
+                       break;
+
+               case NETWORK_BAND_TYPE_GSM_900_1800:
+                       band = AT_XBANDSEL_1800; //summerize 900 + 1800
+                       break;
+
+               case NETWORK_BAND_TYPE_GSM1900:
+                       band = AT_XBANDSEL_1900;
+                       break;
+               case NETWORK_BAND_TYPE_GSM1800:
+                       band = AT_XBANDSEL_1800;
+                       break;
+               case NETWORK_BAND_TYPE_GSM_850_1900:
+                       band = AT_XBANDSEL_1900; //summerize 850 + 1900
+                       break; 
+               default:
+                       break;
+       }
+       pending = tcore_pending_new(o, 0);
+
+       //TODO - Done only for UMTS case, need to do for GSM seperately?
+       cmd_str = g_strdup_printf("AT+XUBANDSEL=%d", req_data->band);
+       atreq = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       tcore_pending_set_request_data(pending, 0, atreq);
+       tcore_pending_set_timeout(pending, 0);
+       tcore_pending_set_priority(pending, TCORE_PENDING_PRIORITY_DEFAULT);
+       tcore_pending_set_response_callback(pending, on_response_set_band, NULL);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_network_message_send, NULL);
+
+
+       tcore_hal_send_request(h, pending);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn get_band(CoreObject *o, UserRequest *ur)
+{
+       TcorePlugin *p = NULL;
+       TcoreHal *h = NULL;
+       TcorePending *pending = NULL;
+
+       TcoreATRequest *atreq;
+       char*cmd_str = NULL;
+       dbg("get_band - ENTER!!");
+
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+
+       h = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       cmd_str = g_strdup_printf("AT+XUBANDSEL?\r");
+       atreq = tcore_at_request_new(cmd_str, "+XUBANDSEL", TCORE_AT_SINGLELINE);
+
+       pending = tcore_pending_new(o, 0);
+       tcore_pending_set_request_data(pending, 0, atreq);
+       tcore_pending_set_response_callback(pending, on_response_get_band, NULL);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_network_message_send, NULL);
+       tcore_hal_send_request(h, pending);
+
+
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn set_preferred_plmn(CoreObject *o, UserRequest *ur)
+{
+       dbg("Entry");
+
+       dbg("Exit");
+       return TCORE_RETURN_SUCCESS; 
+}
+
+static TReturn get_preferred_plmn(CoreObject *o, UserRequest *ur)
+{
+       TcorePlugin *p = NULL;
+       TcoreHal *h = NULL;
+       TcorePending *pending = NULL;
+       TcoreATRequest *atreq = NULL;
+
+       char*cmd_str = NULL;
+
+       dbg("get_preferred_plmn - ENTER!!");
+
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+
+       h = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       cmd_str = g_strdup_printf("AT+CPOL?\r");
+       atreq = tcore_at_request_new(cmd_str, "+CPOL", TCORE_AT_MULTILINE);
+       
+       tcore_pending_set_request_data(pending, 0, atreq);
+       tcore_pending_set_response_callback(pending, on_response_get_preferred_plmn, NULL);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_network_message_send, NULL);
+
+       tcore_hal_send_request(h, pending);
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+
+static TReturn set_cancel_manual_search(CoreObject *o, UserRequest *ur)
+{
+       dbg("Entry");
+
+       dbg("Exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn get_serving_network(CoreObject *o, UserRequest *ur)
+{
+       TcorePlugin *p = NULL;
+       TcoreHal *h = NULL;
+       TcorePending *pending = NULL;
+       dbg("get_serving_network - ENTER!!");
+       
+       if (!o)
+               return TCORE_RETURN_EINVAL;
+
+       dbg("new pending(AT+COPS?)");
+
+       nwk_prepare_and_send_pending_request(tcore_object_ref_plugin(o), "umts_network", "AT+COPS=3,2;+COPS?;+COPS=3,0;+COPS?\r", "+COPS", TCORE_AT_MULTILINE,on_response_get_serving_network);
+       return TCORE_RETURN_SUCCESS;
+}
+
+static struct tcore_network_operations network_ops = {
+               .search                                 = search_network,
+               .set_plmn_selection_mode        = set_plmn_selection_mode,
+               .get_plmn_selection_mode        = get_plmn_selection_mode,
+               .set_service_domain             = NULL,
+               .get_service_domain             = NULL,
+               .set_band                               = set_band,
+               .get_band                               = get_band,
+               .set_preferred_plmn             = set_preferred_plmn,
+               .get_preferred_plmn             = get_preferred_plmn,
+               .set_order                              = NULL,
+               .get_order                              = NULL,
+               .set_power_on_attach            = NULL,
+               .get_power_on_attach            = NULL,
+               .set_cancel_manual_search       = set_cancel_manual_search,
+               .get_serving_network            = get_serving_network,
+};
+
+gboolean s_network_init(TcorePlugin *p, TcoreHal *h)
+{
+       CoreObject *o = NULL;
+
+       o = tcore_network_new(p, "umts_network", &network_ops, h);
+       if (!o)
+               return FALSE;
+
+       tcore_object_add_callback(o,"+CREG", on_event_cs_network_regist, NULL);
+       tcore_object_add_callback(o,"+CGREG", on_event_ps_network_regist, NULL);
+       tcore_object_add_callback(o, "+XCIEV", on_event_network_icon_info, NULL);
+
+       //XNITZINFO is for <time><timezone variance>
+       //CTZDST is for <dst>
+       tcore_object_add_callback(o, "+XNITZINFO", on_event_network_time_info, NULL);
+       tcore_object_add_callback(o, "+CTZDST", on_event_network_time_info, NULL);
+
+       //tcore_object_add_callback(o, "+XCOPS", on_event_network_identity, NULL);
+
+       //need to check whether the following is needed
+
+       //tcore_server_add_notification_hook(tcore_plugin_ref_server(p), TNOTI_SIM_STATUS, on_hook_sim_init, o);
+
+       _insert_mcc_mnc_oper_list(p, o);
+
+       return TRUE;
+}
+
+void s_network_exit(TcorePlugin *p)
+{
+       CoreObject *o;
+
+       o = tcore_plugin_ref_core_object(p, "umts_network");
+
+       tcore_network_free(o);
+}
diff --git a/src/s_ps.c b/src/s_ps.c
new file mode 100755 (executable)
index 0000000..56bc1ee
--- /dev/null
@@ -0,0 +1,1485 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <tcore.h>
+#include <hal.h>
+#include <core_object.h>
+#include <plugin.h>
+#include <queue.h>
+#include <co_ps.h>
+#include <co_context.h>
+#include <storage.h>
+#include <server.h>
+#include <at.h>
+#include <util.h>
+#include <type/ps.h>
+
+#include "s_common.h"
+#include "s_ps.h"
+
+#define CR '\r'
+#define LF '\n'
+
+
+
+#define VNET_CH_PATH_BOOT0     "/dev/umts_boot0"
+#define IOCTL_CG_DATA_SEND  _IO('o', 0x37)
+
+/*Invalid Session ID*/
+#define PS_INVALID_CID 999 /*Need to check */
+
+/*Maximum Number of Active PDP context */
+#define MAX_NUM_PS_PDP_ACTIVE_SESSION 5
+
+/*Maximum String length Of the Command*/
+#define MAX_AT_CMD_STR_LEN     150
+
+/*Name of Packet Service */
+
+/*ps call status*/
+#define AT_SESSION_UP 1
+#define AT_SESSION_DOWN 0
+
+/*Command for PS Attach and Detach*/
+#define AT_PS_ATTACH 1
+#define AT_PS_DETACH 0
+
+/*Max retry for the message*/
+#define AT_MAX_RETRY_COUNT 5
+
+/*Command for PDP activation and Deactivation*/
+#define AT_PDP_ACTIVATE 1
+#define AT_PDP_DEACTIVATE 0
+
+#define AT_DUN_NOTIFICATION_ENABLE 1
+#define AT_DUN_NOTIFICATION_DISABLE    0
+
+#define AT_XDNS_ENABLE 1
+#define AT_XDNS_DISABLE 0
+
+static char addr[4];
+static void _ps_free(void * ptr)
+{
+       dbg("Entered");
+       if(ptr)
+       {
+               (void)free(ptr);
+               ptr = NULL;
+       }
+       dbg("Exit");
+       return;
+}
+static void unable_to_get_pending(CoreObject *co_ps,CoreObject *ps_context)
+{
+       struct tnoti_ps_call_status data_resp = {0};
+       dbg("Entered");
+       data_resp.context_id = tcore_context_get_id(ps_context);
+       data_resp.state = AT_SESSION_DOWN;/*check value of state*/
+       data_resp.result =0xFF;/*check error value*/
+       tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(co_ps)), co_ps,
+               TNOTI_PS_CALL_STATUS, sizeof(struct tnoti_ps_call_status), &data_resp);
+       (void)tcore_context_set_state(ps_context, CONTEXT_STATE_DEACTIVATED);
+       dbg("Exit");
+}
+static TReturn _pdp_device_control(gboolean flag, unsigned int context_id)
+{
+       int fd = -1;
+       int ret = -1 ;
+       //int errno; 
+       fd = open ( VNET_CH_PATH_BOOT0, O_RDWR );
+       if ( fd < 0 ) {
+               dbg("error : open [ %s ] [ %s ]", VNET_CH_PATH_BOOT0, strerror(errno));
+               return -1;
+       }
+
+       dbg("Send IOCTL: arg 0x05 (0101) HSIC1, cid=%d \n",context_id);
+       ret = ioctl(fd, IOCTL_CG_DATA_SEND, 0x05);
+       if (ret < 0) 
+       {
+               dbg("[ error ] send IOCTL_CG_DATA_SEND (0x%x) fail!! \n",IOCTL_CG_DATA_SEND);
+               close(fd);
+               return TCORE_RETURN_FAILURE;
+       }
+       else
+       {
+               dbg("[ ok ] send IOCTL_CG_DATA_SEND (0x%x) success!! \n",IOCTL_CG_DATA_SEND);
+               close(fd);
+               return TCORE_RETURN_SUCCESS;
+       }
+}
+
+static gboolean on_event_cgev_handle(CoreObject *co_ps, const void *data, void *user_data)
+{
+       
+       char *token = NULL;
+       GSList *tokens= NULL;
+    GSList *lines = NULL;
+       const char *line = NULL;
+       char *noti_data = NULL;
+       int i = 0;
+       int value = 20;
+       int state = -1;
+
+       dbg("Entered");
+       lines = (GSList*)data;
+       line = (const char *)lines->data;
+       dbg("Lines->data :-%s",line);
+       
+       tokens = tcore_at_tok_new(line);
+       switch(g_slist_length(tokens))
+       {
+               case 0:
+               {
+                       dbg("No token present: Ignore +CGEV Notifications ");
+                       return TRUE;
+               }
+               case 1:
+               {
+                       dbg("one Token present");
+                       noti_data = g_slist_nth_data(tokens, 0);
+                       dbg("notification data :-%s",noti_data);
+                       if(0 ==  strcmp(noti_data,"ME CLASS B"))
+                       {
+                               dbg("ME Class B notification received");
+                               goto ignore;
+                       }
+                       dbg("");
+                       if(0 ==  strcmp(noti_data,"NW CLASS A"))
+                       {
+                               dbg("NW Class A notification received");
+                               goto ignore;
+                       }       
+                       
+                       token = strtok(noti_data, " ");
+                       while(token != NULL)
+                       {
+                               if((i == 0) && (0!=  strcmp(token,"ME")))
+                                       break;
+                               if((i == 1) && (0!=  strcmp(token,"PDN")))
+                                       break;
+                               if((i == 2) && (0 ==  strcmp(token,"ACT")))
+                                               state = 1;                              
+                               if((i == 2) && (0 ==  strcmp(token,"DEACT")))
+                                               state = 0;      
+                               if(i == 3 )
+                               {
+                                       value = atoi(token);
+                                       break;
+                               }
+                               
+                               i++;
+                               token = strtok(NULL, " ");
+                       }
+                       dbg("value:%d ",value);
+                       i = 0;
+                       break;
+               }
+               case 3:
+               {
+                       i = 0;  
+                       state = 0;
+                       value = 0;
+                       dbg("Three Token present");
+                       noti_data = g_slist_nth_data(tokens, 0);
+                       dbg("notification data :-%s",noti_data);
+                       token = strtok(noti_data, " ");
+                       while(token != NULL)
+                       {
+                               if((i == 0) && (0 ==  strcmp(token,"ME")))
+                                       state = 1;
+                               if((i == 1) && (0!=  strcmp(token,"DEACT")))
+                                       break;
+                               if((i == 2) && (0 ==  strcmp(token,"\"IP\"")) && (0 == state))
+                               {
+                                       dbg("MObile Deactiavted the Context");
+                                       value = 10;
+                                               break;                          
+                               }
+                               if((i == 2) && (0 ==  strcmp(token,"\"IP\"")) && (1 == state))
+                               {
+                                       dbg("NW Deactiavted the Context");
+                                       value = 10;
+                                               break;                          
+                               }       
+                               i++;
+                               token = strtok(NULL, " ");
+                       }
+                       if(value == 10 && state == 0)
+                       {
+                               dbg("Recieved Notification for Context deactivations from network");
+                               noti_data = g_slist_nth_data(tokens, 1);
+                               dbg("PDP Address :- %s",noti_data);
+                               noti_data = g_slist_nth_data(tokens, 2);
+                               dbg("CID got deactivated :- %d",atoi(noti_data));
+                       }
+                       if(value == 10 && state == 1)
+                       {
+                               dbg("Recieved Notification for Context deactivations from Mobile");
+                               noti_data = g_slist_nth_data(tokens, 1);
+                               dbg("PDP Address :- %s",noti_data);
+                               noti_data = g_slist_nth_data(tokens, 2);
+                               dbg("CID got deactivated :- %d",atoi(noti_data));                               
+
+                       }
+                       state = 100;
+                       value  = 100;
+                       break;
+               }
+               default:
+               {
+                       dbg("Ignore +CGEV Notifications ");
+                       
+               }
+       }
+       if(state == 1)
+       {
+               dbg("Notification recieved for Activation of CID:-%d",value);
+               
+       }
+       else if(state == 0)
+       {
+               dbg("Notification recieved for Deactivation of CID:-%d",value);
+               
+       }
+       else
+       {
+               dbg("ignore");
+       }       
+ignore:                
+       tcore_at_tok_free(tokens);
+       return TRUE;
+               
+}
+
+#if 0 /*Not Needed Right Now*/
+static void on_response_send_ps_attach (TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       CoreObject *co_ps = NULL;
+       CoreObject *ps_context = user_data;
+       struct tnoti_ps_call_status resp_data;
+
+       dbg("Entered");
+       memset(&resp_data,0x0,sizeof(struct tnoti_ps_call_status));
+       
+       co_ps = tcore_pending_ref_core_object(p);
+
+       if(resp->success)
+       {
+               dbg("Response Ok");
+               /*Activating the Context */
+               send_pdp_activate_cmd(co_ps,ps_context);
+               return;
+       }
+       else
+       {
+               send_ps_attach_cmd(co_ps,ps_context);
+               
+               
+               dbg("Retry Count: %d",retry_count);
+               resp_data.context_id =tcore_context_get_id(ps_context);
+               resp_data.state = AT_SESSION_DOWN;/*check value of state*/
+               resp_data.result =0xFF;/*check error value*/
+               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(co_ps)), co_ps,
+                       TNOTI_PS_CALL_STATUS, sizeof(struct tnoti_ps_call_status), &resp_data);
+               dbg("Exit: Response NOK");
+               return;
+       }
+}
+
+static void send_ps_attach_cmd(CoreObject *co_ps,CoreObject *ps_context)
+{
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       char cmd_str[MAX_AT_CMD_STR_LEN] ;
+       
+       dbg("Entered");
+       memset(cmd_str,0x0,MAX_AT_CMD_STR_LEN);
+
+       /* FIXME: Before MUX setup, use PHY HAL directly. */
+       hal = tcore_object_get_hal(co_ps);
+       
+       (void)sprintf(cmd_str, "AT+CGATT=%d%c",AT_PS_ATTACH,CR);
+       pending = tcore_at_pending_new(co_ps,cmd_str,NULL,TCORE_AT_NO_RESULT,
+                                       on_response_send_ps_attach,ps_context );
+       if(NULL == pending)
+       {
+               err("Unable to get the create a AT request ");
+               goto error;
+       }
+       tcore_hal_send_request(hal, pending);
+       dbg("Exit: Successfully");
+       return ;        
+
+error:
+       err("Unable to create At request");
+       send_undefine_context_cmd(co_ps,ps_context);
+       return; 
+}
+static void on_response_check_ps_attach(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       CoreObject *co_ps = NULL;
+       CoreObject *ps_context = user_data;
+
+       GSList *tokens=NULL;
+       const char *line = NULL;
+
+       co_ps = tcore_pending_ref_core_object(p);
+       if(resp->final_response)
+       {
+               if(resp->lines)
+               {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if((g_slist_length (tokens)) < 1 )
+                               goto error;     
+                       if(atoi((char *)g_slist_nth_data(tokens,0)) == 1)
+                       {
+                               dbg("PS is Already Attached");
+                               send_pdp_activate_cmd(co_ps,ps_context);
+                       }
+                       else
+                       {
+                               dbg("PS is not attached:Need To send AT command To attach PS");
+                               send_ps_attach_cmd(co_ps,ps_context);
+                       }
+                       tcore_at_tok_free(tokens);
+                       return;
+               }
+       }
+       else
+       {
+               
+               send_check_ps_attach_cmd(co_ps,ps_context);
+               
+       }
+error:
+       
+       err("Exit:Response NOK");
+       tcore_at_tok_free(tokens);
+       send_undefine_context_cmd(co_ps,ps_context);
+       return;
+}
+
+static void send_check_ps_attach_cmd(CoreObject *co_ps,CoreObject *ps_context)
+{
+       
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       char cmd_str[MAX_AT_CMD_STR_LEN] ;
+       
+       
+       dbg("Entered");
+       memset(cmd_str,0x0,MAX_AT_CMD_STR_LEN);
+       
+       /* FIXME: Before MUX setup, use PHY HAL directly. */
+       hal = tcore_object_get_hal(co_ps);
+       
+       (void)sprintf(cmd_str, "AT+CGATT?%c",CR);
+       pending = tcore_at_pending_new(co_ps,cmd_str,"+CGATT",TCORE_AT_SINGLELINE,
+                                       on_response_check_ps_attach,ps_context );
+       if(NULL == pending)
+       {
+               err("Unable to get the create a AT request ");
+               goto error;
+       }
+       tcore_hal_send_request(hal, pending);
+       dbg("Exit: Successfully");
+       return; 
+error:
+
+       dbg("Unable To create At request");
+       send_undefine_context_cmd(co_ps,ps_context);
+       return;
+}
+
+static gboolean on_event_ps_protocol_status(CoreObject *co_ps, const void *data, void *user_data)
+{
+       struct tnoti_ps_protocol_status noti;
+       GSList *tokens=NULL;
+       const char *line = NULL;
+       int value;
+       GSList *lines = NULL;
+
+       lines = (GSList*)data;
+       if (1 != g_slist_length(lines)) {
+               dbg("unsolicited msg but multiple line");
+           goto OUT;
+       }
+
+       line = (const char *)(lines->data);
+       tokens = tcore_at_tok_new(line);
+       value= atoi(g_slist_nth_data(tokens, 0));       
+               switch(value)
+               {
+                       case 1:
+                       {
+                               dbg("registered, home network ");
+                               break;
+                       }       
+                       case 0:/*Fall through*/
+                       case 2:/*Fall through*/
+                       case 3:/*Fall through*/
+                       case 4:/*Fall through*/
+                       case 5:/*Fall through*/
+                       case 6:/*Fall through*/
+                       case 7:/*Fall through*/
+                       case 8:/*Fall through*/
+                       case 9:/*Fall through*/
+                       case 10:/*Fall through*/
+                       default:/*Fall through*/
+                       dbg("circuit mode registration status : %d",value);
+                       noti.status = TELEPHONY_HSDPA_OFF;
+                       tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(co_ps)), co_ps,
+                               TNOTI_PS_PROTOCOL_STATUS,sizeof(struct tnoti_ps_protocol_status), &noti);
+                       tcore_at_tok_free(tokens);      
+                       return TRUE;
+               }       
+               value= atoi(g_slist_nth_data(tokens,4));        
+               switch(value)
+               {
+                       case 4:
+                       {
+                               dbg("ACT:HSDPA");
+                               noti.status = TELEPHONY_HSDPA_ON;
+                               break;
+                       }
+                       case 5:
+                       {
+                               dbg("ACT:HSUPA");
+                               noti.status = TELEPHONY_HSUPA_ON;
+                               break;
+                       }
+                       case 6:
+                       {
+                               dbg("ACT:HSPA");
+                               noti.status = TELEPHONY_HSPA_ON;
+                               break;
+                       }
+                       case 0:/*Fall Through*/
+                       case 1:/*Fall Through*/
+                       case 2:/*Fall Through*/
+                       case 3:/*Fall Through*/
+                       default:
+                       {
+                               dbg("ACT:Unsupported ");
+                               goto OUT;
+                       }
+               }
+               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(co_ps)), co_ps,
+                               TNOTI_PS_PROTOCOL_STATUS,sizeof(struct tnoti_ps_protocol_status), &noti);
+OUT:
+       if(NULL!=tokens)
+               tcore_at_tok_free(tokens);
+       return TRUE;
+}
+
+static gboolean on_event_ps_call_status(CoreObject *co_ps, const void *data, void *user_data)
+{
+       CoreObject *ps_context = (CoreObject *)user_data;
+       GSList *tokens=NULL;
+       GSList *lines = NULL;
+       const char *line = NULL;
+       int value;
+       struct tnoti_ps_call_status data_resp;
+
+       lines = (GSList*)data;
+       if (1 != g_slist_length(lines)) {
+               dbg("unsolicited msg but multiple line");
+               goto OUT;
+       }
+
+       line = (const char*)(lines->data);      
+       tokens = tcore_at_tok_new(line);
+
+       value = atoi(g_slist_nth_data(tokens,0));
+       if(value == 1)
+       {
+               dbg("Session is resumed");
+               data_resp.context_id = tcore_context_get_id(ps_context);
+               data_resp.state = 1;
+               data_resp.result = 0;
+               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(co_ps)), co_ps,
+                       TNOTI_PS_CALL_STATUS, sizeof(struct tnoti_ps_call_status), &data_resp);
+       }       
+       else
+       {
+               dbg("Session is suspended");
+               data_resp.context_id = tcore_context_get_id(ps_context);
+               data_resp.state = 0;
+               data_resp.result = 50;/*To Do: check exact value*/
+               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(co_ps)), co_ps,
+                       TNOTI_PS_CALL_STATUS, sizeof(struct tnoti_ps_call_status), &data_resp);
+               if (_pdp_device_control(FALSE, data_resp.context_id) != TCORE_RETURN_SUCCESS) {
+               dbg("_pdp_device_control() failed");
+               }
+       }
+OUT:
+       if(NULL!=tokens)
+               tcore_at_tok_free(tokens);
+       return TRUE;
+}
+static gboolean on_event_cmee_error_handle(CoreObject *co_ps, const void *data, void *user_data)
+{
+       struct tnoti_ps_call_status data_resp = {0};
+       GSList *tokens= NULL;
+    GSList *lines = NULL;
+       const char *line = NULL;
+       int value = 0;
+
+       dbg("Entered");
+       lines = (GSList*)data;
+       if (1 != g_slist_length(lines)) {
+               dbg("unsolicited msg but multiple line");
+               goto OUT;
+       }
+
+       line = (const char*)(lines->data);      
+       tokens = tcore_at_tok_new(line);
+       value = atoi(g_slist_nth_data(tokens,0));
+
+       data_resp.context_id = 1;/*to do have cid extarcted */
+       data_resp.state = 0;
+       data_resp.result = value;
+       dbg("Exiting: Sending Notification Upwards");
+       tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(co_ps)), co_ps,
+                       TNOTI_PS_CALL_STATUS, sizeof(struct tnoti_ps_call_status), &data_resp);
+OUT:
+       if(tokens)
+               tcore_at_tok_free(tokens);
+       dbg("Ignoring the indications ")
+       return TRUE;
+}
+#endif
+static gboolean on_event_dun_call_notification(CoreObject *o, const void *data, void *user_data)
+{
+       GSList *tokens=NULL;
+       const char *line = NULL;
+       int value;
+       GSList *lines = NULL;
+
+
+       dbg("Entered");
+
+       lines = (GSList*)data;
+       if (1 != g_slist_length(lines)) {
+               dbg("unsolicited msg but multiple line");
+               goto OUT;
+       }
+
+       line = (char*)(lines->data);
+               tokens = tcore_at_tok_new(line);
+       value = atoi(g_slist_nth_data(tokens, 0));
+
+/*
+<status> may be
+0: DUN activation in progress
+1: DUN deactivation in progress
+2: DUN activated
+3: DUN deactivated
+*/
+               switch(value)
+               {
+                       case 0:/*Fall Through*/
+                       case 1:
+                       break;  
+                       case 2:
+                       {
+                               /*To Do:- Fill Data structure : data*/
+                               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o,
+                               TNOTI_PS_EXTERNAL_CALL, sizeof(struct tnoti_ps_external_call), &data);  
+                       }
+                       case 3:
+                       {
+                               /*To Do:- Fill Data structure : data*/
+                               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o,
+                               TNOTI_PS_EXTERNAL_CALL, sizeof(struct tnoti_ps_external_call), &data);
+                       }
+                       break;
+                       default:
+                       goto OUT;       
+               }       
+OUT:
+       if(NULL!=tokens)
+               tcore_at_tok_free(tokens);
+       return TRUE;    
+}
+#if 0
+static void on_response_dun_call_notification(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       TcoreATResponse *resp = data;
+       CoreObject *co_ps =  tcore_pending_ref_core_object(p);
+       CoreObject *ps_context = user_data;
+       
+       if(resp->final_response)
+       {
+               dbg("Dn notification is Enabled");
+                               
+       }
+       else
+       {
+       
+       /*To Do: Need to check that is it to be  reported*/
+       dbg("Unable to set the Dun Notifications");
+       dbg("Response NOK");
+       }
+       return;
+}
+/*This should be called only in case of CID == 1*/
+
+static void send_dun_call_notification(CoreObject *co_ps,CoreObject *ps_context)
+{
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       char cmd_str[MAX_AT_CMD_STR_LEN] ;
+
+       memset(cmd_str,0x0,MAX_AT_CMD_STR_LEN);
+
+       hal = tcore_object_get_hal(co_ps);
+       
+       (void)sprintf(cmd_str, "AT+XNOTIFYDUNSTATUS=%d%c",AT_DUN_NOTIFICATION_ENABLE,CR);
+       pending = tcore_at_pending_new(co_ps,cmd_str,NULL,TCORE_AT_NO_RESULT,
+                                       on_response_dun_call_notification,ps_context );
+       if(NULL == pending)
+       {
+               err("Unable to get the create a AT request ");
+               goto error;
+       }
+       tcore_hal_send_request(hal, pending);
+       return ;
+error: 
+       /*To Do: Need to check that is it to be  reported*/
+               dbg("Unable to set the Dun Notifications");
+       return;
+}
+
+static int find_free_tbl_entry(CoreObject *co_ps,int cid, struct context *loc[])
+{
+       struct context *tbl = tcore_object_ref_user_data(co_ps);
+       dbg("Entered");
+       *loc = tbl + cid;
+       if(tbl->isvalid == 0)
+       {
+               dbg("Entry is free");
+               return 1;
+       }
+       else
+       {
+               dbg("PDP session is already defined ");
+               return 0;
+       }
+}
+
+#endif /*Not Needed Right Now*/
+static void on_response_undefine_context_cmd(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       CoreObject *co_ps = NULL;
+       const TcoreATResponse *resp = data;
+       CoreObject *ps_context = user_data;
+       
+       dbg("Entered");
+       co_ps = tcore_pending_ref_core_object(p);
+       
+       if(resp->success)
+       {
+               dbg("Response Ok");
+               /*getting the IP address and DNS from the modem*/
+       }
+       dbg("Response NOk");
+       unable_to_get_pending(co_ps,ps_context);
+       return;
+}
+
+static void send_undefine_context_cmd(CoreObject *co_ps,CoreObject *ps_context)
+{
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       char cmd_str[MAX_AT_CMD_STR_LEN] ;
+       int cid = 0;
+
+       dbg("Entered");
+       memset(cmd_str,0x0,MAX_AT_CMD_STR_LEN);
+
+       /* FIXME: Before MUX setup, use PHY HAL directly. */
+       hal = tcore_object_get_hal(co_ps);
+       
+       /*Getting Context ID from Core Object*/
+       cid = tcore_context_get_id(ps_context);
+
+       (void)sprintf(cmd_str, "AT+CGDCONT=%d%c",cid,CR);
+       pending = tcore_at_pending_new(co_ps,cmd_str,NULL,TCORE_AT_NO_RESULT,
+                                       on_response_undefine_context_cmd,ps_context );
+       if(NULL == pending)
+       {
+               err("Unable to get the create a AT request ");
+               goto error;
+       }
+       tcore_hal_send_request(hal, pending);
+       dbg("Exit: Successfully");
+       return ;
+
+error:
+       {
+               dbg("Exit: With error");
+               unable_to_get_pending(co_ps,ps_context);
+               return;
+       }
+}
+static void on_response_data_counter_command(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       CoreObject *ps_context = user_data;
+       const TcoreATResponse *resp = data;
+       CoreObject *co_ps = tcore_pending_ref_core_object(p);
+
+       
+       GSList *tokens=NULL;
+       GSList *pRespData; 
+       const char *line = NULL;
+
+       int no_pdp_active =0;
+       int loc = 0;
+       unsigned long long Rx;
+       unsigned long long Tx;
+       int cid = tcore_context_get_id(ps_context);     
+       dbg("Entered");
+       
+       if(resp->final_response)
+       {
+               dbg("Response OK");
+               dbg(" response lines : -%s",resp->lines);
+               if(resp->lines) {
+
+                       pRespData =  (GSList*)resp->lines;
+                       no_pdp_active = g_slist_length(pRespData);
+                       dbg("Total Number of Active PS Context :- %d",no_pdp_active);
+
+                       if(no_pdp_active == 0)
+                               return;
+                       while(pRespData)
+                       {
+                               dbg("Entered the Loop pRespData");
+
+                               line = (const char*)pRespData->data;
+                               dbg("Response->lines->data :%s",line);
+                               tokens = tcore_at_tok_new(line);        
+                               if(cid == atoi(g_slist_nth_data(tokens, 0)))
+                               {
+                                       dbg("Found the data for our CID");
+                                       Tx = (unsigned long long)g_ascii_strtoull((g_slist_nth_data(tokens,1)), NULL, 10);
+                                       dbg("Tx: %d", Tx);
+
+                                       Rx = (unsigned long long)g_ascii_strtoull((g_slist_nth_data(tokens, 2)), NULL, 10);
+                                       dbg("Rx: %d", Rx);
+                               
+                               tcore_at_tok_free(tokens);
+                               tokens = NULL;
+                               dbg("Exiting the Loop pRespData");
+                               break;
+                               }
+                       tcore_at_tok_free(tokens);
+                       tokens = NULL;
+                       pRespData= pRespData->next;
+                       
+               }
+               dbg("Sending Data counter notifications");      
+               
+               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(co_ps)), co_ps,
+                               TNOTI_PS_CURRENT_SESSION_DATA_COUNTER, 0, NULL);
+                       return;
+               }
+               else
+               {
+                       dbg("No Active PS Context");
+               }
+       }
+       
+       dbg("Response NOK");
+ERROR: /* TODO : What to send to TAPI in failure case? */
+       tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(co_ps)), co_ps,
+                       TNOTI_PS_CURRENT_SESSION_DATA_COUNTER, 0, NULL);
+       return;
+}
+
+static void send_data_counter_command(CoreObject *co_ps,CoreObject *ps_context)
+{
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       char cmd_str[MAX_AT_CMD_STR_LEN] ;
+
+       dbg("Enetered");
+       memset(cmd_str,0x0,MAX_AT_CMD_STR_LEN);
+
+       hal = tcore_object_get_hal(co_ps);
+       
+       (void)sprintf(cmd_str, "AT+XGCNTRD%c",CR);
+       pending = tcore_at_pending_new(co_ps,cmd_str,"+XGCNTRD",TCORE_AT_MULTILINE,
+                                       on_response_data_counter_command,ps_context );
+       if(NULL == pending)
+       {
+               goto error;
+       }
+       tcore_pending_set_response_callback(pending, on_response_data_counter_command,ps_context);
+       tcore_hal_send_request(hal, pending);
+       dbg("Exit : Successfully");
+       return ;
+error:
+       /*Unable to create At request Still the Context is deactivated*/
+       err("Unable to create AT request");
+       tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(co_ps)), co_ps,
+                       TNOTI_PS_CURRENT_SESSION_DATA_COUNTER, 0,NULL);
+       return ;
+/*Add code if unable to get the data usage*/
+}
+static void on_response_deactivate_ps_context(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       CoreObject *co_ps = tcore_pending_ref_core_object(p);
+       CoreObject *ps_context = user_data;
+       const TcoreATResponse *resp = data;
+       int cid ;
+
+       cid = tcore_context_get_id(ps_context);
+       if(resp->success)
+       {
+               dbg("Response OK");
+               /*get the data usage and report it application*/
+               (void)tcore_context_set_state(ps_context, CONTEXT_STATE_DEACTIVATED);
+               send_data_counter_command(co_ps,ps_context);
+               
+               /*get the HSDPA status and report it to server*/
+       }
+       else
+       {
+               dbg("Response NOK");
+               _pdp_device_control(TRUE, cid);
+               send_undefine_context_cmd(co_ps,ps_context);
+       }
+       return;
+}
+
+static TReturn deactivate_ps_context(CoreObject *co_ps, CoreObject *ps_context, void *user_data)
+{
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       unsigned int cid = PS_INVALID_CID;
+       char cmd_str[MAX_AT_CMD_STR_LEN] ;
+       struct context *tbl_entry = NULL;
+       dbg("Entered");
+       memset(cmd_str,0x0,MAX_AT_CMD_STR_LEN);
+       
+       /*Getting Context ID from Core Object*/
+       cid = tcore_context_get_id(ps_context);
+
+       /* FIXME: Before MUX setup, use PHY HAL directly. */
+       hal = tcore_object_get_hal(co_ps);
+       
+       tbl_entry = tcore_object_ref_user_data(co_ps);
+       
+       (void)sprintf(cmd_str, "AT+CGACT=%d,%d%c",AT_PDP_DEACTIVATE,cid,CR);
+       dbg("At commands :- %s",cmd_str);
+
+       pending = tcore_at_pending_new(co_ps,cmd_str,NULL,TCORE_AT_NO_RESULT,
+                                       on_response_deactivate_ps_context,ps_context );
+       if(NULL == pending)
+               return TCORE_RETURN_FAILURE;
+       
+       tcore_hal_send_request(hal, pending);
+       (void)tcore_context_set_state(ps_context, CONTEXT_STATE_DEACTIVATING);
+       return TCORE_RETURN_SUCCESS;
+}
+
+static void on_response_get_dns_cmnd(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+
+       int i;
+       int loc;        
+       int num_tokens;
+       int tok_pos = 0;
+       struct tnoti_ps_pdp_ipconfiguration noti = {0};
+       struct tnoti_ps_call_status data_status = {0};
+       char devname[10] = {0,};
+       char s_cid[4];
+       int found = 0;
+       const TcoreATResponse *resp = data;
+       CoreObject *co_ps = tcore_pending_ref_core_object(p);
+       CoreObject *ps_context = user_data;
+       //const char *addr;
+
+       
+       
+       GSList *tokens= NULL;
+       const char *line = NULL;
+       char *token_add = NULL;
+       char *token_dns = NULL;
+       char dns[50] = {0}; /* 3 characted for each IP address value: 12 for IPv4, 48 for IP6*/;
+       
+       int cid = tcore_context_get_id(ps_context);
+
+       dbg("Entered");
+
+       (void)sprintf(s_cid,"%d%s",cid,"\0");
+#if 1  
+       if(resp->final_response)
+       {
+               dbg("RESPONSE OK");
+
+               if(resp->lines) 
+               {
+                       dbg("Resp->lines present");
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       num_tokens = g_slist_length(tokens);
+                       if ( num_tokens < 2) 
+                       {
+                               msg("invalid message");
+                               goto exit_case;
+                       }
+                       while(tok_pos < num_tokens)
+                       {
+                               if(cid == atoi(g_slist_nth_data(tokens,tok_pos)))
+                               {
+                                       dbg("match found for the CID"); 
+                                       found = tok_pos;
+                                       break;
+                               }
+                               tok_pos = tok_pos + 3;
+                               found = 0;
+                       }
+                       if(found != tok_pos )
+                               goto exit_case;
+                                               
+                       { /* Read primary DNS */
+                               token_dns = g_slist_nth_data(tokens, tok_pos + 1);
+                               /* Strip off starting " and ending " from this token to read actual PDP address */
+                               strncpy(dns, token_dns+1, strlen(token_dns)-2);
+                               dbg("Token_dns :%s",token_dns);
+                               dbg("DNS :- %s",dns);
+                               i = 0;
+                               token_add = strtok(dns, ".");
+                               while(token_add != NULL)
+                               {
+                                               noti.primary_dns[i++]= atoi(token_add);
+                                               token_add = strtok(NULL, ".");
+                               }
+                               //_ps_free(token_add);// This is just reference point, not actual pointer allocated in this function.
+                       }
+                       { /* Read Secondary DNS */
+                               memset(dns,0x0,50);
+                               token_dns = g_slist_nth_data(tokens, loc+1);
+                               /* Strip off starting " and ending " from this token to read actual PDP address */
+                               strncpy(dns, token_dns+1, strlen(token_dns)-2);
+
+                               dbg("Token_dns :%s",token_dns);
+                               dbg("DNS :- %s",dns);
+                               i = 0;
+                               token_add = strtok(dns, ".");
+                               while(token_add != NULL)
+                               {
+                                       noti.secondary_dns[i++]= atoi(token_add);
+                                       token_add = strtok(NULL, ".");
+                               }
+                               //_ps_free(token_add);.// This is just reference point, not actual pointer allocated in this function.
+                       }
+                       
+                       /*To DO :  Add Code to notify the the Tapi*/
+               }
+       goto send;      
+       }
+       else
+       {
+               dbg("Respons NOK");
+               dbg("unable to DNS address so static assigning it");
+
+               /*To Do :- Add code if only One DNS Found*/
+       }
+#endif
+#if 0
+#else
+exit_case:
+       dbg("Adding default DNS");
+       tcore_at_tok_free(tokens);
+       dbg("Adding the Primary DNS");
+       noti.primary_dns[0] = 8;
+       noti.primary_dns[1] = 8;
+       noti.primary_dns[2] = 8;
+       noti.primary_dns[3] = 8;
+       dbg("Adding Secondary DNS");
+       noti.secondary_dns[0] = 8;
+       noti.secondary_dns[1] = 8;
+       noti.secondary_dns[2] = 4;
+       noti.secondary_dns[3] = 4;
+
+#endif
+       
+       /* fileds: 
+       0x0001 -> IP address
+       0x0002 -> Primany DNS
+       0x0003 -> Seconday DNS
+       */
+send:  
+       dbg("Adding flag");
+       noti.field_flag = (0x0001 & 0x0002 & 0x0004);
+       dbg("Adding Error if Present");
+       noti.err = 0;
+       noti.context_id = cid;
+       dbg("ADDING IP address");
+#if 0
+       addr = tcore_context_get_address(ps_context);
+       memcpy(&noti.ip_address, &addr, 4);
+       _ps_free((void *)addr);
+#else
+       memcpy(&noti.ip_address, &addr, 4);
+#endif
+       if (_pdp_device_control(TRUE, cid) != TCORE_RETURN_SUCCESS) 
+       {
+               dbg("_pdp_device_control() failed. errno=%d", errno);
+       }
+       snprintf(devname, 10, "pdp%d", cid - 1);
+       memcpy(noti.devname, devname, 10);
+       dbg("devname = [%s]", devname);
+       if (tcore_util_netif_up(devname) != TCORE_RETURN_SUCCESS) 
+       {
+               dbg("util_netif_up() failed. errno=%d", errno);
+       }
+
+       dbg("Send Notification upwards of IP address");
+       tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(co_ps)), co_ps, TNOTI_PS_PDP_IPCONFIGURATION,
+               sizeof(struct tnoti_ps_pdp_ipconfiguration), &noti);
+
+       data_status.context_id = cid;
+       data_status.state = 1;
+       data_status.result = 0 ;
+
+       tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(co_ps)), co_ps,
+                       TNOTI_PS_CALL_STATUS, sizeof(struct tnoti_ps_call_status), &data_status);
+       dbg("EXIT : Without error");
+       return;
+}
+
+static void send_get_dns_cmd(CoreObject *co_ps,CoreObject *ps_context)
+{
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       char cmd_str[MAX_AT_CMD_STR_LEN] ;
+       struct tnoti_ps_call_status data = {0};
+
+       memset(cmd_str,0x0,MAX_AT_CMD_STR_LEN);
+
+       dbg("Entered");
+       hal = tcore_object_get_hal(co_ps);
+
+       (void)sprintf(cmd_str, "AT+XDNS?%c",CR);
+       pending = tcore_at_pending_new(co_ps,cmd_str,"+XDNS",TCORE_AT_MULTILINE,
+                                       on_response_get_dns_cmnd,ps_context );
+       if(NULL == pending)
+       {
+               err("Unable to get the create a AT request ");
+               goto error;
+       }
+       tcore_hal_send_request(hal, pending);
+       dbg("Exit Successfully");
+       return ;
+error: 
+       /*unable to get Ip address so closing the PDP session*/
+       dbg("Unable to get the pending");       
+       
+       data.context_id =tcore_context_get_id(ps_context);
+       data.state = AT_SESSION_DOWN;/*check value of state*/
+       data.result =0xFF;/*check error value*/
+       tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(co_ps)), co_ps,
+       TNOTI_PS_CALL_STATUS, sizeof(struct tnoti_ps_call_status), &data);
+       dbg("Exit : Error");
+       return;
+}
+
+static void on_response_get_pdp_address(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       CoreObject *co_ps =  tcore_pending_ref_core_object(p);
+       CoreObject *ps_context = user_data;
+       int i = 0;
+       GSList *tokens=NULL;
+       const char *line;
+       char *token_pdp_address;
+       char *token_add;
+       char pdp_address[50] = {0}; /* 3 characted for each IP address value: 12 for IPv4, 48 for IP6*/
+       //char addr[4];
+       dbg("Enetered");
+       if(resp->final_response)
+       {
+               dbg("RESPONSE OK");
+               if(resp->lines != NULL) 
+               {
+                       dbg("resp->lines present ");
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) < 2) 
+                       {
+                               msg("invalid message");
+                               goto error;
+                       }
+                       dbg("line:- %s",line);
+                       /* CID is already stored in ps_context, skip over & read PDP address */
+                       token_pdp_address = g_slist_nth_data(tokens, 1);
+
+                       dbg("token_pdp_address :- %s",token_pdp_address);
+                       /* Strip off starting " and ending " from this token to read actual PDP address */
+                       strncpy(pdp_address, token_pdp_address+1, strlen(token_pdp_address)-2);
+                       dbg("PDP address :- %s",pdp_address);
+                       /* Store IP address in char array, Telephony expected IP address in this format */
+                       token_add = strtok(pdp_address, ".");
+                       i = 0;
+                       while((token_add != NULL) && (i<4)) /* Currently only IPv4 is supported */
+                       {
+                               addr[i++]= atoi(token_add);
+                               token_add = strtok(NULL, ".");
+                       }
+                       dbg("PDP address:- %s",addr);
+                       }
+               //tcore_context_set_address(ps_context,(const char *)addr);
+               send_get_dns_cmd(co_ps,ps_context);
+       }
+       else
+       {
+               dbg("Response NOK");
+               /*without PDP address we will not be able to start packet service*/
+               (void)deactivate_ps_context(co_ps,ps_context,NULL);
+       }
+       error:  
+       tcore_at_tok_free(tokens);
+}
+
+static void send_get_pdp_address_cmd(CoreObject *co_ps,CoreObject *ps_context)
+{
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       unsigned int cid = PS_INVALID_CID;
+       char cmd_str[MAX_AT_CMD_STR_LEN] = {0};
+       struct tnoti_ps_call_status data_resp = {0};
+       dbg("Entered");
+       hal = tcore_object_get_hal(co_ps);
+
+       cid = tcore_context_get_id(ps_context);
+       (void)sprintf(cmd_str, "AT+CGPADDR=%d%c",cid,CR);
+       pending = tcore_at_pending_new(co_ps,cmd_str,"+CGPADDR",TCORE_AT_SINGLELINE,
+                                       on_response_get_pdp_address,ps_context );
+       if(NULL == pending)
+       {
+               err("Unable to get the create a AT request ");
+               goto error;
+       }
+       tcore_hal_send_request(hal, pending);
+       dbg("Exiting Successfully");
+       return ;
+
+error:
+               /*unable to get pending*/
+               dbg("Unable to get the pending");       
+               unable_to_get_pending(co_ps,ps_context);
+               dbg("Exit : Error");
+               return;
+}
+
+static void on_response_send_pdp_activate_cmd (TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       CoreObject *co_ps = NULL;
+       const TcoreATResponse *resp = data;
+       CoreObject *ps_context = user_data;
+       
+       int cid;
+       cid = tcore_context_get_id(ps_context);
+
+       
+       dbg("Entered");
+       if(!p)
+               goto error;
+               
+       co_ps = tcore_pending_ref_core_object(p);
+       
+       if(resp->success)
+       {
+               dbg("Response Ok");
+               /*getting the IP address and DNS from the modem*/
+               dbg("Getting the IP Address");
+               send_get_pdp_address_cmd(co_ps,ps_context);
+               return;
+       }
+       else
+       {       
+               
+               dbg("Unable to actiavte PDP context for CID: %d ",cid);
+               dbg("Undefineing the PDP context");
+               (void)tcore_context_set_state(ps_context, CONTEXT_STATE_DEACTIVATED);
+               send_undefine_context_cmd(co_ps,ps_context);
+       }
+       return;
+
+error:
+       {
+               unable_to_get_pending(co_ps,ps_context);
+               return;
+       }
+}
+
+static void send_pdp_activate_cmd(CoreObject *co_ps, CoreObject *ps_context)
+{
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       char cmd_str[MAX_AT_CMD_STR_LEN] = {0};
+       int cid = 0;
+       dbg("Entered");
+       /* FIXME: Before MUX setup, use PHY HAL directly. */
+       hal = tcore_object_get_hal(co_ps);
+       
+       /*Getting Context ID from Core Object*/
+       cid = tcore_context_get_id(ps_context);
+       (void)sprintf(cmd_str, "AT+CGACT=%d,%d%c",AT_PDP_ACTIVATE,cid,CR);
+       pending = tcore_at_pending_new(co_ps,cmd_str,NULL,TCORE_AT_NO_RESULT,
+                                       on_response_send_pdp_activate_cmd,ps_context );
+       if(NULL == pending)
+       {
+               err("Unable to get the create a AT request ");
+               goto error;
+       }
+       
+       tcore_hal_send_request(hal, pending);
+       dbg("Exit: Successfully");
+       return ;
+       
+error:
+       {
+               dbg("Unable to get the pending");
+               unable_to_get_pending(co_ps,ps_context);
+               return;
+       }
+}
+
+static void on_response_xdns_enable_cmd(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       TcoreATResponse *resp = (TcoreATResponse *)data;
+       CoreObject *co_ps =  tcore_pending_ref_core_object(p);
+       CoreObject *ps_context = user_data;
+       dbg("Entered");
+       if(resp->success)
+       {
+               dbg("Response OK");
+               dbg("DNS address getting is Enabled");
+       }
+       else
+       {
+               dbg("Response NOK");
+               /*If response to enable the DNS NOK then we will use google DNS for the PDP context*/
+       }
+       send_pdp_activate_cmd(co_ps, ps_context);
+       dbg("Exiting");
+       return; 
+}
+
+static void send_xdns_enable_cmd(CoreObject *co_ps,CoreObject *ps_context)
+{
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       int cid = -1 ;
+       char cmd_str[MAX_AT_CMD_STR_LEN] ;
+       
+       dbg("Entered");
+       memset(cmd_str,0x0,MAX_AT_CMD_STR_LEN);
+
+       hal = tcore_object_get_hal(co_ps);
+       cid = tcore_context_get_id(ps_context);
+
+       (void)sprintf(cmd_str, "AT+XDNS=%d,%d%c",cid,AT_XDNS_ENABLE,CR);
+       pending = tcore_at_pending_new(co_ps,cmd_str, NULL, TCORE_AT_NO_RESULT,
+                                       on_response_xdns_enable_cmd, ps_context );
+       if(NULL == pending)
+       {
+               err("Unable to get the create a AT request ");
+               goto error;
+       }
+       tcore_hal_send_request(hal, pending);
+       dbg("Exiting Successfully");
+       return ;
+
+error:
+       dbg("Unable to create pending for the AT Request");
+       unable_to_get_pending(co_ps,ps_context);
+       return;
+}
+
+static void on_response_define_pdp_context(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       CoreObject *ps_context = (CoreObject *)user_data;
+       CoreObject *co_ps = tcore_pending_ref_core_object(p);
+               
+       dbg("Entered");
+       if(resp->success)
+       {
+               dbg("Response OK");
+               send_xdns_enable_cmd(co_ps,ps_context);
+       }
+       else
+       {
+               dbg("response NOK");
+               unable_to_get_pending(co_ps,ps_context);
+       }
+       dbg("Exiting");
+       return;
+}
+
+static TReturn send_define_pdp_context_cmd(CoreObject *co_ps, CoreObject *ps_context)
+{
+       
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       char *apn = NULL;
+       char *addr = NULL;
+       char cmd_str[MAX_AT_CMD_STR_LEN] ={0} ;
+       char pdp_type_str[10] = {0};
+       unsigned int cid = PS_INVALID_CID;
+       enum co_context_type pdp_type;
+       enum co_context_d_comp d_comp;
+       enum co_context_h_comp h_comp;
+               
+       dbg("Entered");
+
+       cid = tcore_context_get_id(ps_context);
+       
+       pdp_type = tcore_context_get_type(ps_context);
+       d_comp = tcore_context_get_data_compression(ps_context);
+       h_comp = tcore_context_get_header_compression(ps_context);
+       apn = tcore_context_get_apn(ps_context);
+       //addr = tcore_context_get_address(ps_context);
+
+       /* FIXME: Before MUX setup, use PHY HAL directly. */
+       hal = tcore_object_get_hal(co_ps);
+       switch(pdp_type)
+       {
+               case CONTEXT_TYPE_X25:
+               {
+                       dbg("CONTEXT_TYPE_X25");
+                       strcpy(pdp_type_str,"X.25");
+                       break;
+               }
+               case CONTEXT_TYPE_IP:
+               {
+                       dbg("CONTEXT_TYPE_IP");
+                       strcpy(pdp_type_str,"IP");
+               }
+               break;
+               case CONTEXT_TYPE_PPP:
+               {
+                       dbg("CONTEXT_TYPE_PPP");
+                       strcpy(pdp_type_str,"PPP");
+               }
+               break;
+               case CONTEXT_TYPE_IPV6:
+               {
+                       dbg("CONTEXT_TYPE_IPV6");
+                       strcpy(pdp_type_str,"IPV6");
+                       break;
+               }
+               default :
+               {
+                       /*PDP Type not supported supported*/
+                       dbg("Unsupported PDP type :- %d returning ",pdp_type);
+                       goto error;
+               }
+       }
+       dbg("Activating context for CID :- %d",cid);
+       if(addr)
+               (void)sprintf(cmd_str, "AT+CGDCONT=%d,\"%s\",\"%s\",%s,%d,%d%c",cid,pdp_type_str,apn,addr,d_comp,h_comp,CR);
+       else
+               (void)sprintf(cmd_str, "AT+CGDCONT=%d,\"%s\",\"%s\",,%d,%d%c",cid,pdp_type_str,apn,d_comp,h_comp,CR);
+       pending = tcore_at_pending_new(co_ps,cmd_str,NULL,TCORE_AT_NO_RESULT,
+                                       on_response_define_pdp_context,ps_context );
+       
+       if(NULL == pending)
+       {
+               dbg("Unable to get the create a Pending ");
+               goto error;
+       }
+       tcore_hal_send_request(hal, pending);
+       (void)tcore_context_set_state(ps_context, CONTEXT_STATE_ACTIVATING);
+       return TCORE_RETURN_SUCCESS;
+       
+error:
+       {
+               unable_to_get_pending(co_ps,ps_context);
+               return TCORE_RETURN_FAILURE;
+       }
+}
+
+static TReturn activate_ps_context(CoreObject *co_ps, CoreObject *ps_context, void *user_data)
+{
+       dbg("Entered");
+       return send_define_pdp_context_cmd(co_ps,ps_context);
+}
+
+
+static struct tcore_ps_operations ps_ops =
+{
+       .activate_context = activate_ps_context,
+       .deactivate_context = deactivate_ps_context
+};
+
+gboolean s_ps_init(TcorePlugin *p,TcoreHal *hal)
+{
+       CoreObject *o;
+       struct context *context_table = NULL;
+
+       dbg("Entered");
+       o = tcore_ps_new(p,"umts_ps", &ps_ops, hal);
+
+       if (!o)
+               return FALSE;
+       tcore_object_link_user_data(o, (void *)context_table);
+       
+       tcore_object_add_callback(o, "+CGEV", on_event_cgev_handle,p);
+       tcore_object_add_callback(o, "+XNOTIFYDUNSTATUS", on_event_dun_call_notification, p);
+       
+       dbg("Exiting");
+       return TRUE;
+}
+
+void s_ps_exit(TcorePlugin *p)
+{
+       CoreObject *o;
+
+       dbg("Entered");
+       o = tcore_plugin_ref_core_object(p,"umts_ps");
+       if (!o)
+               return;
+       
+       tcore_ps_free(o);
+       dbg("Exiting");
+}
+
+
diff --git a/src/s_sat.c b/src/s_sat.c
new file mode 100755 (executable)
index 0000000..7a0081a
--- /dev/null
@@ -0,0 +1,682 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <hal.h>
+#include <core_object.h>
+#include <plugin.h>
+#include <queue.h>
+#include <server.h>
+#include <co_sat.h>
+#include <user_request.h>
+#include <at.h>
+
+#include "s_common.h"
+#include "s_sat.h"
+#define ENVELOPE_CMD_LEN        256
+
+static struct tnoti_sat_proactive_ind *g_refresh_data = NULL;
+
+static TReturn s_terminal_response(CoreObject *o, UserRequest *ur);
+//static void setup_event_rsp_get_ipc(CoreObject *o, struct tel_sat_setup_event_list_tlv *setup_evt_list);
+static void on_confirmation_sat_message_send(TcorePending *p, gboolean result, void *user_data ); // from Kernel
+
+static void on_confirmation_sat_message_send( TcorePending *p, gboolean result, void *user_data )
+{
+       dbg("on_confirmation_modem_message_send - msg out from queue.\n");
+
+       if (result == FALSE) {
+               /* Fail */
+               dbg("SEND FAIL");
+       }
+       else {
+               dbg("SEND OK");
+       }
+}
+
+static enum tcore_response_command _find_resp_command(UserRequest *ur)
+{
+       enum tcore_request_command command;
+       command = tcore_user_request_get_command(ur);
+       switch(command){
+               case TREQ_SIM_VERIFY_PINS:
+                       return TRESP_SIM_VERIFY_PINS;
+                       break;
+               case TREQ_SIM_VERIFY_PUKS:
+                       return TRESP_SIM_VERIFY_PUKS;
+                       break;
+               case TREQ_SIM_CHANGE_PINS:
+                       return TRESP_SIM_CHANGE_PINS;
+                       break;
+               case TREQ_SIM_GET_FACILITY_STATUS:
+                       return TRESP_SIM_GET_FACILITY_STATUS;
+                       break;
+               case TREQ_SIM_DISABLE_FACILITY:
+                       return TRESP_SIM_DISABLE_FACILITY;
+                       break;
+               case TREQ_SIM_ENABLE_FACILITY:
+                       return TRESP_SIM_ENABLE_FACILITY;
+                       break;
+               case TREQ_SIM_GET_LOCK_INFO:
+                       return TRESP_SIM_GET_LOCK_INFO;
+                       break;
+               case TREQ_SIM_TRANSMIT_APDU:
+                       return TRESP_SIM_TRANSMIT_APDU;
+                       break;
+               case TREQ_SIM_GET_ATR:
+                       return TRESP_SIM_GET_ATR;
+                       break;
+               case TREQ_SIM_GET_ECC:
+                       return TRESP_SIM_GET_ECC;
+                       break;
+               case TREQ_SIM_GET_LANGUAGE:
+                       return TRESP_SIM_GET_LANGUAGE;
+                       break;
+               case TREQ_SIM_SET_LANGUAGE:
+                       return TRESP_SIM_SET_LANGUAGE;
+                       break;
+               case TREQ_SIM_GET_ICCID:
+                       return TRESP_SIM_GET_ICCID;
+                       break;
+               case TREQ_SIM_GET_MAILBOX:
+                       return TRESP_SIM_GET_MAILBOX;
+                       break;
+               case TREQ_SIM_GET_CALLFORWARDING:
+                       return TRESP_SIM_GET_CALLFORWARDING;
+                       break;
+               case TREQ_SIM_SET_CALLFORWARDING:
+                       return TRESP_SIM_SET_CALLFORWARDING;
+                       break;
+               case TREQ_SIM_GET_MESSAGEWAITING:
+                       return TRESP_SIM_GET_MESSAGEWAITING;
+                       break;
+               case TREQ_SIM_GET_CPHS_INFO:
+                       return TRESP_SIM_GET_CPHS_INFO;
+                       break;
+               case TREQ_SIM_GET_MSISDN:
+                       return TRESP_SIM_GET_MSISDN;
+                       break;
+               case TREQ_SIM_GET_SPN:
+                       return TRESP_SIM_GET_SPN;
+                       break;
+               case TREQ_SIM_GET_SPDI:
+                       return TRESP_SIM_GET_SPDI;
+                       break;
+               case TREQ_SIM_GET_OPL:
+                       return TRESP_SIM_GET_OPL;
+                       break;
+               case TREQ_SIM_GET_PNN:
+                       return TRESP_SIM_GET_PNN;
+                       break;
+               case TREQ_SIM_GET_CPHS_NETNAME:
+                       return TRESP_SIM_GET_CPHS_NETNAME;
+                       break;
+               case TREQ_SIM_GET_OPLMNWACT:
+                       return TRESP_SIM_GET_OPLMNWACT;
+                       break;
+               case TREQ_SIM_REQ_AUTHENTICATION:
+                       return TRESP_SIM_REQ_AUTHENTICATION;
+                       break;
+               default:
+                       break;
+       }
+       return TRESP_UNKNOWN;
+}
+
+/*static void on_response_set_up_eventlist(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur = NULL;
+       CoreObject *o = NULL;
+
+       dbg("SAT setup event list get rsp");
+       o = tcore_pending_ref_core_object(p);
+       ur = tcore_user_request_ref((UserRequest *)user_data);
+
+       s_terminal_response(o, ur);
+       return;
+}*/
+
+/*static void on_event_sat_envelope_resp(CoreObject *o, const void *event_info, void *user_data)
+{
+
+}
+
+static void on_event_sat_refresh_status(CoreObject *o, const void *event_info, void *user_data)
+{
+       ipc_sat_refresh_noti_type *ind = (ipc_sat_refresh_noti_type*) event_info;
+       dbg("CP SAT refresh status[%d]-0:start,1:end,2:fail", ind->action_type);
+
+       if (ind->action_type == IPC_SAT_REFRESH_ACTION_END) {
+               if(g_refresh_data) {
+                       tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SAT_PROACTIVE_CMD,
+                               sizeof(struct tnoti_sat_proactive_ind), g_refresh_data);
+                       free(g_refresh_data);
+               } else {
+                       dbg("refresh proactive command data is null");
+               }
+       }
+}*/
+
+
+static void on_response_terminal_response_confirm(CoreObject *o, const void *event_info, void *user_data)
+{
+       dbg("Function Entry");
+       dbg("Function Exit");
+}
+
+static void on_event_sat_proactive_command(CoreObject *o, const void *event_info, void *user_data)
+{
+       
+       struct tcore_sat_proactive_command decoded_data;
+       struct tnoti_sat_proactive_ind proactive_noti;
+       int     len_proactive_cmd = 0;
+       GSList  *lines= NULL;
+       GSList  *tokens= NULL;
+       char    *line= NULL;
+       char    *hexData= NULL;
+       char    *tmp= NULL;
+       char    *recordData= NULL;
+
+       dbg("Function Entry");
+
+       memset(&proactive_noti, 0x00, sizeof(struct tnoti_sat_proactive_ind));
+       lines = (GSList*)event_info;
+       line = (char*)lines->data;
+       tokens = tcore_at_tok_new(line);
+       if (g_slist_length(tokens) != 1) {
+               dbg("invalid message");
+               tcore_at_tok_free(tokens);
+               return FALSE;
+       }
+       hexData = (char*)g_slist_nth_data(tokens, 0);
+       
+       dbg("hexdata %s ", hexData);
+       dbg("hexdata length %d", strlen(hexData));
+
+       tmp = calloc(1, strlen(hexData)-1);
+       if(tmp == NULL){
+               return;
+       }       
+       memcpy(tmp, hexData+1, strlen(hexData)-2);
+
+       recordData = util_hexStringToBytes(tmp);
+       dbg("recordData: %x", recordData);
+       free(tmp);
+       util_hex_dump("    ", strlen(hexData)/2, recordData);
+       len_proactive_cmd = strlen(recordData);
+       dbg("len_proactive_cmd = %d", len_proactive_cmd);
+       tcore_sat_decode_proactive_command(recordData, (strlen(hexData)/2) - 1, &decoded_data);
+       free(recordData);
+
+       proactive_noti.cmd_number = decoded_data.cmd_num;
+       proactive_noti.cmd_type = decoded_data.cmd_type;
+
+       switch(decoded_data.cmd_type){
+               case SAT_PROATV_CMD_DISPLAY_TEXT:
+                       dbg("decoded command is display text!!");
+                       memcpy(&proactive_noti.proactive_ind_data.display_text, &decoded_data.data.display_text,        sizeof(struct tel_sat_display_text_tlv));
+                       break;
+               case SAT_PROATV_CMD_GET_INKEY:
+                       dbg("decoded command is get inkey!!");
+                       memcpy(&proactive_noti.proactive_ind_data.get_inkey, &decoded_data.data.get_inkey,      sizeof(struct tel_sat_get_inkey_tlv));
+                       break;
+               case SAT_PROATV_CMD_GET_INPUT:
+                       dbg("decoded command is get input!!");
+                       memcpy(&proactive_noti.proactive_ind_data.get_input, &decoded_data.data.get_input,      sizeof(struct tel_sat_get_input_tlv));
+                       break;
+               case SAT_PROATV_CMD_MORE_TIME:
+                       dbg("decoded command is more time!!");
+                       memcpy(&proactive_noti.proactive_ind_data.more_time, &decoded_data.data.more_time,      sizeof(struct tel_sat_more_time_tlv));
+                       break;
+               case SAT_PROATV_CMD_PLAY_TONE:
+                       dbg("decoded command is play tone!!");
+                       memcpy(&proactive_noti.proactive_ind_data.play_tone, &decoded_data.data.play_tone,      sizeof(struct tel_sat_play_tone_tlv));
+                       break;
+               case SAT_PROATV_CMD_SETUP_MENU:
+                       dbg("decoded command is SETUP MENU!!");
+                       memcpy(&proactive_noti.proactive_ind_data.setup_menu, &decoded_data.data.setup_menu, sizeof(struct tel_sat_setup_menu_tlv));
+                       break;
+               case SAT_PROATV_CMD_SELECT_ITEM:
+                       dbg("decoded command is select item!!");
+                       memcpy(&proactive_noti.proactive_ind_data.select_item, &decoded_data.data.select_item,  sizeof(struct tel_sat_select_item_tlv));
+                       break;
+               case SAT_PROATV_CMD_SEND_SMS:
+                       dbg("decoded command is send sms!!");
+                       memcpy(&proactive_noti.proactive_ind_data.send_sms, &decoded_data.data.send_sms,        sizeof(struct tel_sat_send_sms_tlv));
+                       break;
+               case SAT_PROATV_CMD_SEND_SS:
+                       dbg("decoded command is send ss!!");
+                       memcpy(&proactive_noti.proactive_ind_data.send_ss, &decoded_data.data.send_ss,  sizeof(struct tel_sat_send_ss_tlv));
+                       break;
+               case SAT_PROATV_CMD_SEND_USSD:
+                       dbg("decoded command is send ussd!!");
+                       memcpy(&proactive_noti.proactive_ind_data.send_ussd, &decoded_data.data.send_ussd,      sizeof(struct tel_sat_send_ussd_tlv));
+                       break;
+               case SAT_PROATV_CMD_SETUP_CALL:
+                       dbg("decoded command is setup call!!");
+                       memcpy(&proactive_noti.proactive_ind_data.setup_call, &decoded_data.data.setup_call,    sizeof(struct tel_sat_setup_call_tlv));
+                       break;
+               case SAT_PROATV_CMD_REFRESH:
+                       dbg("decoded command is refresh");
+                       memcpy(&proactive_noti.proactive_ind_data.refresh, &decoded_data.data.refresh, sizeof(struct tel_sat_refresh_tlv));
+                       break;
+               case SAT_PROATV_CMD_PROVIDE_LOCAL_INFO:
+                       dbg("decoded command is provide local info");
+                       memcpy(&proactive_noti.proactive_ind_data.provide_local_info, &decoded_data.data.provide_local_info, sizeof(struct tel_sat_provide_local_info_tlv));
+                       break;
+               case SAT_PROATV_CMD_SETUP_EVENT_LIST:
+                       dbg("decoded command is setup event list!!");
+                       memcpy(&proactive_noti.proactive_ind_data.setup_event_list, &decoded_data.data.setup_event_list, sizeof(struct tel_sat_setup_event_list_tlv));
+                       //setup_event_rsp_get_ipc(o, &decoded_data.data.setup_event_list);
+                       break;
+               case SAT_PROATV_CMD_SETUP_IDLE_MODE_TEXT:
+                       dbg("decoded command is setup idle mode text");
+                       memcpy(&proactive_noti.proactive_ind_data.setup_idle_mode_text, &decoded_data.data.setup_idle_mode_text,        sizeof(struct tel_sat_setup_idle_mode_text_tlv));
+                       break;
+               case SAT_PROATV_CMD_SEND_DTMF:
+                       dbg("decoded command is send dtmf");
+                       memcpy(&proactive_noti.proactive_ind_data.send_dtmf, &decoded_data.data.send_dtmf,       sizeof(struct tel_sat_send_dtmf_tlv));
+                       break;
+               case SAT_PROATV_CMD_LANGUAGE_NOTIFICATION:
+                       dbg("decoded command is language notification");
+                       memcpy(&proactive_noti.proactive_ind_data.language_notification, &decoded_data.data.language_notification,      sizeof(struct tel_sat_language_notification_tlv));
+                       break;
+               case SAT_PROATV_CMD_LAUNCH_BROWSER:
+                       dbg("decoded command is launch browser");
+                       memcpy(&proactive_noti.proactive_ind_data.launch_browser, &decoded_data.data.launch_browser,    sizeof(struct tel_sat_launch_browser_tlv));
+                       break;
+               case SAT_PROATV_CMD_OPEN_CHANNEL:
+                       dbg("decoded command is open channel!!");
+                       memcpy(&proactive_noti.proactive_ind_data.open_channel, &decoded_data.data.open_channel,        sizeof(struct tel_sat_open_channel_tlv));
+                       break;
+               case SAT_PROATV_CMD_CLOSE_CHANNEL:
+                       dbg("decoded command is close channel!!");
+                       memcpy(&proactive_noti.proactive_ind_data.close_channel, &decoded_data.data.close_channel,      sizeof(struct tel_sat_close_channel_tlv));
+                       break;
+               case SAT_PROATV_CMD_RECEIVE_DATA:
+                       dbg("decoded command is receive data!!");
+                       memcpy(&proactive_noti.proactive_ind_data.receive_data, &decoded_data.data.receive_data,        sizeof(struct tel_sat_receive_channel_tlv));
+                       break;
+               case SAT_PROATV_CMD_SEND_DATA:
+                       dbg("decoded command is send data!!");
+                       memcpy(&proactive_noti.proactive_ind_data.send_data, &decoded_data.data.send_data,      sizeof(struct tel_sat_send_channel_tlv));
+                       break;
+               case SAT_PROATV_CMD_GET_CHANNEL_STATUS:
+                       dbg("decoded command is get channel status!!");
+                       memcpy(&proactive_noti.proactive_ind_data.get_channel_status, &decoded_data.data.get_channel_status,    sizeof(struct tel_sat_get_channel_status_tlv));
+                       break;
+               default:
+                       dbg("wrong input");
+                       break;
+       }
+
+       if (decoded_data.cmd_type == SAT_PROATV_CMD_REFRESH){
+               g_refresh_data = calloc(1, sizeof(struct tnoti_sat_proactive_ind));
+               if(g_refresh_data == NULL){
+                       dbg("fail to calloc for refresh data");
+                       return;
+               }else {
+                       memcpy(g_refresh_data, &proactive_noti, sizeof(struct tnoti_sat_proactive_ind));
+               }
+       } else{
+               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SAT_PROACTIVE_CMD,
+                               sizeof(struct tnoti_sat_proactive_ind), &proactive_noti);
+       }
+       tcore_at_tok_free(tokens);
+       dbg("Function Exit");
+}
+
+/*static void on_event_sat_control_result(CoreObject *o, const void *event_info, void *user_data)
+{
+
+}*/
+
+static void on_response_envelop_cmd(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       UserRequest *ur = NULL;
+       const struct treq_sat_envelop_cmd_data *req_data = NULL;
+       GSList *tokens=NULL;
+       struct tresp_sat_envelop_data res;
+       const char *line;
+       const char *env_res;
+       int busy;
+
+       
+       ur = tcore_pending_ref_user_request(p);
+       req_data = tcore_user_request_ref_data(ur, NULL);
+
+       if(!req_data){
+               dbg("request data is NULL");
+               return;
+       }
+       memset(&res, 0, sizeof(struct tresp_sat_envelop_data));
+
+       res.sub_cmd = req_data->sub_cmd;
+
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) < 1) {
+                               msg("invalid message");
+                               tcore_at_tok_free(tokens);
+                               return;
+                       }
+               }
+               env_res = g_slist_nth_data(tokens, 0);
+               /*TODO - update actual value now not handled in TAPI*/
+               res.result = 0x8000;
+               res.envelop_resp = ENVELOPE_SUCCESS;
+               /*dbg("RESPONSE OK 3");
+               if(NULL != g_slist_nth_data(tokens, 1)){
+                       busy = atoi(g_slist_nth_data(tokens, 1));
+                       dbg("RESPONSE OK 4");
+                       if(busy != 0){
+                               dbg("RESPONSE OK 5");
+                               res.result = -1;
+                               res.envelop_resp = ENVELOPE_SIM_BUSY;
+                       }
+               }*/
+       }
+       else{
+               dbg("RESPONSE NOK");
+               res.result = -1;
+               res.envelop_resp = ENVELOPE_FAILED;
+       }
+
+       if (ur) {
+               tcore_user_request_send_response(ur, TRESP_SAT_REQ_ENVELOPE, sizeof(struct tresp_sat_envelop_data), &res);
+       }
+       tcore_at_tok_free(tokens);
+       dbg(" Function exit");
+}
+
+static void on_timeout_terminal_response(TcorePending *p, void *user_data)
+{
+       UserRequest *ur = NULL;
+       CoreObject *o = NULL;
+       gpointer tmp = NULL;
+
+       dbg("Function Entry");
+       dbg("SAT - TIMEOUT !!!!! pending=%p", p);
+
+       ur = tcore_pending_ref_user_request(p);
+       tmp = (gpointer)tcore_user_request_ref_communicator(ur);
+       if(!ur || !tmp ){
+               dbg("error - current ur is NULL");
+               return;
+       }
+
+       o = tcore_pending_ref_core_object(p);
+       if(!o)
+               dbg("error - current sat core is NULL");
+
+       tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SAT_SESSION_END,    0, NULL);
+       dbg("Function Exit");
+}
+
+
+static void on_response_terminal_response(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur = NULL;
+       CoreObject *o = NULL;
+       const TcoreATResponse *resp = data;
+       gpointer tmp = NULL;
+
+       dbg("Function Entry");
+
+       if(resp->success > 0){
+               dbg("RESPONSE OK");
+               dbg(" resp->success = %d",  resp->success);
+               ur = tcore_pending_ref_user_request(p);
+               tmp = (gpointer)tcore_user_request_ref_communicator(ur);
+               if(!ur || !tmp ){
+                       dbg("error - current ur is NULL");
+                       return;
+               }
+
+               o = tcore_pending_ref_core_object(p);
+               if(!o)
+                       dbg("error - current sat core is NULL");
+
+               tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SAT_SESSION_END,    0, NULL);
+       }
+
+       dbg("Function Exit");
+}
+
+static TReturn s_envelope(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+       const struct treq_sat_envelop_cmd_data *req_data;
+       int envelope_cmd_len = 0;
+       char envelope_cmd[ENVELOPE_CMD_LEN];
+       int count = 0;
+       char envelope_cmdhex[ENVELOPE_CMD_LEN*2];
+       char *pbuffer = NULL;
+
+       dbg("Function Entry");
+       memset(&envelope_cmdhex, 0x00, sizeof(envelope_cmdhex));
+       pbuffer = envelope_cmdhex;
+
+       hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+       req_data = tcore_user_request_ref_data(ur, NULL);
+       dbg("new pending sub cmd(%d)", req_data->sub_cmd);
+
+       envelope_cmd_len = tcore_sat_encode_envelop_cmd(req_data, (char *)envelope_cmd);
+               
+       dbg("envelope_cmd_len %d", envelope_cmd_len);           
+       if(envelope_cmd_len == 0){
+               return TCORE_RETURN_EINVAL;
+       }
+       for(count = 0; count < envelope_cmd_len ;count++ )
+       {
+               dbg("envelope_cmd %02x", envelope_cmd[count]);
+               sprintf(pbuffer, "%02x", envelope_cmd[count]);
+               pbuffer +=2;
+       }
+       dbg("pbuffer %s", envelope_cmdhex);     
+       cmd_str = g_strdup_printf("AT+SATE=\"%s\"%s", envelope_cmdhex,"\r");
+
+       req = tcore_at_request_new(cmd_str, "+SATE:", TCORE_AT_SINGLELINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_envelop_cmd, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sat_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+       
+       dbg("Function Exit");
+       return TCORE_RETURN_SUCCESS;
+
+       
+}
+
+static TReturn s_terminal_response(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+       const struct treq_sat_terminal_rsp_data *req_data;
+       int proactive_resp_len = 0;
+       char proactive_resp[ENVELOPE_CMD_LEN];
+       char proactive_resphex[ENVELOPE_CMD_LEN*2];
+       char *pbuffer = NULL;
+       int count = 0;
+       int i = 0;
+       char *hexString = NULL;
+
+       dbg("Function Entry");
+       memset(&proactive_resphex, 0x00, sizeof(proactive_resphex));
+       pbuffer = proactive_resphex;
+       hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+       req_data = tcore_user_request_ref_data(ur, NULL);
+
+       proactive_resp_len = tcore_sat_encode_terminal_response(req_data, (char *)proactive_resp);
+       dbg("proactive_resp %s", proactive_resp);
+       dbg("proactive_resp length %d", strlen(proactive_resp));
+       if(proactive_resp_len == 0){
+               return TCORE_RETURN_EINVAL;
+       }
+
+
+        hexString = calloc((proactive_resp_len*2)+1, 1);
+
+    for(i=0; i<proactive_resp_len*2; i+=2) 
+    {
+                    char value = 0;
+
+                    value = (proactive_resp[i/2] & 0xf0) >> 4;
+                    if(value < 0xA)
+                                    hexString[i] = ((proactive_resp[i/2] & 0xf0) >> 4) + '0';
+                    else hexString[i] = ((proactive_resp[i/2] & 0xf0) >> 4) + 'A' -10;
+
+                    value = proactive_resp[i/2] & 0x0f;
+                    if(value < 0xA)
+                                    hexString[i+1] = (proactive_resp[i/2] & 0x0f) + '0';
+                    else hexString[i+1] = (proactive_resp[i/2] & 0x0f) + 'A' -10;
+       }
+
+       dbg("hexString %s", hexString);
+       cmd_str = g_strdup_printf("AT+SATR=\"%s\"%s", hexString,"\r");
+
+       req = tcore_at_request_new(cmd_str, NULL , TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_timeout(pending, 10);
+       tcore_pending_set_response_callback(pending, on_response_terminal_response, hal);
+       tcore_pending_set_timeout_callback(pending, on_timeout_terminal_response, NULL);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sat_message_send, NULL);
+       tcore_hal_send_request(hal, pending);
+
+       dbg("Function Exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+//static void setup_event_rsp_get_ipc(CoreObject *o, struct tel_sat_setup_event_list_tlv *setup_evt_list){
+/*     UserRequest *ur = NULL;
+       struct tcore_user_info ui = { 0, };
+       struct treq_sat_terminal_rsp_data tr;*/
+
+/*     TcorePlugin *p = NULL;
+       TcoreHal *h = NULL;
+       TcorePending *pending = NULL;
+       ipc_sat_setup_evtlist_get_type ipc;
+
+       dbg("new pending(IPC_SAT_TERMINAL_RESPONSE)");
+
+       p = tcore_object_ref_plugin(o);
+       h = tcore_plugin_ref_hal(p);
+
+       memset(&ipc, 0, sizeof(ipc_sat_setup_evtlist_get_type));
+       ipc.hdr.len = (ipc_uint16) sizeof(ipc_sat_setup_evtlist_get_type);
+       ipc.hdr.main_cmd = (ipc_uint8) IPC_SAT_CMD;
+       ipc.hdr.sub_cmd = (ipc_uint8) IPC_SAT_SETUP_EVENT_LIST;
+       ipc.hdr.cmd_type = (ipc_uint8) IPC_CMD_GET;
+       ipc.hdr.msg_seq = (ipc_uint8) 0xFF;
+
+       memset(ipc.evt_list, 0xFF, SAT_EVENT_LIST_MAX);
+       ipc.evt_list_len = setup_evt_list->modem_event_list.event_list_cnt;
+       memcpy(ipc.evt_list, setup_evt_list->modem_event_list.evt_list, sizeof(ipc.evt_list)); */
+
+       //create ur for terminal response
+/*     ur = tcore_user_request_new(NULL, NULL);
+       tcore_user_request_set_user_info(ur, &ui);
+       memset(&tr, 0, sizeof(struct treq_sat_terminal_rsp_data));
+       tr.cmd_number = setup_evt_list->command_detail.cmd_num;
+       tr.cmd_type = setup_evt_list->command_detail.cmd_type;
+       tr.terminal_rsp_data.setup_event_list.command_detail.cmd_num = setup_evt_list->command_detail.cmd_num;
+       tr.terminal_rsp_data.setup_event_list.command_detail.cmd_type = setup_evt_list->command_detail.cmd_type;
+       tr.terminal_rsp_data.setup_event_list.device_id.src = setup_evt_list->device_id.dest;
+       tr.terminal_rsp_data.setup_event_list.device_id.dest = setup_evt_list->device_id.src;
+       tr.terminal_rsp_data.setup_event_list.result_type = RESULT_SUCCESS;
+       tcore_user_request_set_data(ur, sizeof(struct treq_sat_terminal_rsp_data), (void *)&tr);
+       tcore_user_request_set_command(ur, TREQ_SAT_REQ_TERMINALRESPONSE);*/
+
+/*     pending = tcore_pending_new(o, UTIL_ID(ipc.hdr));
+       tcore_pending_set_request_data(pending, sizeof(ipc_sat_setup_evtlist_get_type), &ipc);
+       tcore_pending_set_timeout(pending, 0);
+
+       tcore_pending_set_auto_free_status_after_sent(pending, TRUE);
+       //tcore_pending_set_response_callback(pending, on_response_set_up_eventlist, ur);
+       tcore_hal_send_request(h, pending);
+
+       return;
+}*/
+
+static struct tcore_sat_operations sat_ops =
+{
+       .envelope = s_envelope,
+       .terminal_response = s_terminal_response,
+};
+
+gboolean s_sat_init(TcorePlugin *p, TcoreHal *h)
+{
+       dbg("Entry");
+       CoreObject *o;
+       o = tcore_sat_new(p, "sat", &sat_ops,h);
+       if (!o)
+       {
+               dbg("CoreObject NULL !!");
+               return FALSE;
+       }
+
+       //tcore_object_add_callback(o, " ", on_event_sat_envelope_resp, NULL);
+       //tcore_object_add_callback(o, " ", on_event_sat_refresh_status, NULL);
+       tcore_object_add_callback(o, "+SATI", on_event_sat_proactive_command, NULL);
+       tcore_object_add_callback(o, "+SATN", on_event_sat_proactive_command, NULL);
+       tcore_object_add_callback(o, "+SATF", on_response_terminal_response_confirm, NULL);
+       //tcore_object_add_callback(o, EVENT_IPC_NOTI_SAT_CONTROL_RESULT, on_event_sat_control_result, NULL);
+
+       dbg("Exit");
+       return TRUE;
+}
+
+void s_sat_exit(TcorePlugin *p)
+{
+       CoreObject *o;
+       o = tcore_plugin_ref_core_object(p, "sat");
+       if (!o)
+               return;
+
+       tcore_sat_free(o);
+}
diff --git a/src/s_sim.c b/src/s_sim.c
new file mode 100755 (executable)
index 0000000..79b6bf5
--- /dev/null
@@ -0,0 +1,3363 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+
+
+#include <tcore.h>
+#include <hal.h>
+#include <core_object.h>
+#include <plugin.h>
+#include <queue.h>
+#include <co_sim.h>
+#include <storage.h>
+#include <user_request.h>
+#include <server.h>
+#include <at.h>
+
+#include "s_common.h"
+#include "s_sim.h"
+
+#define ID_RESERVED_AT 0x0229
+
+#define SWAPBYTES16(x) \
+{ \
+    unsigned short int data = *(unsigned short int*)&(x); \
+    data = ((data & 0xff00) >> 8) |    \
+           ((data & 0x00ff) << 8);     \
+    *(unsigned short int*)&(x) = data ;      \
+}
+
+enum s_sim_file_type_e {
+       SIM_FTYPE_DEDICATED = 0x00, /**< Dedicated */
+       SIM_FTYPE_TRANSPARENT = 0x01, /**< Transparent -binary type*/
+       SIM_FTYPE_LINEAR_FIXED = 0x02, /**< Linear fixed - record type*/
+       SIM_FTYPE_CYCLIC = 0x04, /**< Cyclic - record type*/
+       SIM_FTYPE_INVALID_TYPE = 0xFF /**< Invalid type */
+};
+
+enum s_sim_sec_op_e {
+       SEC_PIN1_VERIFY,
+       SEC_PIN2_VERIFY,
+       SEC_PUK1_VERIFY,
+       SEC_PUK2_VERIFY,
+       SEC_SIM_VERIFY,
+       SEC_ADM_VERIFY,
+       SEC_PIN1_CHANGE,
+       SEC_PIN2_CHANGE,
+       SEC_PIN1_ENABLE,
+       SEC_PIN1_DISABLE,
+       SEC_PIN2_ENABLE,
+       SEC_PIN2_DISABLE, //10
+       SEC_SIM_ENABLE,
+       SEC_SIM_DISABLE,
+       SEC_NET_ENABLE,
+       SEC_NET_DISABLE,
+       SEC_NS_ENABLE,
+       SEC_NS_DISABLE,
+       SEC_SP_ENABLE,
+       SEC_SP_DISABLE,
+       SEC_CP_ENABLE,
+       SEC_CP_DISABLE, //20
+       SEC_FDN_ENABLE,
+       SEC_FDN_DISABLE,
+       SEC_PIN1_STATUS,
+       SEC_PIN2_STATUS,
+       SEC_FDN_STATUS,
+       SEC_NET_STATUS,
+       SEC_NS_STATUS,
+       SEC_SP_STATUS,
+       SEC_CP_STATUS,
+       SEC_SIM_STATUS,
+       SEC_SIM_UNKNOWN = 0xff
+};
+
+struct s_sim_property {
+       gboolean b_valid; /**< Valid or not */
+       enum tel_sim_file_id file_id; /**< File identifier */
+       enum s_sim_file_type_e file_type; /**< File type and structure */
+       int rec_length; /**< Length of one record in file */
+       int rec_count; /**< Number of records in file */
+       int data_size; /**< File size */
+       int current_index; /**< current index to read */
+       enum tel_sim_status first_recv_status;
+       enum s_sim_sec_op_e current_sec_op; /**< current index to read */
+       struct tresp_sim_read files;
+};
+
+static void _next_from_get_file_info(CoreObject *o, UserRequest *ur, enum tel_sim_file_id ef, enum tel_sim_access_result rt);
+static void _next_from_get_file_data(CoreObject *o, UserRequest *ur, enum tel_sim_access_result rt, int decode_ret);
+static gboolean _get_sim_type(CoreObject *o);
+static TReturn _get_file_info(CoreObject *o, UserRequest *ur, const enum tel_sim_file_id ef);
+static gboolean _get_file_data(CoreObject *o, UserRequest *ur, const enum tel_sim_file_id ef, const int offset, const int length);
+static gboolean _get_file_record(CoreObject *o, UserRequest *ur, const enum tel_sim_file_id ef, const int index, const int length);
+static void _sim_status_update(CoreObject *o, enum tel_sim_status sim_status);
+
+
+static void on_confirmation_sim_message_send(TcorePending *p, gboolean result, void *user_data); // from Kernel
+
+static void on_confirmation_sim_message_send(TcorePending *p, gboolean result, void *user_data)
+{
+       dbg("on_confirmation_sim_message_send - msg out from queue.\n");
+
+       if (result == FALSE) {
+               /* Fail */
+               dbg("SEND FAIL");
+       }
+       else {
+               dbg("SEND OK");
+       }
+}
+
+static enum tcore_response_command _find_resp_command(UserRequest *ur)
+{
+       enum tcore_request_command command;
+       command = tcore_user_request_get_command(ur);
+       switch(command){
+               case TREQ_SIM_VERIFY_PINS:
+                       return TRESP_SIM_VERIFY_PINS;
+                       break;
+               case TREQ_SIM_VERIFY_PUKS:
+                       return TRESP_SIM_VERIFY_PUKS;
+                       break;
+               case TREQ_SIM_CHANGE_PINS:
+                       return TRESP_SIM_CHANGE_PINS;
+                       break;
+               case TREQ_SIM_GET_FACILITY_STATUS:
+                       return TRESP_SIM_GET_FACILITY_STATUS;
+                       break;
+               case TREQ_SIM_DISABLE_FACILITY:
+                       return TRESP_SIM_DISABLE_FACILITY;
+                       break;
+               case TREQ_SIM_ENABLE_FACILITY:
+                       return TRESP_SIM_ENABLE_FACILITY;
+                       break;
+               case TREQ_SIM_GET_LOCK_INFO:
+                       return TRESP_SIM_GET_LOCK_INFO;
+                       break;
+               case TREQ_SIM_TRANSMIT_APDU:
+                       return TRESP_SIM_TRANSMIT_APDU;
+                       break;
+               case TREQ_SIM_GET_ATR:
+                       return TRESP_SIM_GET_ATR;
+                       break;
+               case TREQ_SIM_GET_ECC:
+                       return TRESP_SIM_GET_ECC;
+                       break;
+               case TREQ_SIM_GET_LANGUAGE:
+                       return TRESP_SIM_GET_LANGUAGE;
+                       break;
+               case TREQ_SIM_SET_LANGUAGE:
+                       return TRESP_SIM_SET_LANGUAGE;
+                       break;
+               case TREQ_SIM_GET_ICCID:
+                       return TRESP_SIM_GET_ICCID;
+                       break;
+               case TREQ_SIM_GET_MAILBOX:
+                       return TRESP_SIM_GET_MAILBOX;
+                       break;
+               case TREQ_SIM_GET_CALLFORWARDING:
+                       return TRESP_SIM_GET_CALLFORWARDING;
+                       break;
+               case TREQ_SIM_SET_CALLFORWARDING:
+                       return TRESP_SIM_SET_CALLFORWARDING;
+                       break;
+               case TREQ_SIM_GET_MESSAGEWAITING:
+                       return TRESP_SIM_GET_MESSAGEWAITING;
+                       break;
+               case TREQ_SIM_GET_CPHS_INFO:
+                       return TRESP_SIM_GET_CPHS_INFO;
+                       break;
+               case TREQ_SIM_GET_MSISDN:
+                       return TRESP_SIM_GET_MSISDN;
+                       break;
+               case TREQ_SIM_GET_SPN:
+                       return TRESP_SIM_GET_SPN;
+                       break;
+               case TREQ_SIM_GET_SPDI:
+                       return TRESP_SIM_GET_SPDI;
+                       break;
+               case TREQ_SIM_GET_OPL:
+                       return TRESP_SIM_GET_OPL;
+                       break;
+               case TREQ_SIM_GET_PNN:
+                       return TRESP_SIM_GET_PNN;
+                       break;
+               case TREQ_SIM_GET_CPHS_NETNAME:
+                       return TRESP_SIM_GET_CPHS_NETNAME;
+                       break;
+               case TREQ_SIM_GET_OPLMNWACT:
+                       return TRESP_SIM_GET_OPLMNWACT;
+                       break;
+               case TREQ_SIM_REQ_AUTHENTICATION:
+                       return TRESP_SIM_REQ_AUTHENTICATION;
+                       break;
+               default:
+                       break;
+       }
+       return TRESP_UNKNOWN;
+}
+
+static int _sim_get_current_pin_facility(enum s_sim_sec_op_e op)
+{
+       int ret_type = 0;
+       dbg("current sec_op[%d]", op);
+       switch(op){
+               case SEC_PIN1_VERIFY :
+               case SEC_PIN1_CHANGE :
+                       ret_type = SIM_PTYPE_PIN1;
+                       break;
+               case SEC_PIN2_VERIFY :
+               case SEC_PIN2_CHANGE :
+                       ret_type = SIM_PTYPE_PIN2;
+                       break;
+               case SEC_PUK1_VERIFY :
+                       ret_type = SIM_PTYPE_PUK1;
+                       break;
+               case SEC_PUK2_VERIFY :
+                       ret_type = SIM_PTYPE_PUK2;
+                       break;
+               case SEC_SIM_VERIFY :
+                       ret_type = SIM_PTYPE_SIM;
+                       break;
+               case SEC_ADM_VERIFY :
+                       ret_type = SIM_PTYPE_ADM;
+                       break;
+
+               case SEC_PIN1_ENABLE :
+               case SEC_PIN1_DISABLE :
+               case SEC_PIN1_STATUS :
+                       ret_type = SIM_FACILITY_SC;
+                       break;
+               case SEC_SIM_ENABLE :
+               case SEC_SIM_DISABLE :
+               case SEC_SIM_STATUS :
+                       ret_type = SIM_FACILITY_PS;
+                       break;
+               case SEC_NET_ENABLE :
+               case SEC_NET_DISABLE :
+               case SEC_NET_STATUS :
+                       ret_type = SIM_FACILITY_PN;
+                       break;
+               case SEC_NS_ENABLE :
+               case SEC_NS_DISABLE :
+               case SEC_NS_STATUS :
+                       ret_type = SIM_FACILITY_PU;
+                       break;
+               case SEC_SP_ENABLE :
+               case SEC_SP_DISABLE :
+               case SEC_SP_STATUS :
+                       ret_type = SIM_FACILITY_PP;
+                       break;
+               case SEC_CP_ENABLE :
+               case SEC_CP_DISABLE :
+               case SEC_CP_STATUS :
+                       ret_type = SIM_FACILITY_PC;
+                       break;
+               case SEC_FDN_ENABLE :
+               case SEC_FDN_DISABLE :
+               case SEC_FDN_STATUS :
+                       ret_type = SIM_FACILITY_FD;
+                       break;
+
+               default:
+                       dbg("not handled current sec op[%d]",op)
+                       break;
+       }
+       return ret_type;
+}
+
+static enum tel_sim_access_result _decode_status_word(unsigned short status_word1, unsigned short status_word2)
+{
+       enum tel_sim_access_result rst = SIM_ACCESS_FAILED;
+
+       if (status_word1 == 0x93 && status_word2 == 0x00) {
+               rst = SIM_ACCESS_FAILED;
+               /*Failed SIM request command*/
+               dbg(" error - SIM application toolkit busy [%x][%x]", status_word1, status_word2);
+       }
+       else if (status_word1 == 0x94 && status_word2 == 0x00) {
+               rst = SIM_ACCESS_FAILED;
+               /*Failed SIM request command*/
+               dbg(" error - No EF Selected [%x][%x]", status_word1, status_word2);
+       }
+       else if (status_word1 == 0x94 && status_word2 == 0x02) {
+               rst = SIM_ACCESS_FAILED;
+               /*Failed SIM request command*/
+               dbg("error - Out of Range - Invalid address or record number[%x][%x]",
+                               status_word1, status_word2);
+       }
+       else if (status_word1 == 0x94 && status_word2 == 0x04) {
+               rst = SIM_ACCESS_FILE_NOT_FOUND;
+               /*Failed SIM request command*/
+               dbg(" error - File ID not found [%x][%x]", status_word1, status_word2);
+       }
+       else if (status_word1 == 0x94 && status_word2 == 0x08) {
+               rst = SIM_ACCESS_FAILED; /* MOdem not support */
+               /*Failed SIM request command*/
+               dbg(" error - File is inconsistent with command - Modem not support or USE [%x][%x]",
+                               status_word1, status_word2);
+       }
+       else if (status_word1 == 0x98 && status_word2 == 0x02) {
+               rst = SIM_ACCESS_CONDITION_NOT_SATISFIED;
+               /*Failed SIM request command*/
+               dbg(" error - CHV not initialized [%x][%x]", status_word1, status_word2);
+       }
+       else if (status_word1 == 0x98 && status_word2 == 0x04) {
+               rst = SIM_ACCESS_CONDITION_NOT_SATISFIED;
+               /*Failed SIM request command*/
+               dbg(" error - Access condition not fullfilled [%x][%x]", status_word1, status_word2);
+               dbg(" error -Unsuccessful CHV verification - at least one attempt left [%x][%x]",
+                               status_word1, status_word2);
+               dbg(" error - Unsuccessful Unblock CHV - at least one attempt left [%x][%x]",
+                               status_word1, status_word2);
+               dbg(" error - Authentication failure [%x][%x]", status_word1, status_word2);
+       }
+       else if (status_word1 == 0x98 && status_word2 == 0x08) {
+               rst = SIM_ACCESS_CONDITION_NOT_SATISFIED;
+               /*Failed SIM request command*/
+               dbg(" error - Contradiction with CHV status [%x][%x]", status_word1, status_word2);
+       }
+       else if (status_word1 == 0x98 && status_word2 == 0x10) {
+               rst = SIM_ACCESS_CONDITION_NOT_SATISFIED;
+               /*Failed SIM request command*/
+               dbg(" error - Contradiction with invalidation  status [%x][%x]",
+                               status_word1, status_word2);
+       }
+       else if (status_word1 == 0x98 && status_word2 == 0x40) {
+               rst = SIM_ACCESS_CONDITION_NOT_SATISFIED;
+               /*Failed SIM request command*/
+               dbg(" error -Unsuccessful CHV verification - no attempt left [%x][%x]",
+                               status_word1, status_word2);
+               dbg(" error - Unsuccessful Unblock CHV - no attempt left [%x][%x]",
+                               status_word1, status_word2);
+               dbg(" error - CHV blocked [%x][%x]", status_word1, status_word2);
+       }
+       else if (status_word1 == 0x67 && status_word2 == 0x00) {
+               rst = SIM_ACCESS_FAILED;
+               dbg(" error -Incorrect Parameter 3 [%x][%x]", status_word1, status_word2);
+       }
+       else if (status_word1 == 0x6B && status_word2 == 0x00) {
+               rst = SIM_ACCESS_FAILED;
+               dbg(" error -Incorrect Parameter 1 or 2 [%x][%x]", status_word1, status_word2);
+       }
+       else if (status_word1 == 0x6D && status_word2 == 0x00) {
+               rst = SIM_ACCESS_CONDITION_NOT_SATISFIED;
+               dbg(" error -Unknown instruction given as command [%x][%x]", status_word1, status_word2);
+       }
+       else if (status_word1 == 0x6E && status_word2 == 0x00) {
+               rst = SIM_ACCESS_CONDITION_NOT_SATISFIED;
+               dbg(" error -Unknown instruction given as command [%x][%x]", status_word1, status_word2);
+       }
+       else if (status_word1 == 0x69 && status_word2 == 0x82) {
+               rst = SIM_ACCESS_CONDITION_NOT_SATISFIED;
+               dbg(" error -Access denied [%x][%x]", status_word1, status_word2);
+       }
+       else if (status_word1 == 0x6A && status_word2 == 0x87) {
+               rst = SIM_ACCESS_FAILED;
+               dbg(" error -Incorrect parameters [%x][%x]", status_word1, status_word2);
+       }
+       else if (status_word1 == 0x6A && status_word2 == 0x82) {
+               rst = SIM_ACCESS_FILE_NOT_FOUND; // not sure of the SW1 and SW2 meaning here
+               dbg(" error -File Not found [%x][%x]", status_word1, status_word2);
+       }
+       else if (status_word1 == 0x6A && status_word2 == 0x83) {
+               rst = SIM_ACCESS_FILE_NOT_FOUND; // not sure of the SW1 and SW2 meaning here
+               dbg(" error -Record Not found [%x][%x]", status_word1, status_word2);
+       }
+       else {
+               rst = SIM_ACCESS_CARD_ERROR;
+               dbg(" error -Unknown state [%x][%x]", status_word1, status_word2);
+       }
+       return rst;
+}
+
+static gboolean _sim_check_identity(CoreObject *o, struct tel_sim_imsi *imsi)
+{
+       Server *s = NULL;
+       Storage *strg = NULL;
+       char* old_imsi = NULL;
+       char new_imsi[15+1] = {0,};
+
+       s = tcore_plugin_ref_server(tcore_object_ref_plugin(o));
+       if(!s){
+               dbg("there is no valid server at this point");
+               return FALSE;
+       }
+
+       strg = (Storage*)tcore_server_find_storage(s, "vconf");
+       if(!strg){
+               dbg("there is no valid storage plugin");
+               return FALSE;
+       }
+
+       memcpy(&new_imsi, imsi->plmn, strlen(imsi->plmn));
+       memcpy(&new_imsi[strlen(imsi->plmn)], imsi->msin, strlen(imsi->msin));
+       new_imsi[strlen(imsi->plmn)+strlen(imsi->msin)] = '\0';
+
+       old_imsi = tcore_storage_get_string(strg, STORAGE_KEY_TELEPHONY_IMSI);
+       dbg("old_imsi[%s],newImsi[%s]", old_imsi, new_imsi);
+
+       if (old_imsi != NULL) {
+               if (strncmp(old_imsi, new_imsi, 15) != 0) {
+                       dbg("NEW SIM");
+                       if (tcore_storage_set_string(strg, STORAGE_KEY_TELEPHONY_IMSI, (const char*) &new_imsi) == FALSE)
+                               dbg("[FAIL] UPDATE STORAGE_KEY_TELEPHONY_IMSI");
+                       tcore_sim_set_identification(o, TRUE);
+               }
+               else {
+                       dbg("SAME SIM");
+                       tcore_sim_set_identification(o, FALSE);
+               }
+       }
+       else {
+               dbg("OLD SIM VALUE IS NULL. NEW SIM");
+               if (tcore_storage_set_string(strg, STORAGE_KEY_TELEPHONY_IMSI, (const char*) &new_imsi) == FALSE)
+                       dbg("[FAIL] UPDATE STORAGE_KEY_TELEPHONY_IMSI");
+               tcore_sim_set_identification(o, TRUE);
+       }
+       return 1;
+}
+
+static void  _next_from_get_file_info(CoreObject *o,  UserRequest *ur, enum tel_sim_file_id ef, enum tel_sim_access_result rt)
+{
+       struct tresp_sim_read resp = {0,};
+       struct s_sim_property *file_meta = NULL;
+
+       dbg("EF[0x%x] access Result[%d]", ef, rt);
+
+       resp.result = rt;
+       memset(&resp.data, 0x00, sizeof(resp.data));
+       file_meta = (struct s_sim_property*)tcore_user_request_ref_metainfo(ur, NULL);
+
+       if ((ef != SIM_EF_ELP && ef != SIM_EF_LP && ef != SIM_EF_USIM_PL && ef != SIM_EF_CPHS_CPHS_INFO)
+                       && (rt != SIM_ACCESS_SUCCESS)) {
+               tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_read),
+                               &resp);
+               return;
+       }
+
+       switch (ef) {
+               case SIM_EF_ELP:
+                       if (rt == SIM_ACCESS_SUCCESS) {
+                               dbg("[SIM DATA] exist EFELP/PL(0x2F05)");
+                               /*                              if (po->language_file == 0x00)
+                                po->language_file = SIM_EF_ELP;*/
+                               _get_file_data(o, ur, ef, 0, file_meta->data_size);
+                       }
+                       else {
+                               if (tcore_sim_get_type(o) == SIM_TYPE_GSM) {
+                                       dbg(" [SIM DATA]SIM_EF_ELP(2F05) access fail. Request SIM_EF_LP(0x6F05) info");
+                                       /* The ME requests the Language Preference (EFLP) if EFELP is not available  */
+                                       _get_file_info(o, ur, SIM_EF_LP);
+                               }
+                               else if (tcore_sim_get_type(o) == SIM_TYPE_USIM) {
+                                       dbg(
+                                                       " [SIM DATA]fail to get Language information in USIM(EF-LI(6F05),EF-PL(2F05)). Request SIM_EF_ECC(0x6FB7) info");
+                                       /* EFELPand EFLI not present at this point. */
+                                       /*                                      po->language.lang_cnt = 0;*/
+                                       tcore_user_request_send_response(ur, _find_resp_command(ur),
+                                                       sizeof(struct tresp_sim_read), &resp);
+                                       return;
+                               }
+                       }
+                       break;
+
+               case SIM_EF_LP: //same with SIM_EF_USIM_LI
+                       if (rt == SIM_ACCESS_SUCCESS) {
+                               dbg("[SIM DATA] exist EFLP/LI(0x6F05)");
+                               /*                              if (po->language_file == 0x00)
+                                po->language_file = SIM_EF_LP;*/
+                               _get_file_data(o, ur, ef, 0, file_meta->data_size);
+                       }
+                       else {
+                               dbg("[SIM DATA]SIM_EF_LP/LI(6F05) access fail. Current CardType[%d]",
+                                               tcore_sim_get_type(o));
+                               if (tcore_sim_get_type(o) == SIM_TYPE_GSM) {
+                                       /* EFELPand EFLP not present at this point.*/
+                                       /*                                      po->language.lang_cnt = 0;*/
+                                       tcore_user_request_send_response(ur, _find_resp_command(ur),
+                                                       sizeof(struct tresp_sim_read), &resp);
+                                       return;
+                               }
+                               /*  if EFLI is not present, then the language selection shall be as defined in EFPL at the MF level     */
+                               else if (tcore_sim_get_type(o) == SIM_TYPE_USIM) {
+                                       dbg("[SIM DATA] try USIM EFPL(0x2F05)");
+                                       _get_file_info(o, ur, SIM_EF_ELP);
+                               }
+                       }
+                       break;
+
+               case SIM_EF_USIM_PL:
+                       if (rt == SIM_ACCESS_SUCCESS) {
+                               dbg("[SIM DATA] exist EFELP/PL(0x2F05)");
+                               /*                              if (po->language_file == 0x00)
+                                po->language_file = SIM_EF_ELP;*/
+                               _get_file_data(o, ur, SIM_EF_ELP, 0, file_meta->data_size);
+                       }
+                       else {
+                               /* EFELIand EFPL not present, so set language count as zero and select ECC */
+                               dbg(
+                                               " [SIM DATA]SIM_EF_USIM_PL(2A05) access fail. Request SIM_EF_ECC(0x6FB7) info");
+                               /*                              po->language.lang_cnt = 0;*/
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),
+                                               sizeof(struct tresp_sim_read), &resp);
+                               return;
+                       }
+                       break;
+
+               case SIM_EF_ECC:
+                       if (tcore_sim_get_type(o) == SIM_TYPE_GSM) {
+                               _get_file_data(o, ur, ef, 0, file_meta->data_size);
+                       }
+                       else if (tcore_sim_get_type(o) == SIM_TYPE_USIM) {
+                               if (file_meta->rec_count > SIM_ECC_RECORD_CNT_MAX)
+                                       file_meta->rec_count = SIM_ECC_RECORD_CNT_MAX;
+
+                               file_meta->current_index++;
+                               _get_file_record(o, ur, ef, file_meta->current_index, file_meta->rec_length);
+                       }
+                       break;
+
+               case SIM_EF_ICCID:
+               case SIM_EF_IMSI:
+               case SIM_EF_SST:
+               case SIM_EF_SPN:
+               case SIM_EF_SPDI:
+               //case SIM_EF_CPHS_CPHS_INFO:
+               case SIM_EF_CPHS_CALL_FORWARD_FLAGS:
+               case SIM_EF_CPHS_VOICE_MSG_WAITING:
+               case SIM_EF_CPHS_OPERATOR_NAME_STRING:
+               case SIM_EF_CPHS_OPERATOR_NAME_SHORT_FORM_STRING:
+               case SIM_EF_CPHS_DYNAMICFLAGS:
+               case SIM_EF_CPHS_DYNAMIC2FLAG:
+               case SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE:
+               case SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE_LINE2:
+                       _get_file_data(o, ur, ef, 0, file_meta->data_size);
+                       break;
+
+               case SIM_EF_CPHS_CPHS_INFO:
+                       if (rt == SIM_ACCESS_SUCCESS) {
+                               tcore_sim_set_cphs_status(o, TRUE);
+                               if (!tcore_user_request_ref_communicator(ur)) {
+                                       dbg("internal CPHS INFO request before sim status update");
+                                       _sim_status_update(o, SIM_STATUS_INIT_COMPLETED);
+                               } else {
+                                       dbg("external CPHS INFO request");
+                                       _get_file_data(o, ur, ef, 0, file_meta->data_size);
+                               }
+                       } else {
+                               tcore_sim_set_cphs_status(o, FALSE);
+                               if (!tcore_user_request_ref_communicator(ur)) {
+                                       dbg("internal CPHS INFO request before sim status update");
+                                       _sim_status_update(o, SIM_STATUS_INIT_COMPLETED);
+                               } else {
+                                       dbg("external CPHS INFO request");
+                                       tcore_user_request_send_response(ur, _find_resp_command(ur),
+                                                       sizeof(struct tresp_sim_read), &resp);
+                               }
+                       }
+                       break;
+
+
+               case SIM_EF_USIM_CFIS:
+                       if (file_meta->rec_count > SIM_CF_RECORD_CNT_MAX)
+                               file_meta->rec_count = SIM_CF_RECORD_CNT_MAX;
+                       file_meta->current_index++;
+                       _get_file_record(o, ur, ef, file_meta->current_index, file_meta->rec_length);
+                       break;
+
+               case SIM_EF_OPL:
+               case SIM_EF_PNN:
+               case SIM_EF_USIM_MWIS:
+               case SIM_EF_USIM_MBI:
+               case SIM_EF_MBDN:
+               case SIM_EF_CPHS_MAILBOX_NUMBERS:
+               case SIM_EF_CPHS_INFORMATION_NUMBERS:
+                       file_meta->current_index++;
+                       _get_file_record(o, ur, ef, file_meta->current_index, file_meta->rec_length);
+                       break;
+
+               default:
+                       dbg("error - File id for get file info [0x%x]", ef);
+                       break;
+       }
+       return;
+}
+
+static void _next_from_get_file_data(CoreObject *o, UserRequest *ur, enum tel_sim_access_result rt, int decode_ret)
+{
+       struct s_sim_property *file_meta = NULL;
+       dbg("Entry");
+
+       file_meta = (struct s_sim_property*)tcore_user_request_ref_metainfo(ur, NULL);
+       dbg("[SIM]EF[0x%x] read rt[%d] Decode rt[%d]", file_meta->file_id, rt, decode_ret);
+       switch (file_meta->file_id) {
+               case SIM_EF_ELP:
+               case SIM_EF_USIM_PL:
+               case SIM_EF_LP:
+               case SIM_EF_USIM_LI:
+                       if (decode_ret == TRUE) {
+                               if (file_meta->file_id == SIM_EF_LP || file_meta->file_id == SIM_EF_USIM_LI) {
+/*                                     po->language_file = SIM_EF_LP;*/
+                               } else if (file_meta->file_id == SIM_EF_ELP || file_meta->file_id == SIM_EF_USIM_PL) {
+/*                                     po->language_file = SIM_EF_ELP;*/
+                               }
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),    sizeof(struct tresp_sim_read), &file_meta->files);
+                       } else {
+                               /* 2G */
+                               /*  The ME requests the Extended Language Preference. The ME only requests the Language Preference (EFLP) if at least one of the following conditions holds:
+                                -      EFELP is not available;
+                                -      EFELP does not contain an entry corresponding to a language specified in ISO 639[30];
+                                -      the ME does not support any of the languages in EFELP.
+                                */
+                               /* 3G */
+                               /*  The ME only requests the Language Preference (EFPL) if at least one of the following conditions holds:
+                                -      if the EFLI has the value 'FFFF' in its highest priority position
+                                -      if the ME does not support any of the language codes indicated in EFLI , or if EFLI is not present
+                                */
+                               if (tcore_sim_get_type(o) == SIM_TYPE_GSM) {
+                                       if (file_meta->file_id == SIM_EF_LP)
+                                               tcore_user_request_send_response(ur, _find_resp_command(ur),    sizeof(struct tresp_sim_read), &file_meta->files);
+                                       else
+                                               _get_file_info(o, ur, SIM_EF_LP);
+                               } else if (tcore_sim_get_type(o) == SIM_TYPE_USIM) {
+
+                                       if (file_meta->file_id == SIM_EF_LP || file_meta->file_id == SIM_EF_USIM_LI){
+                                               _get_file_info(o, ur, SIM_EF_ELP);
+                                       }
+                                       else{
+                                               tcore_user_request_send_response(ur, _find_resp_command(ur),    sizeof(struct tresp_sim_read), &file_meta->files);
+                                       }
+                               }
+                       }
+                       break;
+
+               case SIM_EF_ECC:
+                       if (tcore_sim_get_type(o) == SIM_TYPE_USIM) {
+                               if (file_meta->current_index == file_meta->rec_count) {
+                                       tcore_user_request_send_response(ur, _find_resp_command(ur),    sizeof(struct tresp_sim_read), &file_meta->files);
+                               } else {
+                                       file_meta->current_index++;
+                                       _get_file_record(o, ur, file_meta->file_id, file_meta->current_index, file_meta->rec_length);
+                               }
+                       } else if (tcore_sim_get_type(o) == SIM_TYPE_GSM) {
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),    sizeof(struct tresp_sim_read), &file_meta->files);
+                       } else {
+                               dbg("[SIM DATA]Invalid CardType[%d] Unable to handle", tcore_sim_get_type(o));
+                       }
+                       break;
+
+               case SIM_EF_IMSI:
+                       ur = tcore_user_request_new(NULL, NULL); //this is for using ur metainfo set/ref functionality.
+                       _get_file_info(o, ur, SIM_EF_CPHS_CPHS_INFO);
+                       break;
+
+               case SIM_EF_MSISDN:
+                       if (file_meta->current_index == file_meta->rec_count) {
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),    sizeof(struct tresp_sim_read), &file_meta->files);
+                       } else {
+                               file_meta->current_index++;
+                               _get_file_record(o, ur, file_meta->file_id, file_meta->current_index, file_meta->rec_length);
+                       }
+                       break;
+
+               case SIM_EF_OPL:
+                       if (file_meta->current_index == file_meta->rec_count) {
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),    sizeof(struct tresp_sim_read), &file_meta->files);
+                       } else {
+                               file_meta->current_index++;
+                               _get_file_record(o, ur, file_meta->file_id, file_meta->current_index, file_meta->rec_length);
+                       }
+                       break;
+
+               case SIM_EF_PNN:
+                       if (file_meta->current_index == file_meta->rec_count) {
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),    sizeof(struct tresp_sim_read), &file_meta->files);
+                       } else {
+                               file_meta->current_index++;
+                               _get_file_record(o, ur, file_meta->file_id, file_meta->current_index, file_meta->rec_length);
+                       }
+                       break;
+
+               case SIM_EF_USIM_CFIS:
+               case SIM_EF_USIM_MWIS:
+               case SIM_EF_USIM_MBI:
+               case SIM_EF_MBDN:
+               case SIM_EF_CPHS_MAILBOX_NUMBERS:
+               case SIM_EF_CPHS_INFORMATION_NUMBERS:
+                       if (file_meta->current_index == file_meta->rec_count) {
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),    sizeof(struct tresp_sim_read), &file_meta->files);
+                       } else {
+                               file_meta->current_index++;
+                               _get_file_record(o, ur, file_meta->file_id, file_meta->current_index, file_meta->rec_length);
+                       }
+                       break;
+
+               case SIM_EF_CPHS_OPERATOR_NAME_STRING:
+                       file_meta->files.result = rt;
+                       if (decode_ret == TRUE && rt == SIM_ACCESS_SUCCESS)
+                               memcpy(file_meta->files.data.cphs_net.full_name, file_meta->files.data.cphs_net.full_name, strlen((char*)file_meta->files.data.cphs_net.full_name));
+                       _get_file_info(o, ur, SIM_EF_CPHS_OPERATOR_NAME_SHORT_FORM_STRING);
+                       break;
+
+               case SIM_EF_CPHS_OPERATOR_NAME_SHORT_FORM_STRING:
+                       if (file_meta->files.result == SIM_ACCESS_SUCCESS || file_meta->files.result == SIM_ACCESS_SUCCESS)
+                               file_meta->files.result = SIM_ACCESS_SUCCESS;
+                       if (strlen((char*)file_meta->files.data.cphs_net.full_name))
+                               memcpy(&file_meta->files.data.cphs_net.full_name, &file_meta->files.data.cphs_net.full_name, strlen((char*)file_meta->files.data.cphs_net.full_name));
+                       tcore_user_request_send_response(ur, _find_resp_command(ur),    sizeof(struct tresp_sim_read), &file_meta->files);
+                       break;
+
+               case SIM_EF_ICCID:
+               case SIM_EF_SST:
+               case SIM_EF_SPN:
+               case SIM_EF_SPDI:
+               case SIM_EF_OPLMN_ACT:
+               case SIM_EF_CPHS_CPHS_INFO :
+               case SIM_EF_CPHS_CALL_FORWARD_FLAGS:
+               case SIM_EF_CPHS_VOICE_MSG_WAITING:
+               case SIM_EF_CPHS_DYNAMICFLAGS:
+               case SIM_EF_CPHS_DYNAMIC2FLAG:
+               case SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE:
+               case SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE_LINE2:
+                       tcore_user_request_send_response(ur, _find_resp_command(ur),    sizeof(struct tresp_sim_read), &file_meta->files);
+                       break;
+
+               default:
+                       dbg("File id not handled [0x%x]", file_meta->file_id);
+                       break;
+       }
+}
+
+static void _sim_status_update(CoreObject *o, enum tel_sim_status sim_status)
+{
+       struct tnoti_sim_status noti_data = {0,};
+
+       dbg("tcore_sim_set_status and send noti w/ [%d]", sim_status);
+       tcore_sim_set_status(o, sim_status);
+       noti_data.sim_status = sim_status;
+       tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SIM_STATUS,
+                       sizeof(struct tnoti_sim_status), &noti_data);
+}
+
+static void _response_get_sim_type(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       UserRequest *ur = NULL;
+       CoreObject *co_sim = NULL;
+       struct s_sim_property *sp = NULL;
+       GSList *tokens=NULL;
+       enum tel_sim_type sim_type = SIM_TYPE_UNKNOWN;
+       const char *line;
+       int state;
+
+       dbg(" Function entry ");
+       
+       co_sim = tcore_pending_ref_core_object(p);
+       sp = tcore_sim_ref_userdata(co_sim);
+       ur = tcore_pending_ref_user_request(p);
+
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) != 1) {
+                               msg("invalid message");
+                               tcore_at_tok_free(tokens);
+                               return;
+                       }
+               }
+               state = atoi(g_slist_nth_data(tokens, 0));
+               dbg("SIM Type is %d", state);
+
+               if(state == 0){
+                       sim_type = SIM_TYPE_GSM;
+               }else if(state == 1){
+                       sim_type = SIM_TYPE_USIM;
+               }else{
+                       sim_type = SIM_TYPE_UNKNOWN;
+               }
+               
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               sim_type = SIM_TYPE_UNKNOWN;
+       }
+
+       tcore_sim_set_type(co_sim, sim_type);
+       _sim_status_update(co_sim, sp->first_recv_status);
+       tcore_at_tok_free(tokens);
+       dbg(" Function exit");
+}
+
+static void _response_get_file_info(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       UserRequest *ur = NULL;
+       CoreObject *co_sim = NULL;
+       struct s_sim_property *file_meta = NULL;
+       GSList *tokens=NULL;
+       enum tel_sim_access_result rt;
+       GQueue *queue = NULL;
+       const char *line;
+       int sw1 = 0;
+       int sw2 = 0;
+
+       dbg(" Function entry ");
+       
+       co_sim = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+       file_meta = (struct s_sim_property*)tcore_user_request_ref_metainfo(ur, NULL);
+       
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) < 2) {
+                               err("invalid message");
+                               tcore_at_tok_free(tokens);
+                               return;
+                       }
+               }
+               sw1 = atoi(g_slist_nth_data(tokens, 0));
+               sw2 = atoi(g_slist_nth_data(tokens, 1));
+
+               /*1. SIM access success case*/
+               if ((sw1 == 0x90 && sw2 == 0x00) || sw1 == 0x91) {
+                       unsigned char tag_len = 0; /*   1 or 2 bytes ??? */
+                       unsigned short record_len = 0;
+                       char num_of_records = 0;
+                       unsigned char file_id_len = 0;
+                       unsigned short file_id = 0;
+                       unsigned short file_size = 0;
+                       unsigned short file_type = 0;
+                       unsigned short arr_file_id = 0;
+                       int arr_file_id_rec_num = 0;
+
+                       /*      handling only last 3 bits */
+                       unsigned char file_type_tag = 0x07;
+                       unsigned char *ptr_data;
+
+                       char *hexData;
+                       char *tmp;
+                       char *recordData = NULL;
+                       hexData = g_slist_nth_data(tokens, 2);
+                       dbg("hexData: %s", hexData);
+                       dbg("hexData: %s", hexData+1);
+
+                       tmp = calloc(1, strlen(hexData)-2);
+                       memcpy(tmp, hexData+1, strlen(hexData)-2);
+                       dbg("tmp: %s", tmp);
+
+                       recordData = util_hexStringToBytes(tmp);
+                       dbg("recordData: %x", recordData);
+                       free(tmp);
+                       util_hex_dump("    ", strlen(hexData)/2, recordData);
+                       
+                       ptr_data = (unsigned char *)recordData;
+                       if (tcore_sim_get_type(co_sim) == SIM_TYPE_USIM) {
+                               /*
+                                ETSI TS 102 221 v7.9.0
+                                - Response Data
+                                '62'   FCP template tag
+                                - Response for an EF
+                                '82'   M       File Descriptor
+                                '83'   M       File Identifier
+                                'A5'   O       Proprietary information
+                                '8A'   M       Life Cycle Status Integer
+                                '8B', '8C' or 'AB'     C1      Security attributes
+                                '80'   M       File size
+                                '81'   O       Total file size
+                                '88'   O       Short File Identifier (SFI)
+                                */
+
+                               /* rsim.res_len  has complete data length received  */
+
+                               /* FCP template tag - File Control Parameters tag*/
+                               if (*ptr_data == 0x62) {
+                                       /* parse complete FCP tag*/
+                                       /* increment to next byte */
+                                       ptr_data++;
+                                       tag_len = *ptr_data++;
+                                       dbg("tag_len: %02x", tag_len);
+                                       /* FCP file descriptor - file type, accessibility, DF, ADF etc*/
+                                       if (*ptr_data == 0x82) {
+                                               /* increment to next byte */
+                                               ptr_data++;
+                                               /* 2 or 5 value*/
+                                               ptr_data++;
+                                               /*      unsigned char file_desc_len = *ptr_data++;*/
+                                               /*      dbg("file descriptor length: [%d]", file_desc_len);*/
+                                               /* TBD:  currently capture only file type : ignore sharable, non sharable, working, internal etc*/
+                                               /* consider only last 3 bits*/
+                                               dbg("file_type_tag: %02x", file_type_tag);
+                                               file_type_tag = file_type_tag & (*ptr_data);
+                                               dbg("file_type_tag: %02x", file_type_tag);
+
+                                               switch (file_type_tag) {
+                                                       /* increment to next byte */
+                                                       //ptr_data++;
+                                                       case 0x1:
+                                                               dbg("Getting FileType: [Transparent file type]");
+                                                               file_type = SIM_FTYPE_TRANSPARENT;
+
+                                                               /* increment to next byte */
+                                                               ptr_data++;
+                                                               /* increment to next byte */
+                                                               ptr_data++;
+                                                               break;
+
+                                                       case 0x2:
+                                                               dbg("Getting FileType: [Linear fixed file type]");
+                                                               /* increment to next byte */
+                                                               ptr_data++;
+                                                               /*      data coding byte - value 21 */
+                                                               ptr_data++;
+                                                               /*      2bytes */
+                                                               memcpy(&record_len, ptr_data, 2);
+                                                               /* swap bytes */
+                                                               SWAPBYTES16(record_len);
+                                                               ptr_data = ptr_data + 2;
+                                                               num_of_records = *ptr_data++;
+                                                               /* Data lossy conversation from enum (int) to unsigned char */
+                                                               file_type = SIM_FTYPE_LINEAR_FIXED;
+                                                               break;
+
+                                                       case 0x6:
+                                                               dbg(" Cyclic fixed file type");
+                                                               /* increment to next byte */
+                                                               ptr_data++;
+                                                               /*      data coding byte - value 21 */
+                                                               ptr_data++;
+                                                               /*      2bytes */
+                                                               memcpy(&record_len, ptr_data, 2);
+                                                               /* swap bytes  */
+                                                               SWAPBYTES16(record_len);
+                                                               ptr_data = ptr_data + 2;
+                                                               num_of_records = *ptr_data++;
+                                                               file_type = SIM_FTYPE_CYCLIC;
+                                                               break;
+
+                                               default:
+                                                       dbg("not handled file type [0x%x]", *ptr_data);
+                                                       break;
+                                               }
+                                       } else {
+                                               dbg("INVALID FCP received - DEbug!");
+                                               return;
+                                       }
+
+                                       /*File identifier - file id?? */ // 0x84,0x85,0x86 etc are currently ignored and not handled
+                                       if (*ptr_data == 0x83) {
+                                               /* increment to next byte */
+                                               ptr_data++;
+                                               file_id_len = *ptr_data++;
+                                               dbg("file_id_len: %02x", file_id_len);
+
+                                               memcpy(&file_id, ptr_data, file_id_len);
+                                               dbg("file_id: %x", file_id);
+
+                                               /* swap bytes    */
+                                               SWAPBYTES16(file_id);
+                                               dbg("file_id: %x", file_id);
+
+                                               ptr_data = ptr_data + 2;
+                                               dbg("Getting FileID=[0x%x]", file_id);
+                                       } else {
+                                               dbg("INVALID FCP received - DEbug!");
+                                               free(recordData);                                       
+                                               return;
+                                       }
+
+                                       /*      proprietary information  */
+                                       if (*ptr_data == 0xA5) {
+                                               unsigned short prop_len;
+                                               /* increment to next byte */
+                                               ptr_data++;
+
+                                               /* length */
+                                               prop_len = *ptr_data;
+                                               dbg("prop_len: %02x", prop_len);
+
+                                               /* skip data */
+                                               ptr_data = ptr_data + prop_len + 1;
+                                       } else {
+                                               dbg("INVALID FCP received - DEbug!");
+                                       }
+
+                                       /* life cycle status integer [8A][length:0x01][status]*/
+                                       /*
+                                        status info b8~b1
+                                        00000000 : No information given
+                                        00000001 : creation state
+                                        00000011 : initialization state
+                                        000001-1 : operation state -activated
+                                        000001-0 : operation state -deactivated
+                                        000011-- : Termination state
+                                        b8~b5 !=0, b4~b1=X : Proprietary
+                                        Any other value : RFU
+                                        */
+                                       if (*ptr_data == 0x8A) {
+                                               /* increment to next byte */
+                                               ptr_data++;
+                                               /* length - value 1 */
+                                               ptr_data++;
+
+                                               switch (*ptr_data) {
+                                                       case 0x04:
+                                                       case 0x06:
+                                                               dbg("<RX> operation state -deactivated");
+                                                               ptr_data++;
+                                                               break;
+                                                       case 0x05:
+                                                       case 0x07:
+                                                               dbg("<RX> operation state -activated");
+                                                               ptr_data++;
+                                                               break;
+                                                       default:
+                                                               dbg("<RX> DEBUG! LIFE CYCLE STATUS =[0x%x]",*ptr_data);
+                                                               ptr_data++;
+                                                               break;
+                                               }
+                                       }
+
+                                       /* related to security attributes : currently not handled*/
+                                       if (*ptr_data == 0x86 || *ptr_data == 0x8B || *ptr_data == 0x8C || *ptr_data == 0xAB) {
+                                               /* increment to next byte */
+                                               ptr_data++;
+                                               /* if tag length is 3 */
+                                               if (*ptr_data == 0x03) {
+                                                       /* increment to next byte */
+                                                       ptr_data++;
+                                                       /* EFARR file id */
+                                                       memcpy(&arr_file_id, ptr_data, 2);
+                                                       /* swap byes */
+                                                       SWAPBYTES16(arr_file_id);
+                                                       ptr_data = ptr_data + 2;
+                                                       arr_file_id_rec_num = *ptr_data++;
+                                               } else {
+                                                       /* if tag length is not 3 */
+                                                       /* ignoring bytes       */
+                                                       //      ptr_data = ptr_data + 4;
+                                                       dbg("Useless security attributes, so jump to next tag");
+                                                       ptr_data = ptr_data + (*ptr_data + 1);
+                                               }
+                                       } else {
+                                               dbg("INVALID FCP received[0x%x] - DEbug!", *ptr_data);
+                                               free(recordData);                                               
+                                               return;
+                                       }
+
+                                       dbg("Current ptr_data value is [%x]", *ptr_data);
+
+                                       /* file size excluding structural info*/
+                                       if (*ptr_data == 0x80) {
+                                               /* for EF file size is body of file and for Linear or cyclic it is
+                                                * number of recXsizeof(one record)
+                                                */
+                                               /* increment to next byte */
+                                               ptr_data++;
+                                               /* length is 1 byte - value is 2 bytes or more */
+                                               ptr_data++;
+                                               memcpy(&file_size, ptr_data, 2);
+                                               /* swap bytes */
+                                               SWAPBYTES16(file_size);
+                                               ptr_data = ptr_data + 2;
+                                       } else {
+                                               dbg("INVALID FCP received - DEbug!");
+                                               free(recordData);
+                                               return;
+                                       }
+
+                                       /* total file size including structural info*/
+                                       if (*ptr_data == 0x81) {
+                                               int len;
+                                               /* increment to next byte */
+                                               ptr_data++;
+                                               /* length */
+                                               len = *ptr_data;
+                                               /* ignored bytes */
+                                               ptr_data = ptr_data + 3;
+                                       } else {
+                                               dbg("INVALID FCP received - DEbug!");
+                                               /* 0x81 is optional tag?? check out! so do not return -1 from here! */
+                                               /* return -1; */
+                                       }
+                                       /*short file identifier ignored*/
+                                       if (*ptr_data == 0x88) {
+                                               dbg("0x88: Do Nothing");
+                                               /*DO NOTHING*/
+                                       }
+                               } else {
+                                       dbg("INVALID FCP received - DEbug!");
+                                       free(recordData);
+                                       return;
+                               }
+                       } else if (tcore_sim_get_type(co_sim) == SIM_TYPE_GSM) {
+                               unsigned char gsm_specific_file_data_len = 0;
+                               /*      ignore RFU byte1 and byte2 */
+                               ptr_data++;
+                               ptr_data++;
+                               /*      file size */
+                               //file_size = p_info->response_len;
+                               memcpy(&file_size, ptr_data, 2);
+                               /* swap bytes */
+                               SWAPBYTES16(file_size);
+                               /*      parsed file size */
+                               ptr_data = ptr_data + 2;
+                               /*  file id  */
+                               memcpy(&file_id, ptr_data, 2);
+                               SWAPBYTES16(file_id);
+                               dbg(" FILE id --> [%x]", file_id);
+                               ptr_data = ptr_data + 2;
+                               /* save file type - transparent, linear fixed or cyclic */
+                               file_type_tag = (*(ptr_data + 7));
+
+                               switch (*ptr_data) {
+                                       case 0x0:
+                                               /* RFU file type */
+                                               dbg(" RFU file type- not handled - Debug!");
+                                               break;
+                                       case 0x1:
+                                               /* MF file type */
+                                               dbg(" MF file type - not handled - Debug!");
+                                               break;
+                                       case 0x2:
+                                               /* DF file type */
+                                               dbg(" DF file type - not handled - Debug!");
+                                               break;
+                                       case 0x4:
+                                               /* EF file type */
+                                               dbg(" EF file type [%d] ", file_type_tag);
+                                               /*      increment to next byte */
+                                               ptr_data++;
+
+                                               if (file_type_tag == 0x00 || file_type_tag == 0x01) {
+                                                       /* increament to next byte as this byte is RFU */
+                                                       ptr_data++;
+                                                       file_type =
+                                                                       (file_type_tag == 0x00) ? SIM_FTYPE_TRANSPARENT : SIM_FTYPE_LINEAR_FIXED;
+                                               } else {
+                                                       /* increment to next byte */
+                                                       ptr_data++;
+                                                       /*      For a cyclic EF all bits except bit 7 are RFU; b7=1 indicates that */
+                                                       /* the INCREASE command is allowed on the selected cyclic file. */
+                                                       file_type = SIM_FTYPE_CYCLIC;
+                                               }
+                                               /* bytes 9 to 11 give SIM file access conditions */
+                                               ptr_data++;
+                                               /* byte 10 has one nibble that is RF U and another for INCREASE which is not used currently */
+                                               ptr_data++;
+                                               /* byte 11 is invalidate and rehabilate nibbles */
+                                               ptr_data++;
+                                               /* byte 12 - file status */
+                                               ptr_data++;
+                                               /* byte 13 - GSM specific data */
+                                               gsm_specific_file_data_len = *ptr_data;
+                                               ptr_data++;
+                                               /*      byte 14 - structure of EF - transparent or linear or cyclic , already saved above */
+                                               ptr_data++;
+                                               /* byte 15 - length of record for linear and cyclic , for transparent it is set to 0x00. */
+                                               record_len = *ptr_data;
+                                               dbg("record length[%d], file size[%d]", record_len, file_size);
+
+                                               if (record_len != 0)
+                                                       num_of_records = (file_size / record_len);
+
+                                               dbg("Number of records [%d]", num_of_records);
+                                               break;
+
+                                       default:
+                                               dbg(" not handled file type");
+                                               break;
+                               }
+                       } 
+                       else 
+                       {
+                               dbg(" Card Type - UNKNOWN  [%d]", tcore_sim_get_type(co_sim));
+                       }
+
+                       dbg("req ef[0x%x] resp ef[0x%x] size[%ld] Type[0x%x] NumOfRecords[%ld] RecordLen[%ld]",
+                                       file_meta->file_id, file_id, file_size, file_type, num_of_records, record_len);
+
+                       file_meta->file_type = file_type;
+                       file_meta->data_size = file_size;
+                       file_meta->rec_length = record_len;
+                       file_meta->rec_count = num_of_records;
+                       file_meta->current_index = 0; //reset for new record type EF
+                       rt = SIM_ACCESS_SUCCESS;
+                       free(recordData);
+               }
+               else 
+               {
+                       /*2. SIM access fail case*/
+                       dbg("error to get ef[0x%x]", file_meta->file_id);
+                       dbg("error to get ef[0x%x] (file_meta->file_id) ", file_meta->file_id);
+                       rt = _decode_status_word(sw1, sw2);
+               }
+               
+               //queue = tcore_object_ref_user_data(co_sim);
+               //if (queue)
+               //{
+                       ur = tcore_user_request_ref(ur);
+                       //util_add_waiting_job(queue, ID_RESERVED_AT, ur);
+               //}
+               dbg("Calling _next_from_get_file_info");
+               _next_from_get_file_info(co_sim, ur, file_meta->file_id, rt);
+               tcore_at_tok_free(tokens);
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               dbg("error to get ef[0x%x]", file_meta->file_id);
+               dbg("error to get ef[0x%x] (file_meta->file_id) ", file_meta->file_id);
+               rt = SIM_ACCESS_FAILED;
+
+               ur = tcore_user_request_ref(ur);
+               _next_from_get_file_info(co_sim, ur, file_meta->file_id, rt);
+       }
+       dbg(" Function exit");
+}
+
+static void _response_get_file_data(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       UserRequest *ur = NULL;
+       CoreObject *co_sim = NULL;
+       struct s_sim_property *file_meta = NULL;
+       GSList *tokens=NULL;
+       enum tel_sim_access_result rt;
+       struct tel_sim_imsi imsi;
+       struct tel_sim_ecc ecc;
+       struct tel_sim_msisdn msisdn;
+       struct tel_sim_opl opl;
+       struct tel_sim_pnn pnn;
+       GQueue *queue = NULL;
+       gboolean dr = FALSE;
+       const char *line = NULL;
+       unsigned char *res = NULL;
+       char *tmp = NULL;
+       int res_len;
+       int sw1 = 0;
+       int sw2 = 0;
+
+       dbg(" Function entry ");
+       
+       co_sim = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+       file_meta = (struct s_sim_property*)tcore_user_request_ref_metainfo(ur, NULL);
+       
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) != 3) {
+                               msg("invalid message");
+                               tcore_at_tok_free(tokens);
+                               return;
+                       }
+               }
+               sw1 = atoi(g_slist_nth_data(tokens, 0));
+               sw2 = atoi(g_slist_nth_data(tokens, 1));
+               res  = g_slist_nth_data(tokens, 2);
+               
+               res_len = strlen((const char*)res);
+               tmp = calloc(1, res_len-2);
+               memcpy(tmp, res+1, res_len-2);
+               dbg("tmp: %s", tmp);
+
+               res = util_hexStringToBytes(tmp);
+               res_len = strlen((const char*)res);
+               dbg("res: %s res_len: %d", res, res_len);
+
+               if((sw1 == 0x90 && sw2 == 0x00) || sw1 == 0x91){
+                       rt = SIM_ACCESS_SUCCESS;
+                       file_meta->files.result = rt;
+                       dbg("file_meta->file_id : %x", file_meta->file_id);                             
+               
+                       switch (file_meta->file_id) {
+                               case SIM_EF_IMSI:
+                               {
+                                       dbg("res: %s", res);
+                                       dr = tcore_sim_decode_imsi(&imsi, res, res_len);
+                                       if (dr == FALSE) {
+                                               dbg("imsi decoding failed");
+                                       } else {
+                                               _sim_check_identity(co_sim,&imsi);
+                                               tcore_sim_set_imsi(co_sim,&imsi);
+                                       }
+                                       break;
+                               }
+                               case SIM_EF_ICCID:
+                                       dr = tcore_sim_decode_iccid(&file_meta->files.data.iccid, res, res_len);
+                                       break;
+
+                               case SIM_EF_ELP:/*  2G EF -  2 bytes decoding*/
+                               case SIM_EF_USIM_LI: /* 3G EF - 2 bytes decoding*/
+                               case SIM_EF_USIM_PL:/*  3G EF - same as EFELP, so 2  byte decoding*/
+                               case SIM_EF_LP:/*  1 byte encoding*/
+                                       if (tcore_sim_get_type(co_sim) == SIM_TYPE_GSM && file_meta->file_id == SIM_EF_LP) {
+                                                /*2G LP(0x6F05) has 1 byte for each language*/
+                                               dr = tcore_sim_decode_lp(&file_meta->files.data.language, res, res_len);
+                                       } else {
+                                                /*3G LI(0x6F05)/PL(0x2F05), 2G ELP(0x2F05) has 2 bytes for each language*/
+                                               dr = tcore_sim_decode_li(file_meta->file_id, &file_meta->files.data.language, res, res_len);
+                                       }
+                                       break;
+                               case SIM_EF_SPN:
+                                       dr = tcore_sim_decode_spn(&file_meta->files.data.spn, res, res_len);
+                                       break;
+
+                               case SIM_EF_SPDI:
+                                       dr = tcore_sim_decode_spdi(&file_meta->files.data.spdi, res, res_len);
+                                       break;
+
+                               case SIM_EF_SST:
+/*                                     if(tcore_sim_get_type(o) == SIM_TYPE_GSM)
+                                               dr = tcore_sim_decode_sst(&file_meta->files.data , res, res_len);
+                                       else if(tcore_sim_get_type(o) == SIM_TYPE_USIM)
+                                               dr = tcore_sim_decode_ust(&po->st_u.ust, res, res_len);
+                                       else {
+                                               dbg("err not handled tcore_sim_get_type(o)[%d] in here",tcore_sim_get_type(o));
+                                       }*/
+                                       break;
+
+                               case SIM_EF_MBDN:
+/*                                     dr = tcore_sim_decode_xdn(&file_meta->files.data.mailbox, res, res_len);*/
+                                       break;
+
+                               case SIM_EF_ECC:
+                                       if(tcore_sim_get_type(co_sim) == SIM_TYPE_GSM) {
+                                               dr = tcore_sim_decode_ecc(&file_meta->files.data.ecc, res, res_len);
+                                       } else if(tcore_sim_get_type(co_sim) == SIM_TYPE_USIM){
+                                               dbg("decode w/ index [%d]",file_meta->current_index);
+                                               memset(&ecc, 0x00, sizeof(struct tel_sim_ecc));
+                                               dr = tcore_sim_decode_uecc(&ecc, res, res_len);
+                                               if (dr == TRUE) {
+                                                       memcpy(&file_meta->files.data.ecc.ecc[file_meta->files.data.ecc.ecc_count], &ecc, sizeof(struct tel_sim_ecc));
+                                                       file_meta->files.data.ecc.ecc_count++;
+                                               }
+                                       } else {
+                                               dbg("err not handled tcore_sim_get_type(o)[%d] in here",tcore_sim_get_type(co_sim));
+                                       }
+                                       break;
+
+                               case SIM_EF_USIM_MBI:
+/*                                     dr = tcore_sim_decode_mbi(&po->mb_u.mailbox.mbi, res, res_len);*/
+                                       break;
+
+                               case SIM_EF_MSISDN :
+                                       dbg("decode w/ index [%d]",file_meta->current_index);
+                                       memset(&msisdn, 0x00, sizeof(struct tel_sim_msisdn));
+                                       dr = tcore_sim_decode_msisdn(&msisdn, res, res_len);
+                                       if (dr == TRUE) {
+                                               memcpy(&file_meta->files.data.msisdn_list.msisdn[file_meta->files.data.msisdn_list.count], &msisdn, sizeof(struct tel_sim_msisdn));
+                                               file_meta->files.data.msisdn_list.count++;
+                                       }
+                                       break;
+
+                               case SIM_EF_OPL:
+                                       dbg("decode w/ index [%d]",file_meta->current_index);
+                                       memset(&opl, 0x00, sizeof(struct tel_sim_opl));
+                                       dr = tcore_sim_decode_opl(&opl, res, res_len);
+                                       if (dr == TRUE) {
+                                               memcpy(&file_meta->files.data.opl.opl[file_meta->files.data.opl.opl_count], &opl, sizeof(struct tel_sim_opl));
+                                               file_meta->files.data.opl.opl_count++;
+                                       }
+                                       break;
+
+                               case SIM_EF_PNN:
+                                       dbg("decode w/ index [%d]",file_meta->current_index);
+                                       memset(&pnn, 0x00, sizeof(struct tel_sim_pnn));
+                                       dr = tcore_sim_decode_pnn(&pnn, res, res_len);
+                                       if (dr == TRUE) {
+                                               memcpy(&file_meta->files.data.pnn.pnn[file_meta->files.data.pnn.pnn_count], &opl, sizeof(struct tel_sim_pnn));
+                                               file_meta->files.data.pnn.pnn_count++;
+                                       }
+                                       break;
+
+                               case SIM_EF_OPLMN_ACT:
+                                       dr = tcore_sim_decode_oplmnwact(&file_meta->files.data.opwa, res, res_len);
+                                       break;
+
+                               case SIM_EF_CPHS_CALL_FORWARD_FLAGS:
+                                       dr = tcore_sim_decode_cff(&file_meta->files.data.cf, res, res_len);
+                                       break;
+
+                               case SIM_EF_CPHS_CUSTOMER_SERVICE_PROFILE:
+/*                                     dr = tcore_sim_decode_csp(&po->p_cphs->csp, res, res_len);*/
+                                       break;
+
+                               case SIM_EF_CPHS_VOICE_MSG_WAITING:
+                                       dr = tcore_sim_decode_vmwf(&file_meta->files.data.mw.mw_data_u.cphs_mw, res, res_len);
+                                       break;
+
+                               case SIM_EF_CPHS_MAILBOX_NUMBERS:
+/*                                     dbg("[CPHS]decoding SIM_EF_CPHS_MAILBOX_NUMBERS");
+                                       if (file_meta->current_index == 1)
+                                               dr = tcore_sim_decode_xdn(&po->mb_u.mbn.voice_line1, res, res_len);
+                                       else if (file_meta->current_index == 2)
+                                               dr = tcore_sim_decode_xdn(&po->mb_u.mbn.voice_line2, res, res_len);
+                                       else if (file_meta->current_index == 3)
+                                               dr = tcore_sim_decode_xdn(&po->mb_u.mbn.video, res, res_len);
+                                       else if (file_meta->current_index == 4)
+                                               dr = tcore_sim_decode_xdn(&po->mb_u.mbn.fax, res, res_len);
+                                       else {
+                                               dbg("[CPHS]wrong EF record index[%d] in here", file_meta->current_index);
+                                       }*/
+                                       break;
+
+                               case SIM_EF_USIM_MWIS:
+                                       dr = tcore_sim_decode_mwis(&file_meta->files.data.mw.mw_data_u.mw, res, res_len);
+                                       break;
+
+                               case SIM_EF_USIM_CFIS:
+                                       dr = tcore_sim_decode_cfis(&file_meta->files.data.cf, res, res_len);
+                                       break;
+
+                               case SIM_EF_CPHS_SERVICE_STRING_TABLE:
+                                       dbg(" not handled -SIM_EF_CPHS_SERVICE_STRING_TABLE ");
+                                       break;
+
+                               case SIM_EF_CPHS_OPERATOR_NAME_STRING:
+                                       dr = tcore_sim_decode_ons((unsigned char*)&file_meta->files.data.cphs_net.full_name, res, res_len);
+                                       dbg(" file_meta->files.result[%d],file_meta->files.data.cphs_net.full_name[%s]", file_meta->files.result, file_meta->files.data.cphs_net.full_name);
+                                       break;
+
+                               case SIM_EF_CPHS_DYNAMICFLAGS:
+/*                                     dr = tcore_sim_decode_dynamic_flag(&po->p_cphs->dflagsinfo, res, res_len);*/
+                                       break;
+
+                               case SIM_EF_CPHS_DYNAMIC2FLAG:
+/*                                     dr = tcore_sim_decode_dynamic2_flag(&po->p_cphs->d2flagsinfo, res,      res_len);*/
+                                       break;
+
+                               case SIM_EF_CPHS_CPHS_INFO:
+                                       dr = tcore_sim_decode_cphs_info(&file_meta->files.data.cphs, res, res_len);
+                                       break;
+
+                               case SIM_EF_CPHS_OPERATOR_NAME_SHORT_FORM_STRING:
+                                       dr = tcore_sim_decode_short_ons((unsigned char*)&file_meta->files.data.cphs_net.short_name, res, res_len);
+                                       break;
+
+                               case SIM_EF_CPHS_INFORMATION_NUMBERS:
+/*                                     dr = tcore_sim_decode_information_number(&po->p_cphs->infn, res, res_len);*/
+                                       break;
+
+                               default:
+                                       dbg("File Decoding Failed - not handled File[0x%x]", file_meta->file_id);
+                                       dr = 0;
+                                       break;
+                       }
+               }
+               else{
+                       rt =  _decode_status_word(sw1, sw2);
+                       file_meta->files.result = rt;
+               }
+               free(tmp);
+               tcore_at_tok_free(tokens);
+       }
+       else{
+               dbg("RESPONSE NOK");
+               dbg("error to get ef[0x%x]", file_meta->file_id);
+               rt = SIM_ACCESS_FAILED;
+       }
+
+               ur = tcore_user_request_ref(ur);
+       dbg("Calling _next_from_get_file_data");
+       _next_from_get_file_data(tcore_pending_ref_core_object(p), ur, rt, dr);
+       dbg(" Function exit");
+}
+
+static void _response_get_retry_count(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       UserRequest *ur = NULL;
+       CoreObject *co_sim = NULL;
+       struct s_sim_property *sp = NULL;
+       GSList *tokens=NULL;
+       const char *line;
+       struct tresp_sim_verify_pins v_pin = {0,};
+       struct tresp_sim_verify_puks v_puk = {0,};
+       struct tresp_sim_change_pins change_pin = {0,};
+       struct tresp_sim_disable_facility dis_facility = {0,};
+       struct tresp_sim_enable_facility en_facility = {0,};
+       int lock_type;
+       int attempts_left = 0;
+       int time_penalty = 0;
+
+       dbg(" Function entry ");
+
+       co_sim = tcore_pending_ref_core_object(p);
+       sp = tcore_sim_ref_userdata(co_sim);
+       ur = tcore_pending_ref_user_request(p);
+
+       if(resp->success > 0)
+       {
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) != 3) {
+                               msg("invalid message");
+                               tcore_at_tok_free(tokens);
+                               return;
+                       }
+               }
+               lock_type = atoi(g_slist_nth_data(tokens, 0));
+               attempts_left = atoi(g_slist_nth_data(tokens, 1));
+               time_penalty = atoi(g_slist_nth_data(tokens, 2));
+
+               switch (sp->current_sec_op) {
+                       case SEC_PIN1_VERIFY:
+                       case SEC_PIN2_VERIFY:
+                       case SEC_SIM_VERIFY:
+                       case SEC_ADM_VERIFY:
+                               v_pin.result = SIM_INCORRECT_PASSWORD;
+                               v_pin.pin_type = _sim_get_current_pin_facility(sp->current_sec_op);
+                               v_pin.retry_count = attempts_left;
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),
+                                               sizeof(struct tresp_sim_verify_pins), &v_pin);
+                               break;
+
+                       case SEC_PUK1_VERIFY:
+                       case SEC_PUK2_VERIFY:
+                               v_puk.result = SIM_INCORRECT_PASSWORD;
+                               v_puk.pin_type = _sim_get_current_pin_facility(sp->current_sec_op);
+                               v_puk.retry_count = attempts_left;
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),
+                                               sizeof(struct tresp_sim_verify_puks), &v_puk);
+                               break;
+
+                       case SEC_PIN1_CHANGE:
+                       case SEC_PIN2_CHANGE:
+                               change_pin.result = SIM_INCORRECT_PASSWORD;
+                               change_pin.pin_type = _sim_get_current_pin_facility(sp->current_sec_op);
+                               change_pin.retry_count = attempts_left;
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),
+                                               sizeof(struct tresp_sim_change_pins), &change_pin);
+                               break;
+
+                       case SEC_PIN1_DISABLE:
+                       case SEC_PIN2_DISABLE:
+                       case SEC_FDN_DISABLE:
+                       case SEC_SIM_DISABLE:
+                       case SEC_NET_DISABLE:
+                       case SEC_NS_DISABLE:
+                       case SEC_SP_DISABLE:
+                       case SEC_CP_DISABLE:
+                               dis_facility.result = SIM_INCORRECT_PASSWORD;
+                               dis_facility.type = _sim_get_current_pin_facility(sp->current_sec_op);
+                               dis_facility.retry_count = attempts_left;
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),
+                                               sizeof(struct tresp_sim_disable_facility), &dis_facility);
+                               break;
+
+                       case SEC_PIN1_ENABLE:
+                       case SEC_PIN2_ENABLE:
+                       case SEC_FDN_ENABLE:
+                       case SEC_SIM_ENABLE:
+                       case SEC_NET_ENABLE:
+                       case SEC_NS_ENABLE:
+                       case SEC_SP_ENABLE:
+                       case SEC_CP_ENABLE:
+                               en_facility.result = SIM_INCORRECT_PASSWORD;
+                               en_facility.type = _sim_get_current_pin_facility(sp->current_sec_op);
+                               en_facility.retry_count = attempts_left;
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),
+                                               sizeof(struct tresp_sim_enable_facility), &en_facility);
+                               break;
+
+                       default:
+                               dbg("not handled sec op[%d]", sp->current_sec_op);
+                               break;
+               }
+               tcore_at_tok_free(tokens);
+       }
+       dbg(" Function exit");
+}
+
+static gboolean _get_sim_type(CoreObject *o)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       UserRequest *ur = NULL;
+       char *cmd_str = NULL;
+
+       dbg(" Function entry ");        
+       
+       hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+       
+       cmd_str = g_strdup_printf("AT+XUICC?%s", "\r");
+
+       req = tcore_at_request_new(cmd_str, "+XUICC:", TCORE_AT_SINGLELINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, _response_get_sim_type, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       free(cmd_str);
+       dbg(" Function exit");
+       return TRUE;
+}
+
+static TReturn _get_file_info(CoreObject *o, UserRequest *ur, const enum tel_sim_file_id ef)
+{
+       TcoreHal* hal;
+       //TcoreATRequest *req = NULL;
+       TcorePending *pending = NULL;
+       struct s_sim_property file_meta={0,};
+       char *cmd_str = NULL;
+       int trt = 0;
+
+       dbg(" Function entry ");        
+       
+       //file_meta = (struct s_sim_property*)tcore_user_request_ref_metainfo(ur, NULL);
+       //dbg("file_meta: %x", file_meta);
+       file_meta.file_id = ef;
+       dbg("file_meta.file_id: %d", file_meta.file_id);
+       hal = tcore_object_get_hal(o);
+       dbg("hal: %x", hal);
+       pending = tcore_pending_new(o, 0);
+       
+       trt = tcore_user_request_set_metainfo(ur, sizeof(struct s_sim_property), &file_meta);
+       dbg("trt[%d]",trt);
+       cmd_str = g_strdup_printf("AT+CRSM=192, %d%s", ef, "\r");                       /*command - 192 : GET RESPONSE*/
+       dbg("cmd_str: %x", cmd_str);
+
+       //dbg("cmd : %s, prefix(if any) :%s, cmd_len : 0x%x", req->cmd, req->prefix, strlen(req->cmd));
+       pending = tcore_at_pending_new(o, cmd_str, "+CRSM:", TCORE_AT_SINGLELINE, _response_get_file_info, NULL);
+
+       tcore_pending_link_user_request(pending, ur);
+       tcore_hal_send_request(hal, pending);
+
+       free(cmd_str);
+       dbg(" Function exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static gboolean _get_file_data(CoreObject *o, UserRequest *ur, const enum tel_sim_file_id ef, const int offset, const int length)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+       //struct s_sim_property *sp = NULL;
+       int p1 = 0;
+       int p2 = 0;
+       int p3 = 0;
+       
+       dbg(" Function entry ");        
+       hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+       //sp = tcore_sim_ref_userdata(o);
+       
+       //dbg("sp: %x", sp);
+       //sp->file_id = ef;
+       dbg("file_id: %x", ef);
+
+       p1 = (unsigned char)(offset & 0xFF00) >> 8;
+       p2 = (unsigned char)offset & 0x00FF; //offset low
+       p3 = (unsigned char)length;
+       
+       cmd_str = g_strdup_printf("AT+CRSM=176, %d, %d, %d, %d%s", ef,p1,p2,p3,"\r");                   /*command - 176 : READ BINARY*/
+
+       req = tcore_at_request_new(cmd_str, "+CRSM:", TCORE_AT_SINGLELINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, _response_get_file_data, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       free(cmd_str);
+       dbg(" Function exit");
+       return TRUE;
+}
+
+static gboolean _get_file_record(CoreObject *o, UserRequest *ur, const enum tel_sim_file_id ef, const int index, const int length)
+{
+
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+       int p1 = 0;
+       int p2 = 0;
+       int p3 = 0;
+
+       dbg(" Function entry ");        
+       
+       hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       p1 = (unsigned char)index;
+       p2 = (unsigned char)0x04;               /* 0x4 for absolute mode  */
+       p3 = (unsigned char)length;
+       
+       cmd_str = g_strdup_printf("AT+CRSM=178, %d, %d, %d, %d%s", ef,p1,p2,p3,"\r");                   /*command - 178 : READ RECORD*/
+
+       req = tcore_at_request_new(cmd_str, "+CRSM:", TCORE_AT_SINGLELINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, _response_get_file_data, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       free(cmd_str);
+       dbg(" Function exit");
+       return TRUE;
+}
+
+static TReturn _get_retry_count(CoreObject *o, UserRequest *ur)                /*ToDo*/
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+       const struct treq_sim_get_lock_info *req_data;
+       struct s_sim_property *sp = NULL;
+       char *fac = NULL;
+
+       dbg(" Function entry ");        
+       
+       hal = tcore_object_get_hal(o);
+       sp = tcore_sim_ref_userdata(o);
+       pending = tcore_pending_new(o, 0);
+       req_data = tcore_user_request_ref_data(ur, NULL);
+
+       switch (sp->current_sec_op) {
+               case SEC_PIN1_VERIFY:
+               case SEC_PUK1_VERIFY:
+               case SEC_PIN1_CHANGE:
+               case SEC_PIN1_ENABLE:
+               case SEC_PIN1_DISABLE:
+                       fac = "SC";
+                       break;
+               case SEC_PIN2_VERIFY:
+               case SEC_PUK2_VERIFY:
+               case SEC_PIN2_CHANGE:
+               case SEC_PIN2_ENABLE:
+               case SEC_PIN2_DISABLE:
+               case SEC_FDN_ENABLE:
+               case SEC_FDN_DISABLE:
+                       fac = "FD";
+                       break;
+               case SEC_SIM_VERIFY:
+               case SEC_SIM_ENABLE:
+               case SEC_SIM_DISABLE:
+                       fac = "PS";
+                       break;
+               case SEC_ADM_VERIFY:
+                       fac = "PF";
+                       break;
+               case SEC_NET_ENABLE:
+               case SEC_NET_DISABLE:
+                       fac = "PN";
+                       break;
+               case SEC_NS_ENABLE:
+               case SEC_NS_DISABLE:
+                       fac = "PU";
+                       break;
+               case SEC_SP_ENABLE:
+               case SEC_SP_DISABLE:
+                       fac = "PP";
+                       break;
+               case SEC_CP_ENABLE:
+               case SEC_CP_DISABLE:
+                       fac = "PC";
+                       break;
+               default:
+                       break;
+       }
+
+       cmd_str = g_strdup_printf("AT+XPINCNT=\"%s\"%s",fac,"\r");
+
+       req = tcore_at_request_new(cmd_str, "+XPINCNT:", TCORE_AT_SINGLELINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, _response_get_retry_count, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       free(cmd_str);
+       dbg(" Function exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+
+static gboolean on_event_pin_status(CoreObject *o, const void *event_info, void *user_data)
+{
+       UserRequest *ur = NULL;
+       struct s_sim_property *sp = NULL;
+       enum tel_sim_status sim_status = SIM_STATUS_INITIALIZING;
+       GSList *tokens=NULL;
+       GSList *lines = NULL;
+       const char *line = NULL;
+       int sim_state = 0;
+
+       dbg(" Function entry ");        
+       
+       sp = tcore_sim_ref_userdata(o);
+
+       lines = (GSList*)event_info;
+       if (1 != g_slist_length(lines)) {
+               dbg("unsolicited msg but multiple line");
+               goto OUT;
+       }
+       line  = (char*)(lines->data);
+
+       tokens = tcore_at_tok_new(line);
+       if (g_slist_length(tokens) != 1) {
+               msg("invalid message");
+               tcore_at_tok_free(tokens);
+               return TRUE;
+       }
+       sim_state = atoi(g_slist_nth_data(tokens, 0));
+
+       switch (sim_state) {
+               case 0:                                                                                                         //sim state = SIM not present
+                       sim_status = SIM_STATUS_CARD_NOT_PRESENT;
+                       dbg("NO SIM");
+                       break;
+               case 1:                                                                                                         //sim state = PIN verification needed
+                       sim_status = SIM_STATUS_PIN_REQUIRED;
+                       dbg(" PIN required");
+                       break;
+               case 2:                                                                                                         //sim state = PIN verification not needed \96 Ready
+               case 3:                                                                                                         //sim state = PIN verified \96 Ready
+                       sim_status = SIM_STATUS_INITIALIZING;
+                       dbg(" Inside PIN disabled at BOOT UP");
+                       break;
+               case 4:                                                                                                         //sim state = PUK verification needed
+                       sim_status = SIM_STATUS_PUK_REQUIRED;
+                       dbg(" PUK required");
+                       break;
+               case 5:                                                                                                         //sim state = SIM permanently blocked
+                       sim_status = SIM_STATUS_CARD_BLOCKED;
+                       dbg(" Card permanently blocked");
+                       break;
+               case 6:                                                                                                         //sim state = SIM error
+                       sim_status = SIM_STATUS_CARD_ERROR;
+                       dbg("SIM card error ");
+                       break;          
+               case 7:                                                                                                         //sim state = ready for attach (+COPS)
+                       sim_status = SIM_STATUS_INIT_COMPLETED;
+                       dbg("Modem init completed");
+                       break;
+               case 8:                                                                                                         //sim state = SIM Technical Problem
+                       sim_status = SIM_STATUS_CARD_ERROR;
+                       dbg("SIM unavailable");
+                       break;
+               case 9:                                                                                                         //sim state = SIM removed
+                       sim_status = SIM_STATUS_CARD_REMOVED;
+                       dbg("SIM removed");
+                       break;
+               case 99:                                                                                                                //sim state = SIM State Unknown
+                       sim_status = SIM_STATUS_UNKNOWN;
+                       dbg("SIM State Unknown");
+                       break;
+               case 12:
+                       dbg("SIM Status : %d", sim_status);
+                       /*if (sim_status != SIM_STATUS_INIT_COMPLETED)
+                               sim_status = SIM_STATUS_INIT_COMPLETED;
+                       else*/
+                       goto OUT;
+               default:
+                       dbg(" not handled SEC lock type ");
+                       break;
+       }
+
+       switch (sim_status) {
+               case SIM_STATUS_INIT_COMPLETED:
+                       ur = tcore_user_request_new(NULL, NULL); //this is for using ur metainfo set/ref functionality.
+                       _get_file_info(o, ur, SIM_EF_IMSI);
+                       break;
+
+               case SIM_STATUS_INITIALIZING:
+               case SIM_STATUS_PIN_REQUIRED:
+               case SIM_STATUS_PUK_REQUIRED:
+               case SIM_STATUS_CARD_BLOCKED:
+               case SIM_STATUS_NCK_REQUIRED:
+               case SIM_STATUS_NSCK_REQUIRED:
+               case SIM_STATUS_SPCK_REQUIRED:
+               case SIM_STATUS_CCK_REQUIRED:
+               case SIM_STATUS_LOCK_REQUIRED:
+                       if(sp->first_recv_status == SIM_STATUS_UNKNOWN) {
+                               dbg("first received sim status[%d]",sim_status);
+                               sp->first_recv_status = sim_status;
+                               _get_sim_type(o);
+                       } else {
+                               dbg("second or later received lock status[%d]",sim_status);
+                               if (tcore_sim_get_status(o) != SIM_STATUS_INIT_COMPLETED) {
+                                       dbg("sim is not init complete in telephony side yet");
+                                       _sim_status_update(o,sim_status);
+                               }
+                       }
+                       break;
+
+               case SIM_STATUS_CARD_REMOVED:
+               case SIM_STATUS_CARD_NOT_PRESENT:
+               case SIM_STATUS_CARD_ERROR:
+                       if (sim_status == SIM_STATUS_CARD_NOT_PRESENT && tcore_sim_get_status(o) != SIM_STATUS_UNKNOWN) {
+                               dbg("[SIM]SIM CARD REMOVED!!");
+                               sim_status = SIM_STATUS_CARD_REMOVED;
+                       }
+                       _sim_status_update(o,sim_status);
+                       break;
+
+               default:
+                       dbg("not handled status[%d]", sim_status);
+                       
+                       break;
+               }       
+OUT:
+       dbg(" Function exit");
+       if(NULL!=tokens)
+               tcore_at_tok_free(tokens);
+       return TRUE;
+}
+
+static gboolean on_event_facility_lock_status(CoreObject *o, const void *event_info, void *user_data)
+{
+       const TcoreATResponse *resp = event_info;
+       UserRequest *ur = NULL;
+       struct s_sim_property *sp = NULL;
+       enum tel_sim_status sim_status = SIM_STATUS_INITIALIZING;
+       GSList *tokens=NULL;
+       GSList *lines = NULL;
+       const char *line;
+       char *fac;
+       int lock_state = 0;
+       int lock_result = 0;
+
+       sp = tcore_sim_ref_userdata(o);
+
+       dbg(" Function entry ");
+#if 1
+return TRUE;
+#endif
+       lines = (GSList*)event_info;
+       if (1 != g_slist_length(lines)) {
+               dbg("unsolicited msg but multiple line");
+               goto OUT;
+       }
+       
+       line  = (char*)(lines->data);
+       tokens = tcore_at_tok_new(line);
+       
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) != 3) {
+                               dbg("invalid message");
+                               tcore_at_tok_free(tokens);
+                               return FALSE;
+                       }
+               }
+               fac = g_slist_nth_data(tokens, 0);
+               lock_state = atoi(g_slist_nth_data(tokens, 1));
+               lock_result = atoi(g_slist_nth_data(tokens, 2));
+
+               if(strcmp(fac, "PS")){
+                       dbg(" SIM LOCK required");
+                       sim_status = SIM_STATUS_LOCK_REQUIRED;
+               }else if(strcmp(fac, "PN")){
+                       if(lock_result == 1){                                           //lock_result = "verfication needed"
+                               dbg(" ADMIN-NCK required");
+                               sim_status = SIM_STATUS_NCK_REQUIRED;
+                       }
+               }else if(strcmp(fac, "PU")){
+                       if(lock_result == 1){                                           //lock_result = "verfication needed"
+                               dbg(" ADMIN-NSCK required");
+                               sim_status = SIM_STATUS_NSCK_REQUIRED;
+                       }
+               }else if(strcmp(fac, "PP")){
+                       if(lock_result == 1){                                           //lock_result = "verfication needed"
+                               dbg(" ADMIN-SPCK required");
+                               sim_status = SIM_STATUS_SPCK_REQUIRED;
+                       }
+               }else if(strcmp(fac, "PC")){
+                       if(lock_result == 1){                                           //lock_result = "verfication needed"
+                               dbg(" ADMIN-CCK required");
+                               sim_status = SIM_STATUS_CCK_REQUIRED;
+                       }
+               }else{
+                       sim_status = SIM_STATUS_CARD_ERROR;
+               }
+
+               switch (sim_status) {
+                       case SIM_STATUS_INIT_COMPLETED:
+                               ur = tcore_user_request_new(NULL, NULL); //this is for using ur metainfo set/ref functionality.
+                               _get_file_info(o, ur, SIM_EF_IMSI);
+                               break;
+
+                       case SIM_STATUS_INITIALIZING:
+                       case SIM_STATUS_PIN_REQUIRED:
+                       case SIM_STATUS_PUK_REQUIRED:
+                       case SIM_STATUS_CARD_BLOCKED:
+                       case SIM_STATUS_NCK_REQUIRED:
+                       case SIM_STATUS_NSCK_REQUIRED:
+                       case SIM_STATUS_SPCK_REQUIRED:
+                       case SIM_STATUS_CCK_REQUIRED:
+                       case SIM_STATUS_LOCK_REQUIRED:
+                               if(sp->first_recv_status == SIM_STATUS_UNKNOWN) {
+                                       dbg("first received sim status[%d]",sim_status);
+                                       sp->first_recv_status = sim_status;
+                                       _get_sim_type(o);
+                               } else {
+                                       dbg("second or later received lock status[%d]",sim_status);
+                                       if (tcore_sim_get_status(o) != SIM_STATUS_INIT_COMPLETED) {
+                                               dbg("sim is not init complete in telephony side yet");
+                                               _sim_status_update(o,sim_status);
+                                       }
+                               }
+                               break;
+
+                       case SIM_STATUS_CARD_REMOVED:
+                       case SIM_STATUS_CARD_NOT_PRESENT:
+                       case SIM_STATUS_CARD_ERROR:
+                               if (sim_status == SIM_STATUS_CARD_NOT_PRESENT && tcore_sim_get_status(o) != SIM_STATUS_UNKNOWN) {
+                                       dbg("[SIM]SIM CARD REMOVED!!");
+                                       sim_status = SIM_STATUS_CARD_REMOVED;
+                               }
+                               _sim_status_update(o,sim_status);
+                               break;
+
+                       default:
+                               dbg("not handled status[%d]", sim_status);
+                               
+                               break;
+               }       
+       }
+       dbg(" Function exit");
+
+OUT:
+       if(NULL!=tokens)
+               tcore_at_tok_free(tokens);
+       return TRUE;
+}
+
+static void on_response_verify_pins(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       UserRequest *ur = NULL;
+       CoreObject *co_sim = NULL;
+       struct s_sim_property *sp = NULL;
+       GSList *tokens=NULL;
+       struct tresp_sim_verify_pins res;
+       GQueue *queue;
+       const char *line;
+       int err;
+
+       dbg(" Function entry ");        
+       
+       co_sim = tcore_pending_ref_core_object(p);
+       sp = tcore_sim_ref_userdata(co_sim);
+       ur = tcore_pending_ref_user_request(p);
+       
+       memset(&res, 0, sizeof(struct tresp_sim_verify_pins));
+
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               res.result = SIM_PIN_OPERATION_SUCCESS;
+               res.pin_type = _sim_get_current_pin_facility(sp->current_sec_op);
+               
+               if (res.pin_type == SIM_PTYPE_PIN1 || res.pin_type == SIM_PTYPE_SIM) 
+               {
+                       if (tcore_sim_get_status(co_sim) != SIM_STATUS_INIT_COMPLETED)
+                               _sim_status_update(co_sim, SIM_STATUS_INITIALIZING);
+               }
+               tcore_user_request_send_response(ur, TRESP_SIM_VERIFY_PINS,     sizeof(struct tresp_sim_verify_pins), &res);
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               line = (const char*)resp->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1) {
+                       dbg("err cause not specified or string corrupted");
+                   res.result = TCORE_RETURN_3GPP_ERROR;
+               }
+               else
+               {
+                       err = atoi(g_slist_nth_data(tokens, 0));
+                       dbg("on_response_verify_pins: err = %d", err);
+                       queue = tcore_object_ref_user_data(co_sim);
+
+                       ur = tcore_user_request_ref(ur);
+
+                       _get_retry_count(co_sim, ur);
+               }       
+               tcore_at_tok_free(tokens);
+       }
+       dbg(" Function exit");
+}
+
+static void on_response_verify_puks(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       UserRequest *ur = NULL;
+       CoreObject *co_sim = NULL;
+       struct s_sim_property *sp = NULL;
+       GSList *tokens=NULL;
+       struct tresp_sim_verify_puks res;
+       GQueue *queue;
+       const char *line;
+       int err;
+
+       dbg(" Function entry ");        
+       
+       co_sim = tcore_pending_ref_core_object(p);
+       sp = tcore_sim_ref_userdata(co_sim);
+       ur = tcore_pending_ref_user_request(p);
+
+       memset(&res, 0, sizeof(struct tresp_sim_verify_pins));
+
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               res.result = SIM_PIN_OPERATION_SUCCESS;
+               res.pin_type = _sim_get_current_pin_facility(sp->current_sec_op);
+               tcore_user_request_send_response(ur, TRESP_SIM_VERIFY_PUKS,     sizeof(struct tresp_sim_verify_pins), &res);
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               line = (const char*)resp->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1) {
+                       dbg("err cause not specified or string corrupted");
+                   res.result = TCORE_RETURN_3GPP_ERROR;
+               }
+               else
+               {
+                       err = atoi(g_slist_nth_data(tokens, 0));
+       
+                       queue = tcore_object_ref_user_data(co_sim);
+                       
+                       ur = tcore_user_request_ref(ur);
+                       
+                       _get_retry_count(co_sim, ur);
+               }       
+               tcore_at_tok_free(tokens);
+       }
+       dbg(" Function exit");
+}
+
+static void on_response_change_pins(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       UserRequest *ur = NULL;
+       CoreObject *co_sim = NULL;
+       struct s_sim_property *sp = NULL;
+       GSList *tokens=NULL;
+       struct tresp_sim_change_pins res;
+       GQueue *queue;
+       const char *line;
+       int err;
+
+       dbg(" Function entry ");        
+       
+       co_sim = tcore_pending_ref_core_object(p);
+       sp = tcore_sim_ref_userdata(co_sim);
+       ur = tcore_pending_ref_user_request(p);
+
+       memset(&res, 0, sizeof(struct tresp_sim_change_pins));
+
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               res.result = SIM_PIN_OPERATION_SUCCESS;
+               res.pin_type = _sim_get_current_pin_facility(sp->current_sec_op);
+               tcore_user_request_send_response(ur, TRESP_SIM_CHANGE_PINS,sizeof(struct tresp_sim_change_pins), &res);
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               line = (const char*)resp->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1) {
+                       dbg("err cause not specified or string corrupted");
+                   res.result = TCORE_RETURN_3GPP_ERROR;
+               }
+               else
+               {
+                       err = atoi(g_slist_nth_data(tokens, 0));
+       
+                       queue = tcore_object_ref_user_data(co_sim);
+                       
+                       ur = tcore_user_request_ref(ur);
+                       
+                       _get_retry_count(co_sim, ur);
+               }       
+               tcore_at_tok_free(tokens);
+       }
+       dbg(" Function exit");
+}
+
+static void on_response_get_facility_status(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       UserRequest *ur = NULL;
+       CoreObject *co_sim = NULL;
+       struct s_sim_property *sp = NULL;
+       GSList *tokens=NULL;
+       struct tresp_sim_get_facility_status res;
+       const char *line;
+
+       dbg(" Function entry ");        
+       
+       co_sim = tcore_pending_ref_core_object(p);
+       sp = tcore_sim_ref_userdata(co_sim);
+       ur = tcore_pending_ref_user_request(p);
+
+       memset(&res, 0, sizeof(struct tresp_sim_change_pins));
+
+       res.result = SIM_PIN_OPERATION_SUCCESS;
+       res.type = _sim_get_current_pin_facility(sp->current_sec_op);
+
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) != 1) {
+                               msg("invalid message");
+                               tcore_at_tok_free(tokens);
+                               return;
+                       }
+               }
+               res.b_enable = atoi(g_slist_nth_data(tokens, 0));
+       
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               res.result = SIM_INCOMPATIBLE_PIN_OPERATION;    
+       }
+
+       if (ur) {
+               tcore_user_request_send_response(ur, TRESP_SIM_GET_FACILITY_STATUS,
+                               sizeof(struct tresp_sim_get_facility_status), &res);    
+       }
+       tcore_at_tok_free(tokens);
+       dbg(" Function exit");
+}
+
+static void on_response_enable_facility(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       UserRequest *ur = NULL;
+       CoreObject *co_sim = NULL;
+       struct s_sim_property *sp = NULL;
+       GSList *tokens=NULL;
+       struct tresp_sim_enable_facility res;
+       GQueue *queue;
+       const char *line;
+
+       dbg(" Function entry ");        
+       
+       co_sim = tcore_pending_ref_core_object(p);
+       sp = tcore_sim_ref_userdata(co_sim);
+       ur = tcore_pending_ref_user_request(p);
+
+       memset(&res, 0, sizeof(struct tresp_sim_enable_facility));
+
+       res.result = SIM_PIN_OPERATION_SUCCESS;
+       res.type = _sim_get_current_pin_facility(sp->current_sec_op);
+
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) != 1) {
+                               msg("invalid message");
+                               tcore_at_tok_free(tokens);
+                               return;
+                       }
+               }
+               res.result = atoi(g_slist_nth_data(tokens, 0));
+       
+               if (ur) {
+               tcore_user_request_send_response(ur, TRESP_SIM_ENABLE_FACILITY,
+                               sizeof(struct tresp_sim_enable_facility), &res);
+               }
+               tcore_at_tok_free(tokens);
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               queue = tcore_object_ref_user_data(co_sim);
+
+               ur = tcore_user_request_ref(ur);
+               
+               _get_retry_count(co_sim, ur);
+       }
+       dbg(" Function exit");
+}
+
+static void on_response_disable_facility(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       UserRequest *ur = NULL;
+       CoreObject *co_sim = NULL;
+       struct s_sim_property *sp = NULL;
+       GSList *tokens=NULL;
+       struct tresp_sim_disable_facility res;
+       GQueue *queue;
+       const char *line;
+
+       dbg(" Function entry ");        
+       
+       co_sim = tcore_pending_ref_core_object(p);
+       sp = tcore_sim_ref_userdata(co_sim);
+       ur = tcore_pending_ref_user_request(p);
+
+       memset(&res, 0, sizeof(struct tresp_sim_disable_facility));
+
+       res.result = SIM_PIN_OPERATION_SUCCESS;
+       res.type = _sim_get_current_pin_facility(sp->current_sec_op);
+
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) != 1) {
+                               msg("invalid message");
+                               tcore_at_tok_free(tokens);
+                               return;
+                       }
+               }
+               res.result = atoi(g_slist_nth_data(tokens, 0));
+
+               if (ur) {
+               tcore_user_request_send_response(ur, TRESP_SIM_DISABLE_FACILITY,
+                               sizeof(struct tresp_sim_disable_facility), &res);
+               }
+               tcore_at_tok_free(tokens);
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               queue = tcore_object_ref_user_data(co_sim);
+               
+               ur = tcore_user_request_ref(ur);
+               
+               _get_retry_count(co_sim, ur);
+       }
+       dbg(" Function exit");
+}
+
+static void on_response_get_lock_info(TcorePending *   p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       UserRequest *ur = NULL;
+       CoreObject *co_sim = NULL;
+       struct s_sim_property *sp = NULL;
+       GSList *tokens=NULL;
+       const char *line;
+       struct tresp_sim_verify_pins v_pin = {0,};
+       struct tresp_sim_verify_puks v_puk = {0,};
+       struct tresp_sim_change_pins change_pin = {0,};
+       struct tresp_sim_disable_facility dis_facility = {0,};
+       struct tresp_sim_enable_facility en_facility = {0,};
+       int lock_type;
+       int attempts_left = 0;
+       int time_penalty = 0;
+
+       dbg(" Function entry ");        
+       
+       co_sim = tcore_pending_ref_core_object(p);
+       sp = tcore_sim_ref_userdata(co_sim);
+       ur = tcore_pending_ref_user_request(p);
+
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) != 3) {
+                               msg("invalid message");
+                               tcore_at_tok_free(tokens);
+                               return;
+                       }
+               }
+               lock_type = atoi(g_slist_nth_data(tokens, 0));
+               attempts_left = atoi(g_slist_nth_data(tokens, 1));
+               time_penalty = atoi(g_slist_nth_data(tokens, 2));
+               
+               switch (sp->current_sec_op) {
+                       case SEC_PIN1_VERIFY:
+                       case SEC_PIN2_VERIFY:
+                       case SEC_SIM_VERIFY:
+                       case SEC_ADM_VERIFY:
+                               v_pin.result = SIM_INCORRECT_PASSWORD;
+                               v_pin.pin_type = _sim_get_current_pin_facility(sp->current_sec_op);
+                               v_pin.retry_count = attempts_left;
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),
+                                               sizeof(struct tresp_sim_verify_pins), &v_pin);
+                               break;
+
+                       case SEC_PUK1_VERIFY:
+                       case SEC_PUK2_VERIFY:
+                               v_puk.result = SIM_INCORRECT_PASSWORD;
+                               v_puk.pin_type = _sim_get_current_pin_facility(sp->current_sec_op);
+                               v_puk.retry_count = attempts_left;
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),
+                                               sizeof(struct tresp_sim_verify_puks), &v_puk);
+                               break;
+
+                       case SEC_PIN1_CHANGE:
+                       case SEC_PIN2_CHANGE:
+                               change_pin.result = SIM_INCORRECT_PASSWORD;
+                               change_pin.pin_type = _sim_get_current_pin_facility(sp->current_sec_op);
+                               change_pin.retry_count = attempts_left;
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),
+                                               sizeof(struct tresp_sim_change_pins), &change_pin);
+                               break;
+
+                       case SEC_PIN1_DISABLE:
+                       case SEC_PIN2_DISABLE:
+                       case SEC_FDN_DISABLE:
+                       case SEC_SIM_DISABLE:
+                       case SEC_NET_DISABLE:
+                       case SEC_NS_DISABLE:
+                       case SEC_SP_DISABLE:
+                       case SEC_CP_DISABLE:
+                               dis_facility.result = SIM_INCORRECT_PASSWORD;
+                               dis_facility.type = _sim_get_current_pin_facility(sp->current_sec_op);
+                               dis_facility.retry_count = attempts_left;
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),
+                                               sizeof(struct tresp_sim_disable_facility), &dis_facility);
+                               break;
+
+                       case SEC_PIN1_ENABLE:
+                       case SEC_PIN2_ENABLE:
+                       case SEC_FDN_ENABLE:
+                       case SEC_SIM_ENABLE:
+                       case SEC_NET_ENABLE:
+                       case SEC_NS_ENABLE:
+                       case SEC_SP_ENABLE:
+                       case SEC_CP_ENABLE:
+                               en_facility.result = SIM_INCORRECT_PASSWORD;
+                               en_facility.type = _sim_get_current_pin_facility(sp->current_sec_op);
+                               en_facility.retry_count = attempts_left;
+                               tcore_user_request_send_response(ur, _find_resp_command(ur),
+                                               sizeof(struct tresp_sim_enable_facility), &en_facility);
+                               break;
+
+                       default:
+                               dbg("not handled sec op[%d]", sp->current_sec_op);
+                               break;
+               }       
+               tcore_at_tok_free(tokens);
+       }
+       dbg(" Function exit");
+}
+
+static void on_response_update_file(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       UserRequest *ur = NULL;
+       CoreObject *co_sim = NULL;
+       struct tresp_sim_set_callforwarding resp_cf = {0, };
+       struct tresp_sim_set_language resp_language ={0,};
+       struct s_sim_property *sp = NULL;
+       GSList *tokens=NULL;
+       enum tel_sim_access_result result;
+       const char *line;
+       int sw1 = 0;
+       int sw2 = 0;
+
+       dbg(" Function entry ");        
+       
+       co_sim = tcore_pending_ref_core_object(p);
+       sp = tcore_sim_ref_userdata(co_sim);
+       ur = tcore_pending_ref_user_request(p);
+
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) != 2) {
+                               msg("invalid message");
+                               tcore_at_tok_free(tokens);
+                               return;
+                       }
+               }
+               sw1 = atoi(g_slist_nth_data(tokens, 0));
+               sw2 = atoi(g_slist_nth_data(tokens, 1));
+
+               if((sw1 == 0x90 && sw2 == 0x00) ||sw1 == 0x91){
+                       result = SIM_ACCESS_SUCCESS;
+               }else{
+                       result =  _decode_status_word(sw1, sw2);
+               }
+       }else{
+               dbg("RESPONSE NOK");
+               result = SIM_ACCESS_FAILED;
+       }
+       
+       switch(sp->file_id){
+               case SIM_EF_CPHS_CALL_FORWARD_FLAGS :
+               case SIM_EF_USIM_CFIS :
+                       tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_set_callforwarding), &resp_cf);
+                       break;
+               case SIM_EF_ELP:
+               case SIM_EF_LP:
+               case SIM_EF_USIM_LI:
+               case SIM_EF_USIM_PL:
+                       tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_set_language), &resp_language);
+                       break;
+               default:
+                       break;
+       }
+       tcore_at_tok_free(tokens);
+       dbg(" Function exit");
+}
+
+static void on_response_transmit_apdu(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       UserRequest *ur = NULL;
+       CoreObject *co_sim = NULL;
+       struct s_sim_property *sp = NULL;
+       GSList *tokens=NULL;
+       struct tresp_sim_transmit_apdu res;
+       const char *line;
+
+       dbg(" Function entry ");        
+       
+       co_sim = tcore_pending_ref_core_object(p);
+       sp = tcore_sim_ref_userdata(co_sim);
+       ur = tcore_pending_ref_user_request(p);
+
+       memset(&res, 0, sizeof(struct tresp_sim_transmit_apdu));
+
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               res.result = SIM_ACCESS_SUCCESS;
+               if(resp->lines) {
+                       line = (const char*)resp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       if (g_slist_length(tokens) != 2) {
+                               msg("invalid message");
+                               tcore_at_tok_free(tokens);
+                               return;
+                       }
+               }
+               res.apdu_resp_length = atoi(g_slist_nth_data(tokens, 0));
+               strncpy((char *)res.apdu_resp, (const char *)g_slist_nth_data(tokens, 1), res.apdu_resp_length);
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               res.result = SIM_ACCESS_FAILED; 
+       }
+
+       ur = tcore_pending_ref_user_request(p);
+       if (ur) {
+               tcore_user_request_send_response(ur, _find_resp_command(ur), sizeof(struct tresp_sim_transmit_apdu), &res);
+       }
+       tcore_at_tok_free(tokens);
+       dbg(" Function exit");
+}
+
+static TReturn s_verify_pins(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req = NULL;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+       const struct treq_sim_verify_pins *req_data = NULL;
+       struct s_sim_property *sp = NULL;
+
+       dbg(" Function entry ");        
+
+       hal = tcore_object_get_hal(o);
+       sp = tcore_sim_ref_userdata(o);
+       pending = tcore_pending_new(o, 0);
+       req_data = tcore_user_request_ref_data(ur, NULL);
+
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+
+       if (req_data->pin_type == SIM_PTYPE_PIN1) {
+               sp->current_sec_op = SEC_PIN1_VERIFY;
+       }
+       else if (req_data->pin_type == SIM_PTYPE_PIN2) {
+               sp->current_sec_op = SEC_PIN2_VERIFY;
+       }
+       else if (req_data->pin_type == SIM_PTYPE_SIM) {
+               sp->current_sec_op = SEC_SIM_VERIFY;
+       }
+       else if (req_data->pin_type == SIM_PTYPE_ADM) {
+               sp->current_sec_op = SEC_ADM_VERIFY;
+       }
+       else {
+               return TCORE_RETURN_EINVAL;
+       }
+
+       cmd_str = g_strdup_printf("AT+CPIN=\"%s\"%s", req_data->pin, "\r");
+
+       req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_verify_pins, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+       
+       free(cmd_str);
+       dbg(" Function exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_verify_puks(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+       const struct treq_sim_verify_puks *req_data;
+       struct s_sim_property *sp = NULL;
+
+       dbg(" Function entry ");        
+
+       hal = tcore_object_get_hal(o);
+       sp = tcore_sim_ref_userdata(o);
+       pending = tcore_pending_new(o, 0);
+       req_data = tcore_user_request_ref_data(ur, NULL);
+
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+
+       if(req_data->puk_type == SIM_PTYPE_PUK1){
+               sp->current_sec_op = SEC_PUK1_VERIFY;
+       }
+       else if(req_data->puk_type == SIM_PTYPE_PUK2){
+               sp->current_sec_op = SEC_PUK2_VERIFY;
+       }
+       else {
+               return TCORE_RETURN_EINVAL;
+       }
+
+       cmd_str = g_strdup_printf("AT+CPIN=\"%s\", \"%s\"%s", req_data->puk, req_data->pin, "\r");
+
+       req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_verify_puks, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       free(cmd_str);
+       dbg(" Function exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_change_pins(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+       const struct treq_sim_change_pins *req_data;
+       struct s_sim_property *sp = NULL;
+
+       dbg(" Function entry ");        
+
+       hal = tcore_object_get_hal(o);
+       sp = tcore_sim_ref_userdata(o);
+       pending = tcore_pending_new(o, 0);
+       req_data = tcore_user_request_ref_data(ur, NULL);
+
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+
+       if(req_data->type == SIM_PTYPE_PIN1) {
+               sp->current_sec_op = SEC_PIN1_CHANGE;
+       }
+       else if(req_data->type == SIM_PTYPE_PIN2) {
+               sp->current_sec_op = SEC_PIN2_CHANGE;
+       }
+       else {
+               return TCORE_RETURN_EINVAL;
+       }
+
+       cmd_str = g_strdup_printf("AT+CPIN=\"%s\", \"%s\"%s", req_data->old_pin, req_data->new_pin, "\r");
+
+       req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_change_pins, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       free(cmd_str);
+       dbg(" Function exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_get_facility_status(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+       const struct treq_sim_get_facility_status *req_data;
+       struct s_sim_property *sp = NULL;
+       char *fac = "SC";
+       int mode = 2;           /* 0:unlock, 1:lock, 2:query*/
+
+       dbg(" Function entry ");        
+       
+       hal = tcore_object_get_hal(o);
+       sp = tcore_sim_ref_userdata(o);
+       pending = tcore_pending_new(o, 0);
+       req_data = tcore_user_request_ref_data(ur, NULL);
+
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+       
+       if(req_data->type == SIM_FACILITY_PS){
+               fac = "PS";                                                             /*PH-SIM, Lock PHone to SIM/UICC card*/
+       }else if(req_data->type == SIM_FACILITY_SC){
+               fac = "SC";                                                             /*Lock SIM/UICC card, simply PIN1*/
+       }else if(req_data->type == SIM_FACILITY_FD){
+               fac = "FD";                                                             /*Fixed Dialing Number feature, need PIN2*/
+       }else if(req_data->type == SIM_FACILITY_PN){
+               fac = "PN";                                                             /*Network Personalization*/
+       }else if(req_data->type == SIM_FACILITY_PU){
+               fac = "PU";                                                             /*network sUbset Personalization*/
+       }else if(req_data->type == SIM_FACILITY_PP){
+               fac = "PP";                                                             /*service Provider Personalization*/
+       }else if(req_data->type == SIM_FACILITY_PC){
+               fac = "PC";                                                             /*Corporate Personalization*/
+       }else{
+               return TCORE_RETURN_EINVAL;
+       }
+
+       cmd_str = g_strdup_printf("AT+CLCK=\"%s\", %d%s", fac, mode, "\r");
+
+       req = tcore_at_request_new(cmd_str, "+CLCK:", TCORE_AT_SINGLELINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_get_facility_status, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       free(cmd_str);
+       dbg(" Function exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_enable_facility(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+       const struct treq_sim_enable_facility *req_data;
+       struct s_sim_property *sp = NULL;
+       char *fac = "SC";
+       int mode = 1;           /* 0:unlock, 1:lock, 2:query*/
+
+       dbg(" Function entry ");        
+       
+       hal = tcore_object_get_hal(o);
+       sp = tcore_sim_ref_userdata(o);
+       pending = tcore_pending_new(o, 0);
+       req_data = tcore_user_request_ref_data(ur, NULL);
+
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+       
+       if(req_data->type == SIM_FACILITY_PS){
+               fac = "PS";                                                             /*PH-SIM, Lock PHone to SIM/UICC card*/
+               sp->current_sec_op = SEC_SIM_ENABLE;
+       }else if(req_data->type == SIM_FACILITY_SC){
+               fac = "SC";                                                             /*Lock SIM/UICC card, simply PIN1*/
+               sp->current_sec_op = SEC_PIN1_ENABLE;
+       }else if(req_data->type == SIM_FACILITY_FD){
+               fac = "FD";                                                             /*Fixed Dialing Number feature, need PIN2*/
+               sp->current_sec_op = SEC_FDN_ENABLE;
+       }else if(req_data->type == SIM_FACILITY_PN){
+               fac = "PN";                                                             /*Network Personalization*/
+               sp->current_sec_op = SEC_NET_ENABLE;
+       }else if(req_data->type == SIM_FACILITY_PU){
+               fac = "PU";                                                             /*network sUbset Personalization*/
+               sp->current_sec_op = SEC_NS_ENABLE;
+       }else if(req_data->type == SIM_FACILITY_PP){
+               fac = "PP";                                                             /*service Provider Personalization*/
+               sp->current_sec_op = SEC_SP_ENABLE;
+       }else if(req_data->type == SIM_FACILITY_PC){
+               fac = "PC";                                                             /*Corporate Personalization*/
+               sp->current_sec_op = SEC_CP_ENABLE;
+       }else{
+               return TCORE_RETURN_EINVAL;
+       }
+
+       cmd_str = g_strdup_printf("AT+CLCK=\"%s\", %d, \"%s\"%s", fac, mode, req_data->password,"\r");
+
+       req = tcore_at_request_new(cmd_str, "+CLCK:", TCORE_AT_SINGLELINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_enable_facility, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       free(cmd_str);
+       dbg(" Function exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_disable_facility(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+       const struct treq_sim_enable_facility *req_data;
+       struct s_sim_property *sp = NULL;
+       char *fac = "SC";
+       int mode = 0;           /* 0:unlock, 1:lock, 2:query*/
+
+       dbg(" Function entry ");        
+       
+       hal = tcore_object_get_hal(o);
+       sp = tcore_sim_ref_userdata(o);
+       pending = tcore_pending_new(o, 0);
+       req_data = tcore_user_request_ref_data(ur, NULL);
+
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+       
+       if(req_data->type == SIM_FACILITY_PS){
+               fac = "PS";                                                             /*PH-SIM, Lock PHone to SIM/UICC card*/
+               sp->current_sec_op = SEC_SIM_DISABLE;
+       }else if(req_data->type == SIM_FACILITY_SC){
+               fac = "SC";                                                             /*Lock SIM/UICC card, simply PIN1*/
+               sp->current_sec_op = SEC_PIN1_DISABLE;
+       }else if(req_data->type == SIM_FACILITY_FD){
+               fac = "FD";                                                             /*Fixed Dialing Number feature, need PIN2*/
+               sp->current_sec_op = SEC_FDN_DISABLE;
+       }else if(req_data->type == SIM_FACILITY_PN){
+               fac = "PN";                                                             /*Network Personalization*/
+               sp->current_sec_op = SEC_NET_DISABLE;
+       }else if(req_data->type == SIM_FACILITY_PU){
+               fac = "PU";                                                             /*network sUbset Personalization*/
+               sp->current_sec_op = SEC_NS_DISABLE;
+       }else if(req_data->type == SIM_FACILITY_PP){
+               fac = "PP";                                                             /*service Provider Personalization*/
+               sp->current_sec_op = SEC_SP_DISABLE;
+       }else if(req_data->type == SIM_FACILITY_PC){
+               fac = "PC";                                                             /*Corporate Personalization*/
+               sp->current_sec_op = SEC_CP_DISABLE;
+       }else{
+               return TCORE_RETURN_EINVAL;
+       }
+
+       cmd_str = g_strdup_printf("AT+CLCK=\"%s\", %d, \"%s\"%s", fac, mode, req_data->password,"\r");
+
+       req = tcore_at_request_new(cmd_str, "+CLCK:", TCORE_AT_SINGLELINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_disable_facility, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       free(cmd_str);
+       dbg(" Function exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_get_lock_info(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+       char    *lock_type = NULL;
+       const struct treq_sim_get_lock_info *req_data;
+       struct s_sim_property *sp = NULL;
+
+       dbg(" Function entry ");        
+       
+       hal = tcore_object_get_hal(o);
+       sp = tcore_sim_ref_userdata(o);
+       pending = tcore_pending_new(o, 0);
+       req_data = tcore_user_request_ref_data(ur, NULL);
+
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+
+       switch (req_data->type) {
+               case SIM_FACILITY_PS:
+                       lock_type = "PS";
+                       break;
+               case SIM_FACILITY_SC:
+                       lock_type = "SC";
+                       break;
+               case SIM_FACILITY_FD:
+                       lock_type = "FD";
+                       break;
+               case SIM_FACILITY_PN:
+                       lock_type = "PN";
+                       break;
+               case SIM_FACILITY_PU:
+                       lock_type = "PU";
+                       break;
+               case SIM_FACILITY_PP:
+                       lock_type = "PP";
+                       break;
+               case SIM_FACILITY_PC:
+                       lock_type = "PC";
+                       break;
+               default:
+                       break;
+       }
+
+       cmd_str = g_strdup_printf("AT+XPINCNT =\"%s\"%s", lock_type,"\r");
+
+       req = tcore_at_request_new(cmd_str, "+XPINCNT:", TCORE_AT_SINGLELINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_get_lock_info, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       free(cmd_str);
+       dbg(" Function exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_read_file(CoreObject *o, UserRequest *ur)
+{
+       TReturn api_ret = TCORE_RETURN_SUCCESS;
+       enum tcore_request_command command;
+       command = tcore_user_request_get_command(ur);
+
+       dbg(" Function entry ");        
+       
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+
+       switch (command) {
+               case TREQ_SIM_GET_ECC:
+                       api_ret = _get_file_info(o, ur, SIM_EF_ECC);
+                       break;
+
+               case TREQ_SIM_GET_LANGUAGE:
+                       if (tcore_sim_get_type(o) == SIM_TYPE_GSM)
+                               api_ret = _get_file_info(o, ur, SIM_EF_ELP);
+                       else if (tcore_sim_get_type(o) == SIM_TYPE_USIM)
+                               api_ret = _get_file_info(o, ur, SIM_EF_LP);
+                       else
+                               api_ret = TCORE_RETURN_ENOSYS;
+                       break;
+
+               case TREQ_SIM_GET_ICCID:
+                       api_ret = _get_file_info(o, ur, SIM_EF_ICCID);
+                       break;
+
+               case TREQ_SIM_GET_MAILBOX:
+                       if(tcore_sim_get_cphs_status(o))
+                               api_ret = _get_file_info(o, ur, SIM_EF_CPHS_MAILBOX_NUMBERS);
+                       else
+                               api_ret = _get_file_info(o, ur, SIM_EF_MBDN);
+                       break;
+
+               case TREQ_SIM_GET_CALLFORWARDING:
+                       if(tcore_sim_get_cphs_status(o))
+                               api_ret = _get_file_info(o, ur, SIM_EF_CPHS_CALL_FORWARD_FLAGS);
+                       else
+                               api_ret = _get_file_info(o, ur, SIM_EF_USIM_CFIS);
+                       break;
+
+               case TREQ_SIM_GET_MESSAGEWAITING:
+                       if(tcore_sim_get_cphs_status(o))
+                               api_ret = _get_file_info(o, ur, SIM_EF_CPHS_VOICE_MSG_WAITING);
+                       else
+                               api_ret = _get_file_info(o, ur, SIM_EF_USIM_MWIS);
+                       break;
+
+               case TREQ_SIM_GET_CPHS_INFO:
+/*                     if(tcore_sim_get_cphs_status(o))*/
+                               api_ret = _get_file_info(o, ur, SIM_EF_CPHS_CPHS_INFO);
+/*                     else
+                               api_ret = TCORE_RETURN_ENOSYS;*/
+                       break;
+
+               case TREQ_SIM_GET_MSISDN:
+                       api_ret = _get_file_info(o, ur, SIM_EF_MSISDN);
+                       break;
+
+               case TREQ_SIM_GET_SPN:
+                       dbg("enter case SPN");
+                       api_ret = _get_file_info(o, ur, SIM_EF_SPN);
+                       break;
+
+               case TREQ_SIM_GET_SPDI:
+                       api_ret = _get_file_info(o, ur, SIM_EF_SPDI);
+                       break;
+
+               case TREQ_SIM_GET_OPL:
+                       api_ret = _get_file_info(o, ur, SIM_EF_OPL);
+                       break;
+
+               case TREQ_SIM_GET_PNN:
+                       api_ret = _get_file_info(o, ur, SIM_EF_PNN);
+                       break;
+
+               case TREQ_SIM_GET_CPHS_NETNAME:
+/*                     if(tcore_sim_get_cphs_status(o))*/
+                               api_ret = _get_file_info(o, ur, SIM_EF_CPHS_OPERATOR_NAME_STRING);
+/*                     else
+                               api_ret = TCORE_RETURN_ENOSYS;*/
+                       break;
+
+/*             case TREQ_SIM_GET_CPHS_FULLNETNAME:
+                       if(tcore_sim_get_cphs_status(o))
+                               api_ret = _get_file_info(o, ur, SIM_EF_CPHS_OPERATOR_NAME_STRING);
+                       else
+                               api_ret = TCORE_RETURN_ENOSYS;
+                       break;*/
+
+               case TREQ_SIM_GET_OPLMNWACT:
+                       api_ret = _get_file_info(o, ur, SIM_EF_OPLMN_ACT);
+                       break;
+
+               default:
+                       dbg("error - not handled read treq command[%d]", command);
+                       api_ret = TCORE_RETURN_EINVAL;
+                       break;
+       }
+       dbg(" Function exit");
+       return api_ret;
+}
+
+static TReturn s_update_file(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+       TReturn api_ret = TCORE_RETURN_SUCCESS;
+       char *encoded_data = NULL;
+       int encoded_len = 0;
+       enum tcore_request_command command;
+       enum tel_sim_file_id ef = SIM_EF_INVALID;
+       const struct treq_sim_set_callforwarding *cf;
+       int p1 = 0;
+       int p2 = 0;
+       int p3 = 0;
+       int cmd = 0;
+       command = tcore_user_request_get_command(ur);
+
+       dbg(" Function entry ");        
+
+       hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+
+       switch (command) {
+               case TREQ_SIM_SET_LANGUAGE:
+                       if (tcore_sim_get_type(o) == SIM_TYPE_GSM)
+                               ef = SIM_EF_ELP;
+                       else if (tcore_sim_get_type(o) == SIM_TYPE_USIM)
+                               ef = SIM_EF_LP;
+                       else
+                               api_ret = TCORE_RETURN_ENOSYS;
+                       break;
+
+               case TREQ_SIM_SET_CALLFORWARDING:
+                       cf = tcore_user_request_ref_data(ur, NULL);
+                       if(tcore_sim_get_cphs_status(o)) {
+                               encoded_data = tcore_sim_encode_cff((const struct tel_sim_callforwarding*)cf);
+                               ef = SIM_EF_CPHS_CALL_FORWARD_FLAGS;
+                               p1 = 0;
+                               p2 = 0;
+                               p3 = strlen(encoded_data);
+                               cmd = 214;                              /*command - 214 : UPDATE BINARY*/
+                       } else {
+                               encoded_data = tcore_sim_encode_cfis(&encoded_len, (const struct tel_sim_callforwarding*)cf);
+                               ef = SIM_EF_USIM_CFIS;
+                               p1 = 1;
+                               p2 = 0x04;
+                               p3 = encoded_len;
+                               cmd = 220;                              /*command - 220 : UPDATE RECORD*/
+                       }
+                       break;
+
+               default:
+                       dbg("error - not handled update treq command[%d]", command);
+                       api_ret = TCORE_RETURN_EINVAL;
+                       break;
+       }
+
+       cmd_str = g_strdup_printf("AT+CRSM=%d%d%d%d%d%s%s", cmd,ef,p1,p2,p3, encoded_data,"\r");
+
+       req = tcore_at_request_new(cmd_str, "+CRSM:", TCORE_AT_SINGLELINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+       
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_update_file, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+       if(NULL != encoded_data){
+               g_free(encoded_data);
+       }
+       free(cmd_str);
+       dbg(" Function exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_transmit_apdu(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+       const struct treq_sim_transmit_apdu *req_data;
+
+       dbg(" Function entry ");        
+       
+       hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+       req_data = tcore_user_request_ref_data(ur, NULL);
+
+       if (!o || !ur)
+               return TCORE_RETURN_EINVAL;
+       
+       cmd_str = g_strdup_printf("AT+CSIM=%d%s%s", req_data->apdu_length, req_data->apdu,"\r");
+
+       req = tcore_at_request_new(cmd_str, "+CSIM:", TCORE_AT_SINGLELINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_transmit_apdu, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       free(cmd_str);
+       dbg(" Function exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+/*ToDo - Need to be implemented in Phase-2*/
+/*
+static TReturn s_get_atr(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+
+       hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+       req_data = tcore_user_request_ref_data(ur, NULL);
+       
+       cmd_str = g_strdup_printf("AT+",);                                      //ToDo - Construct AT string
+
+       req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_SINGLELINE);     //ToDo - Set prefix if require
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_get_atr, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       return TCORE_RETURN_SUCCESS;
+}*/
+
+
+/*ToDo - Need to be implemented in Phase-2*/
+/*
+static TReturn s_req_authentication(CoreObject *o, UserRequest *ur)
+{
+       TcoreHal* hal;
+       TcoreATRequest *req;
+       TcorePending *pending = NULL;
+       char *cmd_str = NULL;
+       const struct treq_sim_req_authentication *req_data;
+
+       hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+       req_data = tcore_user_request_ref_data(ur, NULL);
+
+       //ToDo - Fill required parameters
+       
+       cmd_str = g_strdup_printf("AT+",);              //ToDo - Construct AT string
+
+       req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_SINGLELINE); //ToDo - Set prefix if require
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+       tcore_pending_set_response_callback(pending, on_response_req_authentication, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sim_message_send, NULL);
+
+       tcore_hal_send_request(hal, pending);
+
+       return TCORE_RETURN_SUCCESS;
+}*/
+
+static struct tcore_sim_operations sim_ops =
+{
+               .verify_pins = s_verify_pins,
+               .verify_puks = s_verify_puks,
+               .change_pins = s_change_pins,
+               .get_facility_status = s_get_facility_status,
+               .enable_facility = s_enable_facility,
+               .disable_facility = s_disable_facility,
+               .get_lock_info = s_get_lock_info,
+               .read_file = s_read_file,
+               .update_file = s_update_file,
+               .transmit_apdu = s_transmit_apdu,
+               //.get_atr = s_get_atr,
+               //.req_authentication = s_req_authentication
+};
+
+gboolean s_sim_init(TcorePlugin *p, TcoreHal *h)
+{
+       CoreObject *o;
+       struct s_sim_property *file_meta = NULL;
+       GQueue *work_queue;
+
+       dbg("entry");
+
+       o = tcore_sim_new(p, "sim", &sim_ops, h);
+       
+       if (!o)
+               return FALSE;
+
+       file_meta = calloc(sizeof(struct s_sim_property),1);
+       if (!file_meta)
+               return FALSE;
+
+       work_queue = g_queue_new();
+       tcore_object_link_user_data(o, work_queue);
+
+       file_meta->first_recv_status = SIM_STATUS_UNKNOWN;
+       tcore_sim_link_userdata(o, file_meta);
+
+       tcore_object_add_callback(o, "+XLOCK", on_event_facility_lock_status, NULL);
+       tcore_object_add_callback(o, "+XSIM", on_event_pin_status, NULL);
+       dbg("exit");
+       return TRUE;
+}
+
+
+void s_sim_exit(TcorePlugin *p)
+{
+       CoreObject *o;
+
+       o = tcore_plugin_ref_core_object(p, "sim");
+       if (!o)
+               return;
+       tcore_sim_free(o);
+}
diff --git a/src/s_sms.c b/src/s_sms.c
new file mode 100755 (executable)
index 0000000..4e99f88
--- /dev/null
@@ -0,0 +1,4124 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <hal.h>
+#include <core_object.h>
+#include <plugin.h>
+#include <queue.h>
+#include <co_sms.h>
+#include <user_request.h>
+#include <storage.h>
+#include <server.h>
+#include <at.h>
+
+#include "common/TelErr.h"
+#include "s_common.h"
+#include "s_sms.h"
+
+/*=============================================================
+                                                       SMS PARAMETER_ID
+==============================================================*/
+#define TIZEN_SMSPARAMID_TELESERVICE_ID                                        0x01    /* Teleservice Identifier */
+#define TIZEN_SMSPARAMID_SERVICE_CATEGORY                              0x02    /* Broadcast Service Category */
+#define TIZEN_SMSPARAMID_ADDRESS                                                       0x03    /* Address */
+#define TIZEN_SMSPARAMID_SUBADDRESS                                            0x04    /* Subaddress */
+#define TIZEN_SMSPARAMID_BEARER_REPLY                                  0x05    /* Bearer Reply Option */
+#define TIZEN_SMSPARAMID_CAUSE_CODES                                   0x06    /* Cause Codes */
+#define TIZEN_SMSPARAMID_MESSAGE_ID                                            0x07    /* Message Identifier */
+#define TIZEN_SMSPARAMID_USER_DATA                                             0x08    /* User Data */
+#define TIZEN_SMSPARAMID_USER_RESPONSE_CODE                    0x09    /* User Response Code */
+#define TIZEN_SMSPARAMID_MC_TIME_STAMP                                 0x0A    /* Message Center Time Stamp */
+#define TIZEN_SMSPARAMID_VALIDITY_PERIOD_ABS                   0x0B    /* Validity Period - Absolute */
+#define TIZEN_SMSPARAMID_VALIDITY_PERIOD_REL                   0x0C    /* Validiry Period - Relative */
+#define TIZEN_SMSPARAMID_DEFERRED_DELIVERY_ABS                 0x0D    /* Deferred Delivery Time - Absolute */
+#define TIZEN_SMSPARAMID_DEFERRED_DELIVERY_REL                 0x0E    /* Deferred Delivery Time - Relative */
+#define TIZEN_SMSPARAMID_PRIORITY                                                      0x0F    /* Priority Indicator */
+#define TIZEN_SMSPARAMID_PRIVACY                                                       0x10    /* Privacy Indicator */
+#define TIZEN_SMSPARAMID_REPLY_OPTION                                  0x11    /* Reply Option */
+#define TIZEN_SMSPARAMID_NUMBER_OF_MESSAGE                             0x12    /* Number of Messages : Voice Mail Count */
+#define TIZEN_SMSPARAMID_ALERT_ON_DELIVERY                             0x13    /* Alert on Message Delivery */
+#define TIZEN_SMSPARAMID_LANGUAGE                                              0x14    /* Langauge Indicator */
+#define TIZEN_SMSPARAMID_CALLBACK                                              0x15    /* Call Back Number */
+#define TIZEN_SMSPARAMID_DISPLAY_MODE                                  0x16    /* Display Mode */
+#define TIZEN_SMSPARAMID_MULTI_ENCODING_USER_DATA              0x17    /* Multiply Encoding User Data */
+#define TIZEN_SMSPARAMID_MEMORY_INDEX                                  0x18    /* Memory address stored in Phone Memory */
+#define TIZEN_SMSPARAMID_BEARER_DATA                                   0x19    /* Bearer data - raw data  */
+#define TIZEN_SMSPARAMID_SCPT_DATA                                             0x1A    /* Service Category Program Data */
+#define TIZEN_SMSPARAMID_SCPT_RESURLT                                  0x1B    /* Service Category Program Result */
+
+/*=============================================================
+                                               TIZEN_SMSPARAMID_MESSAGE_ID Types
+==============================================================*/
+#define TIZEN_MESSAGETYPE_DELIVER                                              0x01
+#define TIZEN_MESSAGETYPE_SUBMIT                                               0x02
+#define TIZEN_MESSAGETYPE_CANCEL                                               0x03
+#define TIZEN_MESSAGETYPE_DELIVERY_ACK                         0x04
+#define TIZEN_MESSAGETYPE_USER_ACK                                     0x05
+
+/*=============================================================
+                                               TIZEN_SMSPARAMID_LANGUAGE Types
+==============================================================*/
+#define TIZEN_LANGUAGE_UNKNOWN                                 0x00
+#define TIZEN_LANGUAGE_ENGLISH                                 0x01
+#define TIZEN_LANGUAGE_FRENCH                                          0x02
+#define TIZEN_LANGUAGE_SPANISH                                 0x03
+#define TIZEN_LANGUAGE_JAPANESE                                        0x04
+#define TIZEN_LANGUAGE_KOREAN                                          0x05
+#define TIZEN_LANGUAGE_CHINESE                                 0x06
+#define TIZEN_LANGUAGE_HEBREW                                  0x07
+#define TIZEN_LANGUAGE_KOREAN1                                 0x40    /* Used in Korean 3 PCS's and STI */
+#define TIZEN_LANGUAGE_KOREAN_SKT                              0xFE    /* Used in only SKT */
+
+/*=============================================================
+                                                       CDMA-SMS Size
+==============================================================*/
+#define MAX_CDMA_SMS_DATA_SIZE                         512             /* Maximum number of bytes SMSP Record size (Y + 28), y : 0 ~ 128 */
+#define MAX_CDMA_SMS_ADDRESS_SIZE                      32              /* MAX sms destination(or origination ) address /call back number */
+
+/*=============================================================
+                                                       GSM-SMS Size
+==============================================================*/
+#define MAX_GSM_SMS_TPDU_SIZE                                          244
+#define MAX_GSM_SMS_MSG_NUM                                                    255
+#define MAX_GSM_SMS_SERVICE_CENTER_ADDR                                12              /* Maximum number of bytes of service center address */
+#define MAX_GSM_SMS_CBMI_LIST_SIZE                                     100             /* Maximum number of CBMI list size for CBS 30*2=60  */
+#define MAX_GSM_SMS_PARAM_RECORD_SIZE                          156             /* Maximum number of bytes SMSP Record size (Y + 28), y : 0 ~ 128 */
+#define MAX_GSM_SMS_STATUS_FILE_SIZE                                   2               /* Last Used TP-MR + SMS "Memory Cap. Exceeded" Noti Flag */
+#define TAPI_SIM_SMSP_ADDRESS_LEN                                      20
+
+/*=============================================================
+                                                       Device Ready
+==============================================================*/
+#define AT_SMS_DEVICE_READY                    12              /* AT device ready */
+#define SMS_DEVICE_READY                               1               /* Telephony device ready */
+#define SMS_DEVICE_NOT_READY                   0               /* Telephony device not ready */
+
+/*=============================================================
+                                                       CBMI Selection
+==============================================================*/
+#define SMS_CBMI_SELECTED_SOME         0x02    /* Some CBMIs are selected */
+#define SMS_CBMI_SELECTED_ALL                  0x01    /* All CBMIs are selected */
+
+/*=============================================================
+                                                       Message Status
+==============================================================*/
+#define AT_REC_UNREAD                                  0               /* Received and Unread */
+#define AT_REC_READ                                    1               /* Received and Read */
+#define AT_STO_UNSENT                                  2               /* Unsent */
+#define AT_STO_SENT                                    3               /* Sent */
+#define AT_ALL                                                         4               /* Unknown */
+
+/*=============================================================
+                                                       Memory Status
+==============================================================*/
+#define AT_MEMORY_AVAILABLE                    0               /* Memory Available */
+#define AT_MEMORY_FULL                                 1               /* Memory Full */
+
+/*=============================================================
+                                                       Security
+==============================================================*/
+#define MAX_SEC_PIN_LEN                                                        8
+#define MAX_SEC_PUK_LEN                                                        8
+#define MAX_SEC_PHONE_LOCK_PW_LEN                              39              /* Maximum Phone Locking Password Length */
+#define MAX_SEC_SIM_DATA_STRING                                        256             /* Maximum Length of the DATA or RESPONSE. Restricted SIM Access, Generic SIM Access Message */
+#define MAX_SEC_NUM_LOCK_TYPE                                          8               /* Maximum number of Lock Type used in Lock Information Message */                                                                                        
+#define MAX_SEC_IMS_AUTH_LEN                                           512             /* Maximum Length of IMS Authentication Message */
+
+/*=============================================================
+                                                       String Preprocessor
+==============================================================*/
+#define CR             '\r'            /* Carriage Return */
+
+/*=============================================================
+                                                       Developer
+==============================================================*/
+#define TAPI_CODE_SUBJECT_TO_CHANGE                            /* For folding future features */
+
+#define SMS_SWAPBYTES16(x) \
+{ \
+    unsigned short int data = *(unsigned short int*)&(x); \
+    data = ((data & 0xff00) >> 8) |    \
+           ((data & 0x00ff) << 8);     \
+    *(unsigned short int*)&(x) = data ;      \
+}
+
+
+static TReturn Send_SmsSubmitTpdu(CoreObject *o, UserRequest *ur);
+
+/********************************************************************************
+Send Callback: Invoked when request is out from queue
+********************************************************************************/
+static void on_confirmation_sms_message_send(TcorePending *p, gboolean result, void *user_data)
+{
+       dbg("Entered Function. Request message out from queue");
+
+       dbg("TcorePending: [%p]", p);
+       dbg("result: [%02x]", result);
+       dbg("user_data: [%p]", user_data);
+
+       if(result == TRUE)
+       {
+               dbg("SEND OK");
+       }
+       else /* Failed */
+       {
+               dbg("SEND NOK");
+       }
+
+       dbg("Exiting Function. Nothing to return");
+}
+
+/************************************************************/
+/*********************  Utility for SMS  *************************/
+/************************************************************/
+static void util_sms_get_length_of_sca(int* nScLength) {
+       if (*nScLength % 2) {
+               *nScLength = (*nScLength / 2) + 1;
+       } else {
+               *nScLength = *nScLength / 2;
+       }
+
+       return;
+}
+
+static TReturn util_sms_encode_submit_message(const struct telephony_sms_CdmaMsgInfo *pMsgInfo, unsigned char *output, unsigned int *pos)
+{
+       TReturn api_err = TCORE_RETURN_SUCCESS;
+
+       struct telephony_sms_Is637OutSubmit *pSubmit = NULL;
+       unsigned int index = 0;
+       int i = 0;
+
+       // 1. check null pointer
+       if(pMsgInfo == NULL || output == NULL || pos == NULL)
+               return TCORE_RETURN_EINVAL;
+
+       // 2. check manatory parameter in the TelSmsMsgInfo_t
+       if(!((pMsgInfo->ParamMask & SMS_PARAM_TELESERVICE_MASK) &&
+               (pMsgInfo->ParamMask & SMS_PARAM_ADDRESS_MASK) &&
+               (pMsgInfo->ParamMask & SMS_PARAM_MESSAGE_ID_MASK)))
+                               return TCORE_RETURN_EINVAL;
+
+       pSubmit = (struct telephony_sms_Is637OutSubmit *)&(pMsgInfo->MsgData.outSubmit);
+
+       printf("TIZEN_SMSPARAMID_TELESERVICE_ID\n");
+       printf("teleservice msg=%x\n", pSubmit->TeleService);
+       // 3. teleservice
+       output[index++] = TIZEN_SMSPARAMID_TELESERVICE_ID;
+       output[index++] = 2;
+       memcpy(output+index, &(pSubmit->TeleService), sizeof(unsigned short));
+       index += sizeof(unsigned short);
+
+       printf("TIZEN_SMSPARAMID_ADDRESS\n");
+       // 4. Destination address
+       output[index++] = TIZEN_SMSPARAMID_ADDRESS;
+       output[index++] = pSubmit->DstAddr.szAddrLength + 5;
+       output[index++] = (unsigned char)pSubmit->DstAddr.Digit;
+       output[index++] = (unsigned char)pSubmit->DstAddr.NumberMode;
+       output[index++] = (unsigned char)pSubmit->DstAddr.NumberType;
+       output[index++] = (unsigned char)pSubmit->DstAddr.NumberPlan;
+       output[index++] = (unsigned char)pSubmit->DstAddr.szAddrLength;
+       if(pSubmit->DstAddr.szAddrLength > SMS_MAXLENGTH_SMS_ADDRESS)
+               api_err = TCORE_RETURN_EINVAL;
+       else{
+               memcpy(output+ index, pSubmit->DstAddr.szAddress, pSubmit->DstAddr.szAddrLength);
+               index += pSubmit->DstAddr.szAddrLength;
+       }
+
+       printf("TIZEN_SMSPARAMID_SUBADDRESS\n");
+       // 5. Subaddress (optional)
+       if((api_err == TCORE_RETURN_SUCCESS)  && (pMsgInfo->ParamMask & SMS_PARAM_SUBADDRESS_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_SUBADDRESS;
+               output[index++] = pSubmit->DstSubAddr.szAddrLength + 3;
+               output[index++] = pSubmit->DstSubAddr.SubType;
+               output[index++] = pSubmit->DstSubAddr.Odd;
+               output[index++] = pSubmit->DstSubAddr.szAddrLength;
+               if(pSubmit->DstSubAddr.szAddrLength > SMS_MAXLENGTH_SMS_ADDRESS)
+                       api_err = TCORE_RETURN_EINVAL;
+               else{
+                       memcpy(output+ index, pSubmit->DstSubAddr.szAddress, pSubmit->DstSubAddr.szAddrLength);
+                       index += pSubmit->DstSubAddr.szAddrLength;
+               }
+       }
+
+       printf("TIZEN_SMSPARAMID_BEARER_REPLY\n");
+       // 6. Bearer Reply Option
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_BEARER_REPLY_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_BEARER_REPLY;
+               output[index++] = 1;
+               if(pSubmit->ReplySeqNumber >= 64)
+                       api_err = TCORE_RETURN_EINVAL;
+               else output[index++] = pSubmit->ReplySeqNumber;
+       }
+
+       printf("TIZEN_SMSPARAMID_MESSAGE_ID\n");
+       printf("Message ID msg=%x\n",pSubmit->MsgId);
+       // 7. Message Id
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_MESSAGE_ID_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_MESSAGE_ID;
+               output[index++] = 3;
+               output[index++] = TIZEN_MESSAGETYPE_SUBMIT;
+               memcpy(output+ index, &(pSubmit->MsgId), sizeof(unsigned short));
+               index += sizeof(unsigned short);
+       }
+
+       printf("TIZEN_SMSPARAMID_USER_DATA\n");
+       // 8. User Data
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_USER_DATA_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_USER_DATA;
+               output[index++] = 2 + pSubmit->MsgLength;
+               output[index++] = pSubmit->MsgEncoding;
+               output[index++] = pSubmit->MsgLength;
+               if(pSubmit->MsgLength > SMS_MAXLENGTH_SMS_MO_USER_DATA)
+                       api_err = TCORE_RETURN_EINVAL;
+               else{
+                       memcpy(output+ index, pSubmit->szData, pSubmit->MsgLength);
+                       index += pSubmit->MsgLength;
+               }
+       }
+
+       // 9. Deferred DeliveryTime Absolute
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_DEFERRED_DELIVERY_ABS_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_DEFERRED_DELIVERY_ABS;
+               output[index++] = 6;
+               output[index++] = (unsigned char)pSubmit->DeferredDelTimeAbs.year;
+               output[index++] = (unsigned char)pSubmit->DeferredDelTimeAbs.month;
+               output[index++] = (unsigned char)pSubmit->DeferredDelTimeAbs.day;
+               output[index++] = (unsigned char)pSubmit->DeferredDelTimeAbs.hours;
+               output[index++] = (unsigned char)pSubmit->DeferredDelTimeAbs.minutes;
+               output[index++] = (unsigned char)pSubmit->DeferredDelTimeAbs.seconds;
+       }
+
+       // 10. Deferred DeliveryTime Relative
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_DEFERRED_DELIVERY_REL_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_DEFERRED_DELIVERY_REL;
+               output[index++] = 1;
+               output[index++] = (unsigned char)pSubmit->DeferredDelTimeRel;
+       }
+
+       // 11. Priority Indicator
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_PRIORITY_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_PRIORITY;
+               output[index++] = 1;
+               if((int)pSubmit->Privacy < SMS_PRIVACY_NOT_RESTRICTED || pSubmit->Privacy > SMS_PRIVACY_SECRET)
+                       api_err = TCORE_RETURN_EINVAL;
+               else output[index++] = pSubmit->Priority;
+       }
+
+       // 12. Privacy Indicator
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_PRIVACY_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_PRIVACY;
+               output[index++] = 1;
+               if((int)pSubmit->Priority < SMS_PRIORITY_NORMAL || pSubmit->Priority > SMS_PRIORITY_EMERGENCY)
+                       api_err = TCORE_RETURN_EINVAL;
+               else output[index++] = pSubmit->Privacy;
+       }
+
+       // 13. Reply Option
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_REPLY_OPTION_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_REPLY_OPTION;
+               output[index++] = 2;
+               if(pSubmit->bUserAckRequest == 0 &&  pSubmit->bDeliveryAckRequest == 0)
+                       api_err = TCORE_RETURN_EINVAL;
+               else {
+                       output[index++] = (unsigned char)(pSubmit->bUserAckRequest);
+                       output[index++] = (unsigned char)(pSubmit->bDeliveryAckRequest);
+               }
+       }
+
+       // 14. Alert on Message Delivery
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_ALERT_ON_DELIVERY_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_ALERT_ON_DELIVERY;
+               output[index++] = 1;
+               if((int)pSubmit->AlertPriority< SMS_ALERT_PRIORITY_DEFAULT || pSubmit->AlertPriority > SMS_ALERT_PRIORITY_HIGH)
+                       api_err = TCORE_RETURN_EINVAL;
+               else output[index++] = pSubmit->AlertPriority;
+       }
+
+       // 15. Language Indicator
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_LANGUAGE_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_LANGUAGE;
+               output[index++] = 1;
+               if((int)pSubmit->MsgLang< TIZEN_LANGUAGE_UNKNOWN || pSubmit->MsgLang > TIZEN_LANGUAGE_KOREAN_SKT)
+                       api_err = TCORE_RETURN_EINVAL;
+               else output[index++] = pSubmit->MsgLang;
+       }
+
+       printf("TIZEN_SMSPARAMID_CALLBACK\n");
+       // 16. Callback Number
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_CALLBACK_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_CALLBACK;
+               output[index++] = 4 + pSubmit->CallBackNumber.szAddrLength;
+               output[index++] = pSubmit->CallBackNumber.Digit;
+               output[index++] = pSubmit->CallBackNumber.NumberType;
+               output[index++] = pSubmit->CallBackNumber.NumberPlan;
+               output[index++] = (unsigned char)pSubmit->CallBackNumber.szAddrLength;
+               printf("index before =%d, value=%x", (int)index, output[index-1]);
+               if(pSubmit->CallBackNumber.szAddrLength > SMS_MAXLENGTH_SMS_ADDRESS)
+                       api_err = TCORE_RETURN_EINVAL;
+               else{
+                       memcpy(output+ index, pSubmit->CallBackNumber.szAddress, pSubmit->CallBackNumber.szAddrLength);
+
+                       printf("index after =%d, value=%x\n", (int)index, output[index]);
+
+                       for (i=0;i<11;i++)
+                               printf("szAddr[%d]=%x\n", i, output[index+i]);
+                       index += pSubmit->CallBackNumber.szAddrLength;
+               }
+       }
+
+       printf("output index: (0)=%x, (-1)=%x, (+1)=%x\n", output[index], output[index-1],output[index+1]);
+
+       *pos = index;
+
+       return api_err;
+}
+
+static TReturn util_sms_encode_cancel_message(const struct telephony_sms_CdmaMsgInfo *pMsgInfo, unsigned char *output, unsigned int *pos)
+{
+       TReturn api_err = TCORE_RETURN_SUCCESS;
+       struct telephony_sms_Is637OutCancel *pCancel = NULL;
+       unsigned int index = 0;
+
+       // 1. check null pointer
+       if(pMsgInfo == NULL || output == NULL || pos == NULL)
+               return TCORE_RETURN_EINVAL;
+
+       // 2. check manatory parameter in the TelSmsMsgInfo_t
+       if(!((pMsgInfo->ParamMask & SMS_PARAM_TELESERVICE_MASK) &&
+               (pMsgInfo->ParamMask & SMS_PARAM_ADDRESS_MASK) &&
+               (pMsgInfo->ParamMask & SMS_PARAM_MESSAGE_ID_MASK)))
+               return TCORE_RETURN_EINVAL;
+
+       pCancel = (struct telephony_sms_Is637OutCancel *)&(pMsgInfo->MsgData.outCancel);
+
+       // 3. teleservice
+       output[index++] = TIZEN_SMSPARAMID_TELESERVICE_ID;
+       output[index++] = 2;
+       memcpy(output+index, &pCancel->TeleService, sizeof(unsigned short));
+       index += sizeof(unsigned short);
+
+
+       // 4. Destination address
+       output[index++] = TIZEN_SMSPARAMID_ADDRESS;
+       output[index++] = pCancel->DstAddr.szAddrLength + 5;
+       output[index++] = (unsigned char)pCancel->DstAddr.Digit;
+       output[index++] = (unsigned char)pCancel->DstAddr.NumberMode;
+       output[index++] = (unsigned char)pCancel->DstAddr.NumberType;
+       output[index++] = (unsigned char)pCancel->DstAddr.NumberPlan;
+       output[index++] = (unsigned char)pCancel->DstAddr.szAddrLength;
+       if(pCancel->DstAddr.szAddrLength > SMS_MAXLENGTH_SMS_ADDRESS)
+               api_err = TCORE_RETURN_EINVAL;
+       else{
+               memcpy(output+ index, pCancel->DstAddr.szAddress, pCancel->DstAddr.szAddrLength);
+               index += pCancel->DstAddr.szAddrLength;
+       }
+
+       // 5. Subaddress (optional)
+       if((api_err == TCORE_RETURN_SUCCESS)  && (pMsgInfo->ParamMask & SMS_PARAM_SUBADDRESS_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_SUBADDRESS;
+               output[index++] = pCancel->DstSubAddr.szAddrLength + 3;
+               output[index++] = pCancel->DstSubAddr.SubType;
+               output[index++] = pCancel->DstSubAddr.Odd;
+               output[index++] = pCancel->DstSubAddr.szAddrLength;
+               if(pCancel->DstSubAddr.szAddrLength > SMS_MAXLENGTH_SMS_ADDRESS)
+                       api_err = TCORE_RETURN_EINVAL;
+               else{
+                       memcpy(output+ index, pCancel->DstSubAddr.szAddress, pCancel->DstSubAddr.szAddrLength);
+                       index += pCancel->DstSubAddr.szAddrLength;
+               }
+       }
+
+       // 6. Bearer Reply Option
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_BEARER_REPLY_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_BEARER_REPLY;
+               output[index++] = 1;
+               if(pCancel->ReplySeqNumber >= 64)
+                       api_err = TCORE_RETURN_EINVAL;
+               else output[index++] = pCancel->ReplySeqNumber;
+       }
+
+       // 7. Message Id
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_MESSAGE_ID_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_MESSAGE_ID;
+               output[index++] = 3;
+               output[index++] = TIZEN_MESSAGETYPE_CANCEL;
+               memcpy(output+ index, &pCancel->MsgId, sizeof(unsigned short));
+               index += sizeof(unsigned short);
+       }
+
+       *pos = index;
+
+       return api_err;
+}
+
+static TReturn util_sms_encode_user_ack_message(const struct telephony_sms_CdmaMsgInfo *pMsgInfo, unsigned char *output, unsigned int *pos)
+{
+       TReturn api_err = TCORE_RETURN_SUCCESS;
+       struct telephony_sms_Is637OutAck *pUserAck = NULL;
+       unsigned int index = 0;
+
+       // 1. check null pointer
+       if(pMsgInfo == NULL || output == NULL || pos == NULL)
+               return TCORE_RETURN_EINVAL;
+
+       if(!((pMsgInfo->ParamMask & SMS_PARAM_TELESERVICE_MASK) &&
+               (pMsgInfo->ParamMask & SMS_PARAM_ADDRESS_MASK) &&
+               (pMsgInfo->ParamMask & SMS_PARAM_MESSAGE_ID_MASK)))
+                               return TCORE_RETURN_EINVAL;
+
+       pUserAck = (struct telephony_sms_Is637OutAck *)&(pMsgInfo->MsgData.outAck);
+
+       // 3. teleservice
+       output[index++] = TIZEN_SMSPARAMID_TELESERVICE_ID;
+       output[index++] = 2;
+       memcpy(output+index, &pUserAck->TeleService, sizeof(unsigned short));
+       index += sizeof(unsigned short);
+
+
+       // 4. Destination address
+       output[index++] = TIZEN_SMSPARAMID_ADDRESS;
+       output[index++] = pUserAck->DstAddr.szAddrLength + 5;
+       output[index++] = (unsigned char)pUserAck->DstAddr.Digit;
+       output[index++] = (unsigned char)pUserAck->DstAddr.NumberMode;
+       output[index++] = (unsigned char)pUserAck->DstAddr.NumberType;
+       output[index++] = (unsigned char)pUserAck->DstAddr.NumberPlan;
+       output[index++] = (unsigned char)pUserAck->DstAddr.szAddrLength;
+       if(pUserAck->DstAddr.szAddrLength > SMS_MAXLENGTH_SMS_ADDRESS)
+               api_err = TCORE_RETURN_EINVAL;
+       else{
+               memcpy(output+ index, pUserAck->DstAddr.szAddress, pUserAck->DstAddr.szAddrLength);
+               index += pUserAck->DstAddr.szAddrLength;
+       }
+
+       // 5. Subaddress (optional)
+       if((api_err == TCORE_RETURN_SUCCESS)  && (pMsgInfo->ParamMask & SMS_PARAM_SUBADDRESS_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_SUBADDRESS;
+               output[index++] = pUserAck->DstSubAddr.szAddrLength + 3;
+               output[index++] = pUserAck->DstSubAddr.SubType;
+               output[index++] = pUserAck->DstSubAddr.Odd;
+               output[index++] = pUserAck->DstSubAddr.szAddrLength;
+               if(pUserAck->DstSubAddr.szAddrLength > SMS_MAXLENGTH_SMS_ADDRESS)
+                       api_err = TCORE_RETURN_EINVAL;
+               else{
+                       memcpy(output+ index, pUserAck->DstSubAddr.szAddress, pUserAck->DstSubAddr.szAddrLength);
+                       index += pUserAck->DstSubAddr.szAddrLength;
+               }
+       }
+
+       // 6. Bearer Reply Option
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_BEARER_REPLY_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_BEARER_REPLY;
+               output[index++] = 1;
+               if(pUserAck->ReplySeqNumber >= 64)
+                       api_err = TCORE_RETURN_EINVAL;
+               else output[index++] = pUserAck->ReplySeqNumber;
+       }
+
+       // 7. Message Id
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_MESSAGE_ID_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_MESSAGE_ID;
+               output[index++] = 3;
+               output[index++] = TIZEN_MESSAGETYPE_USER_ACK;
+               memcpy(output+ index, &pUserAck->MsgId, sizeof(unsigned short));
+               index += sizeof(unsigned short);
+       }
+
+       // 8. User Data
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_USER_DATA_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_USER_DATA;
+               output[index++] = 2 + pUserAck->MsgEncoding;
+               output[index++] = pUserAck->MsgLength;
+               if(pUserAck->MsgLength > SMS_MAXLENGTH_SMS_MO_USER_DATA)
+                       api_err = TCORE_RETURN_EINVAL;
+               else{
+                       memcpy(output+ index, pUserAck->szData, pUserAck->MsgLength);
+                       index += pUserAck->MsgLength;
+               }
+       }
+
+       // 9. User Response Code
+       if((api_err == TCORE_RETURN_SUCCESS) && (pMsgInfo->ParamMask & SMS_PARAM_USER_RESPONSE_CODE_MASK)){
+               output[index++] = TIZEN_SMSPARAMID_USER_RESPONSE_CODE;
+               output[index++] = 1;
+               output[index++] = pUserAck->UserResponseCode;
+       }
+
+       *pos = index;
+
+       return api_err;
+}
+
+static int util_sms_decode_inDeliver_message(unsigned char *incoming, unsigned int length, struct telephony_sms_CdmaMsgInfo *pMsgInfo)
+{
+       int rtn = TRUE;
+       unsigned int    index = 0;
+       unsigned int    ParamLen = 0;
+       struct telephony_sms_Is637InDeliver *InDeliver = NULL;
+
+       dbg("Parsing Bearer Data below, Total length[0x%x]", (unsigned int)length);
+
+       if(incoming == NULL || pMsgInfo == NULL)
+               return FALSE;
+
+       InDeliver = &(pMsgInfo->MsgData.inDeliver);
+
+       do{
+               if(incoming[index] == TIZEN_SMSPARAMID_USER_DATA){
+                       int i=0;
+                       dbg("ParamID[TIZEN_SMSPARAMID_USER_DATA=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       InDeliver->MsgEncoding = incoming[++index];
+                       InDeliver->MsgLength = incoming[++index];
+                       memcpy(InDeliver->szData, incoming+ ++index, InDeliver->MsgLength);
+                       index += InDeliver->MsgLength;
+                       pMsgInfo->ParamMask |= SMS_PARAM_USER_DATA_MASK;
+                       dbg("MsgEnconding[0x%x], MsgLength[%d]",
+                               InDeliver->MsgEncoding, InDeliver->MsgLength);
+
+                       for(i = 0 ; i < InDeliver->MsgLength ; i++)
+                       {
+                               dbg("Index[%d] Char[0x%x]", i, InDeliver->szData[i]);
+                       }
+                       dbg("Final Index[0x%x]", (unsigned int)index);
+
+
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_VALIDITY_PERIOD_ABS){
+                       dbg("ParamID[TIZEN_SMSPARAMID_VALIDITY_PERIOD_ABS=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       InDeliver->ValidityPeriodAbs.year = incoming[++index];
+                       InDeliver->ValidityPeriodAbs.month = incoming[++index];
+                       InDeliver->ValidityPeriodAbs.day = incoming[++index];
+                       InDeliver->ValidityPeriodAbs.hours = incoming[++index];
+                       InDeliver->ValidityPeriodAbs.minutes = incoming[++index];
+                       InDeliver->ValidityPeriodAbs.seconds = incoming[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_VALIDITY_PERIOD_ABS_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_VALIDITY_PERIOD_REL){
+                       dbg("ParamID[TIZEN_SMSPARAMID_VALIDITY_PERIOD_REL=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       InDeliver->ValidityPeriodRel = incoming[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_VALIDITY_PERIOD_REL_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_MC_TIME_STAMP){
+                       dbg("ParamID[TIZEN_SMSPARAMID_MC_TIME_STAMP=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       InDeliver->MessageCenterTimeStamp.year = incoming[++index];
+                       InDeliver->MessageCenterTimeStamp.month = incoming[++index];
+                       InDeliver->MessageCenterTimeStamp.day = incoming[++index];
+                       InDeliver->MessageCenterTimeStamp.hours = incoming[++index];
+                       InDeliver->MessageCenterTimeStamp.minutes = incoming[++index];
+                       InDeliver->MessageCenterTimeStamp.seconds = incoming[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_MC_TIME_STAMP_MASK;
+               }
+
+               else if(incoming[index] == TIZEN_SMSPARAMID_PRIORITY){
+                       dbg("ParamID[TIZEN_SMSPARAMID_PRIORITY=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       InDeliver->Priority = incoming[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_PRIORITY_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_PRIVACY){
+                       dbg("ParamID[TIZEN_SMSPARAMID_PRIVACY=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       InDeliver->Privacy = incoming[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_PRIVACY_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_NUMBER_OF_MESSAGE){
+                       dbg("ParamID[TIZEN_SMSPARAMID_NUMBER_OF_MESSAGE=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       InDeliver->NumMsg = incoming[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_NUMBER_OF_MESSAGE_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_ALERT_ON_DELIVERY){
+                       dbg("ParamID[TIZEN_SMSPARAMID_ALERT_ON_DELIVERY=0x%x], ParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       InDeliver->AlertPriority = incoming[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_ALERT_ON_DELIVERY_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_LANGUAGE){
+                       dbg("ParamID[TIZEN_SMSPARAMID_LANGUAGE=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       InDeliver->MsgLang = incoming[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_LANGUAGE_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_REPLY_OPTION){
+                       dbg("ParamID[TIZEN_SMSPARAMID_REPLY_OPTION=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       InDeliver->bUserAckRequest = (int)incoming[++index];
+                       InDeliver->bDeliveryAckRequest = (int)incoming[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_REPLY_OPTION_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_CALLBACK){
+                       dbg("ParamID[TIZEN_SMSPARAMID_CALLBACK=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       InDeliver->CallBackNumer.Digit = incoming[++index];
+                       InDeliver->CallBackNumer.NumberType= incoming[++index];
+                       InDeliver->CallBackNumer.NumberPlan = incoming[++index];
+                       InDeliver->CallBackNumer.szAddrLength = incoming[++index];
+                       memcpy(InDeliver->CallBackNumer.szAddress, incoming+ ++index, InDeliver->CallBackNumer.szAddrLength);
+                       index+= InDeliver->CallBackNumer.szAddrLength;
+                       pMsgInfo->ParamMask |= TIZEN_SMSPARAMID_CALLBACK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_DISPLAY_MODE){
+                       dbg("ParamID[TIZEN_SMSPARAMID_DISPLAY_MODE=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       InDeliver->Display= incoming[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_DISPLAY_MODE_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_MEMORY_INDEX){
+                       dbg("ParamID[TIZEN_SMSPARAMID_MEMORY_INDEX=0x%x]\tindex + 4", incoming[index]);
+                       index += 4;
+               }
+
+               else
+               {
+                       dbg("Undefined SMS Parameter ID [0x%x] in the Bearer Data", incoming[index]);
+                       rtn = FALSE;
+                       break;
+               }
+       }while(!(index == length));
+
+       return rtn;
+}
+
+static int util_sms_decode_inAck_message(unsigned char *incoming, unsigned int length, struct telephony_sms_CdmaMsgInfo *pMsgInfo)
+{
+       int rtn = TRUE;
+       struct telephony_sms_Is637InAck *InAck = NULL;
+       unsigned int    index = 0;
+       unsigned int    ParamLen = 0;
+
+       if(incoming == NULL || pMsgInfo == NULL)
+               return FALSE;
+
+       InAck = &(pMsgInfo->MsgData.inAck);
+       do{
+               if(incoming[index] == TIZEN_SMSPARAMID_USER_DATA){
+                       ParamLen = incoming[++index];    //parameter length
+                       InAck->MsgEncoding = incoming[++index];
+                       InAck->MsgLength = incoming[++index];
+                       memcpy(InAck->szData, incoming+ ++index, InAck->MsgLength);
+                       index += InAck->MsgLength;
+                       pMsgInfo->ParamMask |= SMS_PARAM_USER_DATA_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_USER_RESPONSE_CODE){
+                       ParamLen = incoming[++index];    //parameter length
+                       InAck->MsgEncoding = incoming[++index];
+                       InAck->UserResponseCode = incoming[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_USER_RESPONSE_CODE_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_MC_TIME_STAMP){
+                       ParamLen = incoming[++index];    //parameter length
+                       InAck->MessageCenterTimeStamp.year = incoming[++index];
+                       InAck->MessageCenterTimeStamp.month = incoming[++index];
+                       InAck->MessageCenterTimeStamp.day = incoming[++index];
+                       InAck->MessageCenterTimeStamp.hours = incoming[++index];
+                       InAck->MessageCenterTimeStamp.minutes = incoming[++index];
+                       InAck->MessageCenterTimeStamp.seconds = incoming[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_MC_TIME_STAMP_MASK;
+               }
+               else{
+                       rtn = FALSE;
+                       break;
+               }
+       }while(!(index == length));
+
+       return rtn;
+}
+
+static int util_sms_decode_inDeliverAck_message(unsigned char *incoming, unsigned int length, struct telephony_sms_CdmaMsgInfo *pMsgInfo)
+{
+       int rtn = TRUE;
+       struct telephony_sms_Is637InDeliverAck *InDelAck = NULL;
+       unsigned int    index = 0;
+       unsigned int    ParamLen = 0;
+
+       if(incoming == NULL || pMsgInfo == NULL)
+               return FALSE;
+
+       InDelAck = &(pMsgInfo->MsgData.inDeliverAck);
+       do{
+               if(incoming[index] == TIZEN_SMSPARAMID_USER_DATA){
+                       ParamLen = incoming[++index];    //parameter length
+                       InDelAck->MsgEncoding = incoming[++index];
+                       InDelAck->MsgLength = incoming[++index];
+                       memcpy(InDelAck->szData, incoming+ ++index, InDelAck->MsgLength);
+                       index += InDelAck->MsgLength;
+                       pMsgInfo->ParamMask |= SMS_PARAM_USER_DATA_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_MC_TIME_STAMP){
+                       ParamLen = incoming[++index];    //parameter length
+                       InDelAck->MessageCenterTimeStamp.year = incoming[++index];
+                       InDelAck->MessageCenterTimeStamp.month = incoming[++index];
+                       InDelAck->MessageCenterTimeStamp.day = incoming[++index];
+                       InDelAck->MessageCenterTimeStamp.hours = incoming[++index];
+                       InDelAck->MessageCenterTimeStamp.minutes = incoming[++index];
+                       InDelAck->MessageCenterTimeStamp.seconds = incoming[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_MC_TIME_STAMP_MASK;
+               }
+               else{
+                       rtn = FALSE;
+                       break;
+               }
+       }while(!(index == length));
+
+       return rtn;
+}
+
+static int util_sms_decode_ptp_message(unsigned char *incoming, unsigned int length, struct telephony_sms_CdmaMsgInfo *pMsgInfo)
+{
+       int rtn = TRUE;
+       unsigned int    index = 0;
+       unsigned int    ParamLen = 0;
+       struct telephony_sms_Is637InDeliver *pCommon = NULL;
+       enum telephony_sms_CdmaMsgType type;
+
+       if(incoming == NULL || pMsgInfo == NULL)
+               return FALSE;
+
+       pCommon = &(pMsgInfo->MsgData.inDeliver);
+
+       do{
+               if(incoming[index] == TIZEN_SMSPARAMID_TELESERVICE_ID)
+               {
+                       dbg("ParamID[TIZEN_SMSPARAMID_TELESERVICE_ID=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       memcpy(&pCommon->TeleService, incoming+ ++index, ParamLen);
+                       index += ParamLen;
+                       pMsgInfo->ParamMask |= SMS_PARAM_TELESERVICE_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_ADDRESS)
+               {
+                       dbg("ParamID[TIZEN_SMSPARAMID_ADDRESS=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       pCommon->OrigAddr.Digit = incoming[++index];
+                       pCommon->OrigAddr.NumberMode = incoming[++index];
+                       pCommon->OrigAddr.NumberType = incoming[++index];
+                       pCommon->OrigAddr.NumberPlan = incoming[++index];
+                       pCommon->OrigAddr.szAddrLength = incoming[++index];
+                       memcpy(pCommon->OrigAddr.szAddress, incoming+ ++index, pCommon->OrigAddr.szAddrLength);
+                       index += pCommon->OrigAddr.szAddrLength;
+                       pMsgInfo->ParamMask |= SMS_PARAM_ADDRESS_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_SUBADDRESS)
+               {
+                       dbg("ParamID[TIZEN_SMSPARAMID_SUBADDRESS=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       pCommon->OrigSubAddr.SubType =  incoming[++index];
+                       pCommon->OrigSubAddr.Odd =  incoming[++index];
+                       pCommon->OrigSubAddr.szAddrLength = incoming[++index];
+                       memcpy(pCommon->OrigSubAddr.szAddress, incoming+ ++index, pCommon->OrigSubAddr.szAddrLength);
+                       index += pCommon->OrigSubAddr.szAddrLength;
+                       pMsgInfo->ParamMask |= SMS_PARAM_SUBADDRESS_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_BEARER_REPLY)
+               {
+                       dbg("ParamID[TIZEN_SMSPARAMID_BEARER_REPLY=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       pCommon->bBearerReplySeqRequest = (int)TRUE;
+                       pCommon->ReplySeqNumber = incoming[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_BEARER_REPLY_MASK;
+               }
+               else if(incoming[index] == TIZEN_SMSPARAMID_MESSAGE_ID)
+               {
+                       dbg("ParamID[TIZEN_SMSPARAMID_MESSAGE_ID=0x%x]\tParamLen[%d]", incoming[index], incoming[index+1]);
+                       ParamLen = incoming[++index];    //parameter length
+                       type = incoming[++index];
+                       pMsgInfo->MsgType = type;
+                       memcpy(&pCommon->MsgId, incoming+ ++index, sizeof(unsigned short));
+                       index += sizeof(unsigned short);
+                       pMsgInfo->ParamMask |= SMS_PARAM_MESSAGE_ID_MASK;
+                       switch(type)
+                       {
+                               case SMS_MESSAGETYPE_DELIVER:
+                                       dbg("SubParamID[SMS_MESSAGETYPE_DELIVER=0x%x]", type);
+                                       dbg("Current Index[0x%x], Parsing Length[0x%x], ParamLen[0x%x]", (unsigned int)index, (unsigned int)length, (unsigned int)ParamLen);
+
+                                       rtn = util_sms_decode_inDeliver_message(incoming+index, length - index, pMsgInfo);
+
+                                       break;
+                               case SMS_MESSAGETYPE_DELIVERY_ACK:
+                                       dbg("SubParamID[SMS_MESSAGETYPE_DELIVERY_ACK=0x%x]", type);
+
+                                       rtn = util_sms_decode_inAck_message(incoming+index, length - index, pMsgInfo);
+
+                                       break;
+                               case SMS_MESSAGETYPE_USER_ACK:
+                                       dbg("SubParamID[SMS_MESSAGETYPE_USER_ACK=0x%x]", type);
+
+                                       rtn = util_sms_decode_inDeliverAck_message(incoming+index, length - index, pMsgInfo);
+
+                                       break;
+                               default:
+                                       dbg("Unknown Incoming Message Type = %d", type);
+                                       rtn = FALSE;
+                                       break;
+                       }
+                       index = length;
+               }
+               else
+               {
+                       dbg("ParamID[Undefined]");
+                       //rtn = FALSE;
+                       break;
+               }
+
+       }while(!(index == length));
+
+       return rtn;
+}
+
+static int util_sms_decode_broadcast_message(unsigned char *bcmsg, unsigned int length, struct telephony_sms_CdmaMsgInfo *pMsgInfo)
+{
+       int rtn = TRUE;
+       unsigned int    index = 0;
+       unsigned int    ParamLen = 0;
+       struct telephony_sms_Is637InBroadCast *pOutput = NULL;
+
+       if(bcmsg == NULL || pMsgInfo == NULL)
+               return FALSE;
+
+       pOutput = &(pMsgInfo->MsgData.inBc);
+
+       do{
+               if(bcmsg[index] == TIZEN_SMSPARAMID_SERVICE_CATEGORY){
+                       ParamLen = bcmsg[++index];       //parameter length
+                       memcpy(&pOutput->ServiceCategory, bcmsg+ ++index, ParamLen);
+                       index += ParamLen;
+                       pMsgInfo->ParamMask |= SMS_PARAM_SERVICE_CATEGORY_MASK;
+               }
+               else if(bcmsg[index] == TIZEN_SMSPARAMID_BEARER_REPLY){
+                       ParamLen = bcmsg[++index];       //parameter length
+                       pOutput->bBearerReplySeqRequest = (int)TRUE;
+                       pOutput->ReplySeqNumber = bcmsg[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_BEARER_REPLY_MASK;
+               }
+               else if(bcmsg[index] == TIZEN_SMSPARAMID_MESSAGE_ID){
+                       ParamLen = bcmsg[++index];       //parameter length
+                       memcpy(&pOutput->MsgId, bcmsg+ ++index, ParamLen);
+                       index += ParamLen;
+                       pMsgInfo->ParamMask |= SMS_PARAM_MESSAGE_ID_MASK;
+               }
+               else if(bcmsg[index] == TIZEN_SMSPARAMID_VALIDITY_PERIOD_ABS){
+                       ParamLen = bcmsg[++index];       //parameter length
+                       pOutput->ValidityPeriodAbs.year = bcmsg[++index];
+                       pOutput->ValidityPeriodAbs.month = bcmsg[++index];
+                       pOutput->ValidityPeriodAbs.day = bcmsg[++index];
+                       pOutput->ValidityPeriodAbs.hours = bcmsg[++index];
+                       pOutput->ValidityPeriodAbs.minutes = bcmsg[++index];
+                       pOutput->ValidityPeriodAbs.seconds = bcmsg[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_VALIDITY_PERIOD_ABS_MASK;
+               }
+               else if(bcmsg[index] == TIZEN_SMSPARAMID_VALIDITY_PERIOD_REL){
+                       ParamLen = bcmsg[++index];       //parameter length
+                       pOutput->ValidityPeriodRel = bcmsg[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_VALIDITY_PERIOD_REL_MASK;
+               }
+               else if(bcmsg[index] == TIZEN_SMSPARAMID_MC_TIME_STAMP){
+                       ParamLen = bcmsg[++index];       //parameter length
+                       pOutput->MessageCenterTimeStamp.year = bcmsg[++index];
+                       pOutput->MessageCenterTimeStamp.month = bcmsg[++index];
+                       pOutput->MessageCenterTimeStamp.day = bcmsg[++index];
+                       pOutput->MessageCenterTimeStamp.hours = bcmsg[++index];
+                       pOutput->MessageCenterTimeStamp.minutes = bcmsg[++index];
+                       pOutput->MessageCenterTimeStamp.seconds = bcmsg[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_MC_TIME_STAMP_MASK;
+               }
+               else if(bcmsg[index] == TIZEN_SMSPARAMID_PRIORITY){
+                       ParamLen = bcmsg[++index];       //parameter length
+                       pOutput->Priority= bcmsg[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_PRIORITY_MASK;
+               }
+               else if(bcmsg[index] == TIZEN_SMSPARAMID_ALERT_ON_DELIVERY){
+                       ParamLen = bcmsg[++index];       //parameter length
+                       pOutput->AlertPriority = bcmsg[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_ALERT_ON_DELIVERY_MASK;
+               }
+               else if(bcmsg[index] == TIZEN_SMSPARAMID_LANGUAGE){
+                       ParamLen = bcmsg[++index];       //parameter length
+                       pOutput->MsgLang = bcmsg[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_LANGUAGE_MASK;
+               }
+               else if(bcmsg[index] == TIZEN_SMSPARAMID_DISPLAY_MODE){
+                       ParamLen = bcmsg[++index];       //parameter length
+                       pOutput->Display = bcmsg[++index];
+                       index++;
+                       pMsgInfo->ParamMask |= SMS_PARAM_DISPLAY_MODE_MASK;
+               }
+               else if(bcmsg[index] == TIZEN_SMSPARAMID_USER_DATA){
+                       ParamLen = bcmsg[++index];       //parameter length
+                       pOutput->MsgEncoding = bcmsg[++index];
+                       pOutput->MsgLength = bcmsg[++index];
+                       memcpy(pOutput->szData, bcmsg+ ++index, pOutput->MsgLength);
+                       index += pOutput->MsgLength;
+                       pMsgInfo->ParamMask |= SMS_PARAM_USER_DATA_MASK;
+               }
+               else{
+                       rtn = FALSE;
+                       break;
+               }
+
+       }while(!(index == length));
+
+       return rtn;
+}
+
+static int util_sms_decode_smsParameters(unsigned char *incoming, unsigned int length, struct telephony_sms_Params *params)
+{
+       int alpha_id_len = 0;
+       int i = 0;
+       int nOffset = 0;
+
+       dbg(" RecordLen = %d", length);
+
+       if(incoming == NULL || params == NULL)
+               return FALSE;
+
+       alpha_id_len = length -SMS_SMSP_PARAMS_MAX_LEN;
+
+       if (alpha_id_len > 0)
+       {
+               if(alpha_id_len > SMS_SMSP_ALPHA_ID_LEN_MAX)
+               {
+                       alpha_id_len = SMS_SMSP_ALPHA_ID_LEN_MAX;
+               }
+
+               for(i=0 ; i < alpha_id_len ; i++)
+               {
+                       if(0xff == incoming[i])
+                       {
+                               dbg(" found");
+                               break;
+                       }
+               }
+
+               memcpy(params->szAlphaId, incoming, i);
+
+               params->alphaIdLen = i;
+
+               dbg(" Alpha id length = %d", i);
+
+       }
+       else
+       {
+               params->alphaIdLen = 0;
+               dbg(" Alpha id length is zero");
+       }
+
+       //dongil01.park - start parse from here.
+       params->paramIndicator = incoming[alpha_id_len];
+
+       dbg(" Param Indicator = %02x", params->paramIndicator);
+
+       //dongil01.park(2008/12/26) - DestAddr
+       if((params->paramIndicator & SMSPValidDestAddr) == 0)
+       {
+               nOffset = nDestAddrOffset;
+
+               if(0x00 == incoming[alpha_id_len + nOffset] || 0xff == incoming[alpha_id_len + nOffset])
+               {
+                       params->tpDestAddr.dialNumLen = 0;
+
+                       dbg("DestAddr Length is 0");
+               }
+               else
+               {
+                       if (0 < (int)incoming[alpha_id_len + nOffset])
+                       {
+                               params->tpDestAddr.dialNumLen = (int)(incoming[alpha_id_len + nOffset] - 1);
+
+                               if(params->tpDestAddr.dialNumLen > SMS_SMSP_ADDRESS_LEN)
+                                       params->tpDestAddr.dialNumLen = SMS_SMSP_ADDRESS_LEN;
+                       }
+                       else
+                       {
+                               params->tpDestAddr.dialNumLen = 0;
+                       }
+
+                       params->tpDestAddr.numPlanId= incoming[alpha_id_len + (++nOffset)] & 0x0f ;
+                       params->tpDestAddr.typeOfNum= (incoming[alpha_id_len + nOffset] & 0x70)>>4 ;
+
+                       memcpy(params->tpDestAddr.diallingNum, &incoming[alpha_id_len + (++nOffset)], (params->tpDestAddr.dialNumLen)) ;
+
+                       dbg("Dest TON is %d",params->tpDestAddr.typeOfNum);
+                       dbg("Dest NPI is %d",params->tpDestAddr.numPlanId);
+                       dbg("Dest Length = %d",params->tpDestAddr.dialNumLen);
+                       dbg("Dest Addr = %s",params->tpDestAddr.diallingNum);
+
+               }
+       }
+
+       //dongil01.park(2008/12/26) - SvcAddr
+       if((params->paramIndicator & SMSPValidSvcAddr) == 0)
+       {
+               nOffset = nSCAAddrOffset;
+
+               if(0x00 == (int)incoming[alpha_id_len + nOffset] || 0xff == (int)incoming[alpha_id_len + nOffset])
+               {
+                       params->tpSvcCntrAddr.dialNumLen = 0;
+
+                       dbg(" SCAddr Length is 0");
+               }
+               else
+               {
+                       if (0 < (int)incoming[alpha_id_len + nOffset] )
+                       {
+                               params->tpSvcCntrAddr.dialNumLen = (int)(incoming[alpha_id_len + nOffset] - 1);
+
+                               if(params->tpSvcCntrAddr.dialNumLen > SMS_SMSP_ADDRESS_LEN)
+                                       params->tpSvcCntrAddr.dialNumLen = SMS_SMSP_ADDRESS_LEN;
+
+                               params->tpSvcCntrAddr.numPlanId= incoming[alpha_id_len + (++nOffset)] & 0x0f ;
+                               params->tpSvcCntrAddr.typeOfNum= (incoming[alpha_id_len + nOffset] & 0x70) >>4 ;
+
+                               memcpy(params->tpSvcCntrAddr.diallingNum, &incoming[alpha_id_len + (++nOffset)], (params->tpSvcCntrAddr.dialNumLen));
+
+                               dbg("SCAddr Length = %d ",params->tpSvcCntrAddr.dialNumLen);
+                               dbg("SCAddr TON is %d",params->tpSvcCntrAddr.typeOfNum);
+                               dbg("SCAddr NPI is %d",params->tpSvcCntrAddr.numPlanId);
+
+                               for(i = 0 ; i < (int)params->tpSvcCntrAddr.dialNumLen ; i ++)
+                                       dbg("SCAddr = %d [%02x]",i,params->tpSvcCntrAddr.diallingNum[i]);
+                       }
+                       else
+                       {
+                               params->tpSvcCntrAddr.dialNumLen = 0;
+                       }
+               }
+       }
+       else if ((0x00 < (int)incoming[alpha_id_len +nSCAAddrOffset] && (int)incoming[alpha_id_len +nSCAAddrOffset] <= 12)
+                       || 0xff != (int)incoming[alpha_id_len +nSCAAddrOffset])
+       {
+               nOffset = nSCAAddrOffset;
+
+               if(0x00 == (int)incoming[alpha_id_len + nOffset] || 0xff == (int)incoming[alpha_id_len + nOffset])
+               {
+                       params->tpSvcCntrAddr.dialNumLen = 0;
+                       dbg("SCAddr Length is 0");
+               }
+               else
+               {
+
+                       if (0 < (int)incoming[alpha_id_len + nOffset] )
+                       {
+                               params->tpSvcCntrAddr.dialNumLen = (int)(incoming[alpha_id_len + nOffset] - 1);
+
+                               params->tpSvcCntrAddr.dialNumLen = incoming[alpha_id_len + nOffset] -1;
+
+                               if(params->tpSvcCntrAddr.dialNumLen > SMS_SMSP_ADDRESS_LEN)
+                                       params->tpSvcCntrAddr.dialNumLen = SMS_SMSP_ADDRESS_LEN;
+
+                               params->tpSvcCntrAddr.numPlanId= incoming[alpha_id_len + (++nOffset)] & 0x0f ;
+                               params->tpSvcCntrAddr.typeOfNum= (incoming[alpha_id_len + nOffset] & 0x70) >>4 ;
+
+                               memcpy(params->tpSvcCntrAddr.diallingNum, &incoming[alpha_id_len + (++nOffset)],
+                                               (params->tpSvcCntrAddr.dialNumLen)) ;
+
+                               dbg("SCAddr Length = %d ",params->tpSvcCntrAddr.dialNumLen);
+                               dbg("SCAddr TON is %d",params->tpSvcCntrAddr.typeOfNum);
+                               dbg("SCAddr NPI is %d",params->tpSvcCntrAddr.numPlanId);
+
+                               for(i = 0 ; i < (int)params->tpSvcCntrAddr.dialNumLen ; i ++)
+                                       dbg("SCAddr = %d [%02x]",i,params->tpSvcCntrAddr.diallingNum[i]);
+                       }
+                       else
+                       {
+                               params->tpSvcCntrAddr.dialNumLen = 0;
+                       }
+               }
+
+       }
+
+       if((params->paramIndicator & SMSPValidPID) == 0 &&      (alpha_id_len + nPIDOffset) < MAX_GSM_SMS_PARAM_RECORD_SIZE)
+       {
+               params->tpProtocolId = incoming[alpha_id_len + nPIDOffset];
+       }
+       if((params->paramIndicator & SMSPValidDCS) == 0 && (alpha_id_len + nDCSOffset) < MAX_GSM_SMS_PARAM_RECORD_SIZE)
+       {
+               params->tpDataCodingScheme = incoming[alpha_id_len + nDCSOffset];
+       }
+       if((params->paramIndicator & SMSPValidVP) == 0 && (alpha_id_len + nVPOffset) < MAX_GSM_SMS_PARAM_RECORD_SIZE)
+       {
+               params->tpValidityPeriod = incoming[alpha_id_len + nVPOffset];
+       }
+
+       dbg(" Alpha Id(Len) = %d",(int)params->alphaIdLen);
+
+       for (i=0; i< (int)params->alphaIdLen ; i++)
+       {
+               dbg(" Alpha Id = [%d] [%c]",i,params->szAlphaId[i]);
+       }
+       dbg(" PID = %d",params->tpProtocolId);
+       dbg(" DCS = %d",params->tpDataCodingScheme);
+       dbg(" VP = %d",params->tpValidityPeriod);
+
+       return TRUE;
+}
+
+/************************************************************/
+/************************  Events Cb  *************************/
+/************************************************************/
+
+static gboolean on_event_sms_ready_status(CoreObject *o, const void *event_info, void *user_data)
+{
+       struct tnoti_sms_ready_status readyStatusInfo = {0,};
+       char *line = NULL;
+       GSList* tokens = NULL;
+       GSList* lines = NULL;
+       char *pResp = NULL;
+       //CoreObject *o = NULL;
+       
+       int rtn = -1 , status = 0;
+
+       dbg(" Func Entrance");
+
+       lines = (GSList *)event_info;
+       if (1 != g_slist_length(lines))
+       {
+               dbg("unsolicited msg but multiple line");
+               goto OUT;
+       }
+       line = (char *)(lines->data);
+
+       dbg(" Func Entrance");
+
+       if(line!=NULL)
+       {
+               dbg("Response OK");
+                       dbg("noti line is %s", line);
+                       tokens = tcore_at_tok_new(line);
+                       pResp = g_slist_nth_data(tokens, 0);
+                       if (pResp !=NULL)
+                               status = atoi(pResp);
+
+       }
+       else
+       {
+               dbg("Response NOK");
+       }               
+
+       if (status == AT_SMS_DEVICE_READY)
+       {
+               readyStatusInfo.status = SMS_DEVICE_READY;
+               tcore_sms_set_ready_status(o, readyStatusInfo.status);
+               dbg("SMS Ready status = [%s]", readyStatusInfo.status ? "TRUE" : "FALSE");
+               rtn = tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SMS_DEVICE_READY, sizeof(struct tnoti_sms_ready_status), &readyStatusInfo);
+               dbg(" Return value [%d]",rtn);
+       }
+       else
+       {
+               readyStatusInfo.status = SMS_DEVICE_NOT_READY;
+       }
+
+OUT:
+       if(NULL!=tokens)
+               tcore_at_tok_free(tokens);
+       return TRUE;
+}
+
+
+
+static gboolean on_event_sms_incom_msg(CoreObject *o, const void *event_info, void *user_data)
+{
+       struct property_sms_info *property;
+       
+
+       int rtn = -1, ScLength = 0, i = 0 , alpha = 0;
+       unsigned char format = 0;
+       unsigned char LastSemiOctect;
+
+       char * line1 = NULL, *line2 = NULL, *pResp = NULL;
+       GSList *tokens = NULL;
+
+       GSList *lines = NULL;
+       char *line = NULL;
+       int length = 0;
+       unsigned char *bytePDU = NULL;
+       struct tnoti_sms_umts_msg gsmMsgInfo;
+
+       dbg("Entered Function");
+
+       lines = (GSList *)event_info;
+       memset(&gsmMsgInfo, 0x00, sizeof(struct tnoti_sms_umts_msg));
+
+       if(2 != g_slist_length(lines))
+       {
+               err("Invalid number of lines for +CMT. Must be 2");
+               return FALSE;
+       }
+       
+       line = (char *)g_slist_nth_data(lines, 0); /* Fetch Line 1 */
+
+       dbg("Line 1: [%s]", line);
+       
+       if (!line)
+       {
+               err("Line 1 is invalid");
+               return FALSE;
+       }
+
+       tokens = tcore_at_tok_new(line); /* Split Line 1 into tokens */
+
+       dbg("Alpha ID: [%02x]", g_slist_nth_data(tokens, 0)); /* 0: Alpha ID */
+
+       length = atoi((char *)g_slist_nth_data(tokens, 1));
+
+       dbg("Length: [%d]", length);    /* 1: PDU Length */
+
+       gsmMsgInfo.msgInfo.msgLength = length;
+
+       line = (char *)g_slist_nth_data(lines, 1); /* Fetch Line 2 */
+
+       dbg("Line 2: [%s]", line);
+       
+       if (!line)
+       {
+               err("Line 2 is invalid");
+               return FALSE;
+       }
+
+       /* Convert to Bytes */
+       bytePDU = (unsigned char *)util_hexStringToBytes(line);
+
+       if(NULL == bytePDU)
+       {
+               err("bytePDU is NULL");
+               return FALSE;
+       }
+
+       memcpy(gsmMsgInfo.msgInfo.sca, bytePDU, (strlen(line)/2 - length));
+       memcpy(gsmMsgInfo.msgInfo.tpduData, &bytePDU[(strlen(line)/2 - length)], length);
+
+       util_hex_dump("      ", strlen(line)/2, bytePDU);
+       util_hex_dump("      ", (strlen(line)/2 - length), gsmMsgInfo.msgInfo.sca);
+       util_hex_dump("      ", length, gsmMsgInfo.msgInfo.tpduData);
+
+       rtn = tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SMS_INCOM_MSG, sizeof(struct tnoti_sms_umts_msg), &gsmMsgInfo);
+       
+       return TRUE;
+}
+
+
+
+static void on_event_sms_send_ack(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+    GSList *lines = NULL;
+       
+    lines = (GSList*)data;
+    return TRUE;
+}
+
+static gboolean on_event_sms_memory_status(CoreObject *o, const void *event_info, void *user_data)
+{
+       struct tnoti_sms_memory_status memStatusInfo = {0,};
+
+       int rtn = -1 ,memoryStatus = 0;
+       const TcoreATResponse *atResp = event_info;
+       GSList *tokens=NULL;
+       GSList *lines=NULL;
+       char *line = NULL , pResp = NULL;
+
+       lines = (GSList *)event_info;
+        if (1 != g_slist_length(lines))
+        {
+                dbg("unsolicited msg but multiple line");
+               return;
+        }
+
+       line = (char*)(lines->data);
+
+
+       dbg(" Func Entrance");
+
+       if (atResp->success)
+       {
+               dbg("Response OK");
+               line = (const char*)lines->data;
+               tokens = tcore_at_tok_new(line);
+               pResp = g_slist_nth_data(tokens, 0);
+
+               if(pResp)
+               {
+                       memoryStatus = atoi(pResp);     
+               }
+               
+       }
+       switch(memoryStatus)
+       {
+               case AT_MEMORY_AVAILABLE:
+                       {
+                               memStatusInfo.status = SMS_PHONE_MEMORY_STATUS_AVAILABLE;
+                               break;
+                       }
+                       
+               case AT_MEMORY_FULL:
+                       {
+                               memStatusInfo.status = SMS_PHONE_MEMORY_STATUS_FULL;
+                               break;
+                       }
+               default:
+                       {
+                               memStatusInfo.status = -1;
+                               break;
+                       }
+       }
+
+       dbg("memory status - %d",memStatusInfo.status);
+
+       rtn = tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SMS_MEMORY_STATUS, sizeof(struct tnoti_sms_memory_status), &memStatusInfo);
+       dbg(" Return value [%d]",rtn);
+
+       return TRUE;
+
+}
+
+static gboolean on_event_sms_cb_incom_msg(CoreObject *o, const void *event_info, void *user_data)
+{
+       //+CBM: <length><CR><LF><pdu>
+
+       struct tnoti_sms_cellBroadcast_msg cbMsgInfo;
+
+       int rtn = -1 , length = 0;
+       char * line = NULL, *pdu = NULL, pResp = NULL;
+       GSList *tokens = NULL;
+       GSList *lines = NULL;
+
+       dbg(" Func Entrance");
+
+       lines = (GSList *)event_info;
+
+       memset(&cbMsgInfo, 0, sizeof(struct tnoti_sms_cellBroadcast_msg));
+
+       if (1 != g_slist_length(lines))
+       {
+               dbg("unsolicited msg but multiple lines");
+               goto OUT;
+       }
+       line = (char *)(lines->data);
+
+       if (line != NULL)
+       {
+                       dbg("Response OK");
+                       dbg("Noti line is %s",line);
+                       pResp = g_slist_nth_data(tokens, 0);
+                       if (pResp)
+                       {
+                               length = atoi(pResp);
+                       }else
+                       {
+                               dbg("token 0 is null");
+                       }
+                       pdu = g_slist_nth_data(tokens, 3);
+                       if (pdu != NULL)
+                       {
+                               cbMsgInfo.cbMsg.length = length;
+                               cbMsgInfo.cbMsg.cbMsgType = SMS_CB_MSG_CBS ; //TODO - Need to check for other CB types
+
+                               dbg("CB Msg LENGTH [%2x](((( %d ))))", length, cbMsgInfo.cbMsg.length);
+
+                               if ( (cbMsgInfo.cbMsg.length >0) && ((SMS_CB_PAGE_SIZE_MAX +1)  > cbMsgInfo.cbMsg.length))
+                               {
+                                       memcpy(cbMsgInfo.cbMsg.msgData, (char*)pdu, cbMsgInfo.cbMsg.length);
+                                       rtn = tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o, TNOTI_SMS_CB_INCOM_MSG, sizeof(struct tnoti_sms_cellBroadcast_msg), &cbMsgInfo);
+                               }
+                               else
+                               {
+                                       dbg("Invalid Message Length");
+                               }
+
+                       }
+                       else
+                       {
+                               dbg("Recieved NULL pdu");
+                       }
+       }
+       else
+       {
+                       dbg("Response NOK");
+       }
+       
+       
+       dbg(" Return value [%d]",rtn);
+
+OUT:
+
+       return;
+
+}
+
+static void on_response_sms_delete_msg_cnf(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       struct tresp_sms_delete_msg delMsgInfo = {0,};
+       UserRequest *ur = NULL;
+       const TcoreATResponse *atResp = data;
+       GSList *tokens=NULL;
+       char *line = NULL , pResp = NULL;
+
+       int rtn = -1 , RequestId = -1;
+       int index = (int *)user_data;
+
+       dbg(" Func Entrance");
+
+       ur = tcore_pending_ref_user_request(p);
+       if (atResp->success)
+       {
+               dbg("Response OK");
+               delMsgInfo.index = index;
+               delMsgInfo.result = SMS_SENDSMS_SUCCESS;
+               
+       }
+       else
+       {
+               dbg("Response NOK");    
+               delMsgInfo.index = index;
+               delMsgInfo.result = SMS_DEVICE_FAILURE;
+
+       }
+
+       rtn = tcore_user_request_send_response(ur, TRESP_SMS_DELETE_MSG, sizeof(struct tresp_sms_delete_msg), &delMsgInfo);
+
+       return;
+}
+
+static void on_response_sms_save_msg_cnf(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       struct tresp_sms_save_msg saveMsgInfo = {0,};
+       UserRequest *ur = NULL;
+       const TcoreATResponse *atResp = data;
+       GSList *tokens = NULL;
+       char *line = NULL;
+       char *pResp = NULL;
+       int rtn = -1, index = -1;
+
+       ur = tcore_pending_ref_user_request(p);
+       if (atResp->success)
+       {
+               dbg("Response OK");
+               if(atResp->lines)
+               {
+                       line = (const char *)atResp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       pResp = g_slist_nth_data(tokens, 0);
+                       if (pResp)
+                       {
+                               dbg("0: %s", pResp);
+                               saveMsgInfo.index = (atoi(pResp) - 1); /* IMC index starts from 1 */
+                               saveMsgInfo.result = SMS_SENDSMS_SUCCESS;
+                       }
+                       else
+                       {
+                               dbg("No Tokens");       
+                               saveMsgInfo.index = -1;
+                               saveMsgInfo.result = SMS_DEVICE_FAILURE;
+                       }
+                        
+               }
+       }
+       else
+       {
+               dbg("Response NOK");    
+               saveMsgInfo.index = -1;
+               saveMsgInfo.result = SMS_DEVICE_FAILURE;
+       }
+
+       rtn = tcore_user_request_send_response(ur, TRESP_SMS_SAVE_MSG, sizeof(struct tresp_sms_save_msg), &saveMsgInfo);
+       dbg("Return value [%d]", rtn);
+       return;
+}
+
+static void on_response_sms_deliver_rpt_cnf(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+
+       struct tresp_sms_set_delivery_report deliverReportInfo = {0,};
+       UserRequest *ur = NULL;
+       const TcoreATResponse *atResp = data;
+       GSList *tokens=NULL;
+       char *line = NULL , pResp = NULL;
+       int rtn = -1;
+
+       dbg(" Func Entrance");
+
+
+       if (atResp->success)
+       {
+               dbg("Response OK");
+               if(atResp->lines) 
+               {
+                       line = (const char*)atResp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                        pResp = g_slist_nth_data(tokens, 0);
+                        if (pResp)
+                       {
+                               deliverReportInfo.result = SMS_SENDSMS_SUCCESS;
+                       }
+                       else
+                       {
+                               dbg("No tokens");       
+                               deliverReportInfo.result = SMS_DEVICE_FAILURE;
+                       }
+               }else
+               {
+                       dbg("No lines");
+                       deliverReportInfo.result = SMS_DEVICE_FAILURE;
+               }
+       }else
+       {
+               dbg("Response NOK");
+       }
+
+
+       rtn = tcore_user_request_send_response(ur, TRESP_SMS_SET_DELIVERY_REPORT, sizeof(struct tresp_sms_set_delivery_report), &deliverReportInfo);
+
+       dbg(" Return value [%d]",rtn);
+
+       return;
+
+}
+
+
+
+/*************************************************************/
+/***********************  Responses Cb  ************************/
+/************************************************************/
+static void on_response_send_umts_msg(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       const TcoreATResponse *resp = data;
+       UserRequest *ur;
+       struct tresp_sms_send_umts_msg respSendMsg;
+
+       GSList *tokens=NULL;
+       int error;
+       char *line = NULL;
+       int ret;
+       int err;
+
+       ur = tcore_pending_ref_user_request(p);
+
+       if (resp->success)
+               {
+                       dbg("RESPONSE OK");
+                       ret = Send_SmsSubmitTpdu(tcore_pending_ref_core_object(p), ur);
+
+                       if(ret != (int)TCORE_RETURN_SUCCESS)
+                       {
+                               respSendMsg.result = SMS_INVALID_PARAMETER;
+                               tcore_user_request_send_response(ur, TRESP_SMS_SEND_UMTS_MSG, sizeof(struct tresp_sms_send_umts_msg), &respSendMsg);
+                       }       
+                       
+               }
+       else
+               {
+                       dbg("RESPONSE N OK");   
+                       memset(&respSendMsg, 0, sizeof(struct tresp_sms_send_umts_msg));
+       
+                       //failure case - consider this later
+                       line = resp->final_response;
+       
+                       respSendMsg.result = SMS_DEVICE_FAILURE;
+
+                       tcore_user_request_send_response(ur, TRESP_SMS_SEND_UMTS_MSG, sizeof(struct tresp_sms_send_umts_msg), &respSendMsg);
+                       
+               }
+}
+
+static void on_response_send_smsSubmitTpdu(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entered");
+
+       UserRequest *ur = NULL;
+       ur = tcore_pending_ref_user_request(p);
+       struct tresp_sms_send_umts_msg respUmtsInfo;
+       const TcoreATResponse *resp = data;
+       char *line = NULL , *pResp = NULL;
+       int ret =0, result = 0;
+       int mr = 0;
+       int error = 0;
+       GSList* tokens = NULL;
+
+       //currently IMC provides only index and msgref
+        memset(&respUmtsInfo, 0 , sizeof(struct tresp_sms_send_umts_msg));
+       
+       if(resp->success > 0)
+       {
+               dbg("Response OK");
+               if(resp->lines) {
+                       line = (const char *)resp->lines->data;
+                       dbg("line is %s",line);
+                       tokens = tcore_at_tok_new(line);
+                       pResp = g_slist_nth_data(tokens, 0);
+                       if (pResp != NULL)      
+                       {
+                               mr = atoi(pResp);
+                               result = SMS_SENDSMS_SUCCESS;
+                       }else
+                       {
+                               dbg("no MsgRef recieved");
+                               result = SMS_DEVICE_FAILURE;
+                       }
+               }else
+               {
+                       dbg("No lines");        
+                       result = SMS_DEVICE_FAILURE;
+               }
+       }else
+       {
+               //failure case - consider this later
+               dbg("Sent Status Response NOK");
+               result = SMS_DEVICE_FAILURE;
+       }
+               
+       ur = tcore_pending_ref_user_request(p);
+       if(ur)
+       {
+
+
+               dbg(" MR : %d", mr);
+               respUmtsInfo.result = result;
+               tcore_user_request_send_response(ur, TRESP_SMS_SEND_UMTS_MSG, sizeof(struct tresp_sms_send_umts_msg), &respUmtsInfo);
+
+       }
+       else
+       {
+               dbg("no user_request");
+       }
+       
+
+       dbg("Exit");
+       
+}
+
+static void on_response_read_msg(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur;
+       struct tresp_sms_read_msg respReadMsg;
+       const TcoreATResponse *atResp = data;
+
+       GSList *tokens=NULL;
+       char * line = NULL, *pResp = NULL , *pdu = NULL;
+       int ScLength = 0;
+       unsigned char LastSemiOctect;
+       int rtn =0 , i =0;
+       int stat =0 , alpha =0 , length =0;
+       int index = (int *)user_data;
+
+       ur = tcore_pending_ref_user_request(p);
+       if (!ur)
+       {
+               dbg("no user_request");
+               return;
+       }
+
+       if (atResp->success)
+       {
+               if (atResp->lines)
+               {
+                       line = (char*)atResp->lines->data;
+
+                       dbg("response Ok line is %s",line);
+
+                       tokens = tcore_at_tok_new(line);
+                       dbg(" length of tokens is %d\n", g_slist_length(atResp->lines));
+               
+                       pResp = g_slist_nth_data(tokens, 0);
+                       if (pResp != NULL)
+                       {
+                               //ToDO msg status mapping needs to be done
+                               stat = atoi(pResp);
+                               dbg("stat is %d",stat);
+                               switch (stat)
+                               {
+                                       case AT_REC_UNREAD:
+                                               respReadMsg.dataInfo.msgStatus = SMS_STATUS_UNREAD;
+                                               break;
+                                       case AT_REC_READ:
+                                               respReadMsg.dataInfo.msgStatus = SMS_STATUS_READ;
+                                               break;
+                                       case AT_STO_UNSENT:
+                                               respReadMsg.dataInfo.msgStatus = SMS_STATUS_UNSENT;
+                                               break;
+                                       case AT_STO_SENT:
+                                               respReadMsg.dataInfo.msgStatus = SMS_STATUS_SENT;
+                                               break;
+                                       case AT_ALL://TODO Need to verify the mapping
+                                               respReadMsg.dataInfo.msgStatus = SMS_STATUS_RESERVED;
+                                               break;
+                                       default://TODO Need to verify the mapping
+                                               respReadMsg.dataInfo.msgStatus = SMS_STATUS_RESERVED;
+                                               break;
+                               }
+                       }
+               
+                       pResp = g_slist_nth_data(tokens, 1);
+                       if (pResp != NULL)
+                       {
+                               alpha = atoi(pResp);
+                               dbg("alpha is %d",alpha);
+                       }
+               
+                       pResp = g_slist_nth_data(tokens, 2);
+                       if (pResp != NULL)
+                       {
+                               length = atoi(pResp);
+                               dbg("length is %d",length);
+                       }
+
+                       pdu = g_slist_nth_data(tokens, 3);
+                       if (pdu != NULL)
+                       {
+                               dbg("pdu is %s",pdu);
+                               ScLength = (int)pdu[0];
+
+                               respReadMsg.dataInfo.simIndex = index; //Retrieving index stored as part of req userdata 
+
+
+                       if(0 == ScLength)
+                       {
+
+                               respReadMsg.dataInfo.smsData.msgLength =  length  - (ScLength+1) ;
+
+                               if ((respReadMsg.dataInfo.smsData.msgLength >0) && (0xff >= respReadMsg.dataInfo.smsData.msgLength))
+                               {
+                                       dbg("SCA Length is 0");
+
+                                       memset(respReadMsg.dataInfo.smsData.sca, 0, TAPI_SIM_SMSP_ADDRESS_LEN);
+
+                                       //if(read_data.SmsData.MsgLength > SMS_SMDATA_SIZE_MAX)
+                                       //{
+                                               respReadMsg.dataInfo.smsData.msgLength = SMS_SMDATA_SIZE_MAX;
+                                       //}
+
+                                       memcpy(respReadMsg.dataInfo.smsData.tpduData, &pdu[2], respReadMsg.dataInfo.smsData.msgLength);
+                                       respReadMsg.result = SMS_SUCCESS;
+
+                                       rtn = tcore_user_request_send_response(ur, TRESP_SMS_READ_MSG, sizeof(struct tresp_sms_read_msg), &respReadMsg);
+                               }
+                               else
+                               {
+                                       dbg("Invalid Message Length");
+                                       respReadMsg.result = SMS_INVALID_PARAMETER_FORMAT;
+                                       rtn = tcore_user_request_send_response(ur, TRESP_SMS_READ_MSG, sizeof(struct tresp_sms_read_msg), &respReadMsg);
+                               }
+
+                       }
+                       else            //SCLength is Not 0
+                       {
+                               respReadMsg.dataInfo.smsData.msgLength =  (length - (ScLength+1));
+
+                               if ((respReadMsg.dataInfo.smsData.msgLength >0) && (0xff >= respReadMsg.dataInfo.smsData.msgLength))
+                               {
+                                       memcpy(respReadMsg.dataInfo.smsData.sca, (char*)pdu,(ScLength+1));
+
+                                       LastSemiOctect = pdu[ScLength + 1] & 0xf0;
+                                       if(LastSemiOctect == 0xf0)
+                                       {
+                                               respReadMsg.dataInfo.smsData.sca[0] = (ScLength-1)*2 - 1;
+                                       }
+                                       else
+                                       {
+                                               respReadMsg.dataInfo.smsData.sca[0] = (ScLength-1)*2;
+                                       }
+
+                                       //if(read_data.SmsData.MsgLength > SMS_SMDATA_SIZE_MAX)
+                                       //{
+                                               respReadMsg.dataInfo.smsData.msgLength = SMS_SMDATA_SIZE_MAX;
+                                       //}
+
+                                       for(i=0;i<(ScLength+1);i++)
+                                       {
+                                               dbg("SCA is [%2x] ", respReadMsg.dataInfo.smsData.sca[i]);
+                                       }
+
+                                       memcpy(respReadMsg.dataInfo.smsData.tpduData, &pdu[ScLength+1], respReadMsg.dataInfo.smsData.msgLength);
+                                       respReadMsg.result = SMS_SUCCESS;
+
+                                       rtn = tcore_user_request_send_response(ur, TRESP_SMS_READ_MSG, sizeof(struct tresp_sms_read_msg), &respReadMsg);
+                               }
+                               else
+                               {
+                                       dbg("Invalid Message Length");
+                                       respReadMsg.result = SMS_INVALID_PARAMETER_FORMAT;
+                                       rtn = tcore_user_request_send_response(ur, TRESP_SMS_READ_MSG, sizeof(struct tresp_sms_read_msg), &respReadMsg);
+                               }
+
+                       }
+               }
+               else
+               {
+                       dbg("Read PDU Is NULL");
+               }
+               }
+               else
+               {
+                       dbg("No lines in AT response");
+               }
+       }
+       else
+       {
+               dbg("Response NOK");
+       }
+       return;
+
+}
+
+
+static void on_response_get_msg_indices(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur = NULL;
+       struct tresp_sms_get_storedMsgCnt * respStoredMsgCnt = NULL;
+       int ctr = 0;
+       const TcoreATResponse *atResp = data;
+       GSList *tokens = NULL;
+       GSList *lines = NULL;
+       char *line = NULL , *pResp = NULL;
+       int usedCnt = 0, totalCnt = 0, result = 0, noOfLines = 0 , i = 0;
+
+       //memset(&respStoredMsgCnt, 0, sizeof(struct tresp_sms_get_storedMsgCnt));
+
+       respStoredMsgCnt = (struct tresp_sms_get_storedMsgCnt *)user_data;
+       ur = tcore_pending_ref_user_request(p);
+
+
+       if (atResp->success)
+        {
+                dbg("Response OK");
+                if(atResp->lines)
+                {
+                       noOfLines = g_slist_length(atResp->lines);
+
+                       if (noOfLines > SMS_GSM_SMS_MSG_NUM_MAX)
+                               noOfLines = SMS_GSM_SMS_MSG_NUM_MAX;
+
+                        line = (const char*)atResp->lines->data;
+                        dbg("line and no of lines is %s %d",line, noOfLines);
+                        tokens = tcore_at_tok_new(line);
+             
+       
+                       for (i = 0; i < noOfLines ; i++)
+                       {
+                               line = (char *)(lines->data);
+                               if (line != NULL)
+                               {
+                                       tokens = tcore_at_tok_new(line);
+                                       pResp = g_slist_nth_data(tokens, 0);
+                                       if (pResp != NULL)
+                                       {
+                                               respStoredMsgCnt->storedMsgCnt.indexList[i] = atoi(pResp);
+                                               lines = lines->next;
+                                       }
+                                       else
+                                       {
+                                               respStoredMsgCnt->result = SMS_DEVICE_FAILURE;
+                                               dbg("pResp is NULL");
+                               
+                                       }
+                               }
+                               else
+                               {
+                                       respStoredMsgCnt->result = SMS_DEVICE_FAILURE;
+                                       dbg("line is NULL");
+                               }
+                       }
+               }
+               else
+               {
+                       dbg("No lines");
+               }
+       }
+       else
+       {
+               dbg("Respnose NOK");
+       }
+       
+       
+       tcore_user_request_send_response(ur, TRESP_SMS_GET_STORED_MSG_COUNT, sizeof(struct tresp_sms_get_storedMsgCnt), respStoredMsgCnt);
+
+
+}
+
+static void on_response_get_storedMsgCnt(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur = NULL, *ur_dup = NULL;
+       struct tresp_sms_get_storedMsgCnt respStoredMsgCnt;
+       int ctr = 0;
+       const TcoreATResponse *atResp = data;
+       GSList *tokens=NULL;
+       char *line = NULL , *pResp = NULL , *cmd_str = NULL, *atReq = NULL;
+       int usedCnt = 0, totalCnt = 0, result = 0;
+
+       TcorePending *pending_new = NULL;
+       CoreObject *o = NULL;
+
+       memset(&respStoredMsgCnt, 0, sizeof(struct tresp_sms_get_storedMsgCnt));
+
+       ur = tcore_pending_ref_user_request(p);
+       ur_dup = tcore_user_request_ref(ur);
+       o = tcore_pending_ref_core_object(p);
+
+       if (atResp->success)
+       {
+               dbg("Response OK");
+               if(atResp->lines) 
+               {
+                       line = (const char*)atResp->lines->data;
+                       dbg("line is %s",line);
+                       tokens = tcore_at_tok_new(line);
+                        pResp = g_slist_nth_data(tokens, 0);
+                        if (pResp)
+                       {
+                                       usedCnt =atoi(pResp);
+                                       dbg("used cnt is %d",usedCnt);
+                                       
+                       }
+                        pResp = g_slist_nth_data(tokens, 1);
+                        if (pResp)
+                       {
+                                       totalCnt =atoi(pResp);
+                                       result = SMS_SENDSMS_SUCCESS;
+                                       
+                                       respStoredMsgCnt.storedMsgCnt.usedCount = usedCnt;
+                                       respStoredMsgCnt.storedMsgCnt.totalCount = totalCnt;
+                                       respStoredMsgCnt.result = result;
+                                       dbg("used %d, total %d, result %d",usedCnt, totalCnt,result);
+
+
+                                       // This is required  because CPMS does not give index list. So need to store the above in user req and again issue CMGL
+// commented to avoid parser malfunction hyKo 120819
+
+                                       pending_new = tcore_pending_new(o,0);
+                                       cmd_str = g_strdup_printf("AT+CMGL\r");;
+                                       dbg("cmd str is %s",cmd_str);
+                                       atReq = tcore_at_request_new((const char*)cmd_str, "+CMGL:", TCORE_AT_MULTILINE);
+                                       tcore_pending_set_request_data(pending_new, 0,atReq);
+                                       // Setting user data so as to send consolidated response to GetStoredMsgCnt notification
+                                       tcore_pending_set_response_callback(pending_new, on_response_get_msg_indices, (void *)&respStoredMsgCnt);
+                                       tcore_pending_link_user_request(pending_new, ur_dup);
+                                       tcore_pending_set_send_callback(pending_new, on_confirmation_sms_message_send, NULL);
+                                       tcore_hal_send_request(tcore_object_get_hal(o), pending_new);
+
+                                       return;
+
+                       }
+               }else
+               {
+                               dbg("No data");
+                               result = SMS_DEVICE_FAILURE;
+               }
+       }
+       else
+       {
+               dbg("Response NOK");
+       }
+
+       respStoredMsgCnt.storedMsgCnt.usedCount = usedCnt;
+       respStoredMsgCnt.storedMsgCnt.totalCount = totalCnt;
+       respStoredMsgCnt.result = result;
+       //TODO - index list needs to be populated
+//     tcore_user_request_send_response(ur, TRESP_SMS_GET_STORED_MSG_COUNT, sizeof(struct tresp_sms_get_storedMsgCnt), &respStoredMsgCnt);
+
+       return;
+}
+
+static void on_response_get_sca(TcorePending *pending, int data_len, const void *data, void *user_data)
+{
+       //Response is expected in this format +CSCA: <sca>,<tosca>
+
+       TcorePlugin *plugin;
+       UserRequest *ur;
+       struct tresp_sms_get_sca respGetSca;
+       GSList *tokens=NULL;
+
+       //copies the AT response data to resp
+       const TcoreATResponse *atResp = data;
+       char *line = NULL, *sca = NULL, *typeOfAddress = NULL;
+
+       int err = 0;
+       int response = 0;
+
+       // +CSCA: <sca number>,<sca type>
+
+       memset(&respGetSca, 0, sizeof(struct tresp_sms_get_sca));
+
+       ur = tcore_pending_ref_user_request(pending);
+       if (atResp->success)
+       {
+               dbg("Response OK");
+               if(atResp->lines) 
+               {
+                       line = (const char*)atResp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       sca = g_slist_nth_data(tokens, 0);
+                       typeOfAddress = g_slist_nth_data(tokens, 1);
+                       if ((sca) && (typeOfAddress))
+                       {
+                                       dbg("sca and address type are %s %s", sca, typeOfAddress);
+                                       respGetSca.scaAddress.dialNumLen = strlen(sca);
+                                       if(atoi(typeOfAddress) == 145)
+                                               {
+                                                       respGetSca.scaAddress.typeOfNum = SIM_TON_INTERNATIONAL;
+                                               }
+                                       else    
+                                               {
+                                                       respGetSca.scaAddress.typeOfNum = SIM_TON_NATIONAL;
+                                               }
+                                       respGetSca.scaAddress.numPlanId = 0;
+               
+                                       memcpy(respGetSca.scaAddress.diallingNum, sca, strlen(sca));
+
+                                       dbg("len %d, sca %s, TON %d, NPI %d",respGetSca.scaAddress.dialNumLen,respGetSca.scaAddress.diallingNum,respGetSca.scaAddress.typeOfNum,respGetSca.scaAddress.numPlanId); 
+                                       respGetSca.result = SMS_SENDSMS_SUCCESS;
+                       }
+               }
+       }
+       else
+       {
+               dbg("Response NOK");
+               respGetSca.result = SMS_DEVICE_FAILURE;
+       }
+       
+       tcore_user_request_send_response(ur, TRESP_SMS_GET_SCA, sizeof(struct tresp_sms_get_sca), &respGetSca);
+       return;
+       
+}
+
+static void on_response_set_sca(TcorePending *pending, int data_len, const void *data, void *user_data)
+{
+       /*
+       Response is expected in this format 
+       OK
+               or
+       +CMS ERROR: <err>
+       */
+       
+       //CoreObject *obj = user_data;
+       UserRequest *ur;
+       //copies the AT response data to resp
+       const TcoreATResponse *atResp = data;
+       char * line = NULL;
+       struct tresp_sms_set_sca respSetSca;
+       int err = 0, response = 0;
+
+       memset(&respSetSca, 0, sizeof(struct tresp_sms_set_sca));
+
+       ur = tcore_pending_ref_user_request(pending);
+       if (!ur)
+       {
+               dbg("no user_request");
+               return;
+       }
+       
+       if (atResp->success >0)
+       {
+               dbg("RESPONSE OK");
+               respSetSca.result = SMS_SUCCESS;
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               respSetSca.result = SMS_DEVICE_FAILURE;
+       }
+
+       tcore_user_request_send_response(ur, TRESP_SMS_SET_SCA, sizeof(struct tresp_sms_set_sca), &respSetSca);
+
+       return;
+}
+
+
+static void on_response_get_cb_config(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur;
+       struct tresp_sms_get_cb_config respGetCbConfig;
+       const TcoreATResponse *atResp = data;
+       GSList *tokens=NULL;
+
+       int msgid_length = 0 , msgCount = 0;
+       int i = 0, mode =0 , result = 0;
+       char *mid = NULL, *dcs = NULL, *pResp = NULL, *line = NULL, *res = NULL;
+       char delim[] = ",";
+
+       memset(&respGetCbConfig, 0, sizeof(struct tresp_sms_get_cb_config));
+
+       ur = tcore_pending_ref_user_request(p);
+       if (!ur)
+       {
+               dbg("no user_request");
+               return;
+       }
+
+       if (atResp->success)
+       {
+               dbg("Response OK");
+               if(atResp->lines) 
+               {
+                       line = (const char*)atResp->lines->data;
+                       if (line != NULL)
+                       {
+                               dbg("line is %s",line); 
+                               tokens = tcore_at_tok_new(line);
+                               pResp = g_slist_nth_data(tokens, 0);
+                               if (pResp)
+                               {
+                                       mode = atoi(pResp);
+                                       respGetCbConfig.cbConfig.bCBEnabled = mode;
+                                       pResp = g_slist_nth_data(tokens, 1);
+                                       if (pResp)
+                                       {
+                                               mid = strtok(pResp, delim); i = 0;
+                                                       while( res != NULL ) 
+                                                       {
+                                                               res = strtok( NULL, delim );
+                                                               dbg("mid is %s%s\n", mid,res);
+                                                               if (result!= NULL)
+                                                               {
+                                                                       if (strlen(res) >0)
+                                                                               {
+                                                                                       respGetCbConfig.cbConfig.msgIDs[i] = atoi(res);
+                                                                                       i++;
+                                                                               }
+                                                               }
+                                                       }
+                                       }
+                                       else
+                                       {
+                                                       result = SMS_DEVICE_FAILURE;
+                                       }
+                                       respGetCbConfig.cbConfig.msgIdCount = i;
+
+                               }
+                               else
+                               {
+                                               result = SMS_DEVICE_FAILURE;
+                               }
+                               //dcs = g_slist_nth_data(tokens, 2); DCS not needed by telephony
+                       }
+                       else
+                       {
+                               dbg("line is NULL");
+                               result = SMS_DEVICE_FAILURE;
+                       }
+                       
+                       
+               }
+               else
+               {
+                               result = SMS_DEVICE_FAILURE;
+                               dbg("atresp->lines is NULL");
+               }
+       }
+       else
+       {
+                       result = SMS_DEVICE_FAILURE;
+                       dbg("RESPONSE NOK");
+       }
+
+       // Todo max list count and selectedid
+
+       tcore_user_request_send_response(ur, TRESP_SMS_GET_CB_CONFIG, sizeof(struct tresp_sms_get_cb_config), &respGetCbConfig);
+
+       return;
+}
+
+static void on_response_set_cb_config(TcorePending *pending, int data_len, const void *data, void *user_data)
+{
+       /*
+       Response is expected in this format 
+       OK
+               or
+       +CMS ERROR: <err>
+       */
+
+       CoreObject *obj = user_data;
+       UserRequest *ur;
+       const TcoreATResponse *resp = data;
+       
+       GQueue *queue;
+       int err;
+       int response;
+       const char *line = NULL;
+       GSList *tokens=NULL;
+       
+       struct tresp_sms_set_cb_config respSetCbConfig = {0,};
+
+       memset(&respSetCbConfig, 0, sizeof(struct tresp_sms_set_cb_config));
+
+       ur = tcore_pending_ref_user_request(pending);
+
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               line = (const char*)resp->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1) {
+                       dbg("err cause not specified or string corrupted");
+                       respSetCbConfig.result = TCORE_RETURN_3GPP_ERROR;
+               }
+               else
+               {
+                       response = atoi(g_slist_nth_data(tokens, 0));
+                       /* TODO: CMEE error mapping is required. */
+                       respSetCbConfig.result = TCORE_RETURN_3GPP_ERROR;
+               }
+       }
+       if (!ur)
+       {
+               dbg("no user_request");
+               return;
+       }
+
+       tcore_user_request_send_response(ur, TRESP_SMS_SET_CB_CONFIG, sizeof(struct tresp_sms_set_cb_config), &respSetCbConfig);
+
+       return;
+}
+
+static void on_response_set_mem_status(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur;
+       struct tresp_sms_set_mem_status respSetMemStatus = {0,};
+       const TcoreATResponse *resp = data;
+       int err = 0, response = 0;
+       const char *line = NULL;
+       GSList *tokens=NULL;
+       
+       struct tresp_sms_set_cb_config respSetCbConfig = {0,};
+
+       memset(&respSetMemStatus, 0, sizeof(struct tresp_sms_set_mem_status));
+
+       if(resp->success > 0)
+       {
+               dbg("RESPONSE OK");
+               respSetMemStatus.result = SMS_SENDSMS_SUCCESS;
+               
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               respSetMemStatus.result = SMS_DEVICE_FAILURE;
+       }       
+
+       ur = tcore_pending_ref_user_request(p);
+       if (!ur)
+       {
+               dbg("no user_request");
+               return;
+       }
+
+       tcore_user_request_send_response(ur, TRESP_SMS_SET_MEM_STATUS, sizeof(struct tresp_sms_set_mem_status), &respSetMemStatus);
+
+       return;
+}
+
+
+static void on_response_set_msg_status(TcorePending *pending, int data_len, const void *data, void *user_data)
+{
+       UserRequest *ur;
+       struct tresp_sms_set_msg_status respMsgStatus = {0,};
+       const TcoreATResponse *atResp = data;
+        int err = 0, response = 0, sw1 =0 , sw2 = 0;
+        const char *line = NULL;
+        char *pResp = NULL;
+        GSList *tokens=NULL;
+
+       dbg("Entry");
+
+       memset(&respMsgStatus, 0, sizeof(struct tresp_sms_set_msg_status));
+        ur = tcore_pending_ref_user_request(pending);
+
+        if(atResp->success > 0)
+        {
+                dbg("RESPONSE OK");
+
+               if(atResp->lines)
+                {
+                        line = (const char*)atResp->lines->data;
+                        tokens = tcore_at_tok_new(line);
+                        pResp = g_slist_nth_data(tokens, 0);
+                        if (pResp != NULL)
+                        {
+                                sw1 = atoi(pResp);
+                        }
+                        else
+                        {
+                                respMsgStatus.result = SMS_DEVICE_FAILURE;
+                                dbg("sw1 is NULL");
+                        }
+                        pResp = g_slist_nth_data(tokens, 1);
+                        if (pResp != NULL)
+                        {
+                                sw2 = atoi(pResp);
+                                if ((sw1 == 144) && (sw2 == 0))
+                                {
+                                        respMsgStatus.result = SMS_SENDSMS_SUCCESS;
+                                }
+                                else
+                                {
+                                        //TODO Error Mapping
+                                        respMsgStatus.result = SMS_DEVICE_FAILURE;
+                                }
+                        }
+                        else
+                        {
+                                dbg("sw2 is NULL");
+                                respMsgStatus.result = SMS_DEVICE_FAILURE;
+
+                               }
+                        pResp = g_slist_nth_data(tokens, 3);
+
+                       if (pResp != NULL)
+                        {
+                                response = pResp;
+                                dbg("response is %s", response);
+                        }
+
+                }
+               else
+               {
+                       dbg("No lines");
+               }
+
+        }
+        else
+        {
+                dbg("RESPONSE NOK");
+                respMsgStatus.result = SMS_DEVICE_FAILURE;
+        }
+
+        tcore_user_request_send_response(ur, TRESP_SMS_SET_MSG_STATUS , sizeof(struct tresp_sms_set_msg_status), &respMsgStatus);
+
+
+
+       dbg("Exit");
+       return;
+}
+
+static void on_response_get_sms_params(TcorePending *pending, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+
+       UserRequest *ur;
+       struct tresp_sms_get_params respGetParams = {0,};
+       const TcoreATResponse *atResp = data;
+       int err = 0, response = 0, sw1 =0 , sw2 = 0;
+       const char *line = NULL;
+       char *pResp = NULL;
+       GSList *tokens=NULL;
+       
+       memset(&respGetParams, 0, sizeof(struct tresp_sms_set_params));
+       ur = tcore_pending_ref_user_request(pending);
+               
+       if(atResp->success > 0)
+       {
+               dbg("RESPONSE OK");
+
+               if(atResp->lines) 
+               {
+                       line = (const char*)atResp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       pResp = g_slist_nth_data(tokens, 0);
+                       if (pResp != NULL)
+                       {
+                               sw1 = atoi(pResp);
+                       }
+                       else
+                       {
+                               respGetParams.result = SMS_DEVICE_FAILURE;
+                               dbg("sw1 is NULL");
+                       }
+                       pResp = g_slist_nth_data(tokens, 1);
+                       if (pResp != NULL)
+                       {
+                               sw2 = atoi(pResp);
+                               if ((sw1 == 144) && (sw2 == 0))
+                               {
+                                       respGetParams.result = SMS_SENDSMS_SUCCESS;
+                               }
+                               else
+                               {
+                                       //TODO Error Mapping
+                                       respGetParams.result = SMS_DEVICE_FAILURE;
+                               }
+                       }
+                       else
+                       {
+                               dbg("sw2 is NULL");
+                               respGetParams.result = SMS_DEVICE_FAILURE;
+                               
+                       }
+                       pResp = g_slist_nth_data(tokens, 3);
+                       if (pResp != NULL)
+                       {
+                               response = pResp;
+                               dbg("response is %s", response);
+                       }
+                       
+               }
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               respGetParams.result = SMS_DEVICE_FAILURE;
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void on_response_set_sms_params(TcorePending *pending, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+       
+       UserRequest *ur;
+       struct tresp_sms_set_params respSetParams = {0,};
+       const TcoreATResponse *atResp = data;
+       int err = 0, response = 0, sw1 =0 , sw2 = 0;
+       const char *line = NULL;
+       char *pResp = NULL;
+       GSList *tokens=NULL;
+       
+
+       memset(&respSetParams, 0, sizeof(struct tresp_sms_set_params));
+       ur = tcore_pending_ref_user_request(pending);
+               
+       if(atResp->success > 0)
+       {
+               dbg("RESPONSE OK");
+
+               if(atResp->lines) 
+               {
+                       line = (const char*)atResp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       pResp = g_slist_nth_data(tokens, 0);
+                       if (pResp != NULL)
+                       {
+                               sw1 = atoi(pResp);
+                       }
+                       else
+                       {
+                               respSetParams.result = SMS_DEVICE_FAILURE;
+                               dbg("sw1 is NULL");
+                       }
+                       pResp = g_slist_nth_data(tokens, 1);
+                       if (pResp != NULL)
+                       {
+                               sw2 = atoi(pResp);
+                               if ((sw1 == 144) && (sw2 == 0))
+                               {
+                                       respSetParams.result = SMS_SENDSMS_SUCCESS;
+                               }
+                               else
+                               {
+                                       //TODO Error Mapping
+                                       respSetParams.result = SMS_DEVICE_FAILURE;
+                               }
+                       }
+                       else
+                       {
+                               dbg("sw2 is NULL");
+                               respSetParams.result = SMS_DEVICE_FAILURE;
+                               
+                       }
+                       pResp = g_slist_nth_data(tokens, 3);
+                       if (pResp != NULL)
+                       {
+                               response = pResp;
+                               dbg("response is %s", response);
+                       }
+                       
+               }
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               respSetParams.result = SMS_DEVICE_FAILURE;
+       }       
+
+       tcore_user_request_send_response(ur, TRESP_SMS_SET_PARAMS , sizeof(struct tresp_sms_set_params), &respSetParams);
+
+       dbg("Exit");
+       return;
+}
+
+static void on_response_get_paramcnt(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       dbg("Entry");
+
+       UserRequest *ur = NULL;
+       struct tresp_sms_get_paramcnt respGetParamCnt = {0,};
+       const TcoreATResponse *atResp = data;
+       dbg("Entry");
+       char *line = NULL , *pResp = NULL;
+       int ret = 0;
+       int sw1 = 0 , sw2 = 0;
+       int sim_type = SIM_TYPE_USIM; //TODO need to check how to handle this
+       GSList *tokens=NULL;
+
+       ur = tcore_pending_ref_user_request(p);
+
+       if(atResp->success > 0)
+       {
+               dbg("RESPONSE OK");
+
+               if(atResp->lines) 
+               {
+                       line = (const char*)atResp->lines->data;
+                       tokens = tcore_at_tok_new(line);
+                       pResp = g_slist_nth_data(tokens, 0);
+                       if (pResp != NULL)
+                       {
+                               sw1 = atoi(pResp);
+                       }
+                       else
+                       {
+                               respGetParamCnt.result = SMS_DEVICE_FAILURE;
+                               dbg("sw1 is NULL");
+                       }
+                       pResp = g_slist_nth_data(tokens, 1);
+                       if (pResp != NULL)
+                       {
+                               sw2 = atoi(pResp);
+                               if ((sw1 == 144) && (sw2 == 0))
+                               {
+                                       respGetParamCnt.result = SMS_SENDSMS_SUCCESS;
+                               }
+                               else
+                               {
+                                       //TODO Error Mapping
+                                       respGetParamCnt.result = SMS_DEVICE_FAILURE;
+                               }
+                       }
+                       else
+                       {
+                               dbg("sw2 is NULL");
+                               respGetParamCnt.result = SMS_DEVICE_FAILURE;
+                               
+                       }
+                       pResp = g_slist_nth_data(tokens, 3);
+                       if (pResp != NULL)
+                       {
+                               char *hexData;  
+                               char *recordData;
+                               
+                               hexData  = pResp;
+                               if (pResp)
+                               dbg("response is %s", pResp);
+                               
+                               /*1. SIM access success case*/
+                               if ((sw1 == 0x90 && sw2 == 0x00) || sw1 == 0x91) 
+                               {
+                                       unsigned char tag_len = 0; /*   1 or 2 bytes ??? */
+                                       unsigned short record_len = 0;
+                                       char num_of_records = 0;
+                                       unsigned char file_id_len = 0;
+                                       unsigned short file_id = 0;
+                                       unsigned short file_size = 0;
+                                       unsigned short file_type = 0;
+                                       unsigned short arr_file_id = 0;
+                                       int arr_file_id_rec_num = 0;
+
+                                       /*      handling only last 3 bits */
+                                       unsigned char file_type_tag = 0x07;
+                                       unsigned char *ptr_data;
+
+                                       recordData = util_hexStringToBytes(hexData);
+                                       util_hex_dump("    ", strlen(hexData)/2, recordData);
+               
+                                       ptr_data = (unsigned char *)recordData;
+
+                                       if (sim_type ==  SIM_TYPE_USIM) {
+                                               /*
+                                                ETSI TS 102 221 v7.9.0
+                                                       - Response Data
+                                                        '62'   FCP template tag
+                                                        - Response for an EF
+                                                        '82'   M       File Descriptor
+                                                        '83'   M       File Identifier
+                                                       'A5'    O       Proprietary information
+                                                        '8A'   M       Life Cycle Status Integer
+                                                        '8B', '8C' or 'AB'     C1      Security attributes
+                                                       '80'    M       File size
+                                                        '81'   O       Total file size
+                                                        '88'   O       Short File Identifier (SFI)
+                                               */
+
+                                               /* rsim.res_len  has complete data length received  */
+
+                                               /* FCP template tag - File Control Parameters tag*/
+                                               if (*ptr_data == 0x62) {
+                                                       /* parse complete FCP tag*/
+                                                       /* increment to next byte */
+                                                       ptr_data++;
+                                                       tag_len = *ptr_data++;
+                                                       /* FCP file descriptor - file type, accessibility, DF, ADF etc*/
+                                               if (*ptr_data == 0x82) {
+                                                               /* increment to next byte */
+                                                               ptr_data++;
+                                                               /*2 or 5 value*/
+                                                               ptr_data++;
+                                               /*      unsigned char file_desc_len = *ptr_data++;*/
+                                               /*      dbg("file descriptor length: [%d]", file_desc_len);*/
+                                               /* TBD:  currently capture only file type : ignore sharable, non sharable, working, internal etc*/
+                                               /* consider only last 3 bits*/
+                                               file_type_tag = file_type_tag & (*ptr_data);
+
+                                               switch (file_type_tag) {
+                                                       /* increment to next byte */
+                                                       ptr_data++;
+                                                       case 0x1:
+                                                               dbg("Getting FileType: [Transparent file type]");
+                                                               /* increment to next byte */
+                                                               ptr_data++;
+                                                               file_type = 0x01;       //SIM_FTYPE_TRANSPARENT
+                                                               /*      data coding byte - value 21 */
+                                                               ptr_data++;
+                                                               break;
+
+                                                       case 0x2:
+                                                               dbg("Getting FileType: [Linear fixed file type]");
+                                                               /* increment to next byte */
+                                                               ptr_data++;
+                                                               /*      data coding byte - value 21 */
+                                                               ptr_data++;
+                                                               /*      2bytes */
+                                                               memcpy(&record_len, ptr_data, 2);
+                                                               /* swap bytes */
+                                                               SMS_SWAPBYTES16(record_len);
+                                                               ptr_data = ptr_data + 2;
+                                                               num_of_records = *ptr_data++;
+                                                               /* Data lossy conversation from enum (int) to unsigned char */
+                                                               file_type = 0x02;       // SIM_FTYPE_LINEAR_FIXED
+                                                               break;
+
+                                                       case 0x6:
+                                                               dbg(" Cyclic fixed file type");
+                                                               /* increment to next byte */
+                                                               ptr_data++;
+                                                               /*      data coding byte - value 21 */
+                                                               ptr_data++;
+                                                               /*      2bytes */
+                                                               memcpy(&record_len, ptr_data, 2);
+                                                               /* swap bytes  */
+                                                               SMS_SWAPBYTES16(record_len);
+                                                               ptr_data = ptr_data + 2;
+                                                               num_of_records = *ptr_data++;
+                                                               file_type = 0x04;       //SIM_FTYPE_CYCLIC
+                                                               break;
+
+                                               default:
+                                                       dbg("not handled file type [0x%x]", *ptr_data);
+                                                       break;
+                                               }
+                                       }
+                                       else 
+                                       {
+                                               dbg("INVALID FCP received - DEbug!");
+                                               return;
+                                       }
+
+                                       /*File identifier - file id?? */ // 0x84,0x85,0x86 etc are currently ignored and not handled
+                                       if (*ptr_data == 0x83) {
+                                               /* increment to next byte */
+                                               ptr_data++;
+                                               file_id_len = *ptr_data++;
+                                               memcpy(&file_id, ptr_data, file_id_len);
+                                               /* swap bytes    */
+                                               SMS_SWAPBYTES16(file_id);
+                                               ptr_data = ptr_data + 2;
+                                               dbg("Getting FileID=[0x%x]", file_id);
+                                       } else {
+                                               dbg("INVALID FCP received - DEbug!");
+                                               free(recordData);
+                                               //ReleaseResponse();                                            
+                                               return;
+                                       }
+
+                                       /*      proprietary information  */
+                                       if (*ptr_data == 0xA5) {
+                                               unsigned short prop_len;
+                                               /* increment to next byte */
+                                               ptr_data++;
+                                               /* length */
+                                               prop_len = *ptr_data;
+                                               /* skip data */
+                                               ptr_data = ptr_data + prop_len + 1;
+                                       } else {
+                                               dbg("INVALID FCP received - DEbug!");
+                                       }
+
+                                       /* life cycle status integer [8A][length:0x01][status]*/
+                                       /*
+                                        status info b8~b1
+                                        00000000 : No information given
+                                        00000001 : creation state
+                                        00000011 : initialization state
+                                        000001-1 : operation state -activated
+                                        000001-0 : operation state -deactivated
+                                        000011-- : Termination state
+                                        b8~b5 !=0, b4~b1=X : Proprietary
+                                        Any other value : RFU
+                                        */
+                                       if (*ptr_data == 0x8A) {
+                                               /* increment to next byte */
+                                               ptr_data++;
+                                               /* length - value 1 */
+                                               ptr_data++;
+
+                                               switch (*ptr_data) {
+                                                       case 0x04:
+                                                       case 0x06:
+                                                               dbg("<IPC_RX> operation state -deactivated");
+                                                               ptr_data++;
+                                                               break;
+                                                       case 0x05:
+                                                       case 0x07:
+                                                               dbg("<IPC_RX> operation state -activated");
+                                                               ptr_data++;
+                                                               break;
+                                                       default:
+                                                               dbg("<IPC_RX> DEBUG! LIFE CYCLE STATUS =[0x%x]",*ptr_data);
+                                                               ptr_data++;
+                                                               break;
+                                               }
+                                       }
+
+                                       /* related to security attributes : currently not handled*/
+                                       if (*ptr_data == 0x86 || *ptr_data == 0x8B || *ptr_data == 0x8C || *ptr_data == 0xAB) {
+                                               /* increment to next byte */
+                                               ptr_data++;
+                                               /* if tag length is 3 */
+                                               if (*ptr_data == 0x03) {
+                                                       /* increment to next byte */
+                                                       ptr_data++;
+                                                       /* EFARR file id */
+                                                       memcpy(&arr_file_id, ptr_data, 2);
+                                                       /* swap byes */
+                                                       SMS_SWAPBYTES16(arr_file_id);
+                                                       ptr_data = ptr_data + 2;
+                                                       arr_file_id_rec_num = *ptr_data++;
+                                               } else {
+                                                       /* if tag length is not 3 */
+                                                       /* ignoring bytes       */
+                                                       //      ptr_data = ptr_data + 4;
+                                                       dbg("Useless security attributes, so jump to next tag");
+                                                       ptr_data = ptr_data + (*ptr_data + 1);
+                                               }
+                                       } else {
+                                               dbg("INVALID FCP received[0x%x] - DEbug!", *ptr_data);
+                                               free(recordData);
+                                                       
+                                               return;
+                                       }
+
+                                       dbg("Current ptr_data value is [%x]", *ptr_data);
+
+                                       /* file size excluding structural info*/
+                                       if (*ptr_data == 0x80) {
+                                               /* for EF file size is body of file and for Linear or cyclic it is
+                                                * number of recXsizeof(one record)
+                                                */
+                                               /* increment to next byte */
+                                               ptr_data++;
+                                               /* length is 1 byte - value is 2 bytes or more */
+                                               ptr_data++;
+                                               memcpy(&file_size, ptr_data, 2);
+                                               /* swap bytes */
+                                               SMS_SWAPBYTES16(file_size);
+                                               ptr_data = ptr_data + 2;
+                                       } else {
+                                               dbg("INVALID FCP received - DEbug!");
+                                               free(recordData);
+                                               return;
+                                       }
+
+                                       /* total file size including structural info*/
+                                       if (*ptr_data == 0x81) {
+                                               int len;
+                                               /* increment to next byte */
+                                               ptr_data++;
+                                               /* length */
+                                               len = *ptr_data;
+                                               /* ignored bytes */
+                                               ptr_data = ptr_data + 3;
+                                       } else {
+                                               dbg("INVALID FCP received - DEbug!");
+                                               /* 0x81 is optional tag?? check out! so do not return -1 from here! */
+                                               /* return -1; */
+                                       }
+                                       /*short file identifier ignored*/
+                                       if (*ptr_data == 0x88) {
+                                               dbg("0x88: Do Nothing");
+                                               /*DO NOTHING*/
+                                       }
+                               } else {
+                                       dbg("INVALID FCP received - DEbug!");
+                                       free(recordData);
+                                       return;
+                               }
+                       }
+                       else if (sim_type == SIM_TYPE_GSM) 
+                       {
+                               unsigned char gsm_specific_file_data_len = 0;
+                               /*      ignore RFU byte1 and byte2 */
+                               ptr_data++;
+                               ptr_data++;
+                               /*      file size */
+                               //file_size = p_info->response_len;
+                               memcpy(&file_size, ptr_data, 2);
+                               /* swap bytes */
+                               SMS_SWAPBYTES16(file_size);
+                               /*      parsed file size */
+                               ptr_data = ptr_data + 2;
+                               /*  file id  */
+                               memcpy(&file_id, ptr_data, 2);
+                               SMS_SWAPBYTES16(file_id);
+                               dbg(" FILE id --> [%x]", file_id);
+                               ptr_data = ptr_data + 2;
+                               /* save file type - transparent, linear fixed or cyclic */
+                               file_type_tag = (*(ptr_data + 7));
+
+                               switch (*ptr_data) {
+                                       case 0x0:
+                                               /* RFU file type */
+                                               dbg(" RFU file type- not handled - Debug!");
+                                               break;
+                                       case 0x1:
+                                               /* MF file type */
+                                               dbg(" MF file type - not handled - Debug!");
+                                               break;
+                                       case 0x2:
+                                               /* DF file type */
+                                               dbg(" DF file type - not handled - Debug!");
+                                               break;
+                                       case 0x4:
+                                               /* EF file type */
+                                               dbg(" EF file type [%d] ", file_type_tag);
+                                               /*      increment to next byte */
+                                               ptr_data++;
+
+                                               if (file_type_tag == 0x00 || file_type_tag == 0x01) {
+                                                       /* increament to next byte as this byte is RFU */
+                                                       ptr_data++;
+                                                       file_type =
+                                                                       (file_type_tag == 0x00) ? 0x01 : 0x02; // SIM_FTYPE_TRANSPARENT:SIM_FTYPE_LINEAR_FIXED;
+                                               } else {
+                                                       /* increment to next byte */
+                                                       ptr_data++;
+                                                       /*      For a cyclic EF all bits except bit 7 are RFU; b7=1 indicates that */
+                                                       /* the INCREASE command is allowed on the selected cyclic file. */
+                                                       file_type = 0x04;       // SIM_FTYPE_CYCLIC;
+                                               }
+                                               /* bytes 9 to 11 give SIM file access conditions */
+                                               ptr_data++;
+                                               /* byte 10 has one nibble that is RF U and another for INCREASE which is not used currently */
+                                               ptr_data++;
+                                               /* byte 11 is invalidate and rehabilate nibbles */
+                                               ptr_data++;
+                                               /* byte 12 - file status */
+                                               ptr_data++;
+                                               /* byte 13 - GSM specific data */
+                                               gsm_specific_file_data_len = *ptr_data;
+                                               ptr_data++;
+                                               /*      byte 14 - structure of EF - transparent or linear or cyclic , already saved above */
+                                               ptr_data++;
+                                               /* byte 15 - length of record for linear and cyclic , for transparent it is set to 0x00. */
+                                               record_len = *ptr_data;
+                                               dbg("record length[%d], file size[%d]", record_len, file_size);
+
+                                               if (record_len != 0)
+                                                       num_of_records = (file_size / record_len);
+
+                                               dbg("Number of records [%d]", num_of_records);
+                                               break;
+
+                                       default:
+                                               dbg(" not handled file type");
+                                               break;
+                               }
+                       } 
+                       else 
+                       {
+                               dbg(" Card Type - UNKNOWN  [%d]", sim_type);
+                       }
+
+                       dbg("EF[0x%x] size[%ld] Type[0x%x] NumOfRecords[%ld] RecordLen[%ld]", file_id, file_size, file_type, num_of_records, record_len);
+
+                       respGetParamCnt.recordCount = num_of_records;
+                       respGetParamCnt.result = SMS_SUCCESS;
+                       
+                       free(recordData);
+               }
+               else 
+               {
+                       /*2. SIM access fail case*/
+                       dbg("SIM access fail");
+                       respGetParamCnt.result = SMS_UNKNOWN;
+               }
+               }
+                       
+               }
+       }
+       else
+       {
+               dbg("RESPONSE NOK");
+               respGetParamCnt.result = SMS_DEVICE_FAILURE;
+       }
+
+       
+       tcore_user_request_send_response(ur, TRESP_SMS_GET_PARAMCNT, sizeof(struct tresp_sms_get_paramcnt), &respGetParamCnt);
+
+       dbg("Exit");
+       return;
+}
+/********************************************************/
+/******************** Str Utility Functions *******************/
+
+
+
+
+
+
+/********************************************************/
+/***********************  Requests ************************/
+/********************************************************/
+static TReturn send_umts_msg(CoreObject *obj, UserRequest *ur)
+{
+       TcorePlugin *plugin = NULL;
+       TcoreHal *hal = NULL;
+       TcoreATRequest *atreq = NULL;
+       char *cmd_str = NULL;
+       
+       TcorePending *pending = NULL;
+       const struct treq_sms_send_umts_msg *sendUmtsMsg = NULL;
+       GQueue *queue = NULL;
+
+       Storage *strg = NULL;
+       int mode = 0x00;
+       Server *s = NULL;
+
+       unsigned char optMask = 0;
+       TReturn api_err = TCORE_RETURN_SUCCESS;
+
+       hal = tcore_object_get_hal(obj);
+       pending = tcore_pending_new(obj, 0);
+
+       dbg("new pending(TIZEN_SMS_SEND_MSG)");
+       sendUmtsMsg = tcore_user_request_ref_data(ur, NULL);
+       
+       // AT command to select MoreMessagesToSend. In the response, actual send AT cmd will be sent
+       cmd_str = g_strdup_printf("AT+CMMS=%d\r", sendUmtsMsg->more);
+       atreq = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       tcore_pending_set_request_data(pending,0,atreq);
+       tcore_pending_set_timeout(pending, 0);
+       tcore_pending_set_response_callback(pending, on_response_send_umts_msg, hal);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL);
+
+
+       tcore_hal_send_request(hal, pending);
+       return TCORE_RETURN_SUCCESS;
+}
+
+
+static TReturn Send_SmsSubmitTpdu(CoreObject *o, UserRequest *ur)
+{
+       TcorePlugin *p = NULL;
+       TcoreHal *h = NULL;
+       TcorePending *pending = NULL;
+       const struct treq_sms_send_umts_msg *sendUmtsMsg = NULL;
+       
+       char *cmd_str = NULL;
+       char tpdu[2*MAX_GSM_SMS_TPDU_SIZE];
+       int ScLength = 0;
+       int tpduDataLen = 0;
+       int i = 0;
+
+       TcoreATRequest *atreq = NULL;
+       TReturn api_err = TCORE_RETURN_SUCCESS;
+
+       sendUmtsMsg = tcore_user_request_ref_data(ur, NULL);
+
+       h = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       if (!sendUmtsMsg || !h)
+               return TCORE_RETURN_ENOSYS;
+
+       /* Populate data */
+       dbg("[tcore_SMS] MoreToSend[0x%x](1:Persist, 2:NotPersist) MsgLen[%d]",sendUmtsMsg->more, sendUmtsMsg->msgDataPackage.msgLength);
+       for(i=0; i<sendUmtsMsg->msgDataPackage.msgLength; i++)
+               dbg("[%02x]", sendUmtsMsg->msgDataPackage.tpduData[i]);
+
+       ScLength = sendUmtsMsg->msgDataPackage.sca[0];
+
+       if ((sendUmtsMsg->msgDataPackage.msgLength > 0)
+               && (SMS_SMDATA_SIZE_MAX > sendUmtsMsg->msgDataPackage.msgLength)
+               && (ScLength <= SMS_MAX_SMS_SERVICE_CENTER_ADDR))
+       {
+                       memset(tpdu, 0, sizeof(2*MAX_GSM_SMS_TPDU_SIZE));
+               
+                       if(ScLength == 0) /* ScAddress not specified */
+                       {
+                               tpduDataLen = 2;
+                               tpdu[0] = '0';
+                               tpdu[1] = '0';
+                       }
+                       else
+                       {
+                       #ifndef TAPI_CODE_SUBJECT_TO_CHANGE
+                               dbg("SC length in Tx is %d - before", ScLength);
+
+                               util_sms_get_length_of_sca(&ScLength);
+
+                               dbg(" SC length in Tx is %d - after", ScLength);
+
+                               tpdu[0] = ScLength + 1;
+                               memcpy(&(tpdu[1]), &(sendUmtsMsg->msgDataPackage.sca[1]), (ScLength + 1));
+
+                               tpduDataLen = 2 + ScLength;
+                       #else
+                               dbg("Specifying SCA in TPDU is currently not supported");
+
+                               tpduDataLen = 2;
+                               tpdu[0] = '0';
+                               tpdu[1] = '0';
+                       #endif
+                       }
+
+                       for(i=0; i<(sendUmtsMsg->msgDataPackage.msgLength*2); i+=2) 
+                       {
+                               char value = 0;
+
+                               value = (sendUmtsMsg->msgDataPackage.tpduData[i/2] & 0xf0 ) >> 4;
+                               if(value < 0xA)
+                                       tpdu[i+tpduDataLen] = ((sendUmtsMsg->msgDataPackage.tpduData[i/2] & 0xf0 ) >> 4) + '0';
+                               else tpdu[i+tpduDataLen] = ((sendUmtsMsg->msgDataPackage.tpduData[i/2] & 0xf0 ) >> 4) + 'A' -10;
+
+                               value = sendUmtsMsg->msgDataPackage.tpduData[i/2] & 0x0f;
+                               if(value < 0xA)
+                                       tpdu[i+1+tpduDataLen] = (sendUmtsMsg->msgDataPackage.tpduData[i/2] & 0x0f ) + '0';
+                               else tpdu[i+1+tpduDataLen] = (sendUmtsMsg->msgDataPackage.tpduData[i/2] & 0x0f ) + 'A' -10;
+
+                       }
+
+                       tpduDataLen = tpduDataLen + 2*sendUmtsMsg->msgDataPackage.msgLength;
+                       
+                       /* AT+CMGS=<length><CR>PDU is given<ctrl-Z/ESC> */
+                       cmd_str = g_strdup_printf("AT+CMGS=%d%s%s\x1A%s", sendUmtsMsg->msgDataPackage.msgLength, "\r", tpdu, "\r");
+                       dbg("cmd_str is %p", cmd_str);
+                       dbg("tpdu %s", tpdu);
+                       for(i=0; i<strlen(cmd_str); i++)
+                               dbg("cmd_str data: [%x]", cmd_str[i]);
+
+                       dbg("TPDU data_len: %d", tpduDataLen);
+                       
+                       for(i=0; i<tpduDataLen; i++)
+                               dbg("[%02x]", tpdu[i]);
+                       
+                       atreq = tcore_at_request_new(cmd_str, "+CMGS:", TCORE_AT_SINGLELINE);
+
+                       tcore_pending_set_request_data(pending, 0, atreq);
+                       tcore_pending_set_response_callback(pending, on_response_send_smsSubmitTpdu, NULL);
+                       tcore_pending_link_user_request(pending, ur);
+
+                       tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL);
+                       
+                       api_err = tcore_hal_send_request(h, pending);   
+                       
+       }
+       else
+       {
+               dbg("[tcore_SMS] Invalid Data Length");
+               api_err = TCORE_RETURN_SMS_INVALID_DATA_LEN;
+       }
+       
+       return api_err;
+
+}
+
+static TReturn read_msg(CoreObject *obj, UserRequest *ur)
+{
+       TcorePlugin *plugin = NULL;
+       TcoreATRequest *atreq = NULL;
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       const struct treq_sms_read_msg *readMsg = NULL;
+       const char * cmd_str = NULL;
+
+       dbg("new pending(TIZEN_SMS_READ_MSG)");
+
+       readMsg = tcore_user_request_ref_data(ur, NULL);
+
+       hal = tcore_object_get_hal(obj);
+       pending = tcore_pending_new(obj, 0);
+
+       if (!readMsg || !hal)
+               return TCORE_RETURN_ENOSYS;
+
+       cmd_str = g_strdup_printf("AT+CMGR=%d\r", (readMsg->index + 1)); /* IMC index is one ahead of Samsung */
+               
+       dbg("cmd str is %s",cmd_str);
+
+       atreq = tcore_at_request_new((const char *)cmd_str, "\e+CMGR:", TCORE_AT_SINGLELINE);
+
+       g_free(cmd_str);
+
+       tcore_pending_set_request_data(pending, 0, atreq);
+       tcore_pending_set_response_callback(pending, on_response_read_msg, &(readMsg->index)); //storing index as user data
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL);
+
+       return tcore_hal_send_request(hal, pending);
+
+}
+
+static TReturn save_msg(CoreObject *obj, UserRequest *ur)
+{      
+
+       TcorePlugin *plugin = NULL;
+       TcoreATRequest *atreq = NULL;
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       const struct treq_sms_save_msg *saveMsg = NULL;
+       const char *cmd_str = NULL;
+       char pdu[MAX_GSM_SMS_TPDU_SIZE]; /* SCA + PDU */
+
+       TReturn api_err = TCORE_RETURN_SUCCESS;
+       int ScLength = 0, pduLength = 0, stat = 0;
+
+       dbg("new pending(TIZEN_SMS_SAVE_MSG)");
+
+       saveMsg = tcore_user_request_ref_data(ur, NULL);
+
+       hal = tcore_object_get_hal(obj);
+       pending = tcore_pending_new(obj, 0);
+
+       if (!saveMsg ||  !hal)
+               return TCORE_RETURN_ENOSYS;
+
+       dbg("Index value %x is not ensured. CP will allocate index automatically", saveMsg->simIndex);
+       dbg("msgStatus: %x", saveMsg->msgStatus);
+
+       switch (saveMsg->msgStatus) {
+               case SMS_STATUS_READ:
+                       stat = AT_REC_READ;
+                       break;
+               case SMS_STATUS_UNREAD:
+                       stat = AT_REC_UNREAD;
+                       break;
+               case SMS_STATUS_SENT:
+                       stat = AT_STO_SENT;
+                       break;
+               case SMS_STATUS_UNSENT:
+                       stat = AT_STO_UNSENT;
+                       break;
+               default:
+                       err("Invalid msgStatus");
+                       api_err = TCORE_RETURN_EINVAL;
+                       
+                       dbg("Exiting with api_err: %x", api_err);
+                       return api_err;
+       }
+
+       if ((saveMsg->msgDataPackage.msgLength > 0) && (SMS_SMDATA_SIZE_MAX > saveMsg->msgDataPackage.msgLength)) {
+
+               /* Initialize PDU */
+               memset(pdu, 0x00, MAX_GSM_SMS_TPDU_SIZE);
+               
+               ScLength = saveMsg->msgDataPackage.sca[0];
+
+               if(ScLength == 0) {
+                       dbg("ScLength is zero");
+                       pduLength = 1;
+               }
+               else {
+                       dbg("ScLength (Useful semi-octets) %d", ScLength);
+
+                       util_sms_get_length_of_sca(&ScLength); /* Convert useful semi-octets to useful octets */
+
+                       dbg("ScLength (Useful octets) %d", ScLength);
+
+                       pdu[0] = ScLength + 1; /* ScLength */
+                       memcpy(&(pdu[1]), &(saveMsg->msgDataPackage.sca[1]), ScLength+1); /* ScType + ScAddress */
+
+                       pduLength = 2 + ScLength;
+               }
+
+               /* SMS PDU */
+               memcpy(&(pdu[pduLength]), saveMsg->msgDataPackage.tpduData, saveMsg->msgDataPackage.msgLength);
+
+               pduLength = pduLength + saveMsg->msgDataPackage.msgLength;
+
+               dbg("pduLength: %d", pduLength);
+
+               {
+                       int i;
+                       for(i=0; i<pduLength; i++)
+                               dbg("SMS-PDU: [%x]", pdu[i]);
+               }
+
+               /* +CMGW=<length>[,<stat>]<CR>PDU is given<ctrl-Z/ESC> */
+               cmd_str = g_strdup_printf("AT+CMGW=%d,%d%s%s%x%s", pduLength, stat, "\r", pdu, 0x1A, "\r");
+
+               g_printf("cmd_str: %s", cmd_str);
+               
+               atreq = tcore_at_request_new((const char *)cmd_str, "+CMGW", TCORE_AT_SINGLELINE);
+
+               g_free(cmd_str);
+       
+               tcore_pending_set_request_data(pending, 0, atreq);
+               tcore_pending_set_response_callback(pending, on_response_sms_save_msg_cnf, NULL);
+               tcore_pending_link_user_request(pending, ur);
+               tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL);
+
+               api_err = tcore_hal_send_request(hal, pending);
+       }
+       else {
+               dbg("Invalid Data Length for SaveMessage");
+               api_err = TCORE_RETURN_SMS_INVALID_DATA_LEN;
+       }
+
+       dbg("Exiting with api_err: %x", api_err);
+       return api_err;
+
+}
+
+static TReturn delete_msg(CoreObject *obj, UserRequest *ur)
+{
+
+       TcorePlugin *plugin= NULL;
+       TcoreHal *hal = NULL;
+       TcoreATRequest *atreq = NULL;
+       TcorePending *pending = NULL;
+       const struct treq_sms_delete_msg *deleteMsg = NULL;
+       GQueue *queue = NULL;
+       const char * cmd_str = NULL;
+       int index = 0;
+
+       dbg("new pending(TIZEN_SMS_DEL_MSG)");
+
+       deleteMsg = tcore_user_request_ref_data(ur, NULL);
+
+       hal = tcore_object_get_hal(obj);
+       pending = tcore_pending_new(obj, 0);
+
+       if (!deleteMsg || !hal)
+               return TCORE_RETURN_ENOSYS;
+
+       index = deleteMsg->index;
+       
+       cmd_str =g_strdup_printf("AT+CMGD=%d,0\r",deleteMsg->index);
+       atreq = tcore_at_request_new((const char*)cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       tcore_pending_set_request_data(pending, 0, atreq);
+       tcore_pending_set_response_callback(pending, on_response_sms_delete_msg_cnf, (void *)&index);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL);
+
+       return tcore_hal_send_request(hal, pending);
+
+
+
+}
+
+static TReturn get_storedMsgCnt(CoreObject *obj, UserRequest *ur)
+{
+       TReturn ret_code = TCORE_RETURN_UNKNOWN;
+
+       TcorePlugin *plugin = NULL;
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       TcoreATRequest *atreq = NULL;
+       
+       const struct treq_sms_get_msg_count *getStoredMsgCnt = NULL;
+       const char *cmd_str = NULL;
+
+       dbg("new pending(TIZEN_SMS_GET_STORED_MSG_COUNT)");
+
+       getStoredMsgCnt = tcore_user_request_ref_data(ur, NULL);
+
+       hal = tcore_object_get_hal(obj);
+       pending = tcore_pending_new(obj, 0);
+
+       cmd_str = g_strdup_printf("AT+CPMS=\"SM\",\"SM\",\"SM\"%c", CR);
+       atreq = tcore_at_request_new((const char *)cmd_str, "+CPMS", TCORE_AT_SINGLELINE);
+
+       /* NULL checkpoint */
+       if (!hal || !pending || !cmd_str || !atreq)
+       {
+               err("Pointer is NULL. hal:[%p], pending:[%p], cmd_str:[%p], atreq:[%p]", hal, pending, cmd_str, atreq);
+
+               if(pending)
+               {
+                       dbg("Freeing pending");
+                       free(pending);
+               }
+               if(cmd_str)
+               {
+                       dbg("Freeing cmd_str");
+                       g_free(cmd_str);
+               }
+               if(atreq)
+               {
+                       dbg("Freeing atreq");
+                       free(atreq);
+               }
+
+               ret_code = TCORE_RETURN_FAILURE;
+               dbg("Exiting Function with ret_code: [%x]", ret_code);
+               return ret_code;
+       }
+
+       if(cmd_str) /* Already copied in AT-Request */
+       {
+               dbg("Freeing cmd_str");
+               g_free(cmd_str);
+       }
+       
+       tcore_pending_set_request_data(pending, 0, atreq);
+       tcore_pending_set_response_callback(pending, on_response_get_storedMsgCnt, NULL);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL);
+       ret_code = tcore_hal_send_request(hal, pending);
+       
+       dbg("Exiting Function with ret_code: [%x]", ret_code);
+       return ret_code;
+}
+
+static TReturn get_sca(CoreObject *obj, UserRequest *ur)
+{
+
+       //TODO - Need to make this a blocking call??
+       
+       TcorePlugin *plugin = NULL;
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       TcoreATRequest *atreq = NULL;
+       struct tresp_sms_get_sca *respGetSca;
+       const char * cmd_str = NULL;
+
+       dbg("new pending(TIZEN_SMS_GET_SCA)");
+
+       //index is not supported as input param for GetSCA AT command.Hence ignoring
+       respGetSca = tcore_user_request_ref_data(ur, NULL);
+
+       hal = tcore_object_get_hal(obj);
+       pending = tcore_pending_new(obj, 0);
+
+       if (!respGetSca || !hal)
+               return TCORE_RETURN_ENOSYS;
+
+       cmd_str = g_strdup_printf("AT+CSCA?\r");;
+       atreq = tcore_at_request_new((const char*)cmd_str, "+CSCA", TCORE_AT_SINGLELINE);
+
+       tcore_pending_set_request_data(pending, 0,atreq);
+       tcore_pending_set_response_callback(pending, on_response_get_sca, NULL);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL);
+
+
+       return tcore_hal_send_request(hal, pending);
+
+}
+
+static TReturn set_sca(CoreObject *object, UserRequest *ur)
+{
+
+       TcorePlugin *plugin = NULL;
+       TcoreHal *hal = NULL;
+       TcorePending *pending = NULL;
+       TcoreATRequest *atreq = NULL;
+
+       const struct treq_sms_set_sca *setSca = NULL;
+       char* cmd_str = NULL;
+       int addrType = 0;
+       
+
+       dbg("new pending(TIZEN_SMS_SET_SCA)");
+
+       setSca = tcore_user_request_ref_data(ur, NULL);
+
+       if(setSca->index != 0){
+               dbg("Index except 0 is supported");
+               return TCORE_RETURN_EINVAL;     // TAPI_API_NOT_SUPPORTED;
+       }
+
+       hal = tcore_object_get_hal(object);
+       pending = tcore_pending_new(object, 0);
+       
+       if (!setSca || !hal)
+               return TCORE_RETURN_ENOSYS;
+
+       addrType = ((setSca->scaInfo.typeOfNum << 4) | setSca->scaInfo.numPlanId) | 0x80;
+
+       //TODO Need to clarify about dialing NumLen
+       cmd_str = g_strdup_printf("AT+CSCA=%s,%d", setSca->scaInfo.diallingNum, addrType);
+       atreq = tcore_at_request_new((const char*)cmd_str, NULL, TCORE_AT_NO_RESULT);
+       
+       tcore_pending_set_request_data(pending, 0, atreq);
+       tcore_pending_set_response_callback(pending, on_response_set_sca, NULL);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL);
+
+
+       return tcore_hal_send_request(hal, pending);
+
+
+}
+
+static TReturn get_cb_config(CoreObject *obj, UserRequest *ur)
+{
+       //Format of AT command is       AT+CSCB?
+       //Possible response is +CSCB : <mode>,<mids>,<dcss>
+       //OK
+
+       TcorePlugin *plugin = NULL;
+       TcoreHal *hal = NULL;
+       
+       TcoreATRequest *atreq;
+       TcorePending *pending = NULL;
+       
+       const struct treq_sms_get_cb_config *getCbConfig = NULL;
+
+       dbg("new pending(TIZEN_SMS_GET_CBS_CFG)");
+
+       getCbConfig = tcore_user_request_ref_data(ur, NULL);
+
+       hal = tcore_object_get_hal(obj);
+       pending = tcore_pending_new(obj, 0);
+
+       if (!hal) // request data is NULL, so do not NULL check for getCbConfig
+       {
+               dbg("[ERR]  pointer is NULL, getCbConfig=0x%x, h=0x%x", getCbConfig, hal);
+               return TCORE_RETURN_ENOSYS;
+       }
+
+       atreq = tcore_at_request_new("AT+CSCB?", "+CSCB", TCORE_AT_SINGLELINE);
+       tcore_pending_set_request_data(pending, 0, atreq);
+       tcore_pending_set_response_callback(pending, on_response_get_cb_config, NULL);
+       tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL);
+       tcore_pending_link_user_request(pending, ur);
+
+       return tcore_hal_send_request(hal, pending);
+
+}
+
+static TReturn set_cb_config(CoreObject *obj, UserRequest *ur)
+{
+       TcorePlugin *plugin = NULL;
+       TcoreHal *hal = NULL;
+       TcoreATRequest *atreq = NULL;
+       TcorePending *pending = NULL;
+
+       const struct treq_sms_set_cb_config *setCbConfig = NULL;
+       char *cmd_str = NULL;
+       gchar *mids_str = NULL;
+       GString *mids_GString = NULL;
+       int err = 0, response = 0, ctr = 0;
+
+       dbg("new pending(TIZEN_SMS_SET_CBS_CFG)");
+
+       setCbConfig = tcore_user_request_ref_data(ur, NULL);
+
+       hal = tcore_object_get_hal(obj);
+       pending = tcore_pending_new(obj, 0);
+
+       
+       if (!setCbConfig || !hal)
+               return TCORE_RETURN_ENOSYS;
+
+       if (setCbConfig->bCBEnabled == FALSE) /* AT+CSCB=0: Disable CBS */
+       {
+               cmd_str = g_strdup_printf("AT+CSCB=0\r");
+       }
+       else
+       {
+               if(setCbConfig->selectedId == SMS_CBMI_SELECTED_SOME) /* AT+CSCB=0,<mids>,<dcss>: Enable CBS for specified <mids> and <dcss> */
+               {
+                       dbg("Enabling specified CBMIs");
+                       mids_GString = g_string_new(g_strdup_printf("%d", setCbConfig->msgIDs[0]));
+                       
+                       for(ctr=1; ctr <setCbConfig->msgIdCount; ctr++)
+                       {
+                               mids_GString = g_string_append(mids_GString, ",");
+                               mids_GString = g_string_append(mids_GString, g_strdup_printf("%d", setCbConfig->msgIDs[ctr]));
+                       }
+
+                       mids_str = g_string_free(mids_GString, FALSE);
+                       //cmd_str = g_strdup_printf("AT+CSCB=0,\"%s\"\r", mids_str);
+
+                       //Temporary work around to test from UI. Enabling all - To be removed later
+                       cmd_str = g_strdup_printf("AT+CSCB=1\r");
+                       g_free(mids_str);
+               }
+               else if (setCbConfig->selectedId == SMS_CBMI_SELECTED_ALL) /* AT+CSCB=1: Enable CBS for all <mids> and <dcss> */
+               {
+                       dbg("Enabling all CBMIs");
+                       cmd_str = g_strdup_printf("AT+CSCB=1\r");
+               }
+       }
+       
+       dbg("cmd_str: %s", cmd_str);
+       
+       atreq = tcore_at_request_new((const char *)cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       g_free(cmd_str);
+       
+       tcore_pending_set_request_data(pending, 0, atreq);
+       tcore_pending_set_response_callback(pending, on_response_set_cb_config, NULL);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL);
+       
+       tcore_hal_send_request(hal, pending);
+
+       return TCORE_RETURN_SUCCESS;
+       
+}
+
+static TReturn set_mem_status(CoreObject *obj, UserRequest *ur)
+{
+
+       TcorePlugin *plugin = NULL;
+       TcoreHal *hal = NULL;
+       TcoreATRequest *atreq;
+       TcorePending *pending = NULL;
+
+       const struct treq_sms_set_mem_status *setMemStatus = NULL;
+       char* cmd_str = NULL;
+       int memoryStatus = 0;
+
+       dbg("new pending(TIZEN_SMS_SET_MEM_STATUS)");
+
+       setMemStatus = tcore_user_request_ref_data(ur, NULL);
+
+       hal = tcore_object_get_hal(obj);
+       pending = tcore_pending_new(obj, 0);
+
+
+       if (!setMemStatus || !hal)
+               return TCORE_RETURN_ENOSYS;
+
+       if(setMemStatus->memory_status < SMS_PDA_MEMORY_STATUS_AVAILABLE ||
+               setMemStatus->memory_status > SMS_PDA_MEMORY_STATUS_FULL)
+               return TCORE_RETURN_EINVAL;
+
+       switch (setMemStatus->memory_status)
+       {
+               case SMS_PDA_MEMORY_STATUS_AVAILABLE:
+                       memoryStatus = AT_MEMORY_AVAILABLE;
+                       break;
+               case SMS_PDA_MEMORY_STATUS_FULL:
+                       memoryStatus = AT_MEMORY_FULL;
+                       break;
+               default:
+                       memoryStatus = -1;
+                       break;
+       }
+
+
+       cmd_str = g_strdup_printf("AT+XTESM=%d",memoryStatus);
+       atreq = tcore_at_request_new((const char *)cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       dbg("cmd str is %s",cmd_str);
+               
+
+       tcore_pending_set_request_data(pending, 0, atreq);
+       tcore_pending_set_response_callback(pending, on_response_set_mem_status, NULL);
+       tcore_pending_link_user_request(pending, ur);
+       tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL);
+
+
+       return tcore_hal_send_request(hal, pending);
+       
+}
+
+static TReturn get_pref_brearer(CoreObject *obj, UserRequest *ur)
+{
+       dbg("Entry");
+
+       dbg("Exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn set_pref_brearer(CoreObject *obj, UserRequest *ur)
+{
+       dbg("Entry");
+
+       dbg("Exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn set_delivery_report(CoreObject *obj, UserRequest *ur)
+{
+       TcorePlugin *plugin = NULL;
+       TcoreHal *hal = NULL;
+       TcoreATRequest *atreq;
+       TcorePending *pending = NULL;
+       const struct treq_sms_set_delivery_report *deliveryReport = NULL;
+       struct property_sms_info *property = NULL;
+       GQueue *queue = NULL;
+       char pdu[MAX_GSM_SMS_TPDU_SIZE];
+
+       TReturn api_err = TCORE_RETURN_SUCCESS;
+       int scaLen = 0 , length = 0;
+       unsigned short nRpCause = 0;
+       char *cmd_str = NULL ;
+
+       //Format  -     +CNMA[=<n>[,<length>[<CR>PDU is given<ctrl-Z/ESC>]]]
+       dbg("new pending(IPC_SMS_SET_DELIVER_REPORT)");
+
+       deliveryReport = tcore_user_request_ref_data(ur, NULL);
+
+       hal = tcore_object_get_hal(obj);
+       pending = tcore_pending_new(obj, 0);
+
+       if (!deliveryReport || !hal)
+               return TCORE_RETURN_ENOSYS;
+
+       //pdu = (treq_sms_set_delivery_report *) calloc (1,sizeof(treq_sms_set_delivery_report));
+
+       if ((deliveryReport->dataInfo.msgLength > 0) && (MAX_GSM_SMS_TPDU_SIZE > deliveryReport->dataInfo.msgLength)) 
+       {
+                       //pending = tcore_pending_new(obj, 0);
+                       //atreq = tcore_at_request_new("AT+CNMA", NULL, TCORE_AT_NO_RESULT);
+
+               scaLen = deliveryReport->dataInfo.sca[0];
+               if(scaLen == 0){
+                       memcpy(pdu, deliveryReport->dataInfo.sca, scaLen+2);
+               }
+               else{
+                       scaLen = deliveryReport->dataInfo.sca[0];
+
+                       dbg(" SC length in tx is %d - before", scaLen);
+
+                       util_sms_get_length_of_sca(&scaLen);
+
+                       dbg(" SC length in tx is %d - after", scaLen);
+
+                       //1Copy SCA to the pdu stream first
+                       pdu[0] = scaLen + 1;
+                       memcpy(&(pdu[1]), &(deliveryReport->dataInfo.sca[1]), scaLen+1);
+               }
+
+               length = (deliveryReport->dataInfo.msgLength) + (scaLen + 2);
+
+               nRpCause = (unsigned short) deliveryReport->rspType;
+
+               dbg(" data len is %d",length);
+
+               if ((deliveryReport->dataInfo.msgLength < SMS_SMDATA_SIZE_MAX)) {
+                       //2Copy rest of the SMS-DELIVER TPDU
+                       memcpy(&(pdu[scaLen + 2]), deliveryReport->dataInfo.tpduData,   deliveryReport->dataInfo.msgLength);
+               } else {
+                       dbg(" SCA len is %d", scaLen);
+                       api_err = TCORE_RETURN_SMS_INVALID_DATA_LEN;
+                       return api_err;
+               }
+
+
+                       if(deliveryReport->rspType == SMS_SENDSMS_SUCCESS)
+                       {
+                               //cmd_str = g_strdup_printf("AT+CNMA=1,%d\r%s\x1A\r", length,pdu);
+                               cmd_str = g_strdup_printf("AT+CNMA=1\r");
+                       }
+                       else
+                       {
+                               cmd_str = g_strdup_printf("AT+CNMA=2\r");
+                       }
+       
+                       atreq = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+                       tcore_pending_set_request_data(pending, 0, atreq);
+                       tcore_pending_set_timeout(pending, 0);
+                       tcore_pending_set_response_callback(pending, on_response_sms_deliver_rpt_cnf, NULL);
+                       tcore_pending_link_user_request(pending, ur);
+
+                       return tcore_hal_send_request(hal, pending);
+
+               }
+       else {
+               dbg(" Invalid Data Length for DeliverReportSet");
+               api_err = TCORE_RETURN_SMS_INVALID_DATA_LEN;
+       }
+
+       return api_err;
+}
+
+static TReturn set_msg_status(CoreObject *obj, UserRequest *ur)
+{
+       dbg("Entry");
+
+       TcorePlugin *plugin = NULL;
+       TcoreHal *hal = NULL;
+       TcoreATRequest *atreq;
+       TcorePending *pending = NULL;
+       const struct treq_sms_set_msg_status *msg_status = NULL;
+       char *cmd_str = NULL, *encoded_data = NULL;     
+
+       encoded_data = calloc(176,1);
+
+
+       msg_status = tcore_user_request_ref_data(ur, NULL);
+
+       dbg("msg status %d and index %d",msg_status->msgStatus, msg_status->index);
+
+       switch (msg_status->msgStatus)
+       {
+               case SMS_STATUS_READ:
+                       encoded_data[0] = encoded_data[0] | 0x01;
+                       break;
+               
+               case SMS_STATUS_UNREAD:
+                       encoded_data[0] = encoded_data[0] | 0x03;
+                       break;
+
+               case SMS_STATUS_UNSENT:
+                       encoded_data[0] = encoded_data[0] | 0x07;
+                       break;
+       
+               case SMS_STATUS_SENT:
+                       encoded_data[0] = encoded_data[0] | 0x05;
+                       break;
+
+               case SMS_STATUS_DELIVERED:
+                       encoded_data[0] = encoded_data[0] | 0x1D;
+                       break;
+               case SMS_STATUS_DELIVERY_UNCONFIRMED:
+                       encoded_data[0] = encoded_data[0] | 0xD;
+                       break;
+               case SMS_STATUS_MESSAGE_REPLACED:
+               case SMS_STATUS_RESERVED:
+                       encoded_data[0] = encoded_data[0] | 0x03;
+                       break;          
+       }
+
+       memset(&encoded_data[1] , 0xff, 175);
+       
+
+       hal = tcore_object_get_hal(obj);
+       pending = tcore_pending_new(obj, 0);
+
+       if (!hal)
+       {
+               dbg("[ERR]  pointer is NULL, h=0x%x", hal);
+               return TCORE_RETURN_ENOSYS;
+       }
+
+       // AT+CRSM=<command>,<fildid>,<p1>,<p2+C29,<p3> TODO
+       cmd_str = g_strdup_printf("AT+CRSM=220,0x6F3C,%d, 4, 176 %s\r", msg_status->index, encoded_data);
+       dbg("cmd str is %s",cmd_str);
+
+       atreq = tcore_at_request_new(cmd_str, "+CRSM:", TCORE_AT_SINGLELINE);
+       
+       tcore_pending_set_request_data(pending, 0,atreq);
+       tcore_pending_set_timeout(pending, 0);
+       tcore_pending_set_response_callback(pending, on_response_set_msg_status, NULL);
+       tcore_pending_link_user_request(pending, ur);
+
+       tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL);
+       
+       tcore_hal_send_request(hal, pending);
+       free(cmd_str);
+
+       dbg("Exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn get_sms_params(CoreObject *obj, UserRequest *ur)
+{
+       dbg("Entry");
+
+       TcorePlugin *plugin = NULL;
+       TcoreHal *hal = NULL;
+       TcoreATRequest *atreq = NULL;
+       TcorePending *pending = NULL;
+       const struct treq_sms_get_params *getSmsParams = NULL;
+       char *cmd_str = NULL;
+       
+       getSmsParams = tcore_user_request_ref_data(ur, NULL);
+
+       hal = tcore_object_get_hal(obj);
+       pending = tcore_pending_new(obj, 0);
+
+       if (!getSmsParams || !hal)
+       {
+               dbg("[ERR]  pointer is NULL, getSmsParams=0x%x, h=0x%x", getSmsParams, hal);
+               return TCORE_RETURN_ENOSYS;
+       }
+
+       // AT+CRSM=<command>,<fildid>,<p1>,<p2+C29,<p3> 
+       
+       //cmd_str = g_strdup_printf("AT+CRSM=%d,%x,%d,4 40%s", 178, 0x6F42, getSmsParams->index + 1, "\r");
+       
+       cmd_str = g_strdup_printf("AT+CRSM=178,0x6F42,%d,4,0\r",getSmsParams->index);
+
+       
+       atreq = tcore_at_request_new(cmd_str, "+CRSM:", TCORE_AT_SINGLELINE);
+       dbg("cmd str is %s",cmd_str);
+       
+       tcore_pending_set_request_data(pending, 0,atreq);
+       tcore_pending_set_timeout(pending, 0);
+       tcore_pending_set_response_callback(pending, on_response_get_sms_params, NULL);
+       tcore_pending_link_user_request(pending, ur);
+
+       tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL);
+        
+       tcore_hal_send_request(hal, pending);
+       free(cmd_str);
+       
+
+       dbg("Exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn set_sms_params(CoreObject *obj, UserRequest *ur)
+{
+       dbg("Entry");
+       
+       TcorePlugin *plugin = NULL;
+       TcoreHal *hal = NULL;
+       TcoreATRequest *atreq = NULL;
+       TcorePending *pending = NULL;
+       const struct treq_sms_set_params *setSmsParams = NULL;
+       char *cmd_str = NULL, *encoded_data = NULL ,*temp_data = NULL;
+       int len = 0, i = 0, iSize = sizeof(struct treq_sms_set_params);
+
+
+       setSmsParams = tcore_user_request_ref_data(ur, NULL);
+       
+       temp_data = calloc(iSize,1);
+
+       
+       memcpy(temp_data,(void *)(setSmsParams+6), (iSize-6));  
+       len = strlen(temp_data);
+
+       //EFsmsp file size is 28 +Y bytes (Y is alpha id size)
+        encoded_data = calloc((setSmsParams->params.alphaIdLen+28),1);
+
+       hal = tcore_object_get_hal(obj);
+       pending = tcore_pending_new(obj, 0);
+
+       if (!setSmsParams || !hal)
+       {
+               dbg("[ERR]  pointer is NULL, setSmsParams=0x%x, h=0x%x", setSmsParams, hal);
+               return TCORE_RETURN_ENOSYS;
+       }
+
+       // AT+CRSM=<command>,<fildid>,<p1>,<p2+C29,<p3> 
+
+       for(i=0; i<(len*2); i+=2)
+        {
+               char value = 0;
+
+                value = (temp_data[i/2] & 0xf0 ) >> 4;
+                                if(value < 0xA)
+                                        encoded_data[i+len] = ((temp_data[i/2] & 0xf0 ) >> 4) + '0';
+                                else encoded_data[i+len] = ((temp_data[i/2] & 0xf0 ) >> 4) + 'A' -10;
+
+                                value = temp_data[i/2] & 0x0f;
+                                if(value < 0xA)
+                                        encoded_data[i+1+len] = (temp_data[i/2] & 0x0f ) + '0';
+                                else encoded_data[i+1+len] = (temp_data[i/2] & 0x0f ) + 'A' -10;
+
+         }
+
+
+
+
+       cmd_str = g_strdup_printf("AT+CRSM=220,0x6F42,%x,4,0,%x%x%x%x%x%x%x", 220, 0x6F42, setSmsParams->params.recordIndex, setSmsParams->params.szAlphaId,setSmsParams->params.paramIndicator,setSmsParams->params.tpDestAddr,setSmsParams->params.tpSvcCntrAddr,setSmsParams->params.tpProtocolId,setSmsParams->params.tpDataCodingScheme,setSmsParams->params.tpValidityPeriod, "\r"); 
+
+       dbg("cmd str is %s",cmd_str);
+       atreq = tcore_at_request_new(cmd_str, "+CRSM:", TCORE_AT_SINGLELINE);
+       
+       tcore_pending_set_request_data(pending, 0,atreq);
+       tcore_pending_set_timeout(pending, 0);
+       tcore_pending_set_response_callback(pending, on_response_set_sms_params, NULL);
+       tcore_pending_link_user_request(pending, ur);
+
+       tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL);
+       
+       tcore_hal_send_request(hal, pending);
+       free(cmd_str);
+
+       
+
+       dbg("Exit");
+       return TCORE_RETURN_SUCCESS;
+}
+static TReturn get_paramcnt(CoreObject *obj, UserRequest *ur)
+{
+       dbg("Entry");
+
+       TcorePlugin *plugin = NULL;
+       TcoreHal *hal = NULL;
+       TcoreATRequest *atreq = NULL;
+       TcorePending *pending = NULL;
+       const struct treq_sms_get_paramcnt *getParamCnt = NULL;
+       char *cmd_str = NULL;
+       
+       getParamCnt = tcore_user_request_ref_data(ur, NULL);
+
+       hal = tcore_object_get_hal(obj);
+       pending = tcore_pending_new(obj, 0);
+
+       if (!hal)
+       {
+               dbg("[ERR]  pointer is NULL, h=0x%x", hal);
+               return TCORE_RETURN_ENOSYS;
+       }
+
+       // AT+CRSM=<command>,<fildid>,<p1>,<p2+C29,<p3>, EFsmsp: 0x6F42 
+       cmd_str = g_strdup_printf("AT+CRSM=192, %d%s", 0x6F42, "\r");
+
+       atreq = tcore_at_request_new(cmd_str, "+CRSM:", TCORE_AT_SINGLELINE);
+       dbg("cmd str is %s",cmd_str);
+
+       
+       tcore_pending_set_request_data(pending, 0,atreq);
+       tcore_pending_set_timeout(pending, 0);
+       tcore_pending_set_response_callback(pending, on_response_get_paramcnt, NULL);
+       tcore_pending_link_user_request(pending, ur);
+
+       tcore_pending_set_send_callback(pending, on_confirmation_sms_message_send, NULL);
+       
+       tcore_hal_send_request(hal, pending);
+       free(cmd_str);
+
+       dbg("Exit");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static struct tcore_sms_operations sms_ops =
+{
+       //.send_umts_msg = send_umts_msg,       
+       .send_umts_msg = Send_SmsSubmitTpdu,
+       .read_msg = read_msg,
+       .save_msg = save_msg,
+       .delete_msg = delete_msg,
+       .get_storedMsgCnt = get_storedMsgCnt,
+       .get_sca = get_sca,
+       .set_sca = set_sca,
+       .get_cb_config = get_cb_config,
+       .set_cb_config = set_cb_config,
+       .set_mem_status = set_mem_status,
+       .get_pref_brearer = get_pref_brearer,
+       .set_pref_brearer = set_pref_brearer,
+       .set_delivery_report = set_delivery_report,
+       .set_msg_status = set_msg_status,
+       .get_sms_params = get_sms_params,
+       .set_sms_params = set_sms_params,
+       .get_paramcnt = get_paramcnt,
+       //.send_cdma_msg = send_cdma_msg,
+};
+
+gboolean s_sms_init(TcorePlugin *plugin,  TcoreHal *hal)
+{
+       CoreObject *obj = NULL;
+       struct property_sms_info *data = NULL;
+       GQueue *work_queue = NULL;
+       dbg("Entry");
+       
+       obj = tcore_sms_new(plugin, "umts_sms", &sms_ops, hal);
+       if (!obj) {
+               return FALSE;
+       }
+
+       work_queue = g_queue_new();
+       tcore_object_link_user_data(obj, work_queue);
+
+       tcore_object_add_callback(obj, "\e+CMTI" , on_event_sms_incom_msg, NULL);
+       tcore_object_add_callback(obj, "\e+CMT" , on_event_sms_incom_msg, NULL);
+
+       tcore_object_add_callback(obj, "\e+CDS" , on_event_sms_incom_msg, NULL);
+       tcore_object_add_callback(obj, "\e+CDSI" , on_event_sms_incom_msg, NULL);
+
+       tcore_object_add_callback(obj, "+XTESM",  on_event_sms_memory_status, NULL);
+
+       tcore_object_add_callback(obj, "\e+CBMI" , on_event_sms_cb_incom_msg, NULL);    
+       tcore_object_add_callback(obj, "\e+CBM" , on_event_sms_cb_incom_msg, NULL);
+       tcore_object_add_callback(obj, "+XSIM", on_event_sms_ready_status, NULL);
+
+       //tcore_at_add_notification(&coreAt, "+XSIMSTATE", 0 , on_event_sms_incom_msg, NULL);
+
+       data = calloc(sizeof(struct property_sms_info), 1);
+       tcore_plugin_link_property(plugin, "SMS", data);
+
+       /* Make registration settings via AT commands necessary to recieve unsolicited noti */
+
+       dbg("Exit");
+       return TRUE;
+}
+
+
+void s_sms_exit(TcorePlugin *p)
+{
+       CoreObject *o;
+       struct property_sms_info *data;
+       dbg("Entry");
+
+       o = tcore_plugin_ref_core_object(p, "umts_sms");
+       if (!o) {
+               return;
+       }
+       tcore_sms_free(o);
+
+       data = tcore_plugin_ref_property(p, "SMS");
+       if (data) {
+               free(data);
+       }
+
+       dbg("Exit");
+       return;
+}
+
diff --git a/src/s_ss.c b/src/s_ss.c
new file mode 100755 (executable)
index 0000000..898489c
--- /dev/null
@@ -0,0 +1,3020 @@
+/*
+ * tel-plugin-imc
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hayoon Ko <hayoon.ko@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <hal.h>
+#include <core_object.h>
+#include <plugin.h>
+#include <queue.h>
+#include <co_call.h>
+#include <co_ss.h>
+#include <user_request.h>
+#include <util.h>
+#include <server.h>
+#include <at.h>
+
+#include "s_common.h"
+#include "s_ss.h"
+
+#define TIZEN_NUM_TYPE_INTERNATIONAL           0x01
+#define TIZEN_NUM_PLAN_ISDN                                0x01
+
+//To avoid sending multiple response to application
+static gboolean UssdResp = FALSE;
+
+enum  telephony_ss_opcode
+{
+       TIZEN_SS_OPCO_REG=0x01,         /* 0x01 : Registration */
+       TIZEN_SS_OPCO_DEREG,            /* 0x02 : De-registration(erase) */
+       TIZEN_SS_OPCO_ACTIVATE,         /* 0x03 : Activation */
+       TIZEN_SS_OPCO_DEACTIVATE,       /* 0x04 : De-activation */
+       TIZEN_SS_OPCO_MAX
+};
+
+struct ss_confirm_info
+{
+       enum telephony_ss_class class;
+       int  flavor_type;
+       enum tcore_response_command resp;
+       void *data;
+       int  data_len;
+};
+
+static gboolean _ss_request_message(TcorePending *pending, CoreObject *o, UserRequest *ur, void* on_resp, void* user_data);
+
+static TReturn _ss_barring_get(CoreObject *o,
+                                                               UserRequest *ur,
+                                                               enum telephony_ss_class class,
+                                                               enum telephony_ss_barring_mode type,
+                                                               enum tcore_response_command resp);
+
+static TReturn _ss_forwarding_get(CoreObject *o,
+                                                                       UserRequest *ur,
+                                                                       enum telephony_ss_class class,
+                                                                       enum telephony_ss_forwarding_mode type,
+                                                                       enum tcore_response_command resp);
+
+static TReturn _ss_waiting_get(CoreObject *o,
+                                                               UserRequest *ur,
+                                                               enum telephony_ss_class class,
+                                                               enum tcore_response_command resp);
+
+
+static TReturn s_ss_barring_activate(CoreObject *o, UserRequest *ur);
+static TReturn s_ss_barring_deactivate(CoreObject *o, UserRequest *ur);
+static TReturn s_ss_barring_change_password(CoreObject *o, UserRequest *ur);
+static TReturn s_ss_barring_get_status(CoreObject *o, UserRequest *ur);
+
+static TReturn s_ss_forwarding_activate(CoreObject *o, UserRequest *ur);
+static TReturn s_ss_forwarding_deactivate(CoreObject *o, UserRequest *ur);
+static TReturn s_ss_forwarding_register(CoreObject *o, UserRequest *ur);
+static TReturn s_ss_forwarding_deregister(CoreObject *o, UserRequest *ur);
+static TReturn s_ss_forwarding_get_status(CoreObject *o, UserRequest *ur);
+
+static TReturn s_ss_waiting_activate(CoreObject *o, UserRequest *ur);
+static TReturn s_ss_waiting_deactivate(CoreObject *o, UserRequest *ur);
+static TReturn s_ss_waiting_get_status(CoreObject *o, UserRequest *ur);
+
+static TReturn s_ss_cli_activate(CoreObject *o, UserRequest *ur);
+static TReturn s_ss_cli_deactivate(CoreObject *o, UserRequest *ur);
+static TReturn s_ss_cli_get_status(CoreObject *o, UserRequest *ur);
+
+static TReturn s_ss_send_ussd(CoreObject *o, UserRequest *ur);
+
+static TReturn s_ss_set_aoc(CoreObject *o, UserRequest *ur);
+static TReturn s_ss_get_aoc(CoreObject *o, UserRequest *ur);
+
+static TReturn s_ss_manage_call_0_send(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data);
+static TReturn s_ss_manage_call_1_send(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data);
+static TReturn s_ss_manage_call_1x_send(CoreObject* o, UserRequest* ur, const int id, ConfirmCallback cb, void* user_data);
+static TReturn s_ss_manage_call_2_send(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data);
+static TReturn s_ss_manage_call_2x_send(CoreObject* o, UserRequest* ur, const int id, ConfirmCallback cb, void* user_data);
+static TReturn s_ss_manage_call_3_send(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data);
+static TReturn s_ss_manage_call_4_send(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data);
+static TReturn s_ss_manage_call_4dn_send(CoreObject* o, UserRequest* ur, const char* number, ConfirmCallback cb, void* user_data);
+
+static void on_confirmation_ss_message_send(TcorePending *p, gboolean result, void *user_data);
+
+static void _ss_ussd_response(UserRequest *ur, const char* ussd_str, enum telephony_ss_ussd_type type, enum telephony_ss_ussd_status status);
+static void _ss_ussd_notification(TcorePlugin *p, const char* ussd_str, enum telephony_ss_ussd_status status);
+
+static gboolean on_notification_ss_info(CoreObject *o, const void *data, void *user_data);
+static gboolean on_notification_ss_ussd(CoreObject *o, const void *data, void *user_data);
+
+static gboolean _ss_request_message(TcorePending *pending,
+                                                                               CoreObject *o,
+                                                                               UserRequest *ur,
+                                                                               void* on_resp,
+                                                                               void* user_data)
+{
+       TcoreHal *hal = NULL;
+       TReturn ret;
+       dbg("Entry");
+
+       if (on_resp) {
+               tcore_pending_set_response_callback(pending, on_resp, user_data);
+       }
+
+       tcore_pending_set_send_callback(pending, on_confirmation_ss_message_send, NULL);
+
+       if (ur) {
+               tcore_pending_link_user_request(pending, ur);
+       }
+       else {
+               err("User Request is NULL, is this internal request??");
+       }
+
+       /* HAL */
+       hal = tcore_object_get_hal(o);
+
+       /* Send request to HAL */
+       ret = tcore_hal_send_request(hal, pending);
+       if(TCORE_RETURN_SUCCESS != ret) {
+               err("Request send failed");
+               return FALSE;
+       }
+
+       dbg("Exit");
+       return TRUE;
+}
+
+static void _ss_ussd_response(UserRequest *ur, const char* ussd_str, enum telephony_ss_ussd_type type, enum telephony_ss_ussd_status status)
+{
+       struct tresp_ss_ussd resp;
+       dbg("Entry");
+
+       if (ur) {
+               memset (&resp, 0x0, sizeof(struct tresp_ss_ussd));
+
+               resp.type = type;
+               resp.status = status;
+               resp.err = FALSE;
+        dbg("ussd_str = %s resp.type - %d resp.status - %d",ussd_str ,resp.type,resp.status);
+
+               if (ussd_str) {
+                       int len = strlen(ussd_str);
+
+                       if (len < MAX_SS_USSD_LEN) {
+                               memcpy(resp.str, ussd_str, len);
+                               resp.str[len] = '\0';
+                       }
+                       else {
+                               memcpy(resp.str, ussd_str, MAX_SS_USSD_LEN);
+                               resp.str[MAX_SS_USSD_LEN - 1] = '\0';
+                       }
+                       dbg("Response string: %s", resp.str);
+               }
+               else {
+                       dbg("USSD string is not present");
+                       memset(resp.str, '\0', MAX_SS_USSD_LEN);
+               }
+
+         UssdResp = TRUE;
+               /* Send response to TAPI */
+               tcore_user_request_send_response(ur, TRESP_SS_SEND_USSD, sizeof(struct tresp_ss_ussd), &resp);
+       }
+       else {
+               err("User request is NULL");
+       }
+
+       dbg("Exit");
+       return;
+}
+
+static void _ss_ussd_notification(TcorePlugin *p, const char* ussd_str, enum telephony_ss_ussd_status status)
+{
+       CoreObject *o = 0;
+       struct tnoti_ss_ussd noti;
+
+       dbg("function enter");
+
+       if (!p)
+    {
+               dbg("[ error ] p : (NULL)");
+               return ;
+       }
+
+       noti.status = status;
+
+       if (ussd_str)
+    {
+
+               int len = strlen(ussd_str);
+
+               if (len < MAX_SS_USSD_LEN)
+        {
+                       memcpy(noti.str, ussd_str, len);
+                       noti.str[ len ] = '\0';
+               }
+        else
+        {
+                       memcpy(noti.str, ussd_str, MAX_SS_USSD_LEN);
+                       noti.str[ MAX_SS_USSD_LEN - 1 ] = '\0';
+               }
+
+       }
+    else
+    {
+               memset(noti.str, '\0', MAX_SS_USSD_LEN);
+
+       }
+    dbg("noti.str - %s", noti.str);
+
+       o = tcore_plugin_ref_core_object(p, "ss");
+
+       tcore_server_send_notification(tcore_plugin_ref_server(p),
+                       o,
+                       TNOTI_SS_USSD,
+                       sizeof(struct tnoti_ss_ussd),
+                       (void*)&noti    );
+
+}
+
+static gboolean        on_notification_ss_ussd(CoreObject *o, const void *data, void *user_data)
+{
+    enum telephony_ss_ussd_status status;
+       UssdSession *ussd_session = 0;
+       char *ussd_str = 0, *cmd = 0;
+       TcorePlugin *p = 0;
+       int m = -1, dcs = 0;
+    char *pUssdNoti= NULL, *pStr = NULL, *pDcs = NULL;
+    GSList *tokens = NULL;
+    GSList *lines = NULL;
+    char *Ussd_String = NULL;
+    unsigned int len;
+
+       p = tcore_object_ref_plugin(o);
+       ussd_session = tcore_ss_ussd_get_session(o);
+
+    dbg("function enter");
+       lines = (GSList*)data;
+       if (1 != g_slist_length(lines)) {
+               dbg("unsolicited msg but multiple line");
+               goto OUT;
+       }
+       cmd = (char*)(lines->data);
+
+       // parse ussd status
+    tokens = tcore_at_tok_new(cmd);
+
+    // parse <m>
+    pUssdNoti = g_slist_nth_data(tokens, 0);
+    if(!pUssdNoti)
+    {
+        dbg("+CUSD<m> is missing from %CUSD Notification");
+
+    }
+    else
+    {
+        m  = atoi(pUssdNoti);
+        dbg("USSD status  %d",m);
+        //parse [ <str>, <dcs>]
+        Ussd_String = g_slist_nth_data(tokens, 1);
+
+
+        if(Ussd_String)
+        {
+            /* Strike off starting & ending quotes. 1 extra character for NULL termination */
+            pStr = malloc(strlen(Ussd_String) - 1);
+            dbg("length of Ussd Stirng - %d", strlen(Ussd_String));
+            if(pStr)
+            {
+               memset(pStr, 0x00, strlen(Ussd_String) - 1);
+            }
+            else
+            {
+                dbg("malloc failed")
+                return FALSE;
+            }
+
+            len  = strlen(Ussd_String)-1;
+            ++Ussd_String;
+            strncpy(pStr, Ussd_String, len);
+       }
+       if((pDcs = g_slist_nth_data(tokens, 2)))
+       {
+            dcs = atoi(pDcs);
+       }
+        dbg("USSD String - %s len = %d",pStr,strlen(pStr));
+        dbg("USSD dcs %d",dcs);
+
+     }
+
+       switch(m)
+    {
+               case 0:
+                       status = SS_USSD_NO_ACTION_REQUIRE;
+               break;
+
+               case 1:
+                       status = SS_USSD_ACTION_REQUIRE;
+               break;
+
+               case 2:
+                       status = SS_USSD_TERMINATED_BY_NET;
+               break;
+
+               case 3:
+                       status = SS_USSD_OTHER_CLIENT;
+               break;
+
+               case 4:
+                       status = SS_USSD_NOT_SUPPORT;
+               break;
+
+               case 5:
+                       status = SS_USSD_TIME_OUT;
+               break;
+
+               default:
+                       dbg("unsupported m : %d", m);
+                       status = SS_USSD_MAX;
+               break;
+       }
+
+    switch (tcore_util_get_cbs_coding_scheme(dcs))
+    {
+        case TCORE_DCS_TYPE_7_BIT:
+        case TCORE_DCS_TYPE_UNSPECIFIED:
+               //ussd_str = tcore_util_unpack_gsm7bit(pStr, strlen(pStr));
+         //break;
+
+        case TCORE_DCS_TYPE_UCS2:
+        case TCORE_DCS_TYPE_8_BIT:
+            if (strlen(pStr)  > 0)
+            {
+                       ussd_str = g_new0(char, strlen(pStr)  + 1);
+                       memcpy(ussd_str,pStr, strlen(pStr));
+                       ussd_str[ strlen(pStr) ] = '\0';
+               }
+
+        break;
+        default:
+          dbg("[ error ] unknown dcs type. ussd_session : %x", ussd_session);
+          if (ussd_session)
+          {
+                UserRequest *ur = 0;
+                enum telephony_ss_ussd_type type;
+
+                tcore_ss_ussd_get_session_data(ussd_session, (void**)&ur);
+                if (!ur)
+                {
+                    dbg("[ error ] ur : (0)");
+                    return  FALSE;
+                }
+
+                type = (enum telephony_ss_ussd_type)tcore_ss_ussd_get_session_type(ussd_session);
+                dbg("ussd type  - %d", type);
+
+                _ss_ussd_response(ur, ussd_str, type, status);
+          }
+          return FALSE;
+    }
+
+    switch (status)
+    {
+       case SS_USSD_NO_ACTION_REQUIRE:
+       case SS_USSD_ACTION_REQUIRE:
+       case SS_USSD_OTHER_CLIENT:
+       case SS_USSD_NOT_SUPPORT:
+       case SS_USSD_TIME_OUT:
+        {
+               if (ussd_session)
+            {
+
+                       UserRequest *ur = 0;
+                       enum telephony_ss_ussd_type type;
+
+                       tcore_ss_ussd_get_session_data(ussd_session, (void**)&ur);
+                       if (!ur) {
+                               dbg("[ error ] ur : (0)");
+                               return FALSE;
+                       }
+
+                       type = (enum telephony_ss_ussd_type)tcore_ss_ussd_get_session_type(ussd_session);
+                dbg("ussd type  - %d", type);
+                       _ss_ussd_response(ur, (const char*)ussd_str, type, status);
+                if(ussd_str)
+                           g_free(ussd_str);
+
+               }
+            else
+            {
+                               tcore_ss_ussd_create_session(o, TCORE_SS_USSD_TYPE_NETWORK_INITIATED, 0, 0);
+                       _ss_ussd_notification(p, (const char*)ussd_str, status);
+                 if(ussd_str)
+                           g_free(ussd_str);
+
+                   }
+
+           }
+        break;
+           case SS_USSD_TERMINATED_BY_NET:
+        {
+
+               if (ussd_session)
+            {
+                       UserRequest *ur = 0;
+
+                       tcore_ss_ussd_get_session_data(ussd_session, (void**)&ur);
+
+                       if (ur)
+                               tcore_user_request_unref(ur);
+
+                       tcore_ss_ussd_destroy_session(ussd_session);
+               }
+
+           }
+        break;
+
+           default:
+           break;
+    }
+
+OUT:
+       if(NULL!=tokens)
+               tcore_at_tok_free(tokens);
+
+    if(NULL != pStr)
+        free(pStr);
+    dbg("Exit");
+       return TRUE;
+
+}
+static gboolean        on_notification_ss_info(CoreObject *o, const void *data, void *user_data)
+{
+
+       TcorePlugin *p  = 0;
+       CoreObject *co = 0;
+       char* cmd = 0, *number = 0, *pos;
+       int code1 = -1, code2 = -1, index = 0, ton = 0;
+    char *pCode1, *pCode2, *pTon ,*pIndex;
+    GSList *tokens = NULL;
+    char *buf;
+    gboolean cssu = FALSE,cssi = FALSE;
+    GSList *lines = NULL;
+    dbg("function enter");
+
+       p       = tcore_object_ref_plugin(o);
+       co      = tcore_plugin_ref_core_object(p, "call");
+       if (!co)
+    {
+               dbg("[ error ] plugin_ref_core_object : call");
+               return FALSE;
+       }
+
+       lines = (GSList*)data;
+       if (1 != g_slist_length(lines)) {
+               dbg("unsolicited msg but multiple line");
+               goto OUT;
+       }
+
+       cmd = (char*)(lines->data);
+
+    pos = strchr(cmd, ':');
+    if(!pos)
+    {
+        dbg("[ error ] not valid SS- notification ");
+               return TRUE;
+    }
+    buf = calloc(pos - cmd + 2, 1);
+       memcpy(buf, cmd, pos - cmd);
+    dbg("buf is %s", buf);
+
+    if(!strcmp(buf,"+CSSU"))
+    {
+        dbg("SS - +CSSU indication");
+        cssu = TRUE;
+    }
+    else if(!strcmp(buf,"+CSSI"))
+    {
+        dbg("SS - +CSSI indication");
+        cssi = TRUE;
+    }
+
+    free(buf);
+
+   //handle %CSSU notification
+    if(cssu)
+    {
+        tokens = tcore_at_tok_new(cmd);
+        // parse <code2>
+        pCode2 = g_slist_nth_data(tokens, 0);
+        if(!pCode2)
+        {
+            dbg("Code2 is missing from %CSSU indiaction");
+
+        }
+        else
+        {
+            code2  = atoi(pCode2);
+
+            //parse [ <index>, <number> <type>]
+            if ((pIndex = g_slist_nth_data(tokens, 1)))
+            {
+                index = atoi(pIndex);
+            }
+             if ((number = g_slist_nth_data(tokens, 2)))
+             {
+                pTon = g_slist_nth_data(tokens, 3);
+
+                if(pTon)
+                {
+                   ton = atoi(pTon);
+                }
+             }
+        }
+
+        dbg("CSSU - code2 = %d index = %d number = %s type = %d", code2, index,number, ton);
+       switch(code2)
+        {
+               case 0:  //this is a forwarded call (MT call setup)
+                       tcore_call_information_mt_forwarded_call(co, number);
+               break;
+
+               case 2: //call has been put on hold (during a voice call)
+                       tcore_call_information_held(co, number);
+               break;
+
+               case 3: //call has been retrieved (during a voice call)
+                       tcore_call_information_active(co, number);
+               break;
+
+               case 4: //multiparty call entered (during a voice call)
+                       tcore_call_information_joined(co, number);
+               break;
+
+               case 5: //call on hold has been released
+                       tcore_call_information_released_on_hold(co, number);
+               break;
+
+               case 6: //forward check SS message received (can be received whenever)
+                       tcore_call_information_cf_check_ss_message(co, number);
+               break;
+
+               case 7: //call is being connected (alerting) with the remote party in alerting state in explicit call transfer operation (during a voice call)
+                       tcore_call_information_transfer_alert(co, number);
+               break;
+
+               case 8: //call has been connected with the other remote party in explicit call transfer operation (also number and subaddress parameters may be present) (during a voice call or MT call setup)
+                       tcore_call_information_transfered(co, number);
+               break;
+
+               case 9: //this is a deflected call (MT call setup):
+                       tcore_call_information_mt_deflected_call(co, number);
+               break;
+
+               default:
+                       dbg("CSSU - unsupported code2 : %d",code2);
+               break;
+       }
+    }
+    //handle %CSSI notification
+
+    if(cssi)
+    {
+        tokens = tcore_at_tok_new(cmd);
+        // parse <code1>
+        pCode1 = g_slist_nth_data(tokens, 0);
+        if(!pCode1)
+        {
+            dbg("Code1 is missing from %CSSI indiaction");
+
+        }
+        else
+        {
+            code1  = atoi(pCode1);
+
+            //parse [ <index> ]
+            if ((pIndex = g_slist_nth_data(tokens, 1)))
+            {
+                index = atoi(pIndex);
+            }
+
+        }
+
+        dbg("CSSI - code1 - %d index - %d ", code1, index);
+
+       switch(code1)
+        {
+               case 0:  //Unconditional CF is active
+                       tcore_call_information_mo_cfu(co);
+               break;
+
+            case 1:     /*some of the conditional call forwarding are active */
+                tcore_call_information_mo_cfc(co);
+            break;
+
+               case 2:     /* outgoing call is forwarded */
+                           tcore_call_information_mo_forwarded(co);
+               break;
+
+               case 3:     /* this call is waiting */
+                           tcore_call_information_mo_waiting(co);
+               break;
+
+               case 5:     /*outgoing call is barred */
+                           tcore_call_information_mo_barred_outgoing(co);
+               break;
+
+               case 6:     /*incoming call is barred */
+                       tcore_call_information_mo_barred_incoming(co);
+               break;
+
+               case 7:     /* CLIR suppression rejected */
+                           tcore_call_information_mo_clir_suppression_reject(co);
+               break;
+
+               case 8:     /* outgoing call is deflected */
+                           tcore_call_information_mo_deflected(co);
+               break;
+
+               default:
+                       dbg("unsupported cmd : %d",code1);
+               break;
+       }
+
+    }
+OUT:
+       if(NULL!=tokens)
+               tcore_at_tok_free(tokens);
+       return TRUE;
+}
+
+static void on_confirmation_ss_message_send(TcorePending *p, gboolean result, void *user_data)
+{
+       dbg("");
+
+       if (result == FALSE) {
+               /* Fail */
+               dbg("FAIL");
+       }
+       else {
+               dbg("SEND OK");
+       }
+}
+
+static void on_response_ss_barring_set(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+
+       struct ss_confirm_info *info = 0;
+       enum telephony_ss_class class;
+       CoreObject* o = 0;
+       UserRequest *ur;
+       struct tresp_ss_general resp;
+       UserRequest *ur_dup=0;
+       GSList *tokens=NULL;
+       const char *line;
+    int err;
+    const TcoreATResponse* response;
+
+    dbg("function enter");
+
+    response = data;
+
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+
+       info = (struct ss_confirm_info*)user_data;
+       class = info->class;
+
+    if (response->success > 0)
+    {
+        dbg("RESPONSE OK");
+        resp.err = TCORE_RETURN_SUCCESS;
+    }
+    else
+    {
+        dbg("RESPONSE NOT OK");
+        line = (const char*)response->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1)
+        {
+                       dbg("err cause not specified or string corrupted");
+                   resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               else
+               {
+                       err = atoi(g_slist_nth_data(tokens, 0));
+                       /* TODO: CMEE error mapping is required. */
+               resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+
+        tcore_at_tok_free(tokens);
+       }
+
+    dbg("on_response_ss_barring_set - rsp.err : %d, ur : %x flavor_type = %d", resp.err, ur , info->flavor_type);
+    dbg("[ check ] class : 0x%x", info->class);
+
+    if (response->success > 0)
+       {
+               if (info->class == SS_CLASS_VOICE)
+               {
+                   class = SS_CLASS_ALL_TELE_BEARER;
+               }
+
+               ur_dup = tcore_user_request_ref(ur);
+
+               if (info->flavor_type == SS_BARR_MODE_AB || info->flavor_type == SS_BARR_MODE_AOB)
+               {
+                       _ss_barring_get(o, ur_dup, class, SS_BARR_MODE_BAOC, info->resp);
+               }
+               else if (info->flavor_type == SS_BARR_MODE_AIB)
+               {
+                       _ss_barring_get(o, ur_dup, class, SS_BARR_MODE_BAIC, info->resp);
+               }
+               else
+               {
+                       _ss_barring_get(o, ur_dup, class, info->flavor_type, info->resp);
+               }
+
+       }
+       else
+       {
+               if (ur)
+               {
+                       tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_general), &resp);
+               }
+               else
+               {
+                       dbg("[ error ] ur is 0");
+               }
+       }
+}
+
+static void on_response_ss_barring_change_pwd(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+
+    const TcoreATResponse* response = data;
+    struct ss_confirm_info *info = 0;
+       UserRequest *ur;
+       struct tresp_ss_general resp;
+    int err;
+       GSList *tokens=NULL;
+       const char *line;
+
+    dbg("function enter");
+
+       ur = tcore_pending_ref_user_request(p);
+
+       info = (struct ss_confirm_info*)user_data;
+
+    if (response->success > 0)
+    {
+        dbg("RESPONSE OK");
+        resp.err = TCORE_RETURN_SUCCESS;
+    }
+    else
+    {
+        dbg("RESPONSE NOT OK");
+
+        line = (const char*)response->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1)
+        {
+                       dbg("err cause not specified or string corrupted");
+                   resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               else
+               {
+                       err = atoi(g_slist_nth_data(tokens, 0));
+                       /* TODO: CMEE error mapping is required. */
+               resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               tcore_at_tok_free(tokens);
+       }
+
+       dbg("on_response_ss_barring_change_pwd: rsp.err : %d, usr : %x", resp.err, ur);
+
+       if (ur)
+       {
+               tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_general), &resp);
+       }
+       else
+       {
+               dbg("[ error ] ur is 0");
+       }
+
+       g_free(user_data);
+
+}
+
+
+static void on_response_ss_forwarding_set(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+       CoreObject* o = 0;
+       UserRequest* ur = 0, *dup_ur=0;
+       struct ss_confirm_info *info = 0;
+       struct tresp_ss_general resp;
+       GSList *tokens=NULL;
+       const char *line;
+    int err;
+    const TcoreATResponse* response;
+
+    dbg("function enter");
+
+    response  = data;
+
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+
+       info = (struct ss_confirm_info*)user_data;
+
+    if (response->success > 0)
+    {
+        dbg("RESPONSE OK");
+        resp.err = TCORE_RETURN_SUCCESS;
+    }
+    else
+    {
+        dbg("RESPONSE NOT OK");
+
+        line = (const char*)response->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1)
+        {
+                       dbg("err cause not specified or string corrupted");
+                   resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               else
+               {
+                       err = atoi(g_slist_nth_data(tokens, 0));
+                       /* TODO: CMEE error mapping is required. */
+               resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+
+       tcore_at_tok_free(tokens);
+       }
+
+
+       dbg("[ check ] class : 0x%x", info->class);
+       dbg("[ check ] flavor_type : 0x%x", info->flavor_type);
+
+       dbg("on_response_ss_forwarding_set - rsp.err : %d, ur : %x", resp.err, ur);
+
+       if (response->success > 0)
+     {
+               if (info->flavor_type == SS_CF_MODE_CF_ALL ||
+                        info->flavor_type == SS_CF_MODE_CFC)
+               {
+                       if (ur)
+                       {
+                               tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_general), &resp);
+                       }
+                       else
+                       {
+                               dbg("[ error ] ur is 0");
+                       }
+               }
+        else
+               {
+                       dup_ur = tcore_user_request_ref(ur);
+                       _ss_forwarding_get(o, dup_ur, info->class, info->flavor_type, info->resp);
+               }
+       }
+    else
+    {
+               if(ur)
+               {
+                       tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_general), &resp);
+               }
+               else
+               {
+                       dbg("[ error ] ur is 0");
+               }
+
+       }
+       g_free(user_data);
+
+}
+
+static void on_response_ss_waiting_set(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+
+       CoreObject*     o = 0;
+       UserRequest* ur = 0;
+       UserRequest* ur_dup = 0;
+       struct ss_confirm_info *info = 0;
+       struct tresp_ss_general resp;
+       GSList *tokens = NULL;
+       const char *line;
+    int err;
+    const TcoreATResponse* response;
+
+    dbg("function enter");
+
+    response = data;
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+
+       info = (struct ss_confirm_info*)user_data;
+
+       if(response->success > 0)
+    {
+        dbg("RESPONSE OK");
+        resp.err = TCORE_RETURN_SUCCESS;
+    }
+    else
+    {
+        dbg("RESPONSE NOT OK");
+
+        line = (const char*)response->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1)
+        {
+                       dbg("err cause not specified or string corrupted");
+                   resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               else
+               {
+                       err = atoi(g_slist_nth_data(tokens, 0));
+                       /* TODO: CMEE error mapping is required. */
+               resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               tcore_at_tok_free(tokens);
+
+       }
+
+       dbg("on_response_ss_waiting_set - rsp.err : %d, ur : %x, class : %d", resp.err, ur, info->class);
+
+       if(resp.err == TCORE_RETURN_SUCCESS)
+    {
+                ur_dup = tcore_user_request_ref(ur);
+         dbg("Get waiting call status");
+               _ss_waiting_get(o, ur_dup, info->class, info->resp);
+       }
+    else
+    {
+               if (ur)
+               {
+                       tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_general), &resp);
+               }
+               else
+               {
+                       dbg("[ error ] ur is 0");
+                }
+        }
+        g_free(user_data);
+}
+
+
+
+static void on_confirmation_ss_ussd(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+
+       struct ss_confirm_info *info = 0;
+       struct tresp_ss_ussd resp;
+       CoreObject*             o = NULL;
+       UserRequest*    ur = NULL , *ussd_ur= NULL;
+       GSList *tokens=NULL;
+       const char *line;
+       int err;
+    UssdSession *ussd_s = NULL;
+    enum tcore_ss_ussd_type type = TCORE_SS_USSD_TYPE_MAX;
+    const TcoreATResponse* response;
+
+    dbg("function enter");
+    response = data;
+
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+
+       info = (struct ss_confirm_info*)user_data;
+
+    memset(resp.str, 0x00, MAX_SS_USSD_LEN);
+
+
+       ussd_s = tcore_ss_ussd_get_session(o);
+
+       if(ussd_s)
+               type = tcore_ss_ussd_get_session_type(ussd_s);
+       else
+               dbg("[ error ] ussd_s : (0)");
+
+       resp.type = (enum telephony_ss_ussd_type)type;
+    resp.status = SS_USSD_MAX; //hardcoded value.
+
+
+       if(response->success > 0)
+    {
+        dbg("RESPONSE OK");
+        resp.err = TCORE_RETURN_SUCCESS;
+    }
+    else
+    {
+        dbg("RESPONSE NOT OK");
+
+        line = (const char*)response->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1)
+        {
+                       dbg("err cause not specified or string corrupted");
+                   resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               else
+               {
+                       err = atoi(g_slist_nth_data(tokens, 0));
+                       /* TODO: CMEE error mapping is required. */
+               resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+
+       tcore_at_tok_free(tokens);
+     }
+
+       dbg("on_confirmation_ss_ussd - rsp.err : %d, ur : %x", resp.err, ur);
+
+       if(response->success > 0)
+       {
+
+           if(type == TCORE_SS_USSD_TYPE_USER_INITIATED)
+        {
+            dbg("ussd type %d",resp.type);
+
+            if(ussd_s)
+            {
+                           tcore_ss_ussd_get_session_data(ussd_s, (void**)&ussd_ur);
+                           if(ussd_ur)
+                    tcore_user_request_free(ussd_ur);
+            }
+               }
+        }
+
+    if(ussd_s)
+        tcore_ss_ussd_destroy_session(ussd_s);
+
+       if(ur)
+    {
+        if(UssdResp == FALSE) // to avoid sending multiple response to application.
+        {
+                   tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_ussd), &resp);
+
+        }
+        UssdResp =  FALSE;
+       }
+       else
+               dbg("[ error ] ur : (0)");
+
+       g_free(user_data);
+
+}
+
+static void on_response_ss_barring_get(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+    CoreObject* o = 0;
+       UserRequest* ur = 0;
+       int status = 0, classx = 0, err = 0;
+    GSList *pRespData;
+
+       struct ss_confirm_info* info = 0;
+       struct tresp_ss_barring resp;
+       int countRecords = 0, countValidRecords = 0;
+       GSList *tokens = NULL;
+       const char *line;
+    char *pClassx;
+    char *pStat = NULL;
+    const TcoreATResponse *response;
+
+    dbg("function enter");
+
+    response = data;
+
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+
+       info = (struct ss_confirm_info*)user_data;
+
+    if(response->lines)
+    {
+        pRespData = (GSList *)response->lines;
+        countRecords = g_slist_length(pRespData);
+       dbg("total records : %d",countRecords);
+
+    }
+    else
+    {
+        countRecords  = 0;
+        dbg("no active status - return to user")
+    }
+    resp.record_num = countRecords;
+
+    if(resp.record_num > 0)
+    {
+               resp.record = g_new0(struct barring_info, resp.record_num);
+
+               for (countValidRecords = 0; pRespData != NULL ; pRespData = pRespData->next)
+               {
+            line  = (const char*)(pRespData->data);
+            tokens = tcore_at_tok_new(line);
+
+           // parse <status>
+            pStat = g_slist_nth_data(tokens, 0);
+            if(!pStat)
+            {
+                dbg("Stat is missing");
+                               goto error;
+            }
+
+                   status = atoi(pStat);
+
+                       if(status == 1)
+            {
+                               resp.record[countValidRecords].status = SS_STATUS_ACTIVATE;
+                       }
+                       else
+            {
+                               resp.record[countValidRecords].status = SS_STATUS_DEACTIVATE;
+                       }
+            dbg("call barring status - %d",status);
+
+           //Parse <class>
+            pClassx = g_slist_nth_data(tokens, 1);
+
+               if (!pClassx)
+            {
+                               dbg("class error. classx not exist - set to requested one : %d", info->class);
+                               switch(info->class)
+                {
+                               case SS_CLASS_ALL_TELE:
+                                       classx = 7;
+                               break;
+                               case SS_CLASS_VOICE:
+                                       classx = 1;
+                               break;
+                               case SS_CLASS_ALL_DATA_TELE:
+                                       classx =2;
+                               break;
+                               case SS_CLASS_FAX:
+                                       classx = 4;
+                               break;
+                               case SS_CLASS_SMS:
+                                       classx = 8;
+                               break;
+                               case SS_CLASS_ALL_CS_SYNC:
+                                       classx = 16;
+                               break;
+
+                               default:
+                                       classx =7;
+                                       dbg("unsupported class %d. set to default : 7", info->class);
+                               break;
+                               }
+                       }
+            else
+            {
+                classx = atoi(pClassx);
+                dbg("call barring classx - %d",classx);
+            }
+
+                       switch(classx)
+                       {
+                               case 1:
+                                       resp.record[countValidRecords].class = SS_CLASS_VOICE;
+                               break;
+                               case 2:
+                                       resp.record[countValidRecords].class = SS_CLASS_ALL_DATA_TELE;
+                               break;
+                               case 4:
+                                       resp.record[countValidRecords].class = SS_CLASS_FAX;
+                               break;
+                               case 7:
+                                       resp.record[countValidRecords].class = SS_CLASS_ALL_TELE;
+                               break;
+                               case 8:
+                                       resp.record[countValidRecords].class = SS_CLASS_SMS;
+                               break;
+                               case 16:
+                                       resp.record[countValidRecords].class = SS_CLASS_ALL_CS_SYNC;
+                               break;
+                               case 32:
+                                       resp.record[countValidRecords].class = SS_CLASS_ALL_CS_ASYNC;
+                               break;
+                               default:
+                                       dbg("unspoorted class : [%d]\n", classx);
+                                       goto error;
+                               break;
+                       }
+
+                       resp.record[countValidRecords].mode = (enum telephony_ss_barring_mode)(info->flavor_type);
+                       countValidRecords++;
+            tcore_at_tok_free(tokens);
+                       continue;
+
+        error:
+                       dbg("invalid field found. coutinue");
+            tcore_at_tok_free(tokens);
+                       continue;
+               }
+
+               dbg("valid count :%d",countValidRecords);
+               resp.record_num = countValidRecords;
+               resp.err = TCORE_RETURN_SUCCESS;
+       }
+    else
+       {
+               dbg("no active status - return to user")
+       }
+
+    if(response->success > 0)
+    {
+        dbg("RESPONSE OK");
+        resp.err = TCORE_RETURN_SUCCESS;
+    }
+    else
+    {
+        dbg("RESPONSE NOT OK");
+        resp.err = TCORE_RETURN_FAILURE;
+
+        line = (const char*)response->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1)
+        {
+                       dbg("err cause not specified or string corrupted");
+                   resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               else
+               {
+                       err = atoi(g_slist_nth_data(tokens, 0));
+                       /* TODO: CMEE error mapping is required. */
+               resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+        tcore_at_tok_free(tokens);
+
+    }
+
+       dbg("on_response_ss_barring_get- rsp.err : %d, ur : %x", resp.err, ur);
+
+    if (ur)
+               tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_barring), &resp);
+       else
+               dbg("[ error ] ur is 0");
+
+       if (resp.record)
+       {
+               g_free(resp.record);
+        resp.record = NULL;
+       }
+
+       g_free(user_data);
+
+}
+
+static void on_response_ss_forwarding_get(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+    CoreObject* o = 0;
+       UserRequest* ur = 0;
+    int classx = 0, err = 0, time = 0;
+       char* num;
+       struct ss_confirm_info* info = 0;
+       struct tresp_ss_forwarding resp;
+       int countRecords = 0, countValidRecords = 0;
+
+    GSList *pRespData = NULL ,*tokens = NULL ;
+       const char *line;
+    char *pClassx ,*pStatus, *pTon , *pTime;
+    const TcoreATResponse *response;
+
+    dbg("function enter");
+    response = data;
+
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+
+    info = (struct ss_confirm_info*)user_data;
+
+    if(response->lines)
+    {
+        pRespData =  (GSList*)response->lines;
+        countRecords = g_slist_length(pRespData);
+       dbg("total records : %d",countRecords);
+
+    }
+    else
+    {
+        countRecords  = 0;
+        dbg("no active status - return to user")
+    }
+    resp.record_num = countRecords;
+
+    if (resp.record_num > 0)
+    {
+               resp.record = g_new0(struct forwarding_info, resp.record_num);
+
+               for (countValidRecords = 0; pRespData != NULL ; pRespData = pRespData->next)
+               {
+
+           line  = (const char*)(pRespData->data);
+           tokens = tcore_at_tok_new(line);
+
+           // parse <status>
+            pStatus = g_slist_nth_data(tokens, 0);
+            if(!pStatus)
+            {
+                dbg("start line error. skip this line");
+                               goto error;
+            }
+            else
+            {
+                       if(atoi(pStatus)== 1)
+                {
+                               resp.record[countValidRecords].status = SS_STATUS_ACTIVATE;
+                       }
+                       else
+                {
+                               resp.record[countValidRecords].status = SS_STATUS_DEACTIVATE;
+                       }
+             }
+
+                   //Parse <class>
+
+            pClassx = g_slist_nth_data(tokens, 1);
+               if (!pClassx)
+            {
+                               dbg("class error. skip this line");
+                               goto error;
+                       }
+            else
+            {
+               switch(atoi(pClassx))
+                {
+                               case 1:
+                                       resp.record[countValidRecords].class = SS_CLASS_VOICE;
+                               break;
+                               case 2:
+                                       resp.record[countValidRecords].class = SS_CLASS_ALL_DATA_TELE;
+                               break;
+                               case 4:
+                                       resp.record[countValidRecords].class = SS_CLASS_FAX;
+                               break;
+                               case 7:
+                                       resp.record[countValidRecords].class = SS_CLASS_ALL_TELE;
+                               break;
+                               case 8:
+                                       resp.record[countValidRecords].class = SS_CLASS_SMS;
+                               break;
+                               case 16:
+                                       resp.record[countValidRecords].class = SS_CLASS_ALL_CS_SYNC;
+                               break;
+                               case 32:
+                                       resp.record[countValidRecords].class = SS_CLASS_ALL_CS_ASYNC;
+                               break;
+                               default:
+                                       dbg("unspoorted class : [%d]\n", classx);
+                                       goto error;
+                               break;
+                       }
+             }
+
+            //parse  <numer> <type>
+            num = g_slist_nth_data(tokens, 2);
+            if (num)
+            {
+                dbg("number  - %s", num);
+                memcpy((resp.record[countValidRecords].number), num, strlen(num));
+                               resp.record[countValidRecords].number_present = TRUE;
+
+                pTon = g_slist_nth_data(tokens, 3);
+                if(pTon)
+                   resp.record[countValidRecords].number_type = atoi(pTon);
+                   dbg("number  type - %d", resp.record[countValidRecords].number_type);
+            }
+
+            //skip  <subaddr> <satype>
+            //parse  <time>
+            pTime = g_slist_nth_data(tokens, 6);
+            if(pTime)
+            {
+                time  =  atoi(pTime);
+                resp.record[countValidRecords].time = (enum telephony_ss_forwarding_no_reply_time)time;
+                dbg("time  - %d", time);
+            }
+
+                       resp.record[countValidRecords].mode = (enum telephony_ss_forwarding_mode)(info->flavor_type);
+            dbg("flavor_type  - %d", (enum telephony_ss_forwarding_mode)(info->flavor_type));
+
+                       countValidRecords++;
+            tcore_at_tok_free(tokens);
+                       continue;
+        error:
+                       dbg("invalid field found. coutinue");
+            tcore_at_tok_free(tokens);
+                       continue;
+               }
+
+               dbg("valid count :%d",countValidRecords);
+               resp.record_num = countValidRecords;
+               resp.err = TCORE_RETURN_SUCCESS;
+
+       }
+    else
+       {
+               dbg("no active status - return to user")
+       }
+
+    if(response->success > 0)
+    {
+        dbg("RESPONSE OK");
+        resp.err = TCORE_RETURN_SUCCESS;
+    }
+    else
+    {
+        dbg("RESPONSE NOT OK");
+
+        line = (const char*)response->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1)
+        {
+                       dbg("err cause not specified or string corrupted");
+                   resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               else
+               {
+                       err = atoi(g_slist_nth_data(tokens, 0));
+                       /* TODO: CMEE error mapping is required. */
+               resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+        tcore_at_tok_free(tokens);
+
+    }
+
+       dbg("on_response_ss_forwarding_get- rsp.err : %d, ur : %x", resp.err, ur);
+
+    if (ur)
+               tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_forwarding), &resp);
+       else
+               dbg("[ error ] ur is 0");
+
+       if (resp.record)
+       {
+               g_free(resp.record);
+        resp.record = NULL;
+       }
+
+       g_free(user_data);
+
+}
+
+static void on_response_ss_waiting_get(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+    CoreObject* o = 0;
+       UserRequest* ur = 0;
+    GSList *pRespData, *tokens = NULL;
+       int classx = 0, err = 0;
+
+       struct ss_confirm_info* info = 0;
+       struct tresp_ss_waiting resp;
+       int countRecords = 0, countValidRecords = 0;
+    const char *line;
+    char *pClassx ,*pStatus;
+    const TcoreATResponse *response;
+
+    dbg("function enter")
+    response = data;
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+
+       info = (struct ss_confirm_info*)user_data;
+
+    if(response->lines)
+    {
+        pRespData =  (GSList*)response->lines;
+        countRecords = g_slist_length(pRespData);
+       dbg("total records : %d",countRecords);
+
+    }
+    else
+    {
+        countRecords  = 0;
+        dbg("no active status - return to user")
+    }
+    resp.record_num = countRecords;
+
+       if (resp.record_num > 0)
+    {
+               resp.record = g_new0(struct waiting_info, resp.record_num);
+
+               for (countValidRecords = 0; pRespData != NULL ; pRespData = pRespData->next)
+               {
+
+           line  = (const char*)(pRespData->data);
+           tokens = tcore_at_tok_new(line);
+
+           // parse <status>
+            pStatus = g_slist_nth_data(tokens, 0);
+            if(!pStatus)
+            {
+                dbg("Missing stat  in responce ");
+                               goto error;
+            }
+            else
+            {
+                       if(atoi(pStatus) == 1)
+                {
+                               resp.record[countValidRecords].status = SS_STATUS_ACTIVATE;
+                       }
+                       else
+                {
+                               resp.record[countValidRecords].status = SS_STATUS_DEACTIVATE;
+                       }
+            }
+            dbg("status = %d", resp.record[countValidRecords].status);
+
+           //Parse <class>
+
+            pClassx = g_slist_nth_data(tokens, 1);
+               if (!pClassx)
+            {
+                               dbg("error - class is missing");
+                               goto error;
+                       }
+            else
+            {
+                switch(atoi(pClassx))
+                {
+                               case 1:
+                                       resp.record[countValidRecords].class = SS_CLASS_VOICE;
+                               break;
+                               case 2:
+                                       resp.record[countValidRecords].class = SS_CLASS_ALL_DATA_TELE;
+                               break;
+                               case 4:
+                                       resp.record[countValidRecords].class = SS_CLASS_FAX;
+                               break;
+                               case 7:
+                                       resp.record[countValidRecords].class = SS_CLASS_ALL_TELE;
+                               break;
+                               case 8:
+                                       resp.record[countValidRecords].class = SS_CLASS_SMS;
+                               break;
+                               case 16:
+                                       resp.record[countValidRecords].class = SS_CLASS_ALL_CS_SYNC;
+                               break;
+                               case 32:
+                                       resp.record[countValidRecords].class = SS_CLASS_ALL_CS_ASYNC;
+                               break;
+                               default:
+                                       dbg("unspoorted class : [%d]\n", classx);
+                                       goto error;
+                               break;
+                       }
+                dbg("class info %d",resp.record[countValidRecords].class);
+             }
+
+                           countValidRecords++;
+                tcore_at_tok_free(tokens);
+                           continue;
+        error:
+                           dbg("invalid field found. coutinue");
+                tcore_at_tok_free(tokens);
+                           continue;
+               }
+
+               dbg("valid count :%d",countValidRecords);
+               resp.record_num = countValidRecords;
+               resp.err = TCORE_RETURN_SUCCESS;
+       }
+       else
+       {
+               dbg("no active status - return to user")
+       }
+
+       if(response->success > 0)
+    {
+        dbg("RESPONSE OK");
+        resp.err = TCORE_RETURN_SUCCESS;
+    }
+    else
+    {
+        dbg("RESPONSE NOT OK");
+
+        line = (const char*)response->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1)
+        {
+                       dbg("err cause not specified or string corrupted");
+                   resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               else
+               {
+                       err = atoi(g_slist_nth_data(tokens, 0));
+                       /* TODO: CMEE error mapping is required. */
+               resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+        tcore_at_tok_free(tokens);
+
+    }
+
+       dbg("on_response_ss_waiting_get - rsp.err : %d, ur : %x", resp.err, ur);
+
+       if (ur)
+               tcore_user_request_send_response(ur, info->resp, sizeof(struct tresp_ss_waiting), &resp);
+       else
+               dbg("[ error ] ur is 0");
+
+    if (resp.record)
+       {
+               g_free(resp.record);
+        resp.record = NULL;
+       }
+
+       g_free(user_data);
+
+}
+
+
+static void on_response_ss_cli_get(TcorePending *p, int data_len, const void *data, void *user_data)
+{
+    CoreObject*        o = 0;
+       UserRequest* ur = 0;
+
+       struct tresp_ss_cli resp;
+       enum telephony_ss_cli_type *p_type = NULL;
+       char *line = NULL, *pStatus;
+       int err = FALSE;
+    int cli_adj,stat ;
+    GSList *tokens = NULL ;
+    const TcoreATResponse *response;
+
+    dbg("function enter")
+    response = data;
+
+       o  = tcore_pending_ref_core_object(p);
+       ur = tcore_pending_ref_user_request(p);
+
+       p_type = (enum telephony_ss_cli_type*)(user_data);
+
+    if (response->success  > 0)
+       {
+        line  = (char*) (((GSList*)response->lines)->data);
+        tokens = tcore_at_tok_new(line);
+
+        if(*p_type == SS_CLI_TYPE_CLIR)
+        {
+            //+CLIR: <n> <m>
+           dbg("CLI type is CLIR")
+
+            //parse <n>
+            pStatus = g_slist_nth_data(tokens, 0);
+
+            if(!pStatus)
+            {
+                dbg("Call line identification adjustment missing <n>");
+            }
+            else
+            {
+                cli_adj = atoi(pStatus);
+                dbg("CLIR response value of <n> - %d",cli_adj);
+
+                if(cli_adj == 0)
+                {
+                    //parse <m>
+                    pStatus = g_slist_nth_data(tokens, 1);
+                    if(!pStatus)
+                    {
+                        dbg("status is missing<m>");
+                    }
+
+                    stat  = atoi(pStatus);
+                    dbg("CLIR response value of <m> - %d",stat);
+
+                    if(stat == 1 || stat == 3)
+                    {
+                       resp.status = TRUE;
+                    }
+                    else
+                    {
+                        resp.status = FALSE;
+                    }
+               }
+               else if (cli_adj  == 1)
+               {
+                  resp.status = TRUE;
+               }
+               else
+               {
+                   resp.status = FALSE;
+               }
+               dbg("resp.status -  %d",resp.status);
+            }
+
+            tcore_at_tok_free(tokens);
+        }
+        else
+        {
+            //parse <n>
+            pStatus = g_slist_nth_data(tokens, 0);
+            if(!pStatus)
+            {
+                dbg("Stat is missing");
+            }
+            else
+            {
+                stat  = atoi(pStatus);
+
+                if(stat == 1)
+                    resp.status = TRUE;
+                else
+                    resp.status = FALSE ;
+
+                dbg("resp.status -  %d",resp.status);
+            }
+
+            tcore_at_tok_free(tokens);
+        }
+    }
+
+    if (response->success > 0)
+    {
+        dbg("RESPONSE OK");
+        resp.err = TCORE_RETURN_SUCCESS;
+    }
+
+    else
+    {
+        dbg("RESPONSE NOT OK");
+
+        line = (char*)response->final_response;
+               tokens = tcore_at_tok_new(line);
+
+               if (g_slist_length(tokens) < 1)
+        {
+                       dbg("err cause not specified or string corrupted");
+                   resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               else
+               {
+                       err = atoi(g_slist_nth_data(tokens, 0));
+                       /* TODO: CMEE error mapping is required. */
+               resp.err = TCORE_RETURN_3GPP_ERROR;
+               }
+               tcore_at_tok_free(tokens);
+       }
+
+
+    resp.type = *p_type;
+    dbg("check - resp.type = %d ", resp.type);
+
+       if (ur)
+               tcore_user_request_send_response(ur, TRESP_SS_CLI_GET_STATUS, sizeof(struct tresp_ss_cli), &resp);
+       else
+               dbg("[ error ] ur : (0)");
+
+       g_free(user_data);
+
+}
+
+static struct tcore_ss_operations ss_ops = {
+       .barring_activate               = s_ss_barring_activate,
+       .barring_deactivate             = s_ss_barring_deactivate,
+       .barring_change_password= s_ss_barring_change_password,
+       .barring_get_status             = s_ss_barring_get_status,
+       .forwarding_activate    = s_ss_forwarding_activate,
+       .forwarding_deactivate  = s_ss_forwarding_deactivate,
+       .forwarding_register    = s_ss_forwarding_register,
+       .forwarding_deregister  = s_ss_forwarding_deregister,
+       .forwarding_get_status  = s_ss_forwarding_get_status,
+       .waiting_activate               = s_ss_waiting_activate,
+       .waiting_deactivate             = s_ss_waiting_deactivate,
+       .waiting_get_status             = s_ss_waiting_get_status,
+       .cli_activate                   = s_ss_cli_activate,
+       .cli_deactivate                 = s_ss_cli_deactivate,
+       .cli_get_status                 = s_ss_cli_get_status,
+       .send_ussd                              = s_ss_send_ussd,
+       .set_aoc                                = s_ss_set_aoc,
+       .get_aoc                                = s_ss_get_aoc,
+};
+
+
+static TReturn _ss_barring_set(CoreObject *o, UserRequest *ur, enum telephony_ss_opcode op)
+{
+       struct treq_ss_barring *barring = 0;
+       struct ss_confirm_info *user_data = 0;
+
+    char *cmd_str = NULL;
+       TcoreHal* hal;
+       TcorePending *pending = NULL;
+       TcoreATRequest *req;
+       char passwd[MAX_SS_BARRING_PASSWORD_LEN+1];
+       int opco;
+       int classx;
+       char* facility = NULL;
+
+    gboolean ret = FALSE;
+
+    dbg("function enter");
+    barring = (struct treq_ss_barring*)tcore_user_request_ref_data(ur, 0);
+
+    switch(op)
+    {
+               case TIZEN_SS_OPCO_ACTIVATE:
+                       opco = 1;
+               break;
+               case TIZEN_SS_OPCO_DEACTIVATE:
+                       opco = 0;
+               break;
+               default:
+                       dbg("unsupported opco : %d", op);
+               return TCORE_RETURN_FAILURE;
+       }
+    dbg("opco - %d",opco);
+
+       switch(barring->mode){
+               case SS_BARR_MODE_BAOC:
+                       facility = "AO";
+               break;
+               case SS_BARR_MODE_BOIC:
+                       facility = "OI";
+               break;
+               case SS_BARR_MODE_BOIC_NOT_HC:
+                       facility = "OX";
+               break;
+               case SS_BARR_MODE_BAIC:
+                       facility = "AI";
+               break;
+               case SS_BARR_MODE_BIC_ROAM:
+                       facility = "IR";
+               break;
+               case SS_BARR_MODE_AB:
+                       facility = "AB";
+               break;
+               case SS_BARR_MODE_AOB:
+                       facility = "AG";
+               break;
+               case SS_BARR_MODE_AIB:
+                       facility = "AC";
+               break;
+               case SS_BARR_MODE_BIC_NOT_SIM:
+               //      facility = "NS";
+               default:
+                       dbg("unspported mode %d", barring->mode);
+               return TCORE_RETURN_FAILURE;
+       }
+
+    dbg("facility - %s",facility);
+
+       switch(barring->class)
+       {
+               case SS_CLASS_ALL_TELE:
+                       classx =7;
+               break;
+               case SS_CLASS_VOICE:
+                       classx =1;
+               break;
+               case SS_CLASS_ALL_DATA_TELE:
+                       classx =2;
+               break;
+               case SS_CLASS_FAX:
+                       classx =4;
+               break;
+               case SS_CLASS_SMS:
+                       classx = 8;
+               break;
+               case SS_CLASS_ALL_CS_SYNC:
+                       classx = 16;
+               break;
+
+               default:
+                       classx =7;
+                       dbg("unsupported class %d. set to default : 7", barring->class);
+               break;
+       }
+
+    dbg("classx - %d",classx);
+
+       // null-ended pwd handling added - unexpected  0x11 value observed in req string
+       memcpy(passwd, barring->password, MAX_SS_BARRING_PASSWORD_LEN);
+       passwd[MAX_SS_BARRING_PASSWORD_LEN]='\0';
+    dbg("passwd - %s",passwd);
+
+       hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+    cmd_str = g_strdup_printf("AT+CLCK=\"%s\",%d,\"%s\",%d%s", facility, opco, passwd, classx,"\r");
+    dbg("request command : %s", cmd_str);
+
+
+       req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+
+       user_data = g_new0(struct ss_confirm_info, 1);
+
+       if (op == TIZEN_SS_OPCO_ACTIVATE)
+    {
+               user_data->resp = TRESP_SS_BARRING_ACTIVATE;
+
+       }
+    else if (op == TIZEN_SS_OPCO_DEACTIVATE)
+    {
+               user_data->resp = TRESP_SS_BARRING_DEACTIVATE;
+
+       }
+    else
+    {
+               dbg("[ error ] wrong ss opco (0x%x)", op);
+               return TCORE_RETURN_FAILURE;
+       }
+
+       user_data->flavor_type = (int)(barring->mode);
+       user_data->class = barring->class;
+
+       ret = _ss_request_message(pending, o, ur, on_response_ss_barring_set, user_data);
+
+       g_free(cmd_str);
+
+       if (!ret)
+       {
+           dbg("AT request sent failed ")
+               return TCORE_RETURN_FAILURE;
+       }
+
+       return TCORE_RETURN_SUCCESS;
+
+}
+
+static TReturn _ss_barring_get(CoreObject *o,
+                                                               UserRequest *ur,
+                                                               enum telephony_ss_class class,
+                                                               enum telephony_ss_barring_mode mode,
+                                                               enum tcore_response_command resp)
+
+{
+
+    TcorePlugin *p = 0;
+       struct ss_confirm_info *user_data = 0;
+       gboolean ret = FALSE;
+       char* cmd_str = NULL;
+       int opco, classx;
+       char* facility = NULL;
+
+    TcoreHal* hal;
+       TcorePending *pending = NULL;
+       TcoreATRequest *req;
+
+    dbg("function enter");
+       p = tcore_object_ref_plugin(o);
+
+    //query status - opco is fixed to 2
+       opco = 2;
+
+       //barring mode
+       switch(mode)
+    {
+               case SS_BARR_MODE_BAOC:
+                       facility = "AO";
+               break;
+               case SS_BARR_MODE_BOIC:
+                       facility = "OI";
+               break;
+               case SS_BARR_MODE_BOIC_NOT_HC:
+                       facility = "OX";
+               break;
+               case SS_BARR_MODE_BAIC:
+                       facility = "AI";
+               break;
+               case SS_BARR_MODE_BIC_ROAM:
+                       facility = "IR";
+               break;
+               case SS_BARR_MODE_AB:
+                       facility = "AB";
+               break;
+               case SS_BARR_MODE_AOB:
+                       facility = "AG";
+               break;
+               case SS_BARR_MODE_AIB:
+                       facility = "AC";
+               break;
+               case SS_BARR_MODE_BIC_NOT_SIM:
+               default:
+                       dbg("unspported mode %d", mode);
+               return TCORE_RETURN_FAILURE;
+       }
+
+    dbg("facility - %s", facility);
+
+       switch(class)
+       {
+               case SS_CLASS_ALL_TELE:
+                       classx =7;
+               break;
+               case SS_CLASS_VOICE:
+                       classx =1;
+               break;
+               case SS_CLASS_ALL_DATA_TELE:
+                       classx =2;
+               break;
+               case SS_CLASS_FAX:
+                       classx =4;
+               break;
+               case SS_CLASS_SMS:
+                       classx = 8;
+               break;
+               case SS_CLASS_ALL_CS_SYNC:
+                       classx = 16;
+               break;
+
+               default:
+                       classx =7;
+                       dbg("unsupported class %d. set to default : 7", class);
+               break;
+       }
+    dbg("class - %d", classx);
+
+       if(classx ==7)
+           cmd_str = g_strdup_printf("AT+CLCK=\"%s\",%d%s", facility, opco,"\r");
+       else
+               cmd_str = g_strdup_printf("AT+CLCK=\"%s\",%d,,%d%s", facility, opco,classx,"\r");
+
+       dbg("request command : %s", cmd_str);
+
+
+    hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+    req = tcore_at_request_new(cmd_str, "+CLCK", TCORE_AT_MULTILINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+
+
+       user_data = g_new0(struct ss_confirm_info, 1);
+       user_data->resp = resp;
+
+       user_data->flavor_type = (int)(mode);
+       user_data->class = class;
+
+       ret = _ss_request_message(pending, o, ur, on_response_ss_barring_get, user_data);
+
+       g_free(cmd_str);
+
+       if (!ret)
+       {
+           dbg("AT request sent failed ")
+               return TCORE_RETURN_FAILURE;
+       }
+
+       return TCORE_RETURN_SUCCESS;
+
+}
+
+static TReturn s_ss_barring_activate(CoreObject *o, UserRequest *ur)
+{
+       return _ss_barring_set(o, ur, TIZEN_SS_OPCO_ACTIVATE);
+}
+
+static TReturn s_ss_barring_deactivate(CoreObject *o, UserRequest *ur)
+{
+       return _ss_barring_set(o, ur, TIZEN_SS_OPCO_DEACTIVATE);
+}
+
+static TReturn s_ss_barring_change_password(CoreObject *o, UserRequest *ur)
+{
+    TcoreHal* hal;
+       TcorePending *pending = NULL;
+       TcoreATRequest *req;
+       struct treq_ss_barring_change_password *barring = 0;
+       struct ss_confirm_info *user_data = 0;
+    char* cmd_str = NULL;
+       gboolean ret = FALSE;
+
+    dbg("function enter");
+       barring = (struct treq_ss_barring_change_password*)tcore_user_request_ref_data(ur, 0);
+
+       cmd_str = g_strdup_printf("AT+CPWD=\"%s\",\"%s\",\"%s\"%s", "AB", barring->password_old, barring->password_new,"\r");
+       dbg("request command : %s", cmd_str);
+
+
+    hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+
+       user_data = g_new0(struct ss_confirm_info, 1);
+       user_data->resp = TRESP_SS_BARRING_CHANGE_PASSWORD;
+
+       ret = _ss_request_message(pending, o, ur, on_response_ss_barring_change_pwd, user_data);
+
+       g_free(cmd_str);
+       if (!ret)
+       {
+           dbg("AT request sent failed ")
+               return TCORE_RETURN_FAILURE;
+       }
+
+       return TCORE_RETURN_SUCCESS;
+
+}
+
+static TReturn s_ss_barring_get_status(CoreObject *o, UserRequest *ur)
+{
+       struct treq_ss_barring *barring = 0;
+       barring = (struct treq_ss_barring*)tcore_user_request_ref_data(ur, 0);
+
+       return _ss_barring_get(o, ur, barring->class, barring->mode, TRESP_SS_BARRING_GET_STATUS);
+}
+
+static TReturn _ss_forwarding_set(CoreObject *o, UserRequest *ur, enum telephony_ss_opcode op)
+{
+       struct treq_ss_forwarding *forwarding = 0;
+       struct ss_confirm_info *user_data = 0;
+
+       gboolean ret = FALSE;
+       int len = 0;
+
+       char* cmd_str = NULL;
+       char* tmp_str = NULL;
+       int reason=0, mode = 0, num_type = 0, classx = 0,time = 0;
+       gboolean valid_num = FALSE;
+    TcoreHal* hal;
+       TcorePending *pending = NULL;
+       TcoreATRequest *req;
+
+       dbg("_ss_forwarding_set with opco %d ", op);
+
+       forwarding = (struct treq_ss_forwarding*) tcore_user_request_ref_data(ur, 0);
+
+       switch(forwarding->mode)
+       {
+               case SS_CF_MODE_CFU:
+                       reason = 0;
+                       break;
+               case SS_CF_MODE_CFB:
+                       reason = 1;
+                       break;
+               case SS_CF_MODE_CFNRy:
+                       reason = 2;
+                       break;
+               case SS_CF_MODE_CFNRc:
+                       reason = 3;
+                       break;
+               case SS_CF_MODE_CF_ALL:
+                       reason = 4;
+               break;
+               case SS_CF_MODE_CFC:
+                       reason = 5;
+               break;
+
+               default:
+                       dbg("unsupported reason : %d");
+            return TCORE_RETURN_FAILURE;
+                       break;
+       }
+
+    dbg("reason = %d", reason);
+
+       switch(op){
+               case TIZEN_SS_OPCO_DEACTIVATE:
+                       mode = 0;
+               break;
+               case TIZEN_SS_OPCO_ACTIVATE:
+                       mode = 1;
+               break;
+               case TIZEN_SS_OPCO_REG:
+                       mode = 3;
+               break;
+               case TIZEN_SS_OPCO_DEREG:
+                       mode = 4;
+               break;
+
+               default:
+                       dbg("unsupported opco : %d", op);
+                       return TCORE_RETURN_FAILURE;
+       }
+
+    dbg("mode = %d", mode);
+
+// class
+       switch(forwarding->class)
+       {
+               case SS_CLASS_ALL_TELE:
+                       classx =7;
+               break;
+               case SS_CLASS_VOICE:
+                       classx =1;
+               break;
+               case SS_CLASS_ALL_DATA_TELE:
+                       classx =2;
+               break;
+               case SS_CLASS_FAX:
+                       classx =4;
+               break;
+               case SS_CLASS_SMS:
+                       classx = 8;
+               break;
+               case SS_CLASS_ALL_CS_SYNC:
+                       classx = 16;
+               break;
+
+               default:
+                       classx =7;
+                       dbg("unsupported class %d. set to default : 7", forwarding->class);
+               break;
+       }
+    dbg("classx = %d", classx);
+
+//number
+       len = strlen(forwarding->number);
+       if (len > 0){
+               valid_num = TRUE;
+               if (forwarding->number[0] == '+')
+                       num_type = ((TIZEN_NUM_TYPE_INTERNATIONAL << 4)|TIZEN_NUM_PLAN_ISDN);
+               else
+                       num_type = 0;
+       }
+
+    dbg("number = %s", forwarding->number);
+
+       user_data = g_new0(struct ss_confirm_info, 1);
+
+       switch (op) {
+               case TIZEN_SS_OPCO_REG:
+                       user_data->resp = TRESP_SS_FORWARDING_REGISTER;
+                       break;
+               case TIZEN_SS_OPCO_DEREG:
+                       user_data->resp = TRESP_SS_FORWARDING_DEREGISTER;
+                       break;
+               case TIZEN_SS_OPCO_ACTIVATE:
+                       user_data->resp = TRESP_SS_FORWARDING_ACTIVATE;
+                       break;
+               case TIZEN_SS_OPCO_DEACTIVATE:
+                       user_data->resp = TRESP_SS_FORWARDING_DEACTIVATE;
+                       break;
+               default:
+                       dbg("[ error ] unknown op (0x%x)", op);
+                       break;
+       }
+
+   if(forwarding->number[0] == '+')
+       num_type = 145;
+   else
+      num_type = 129;
+
+       if(op == TIZEN_SS_OPCO_REG)
+               tmp_str = g_strdup_printf("AT+CCFC=%d,%d,\"%s\",%d,%d", reason, mode, forwarding->number, num_type, classx);
+       else// other opcode does not need num field
+               tmp_str = g_strdup_printf("AT+CCFC=%d,%d,,,%d", reason, mode, classx);
+
+       if(forwarding->mode == SS_CF_MODE_CFNRy)
+    {
+               //add time info to 'no reply' case
+               time = (int)(forwarding->time);
+               cmd_str = g_strdup_printf("%s,,,%d%s", tmp_str,time,"\r");
+       }
+       else
+    {
+               cmd_str = g_strdup_printf("%s%s", tmp_str,"\r");
+       }
+
+       dbg("request command : %s", cmd_str);
+
+
+    hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+
+
+       user_data->flavor_type = forwarding->mode;
+       user_data->class = forwarding->class;
+
+       ret = _ss_request_message(pending, o, ur, on_response_ss_forwarding_set, user_data);
+
+       g_free(tmp_str);
+       g_free(cmd_str);
+
+       if (!ret)
+       {
+           dbg("AT request sent failed ")
+               return TCORE_RETURN_FAILURE;
+       }
+
+       return TCORE_RETURN_SUCCESS;
+
+}
+
+
+static TReturn _ss_forwarding_get(CoreObject *o,
+                                                                       UserRequest *ur,
+                                                                       enum telephony_ss_class class,
+                                                                       enum telephony_ss_forwarding_mode type,
+                                                                       enum tcore_response_command resp)
+{
+
+       struct ss_confirm_info *user_data = 0;
+       gboolean ret = FALSE;
+
+       char* cmd_str = NULL;
+       int reason = 0, mode = 0, classx = 0;
+
+    TcoreHal* hal;
+       TcorePending *pending = NULL;
+       TcoreATRequest *req;
+
+    dbg("function enter");
+
+       switch(type)
+       {
+               case SS_CF_MODE_CFU:
+                       reason = 0;
+               break;
+               case SS_CF_MODE_CFB:
+                       reason = 1;
+               break;
+               case SS_CF_MODE_CFNRy:
+                       reason = 2;
+               break;
+               case SS_CF_MODE_CFNRc:
+                       reason = 3;
+               break;
+               case SS_CF_MODE_CF_ALL:
+                       reason = 4;
+               break;
+               case SS_CF_MODE_CFC:
+                       reason = 5;
+               break;
+
+               default:
+                       dbg("unsupported reason : %d");
+               break;
+       }
+    dbg("reason  = %d", reason);
+
+       switch(class)
+       {
+               case SS_CLASS_ALL_TELE:
+                       classx =7;
+               break;
+               case SS_CLASS_VOICE:
+                       classx =1;
+               break;
+               case SS_CLASS_ALL_DATA_TELE:
+                       classx =2;
+               break;
+               case SS_CLASS_FAX:
+                       classx =4;
+               break;
+               case SS_CLASS_SMS:
+                       classx = 8;
+               break;
+               case SS_CLASS_ALL_CS_SYNC:
+                       classx = 16;
+               break;
+               default:
+                       classx =7;
+                       dbg("unsupported class %d. set to default : 7", class);
+               break;
+       }
+
+    dbg("classx  = %d", classx);
+
+       //query status - mode set to 2
+       mode = 2;
+
+       user_data = g_new0(struct ss_confirm_info, 1);
+       user_data->resp = resp;
+
+       user_data->class = class;
+       user_data->flavor_type = type;
+
+       if(classx ==7)
+               cmd_str = g_strdup_printf("AT+CCFC=%d,%d%s", reason, mode,"\r");
+       else
+               cmd_str = g_strdup_printf("AT+CCFC=%d,%d,,,%d%s", reason, mode,classx,"\r");
+
+       dbg("request command : %s", cmd_str);
+
+    hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       req = tcore_at_request_new(cmd_str, "+CCFC", TCORE_AT_MULTILINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+
+       ret = _ss_request_message(pending, o, ur, on_response_ss_forwarding_get, user_data);
+       g_free(cmd_str);
+
+       if (!ret)
+       {
+           dbg("AT request sent failed ")
+               return TCORE_RETURN_FAILURE;
+       }
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+
+static TReturn s_ss_forwarding_activate(CoreObject *o, UserRequest *ur)
+{
+       return _ss_forwarding_set(o, ur, TIZEN_SS_OPCO_ACTIVATE);
+}
+
+static TReturn s_ss_forwarding_deactivate(CoreObject *o, UserRequest *ur)
+{
+       return _ss_forwarding_set(o, ur, TIZEN_SS_OPCO_DEACTIVATE);
+}
+
+static TReturn s_ss_forwarding_register(CoreObject *o, UserRequest *ur)
+{
+       return _ss_forwarding_set(o, ur, TIZEN_SS_OPCO_REG);
+}
+
+static TReturn s_ss_forwarding_deregister(CoreObject *o, UserRequest *ur)
+{
+       return _ss_forwarding_set(o, ur, TIZEN_SS_OPCO_DEREG);
+}
+
+static TReturn s_ss_forwarding_get_status(CoreObject *o, UserRequest *ur)
+{
+       struct treq_ss_forwarding *forwarding = 0;
+       forwarding = (struct treq_ss_forwarding*)tcore_user_request_ref_data(ur, 0);
+
+       return _ss_forwarding_get(o, ur, forwarding->class, forwarding->mode, TRESP_SS_FORWARDING_GET_STATUS);
+}
+
+
+static TReturn _ss_waiting_set(CoreObject *o, UserRequest *ur, enum telephony_ss_opcode opco)
+{
+       struct treq_ss_waiting *waiting = 0;
+       struct ss_confirm_info *user_data = 0;
+
+       gboolean ret = FALSE;
+       int mode = 0, classx = 0;
+       char* cmd_str;
+    TcoreHal* hal;
+       TcorePending *pending = NULL;
+       TcoreATRequest *req;
+
+    dbg("function enter ");
+       waiting = (struct treq_ss_waiting*) tcore_user_request_ref_data(ur, 0);
+
+       user_data = g_new0(struct ss_confirm_info, 1);
+
+       if(opco == TIZEN_SS_OPCO_ACTIVATE)
+    {
+               user_data->resp = TRESP_SS_WAITING_ACTIVATE;
+               mode = 1;//enable
+       }
+       else if (opco == TIZEN_SS_OPCO_DEACTIVATE)
+    {
+               user_data->resp = TRESP_SS_WAITING_DEACTIVATE;
+               mode =0; //disable
+       }
+       else
+               dbg("[ error ] unknown ss mode (0x%x)", opco);
+
+    switch(waiting->class)
+       {
+               case SS_CLASS_ALL_TELE:
+                       classx =7;
+               break;
+               case SS_CLASS_VOICE:
+                       classx =1;
+               break;
+               case SS_CLASS_ALL_DATA_TELE:
+                       classx =2;
+               break;
+               case SS_CLASS_FAX:
+                       classx =4;
+               break;
+               case SS_CLASS_SMS:
+                       classx = 8;
+               break;
+
+               default:
+                       classx =1;
+                       dbg("unsupported class %d. set to default : 1", waiting->class);
+               break;
+       }
+     dbg("mode = %d classxx- %d", mode , classx);
+
+       user_data->class = waiting->class;
+       user_data->flavor_type = (int)opco;
+
+       cmd_str = g_strdup_printf("AT+CCWA=1,%d,%d%s", mode, classx,"\r"); //always enable +CCWA: unsolicited cmd
+       dbg("request command : %s",cmd_str);
+
+    hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+
+       ret = _ss_request_message(pending, o, ur, on_response_ss_waiting_set, user_data);
+
+       g_free(cmd_str);
+
+       if (!ret)
+       {
+           dbg("AT request sent failed ")
+               return TCORE_RETURN_FAILURE;
+       }
+
+       return TCORE_RETURN_SUCCESS;
+
+}
+
+static TReturn _ss_waiting_get(CoreObject *o,
+                                                               UserRequest *ur,
+                                                               enum telephony_ss_class class,
+                                                               enum tcore_response_command resp)
+
+{
+
+       struct ss_confirm_info *user_data = 0;
+       gboolean ret = FALSE;
+       int classx; //mode,
+       char* cmd_str;
+
+    TcoreHal* hal;
+       TcorePending *pending = NULL;
+       TcoreATRequest *req;
+
+    dbg("function  enter")
+       switch(class)
+       {
+               case SS_CLASS_ALL_TELE:
+                       classx = 7;
+               break;
+               case SS_CLASS_VOICE:
+                       classx = 1;
+               break;
+               case SS_CLASS_ALL_DATA_TELE:
+                       classx = 2;
+               break;
+               case SS_CLASS_FAX:
+                       classx = 4;
+               break;
+               case SS_CLASS_SMS:
+                       classx = 8;
+               break;
+
+               default:
+                       classx =7;
+                       dbg("unsupported class %d. set to default : 7", class);
+               break;
+       }
+    dbg("classx - %d", classx);
+
+       dbg("allocating user data");
+       user_data = g_new0(struct ss_confirm_info, 1);
+       user_data->resp = resp;
+       user_data->class = class;
+
+       cmd_str = g_strdup_printf("AT+CCWA=1,2,%d%s", classx,"\r"); //always enable +CCWA: unsolicited cmd , mode is fixed to 2(query status)
+       dbg("request cmd : %s", cmd_str);
+
+    hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       req = tcore_at_request_new(cmd_str, "+CCWA", TCORE_AT_MULTILINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+
+       ret = _ss_request_message(pending, o, ur, on_response_ss_waiting_get, user_data);
+
+       g_free(cmd_str);
+
+       if (!ret)
+       {
+           dbg("AT request sent failed ")
+               return TCORE_RETURN_FAILURE;
+       }
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_ss_waiting_activate(CoreObject *o, UserRequest *ur)
+{
+       return _ss_waiting_set(o, ur, TIZEN_SS_OPCO_ACTIVATE);
+}
+
+static TReturn s_ss_waiting_deactivate(CoreObject *o, UserRequest *ur)
+{
+       return _ss_waiting_set(o, ur, TIZEN_SS_OPCO_DEACTIVATE);
+}
+
+static TReturn s_ss_waiting_get_status(CoreObject *o, UserRequest *ur)
+{
+       struct treq_ss_waiting *waiting = 0;
+       waiting = (struct treq_ss_waiting*)tcore_user_request_ref_data(ur, 0);
+
+       return _ss_waiting_get(o, ur, waiting->class, TRESP_SS_WAITING_GET_STATUS);
+}
+
+static TReturn s_ss_cli_activate(CoreObject *o, UserRequest *ur)
+{
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_ss_cli_deactivate(CoreObject *o, UserRequest *ur)
+{
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_ss_cli_get_status(CoreObject *o, UserRequest *ur)
+{
+
+       struct treq_ss_cli *cli = 0;
+       gboolean ret = FALSE;
+       char *cmd_prefix = NULL, *rsp_prefix = NULL, *cmd_str = NULL;
+       enum  telephony_ss_cli_type *user_data = 0;
+
+    TcoreHal* hal;
+       TcorePending *pending = NULL;
+       TcoreATRequest *req;
+
+       cli = (struct treq_ss_cli*)tcore_user_request_ref_data(ur, 0);
+
+       switch(cli->type)
+     {
+               case SS_CLI_TYPE_CLIP:
+                       cmd_prefix = "+CLIP";
+                       rsp_prefix = "+CLIP";
+               break;
+
+               case SS_CLI_TYPE_CLIR:
+                       cmd_prefix = "+CLIR";
+                       rsp_prefix = "+CLIR";
+               break;
+
+               case SS_CLI_TYPE_COLP:
+                       cmd_prefix = "+COLP";
+                       rsp_prefix = "+COLP";
+               break;
+
+        case SS_CLI_TYPE_COLR:
+            cmd_prefix = "+COLR";
+                       rsp_prefix = "+COLR";
+         break;
+
+            case SS_CLI_TYPE_CNAP:
+             cmd_prefix = "+CNAP";
+                        rsp_prefix = "+CNAP";
+          break;
+
+               case SS_CLI_TYPE_CDIP:
+               default:
+                       dbg("unsupported cli_type : %d", cli->type);
+                       return TCORE_RETURN_FAILURE;
+               break;
+       }
+
+       dbg("cmd_prefix : %s",cmd_prefix);
+
+       cmd_str = g_strdup_printf("AT%s?%s", cmd_prefix, "\r");
+       dbg("request cmd : %s", cmd_str);
+
+       user_data = g_new0(enum telephony_ss_cli_type, 1);
+    *user_data = cli->type;
+
+    hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       req = tcore_at_request_new(cmd_str, rsp_prefix, TCORE_AT_SINGLELINE);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+
+       ret = _ss_request_message(pending, o, ur, on_response_ss_cli_get, user_data);
+
+       g_free(cmd_str);
+
+    if (!ret)
+       {
+           dbg("AT request sent failed ")
+               return TCORE_RETURN_FAILURE;
+       }
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_ss_send_ussd(CoreObject *o, UserRequest *ur)
+{
+
+       UssdSession *ussd_s = 0;
+
+       struct treq_ss_ussd *ussd = 0;
+       struct ss_confirm_info *user_data = 0;
+       gboolean ret = FALSE;
+       char* cmd_str;
+    TcoreHal* hal;
+       TcorePending *pending = NULL;
+       TcoreATRequest *req;
+
+    dbg("function enter");
+       ussd = (struct treq_ss_ussd*)tcore_user_request_ref_data(ur, 0);
+
+       cmd_str = g_strdup_printf("AT+CUSD=1,\"%s\",%d%s", ussd->str, 0x0f,"\r"); //always enable +CUSD: unsolicited cmd. set to dcs to 0x0f. only supports HEX type
+       dbg("request command : %s",cmd_str);
+
+
+       user_data = g_new0(struct ss_confirm_info, 1);
+       user_data->resp = TRESP_SS_SEND_USSD;
+
+       ussd_s = tcore_ss_ussd_get_session(o);
+       if(!ussd_s)
+    {
+        dbg("USSD session does not  exist");
+               tcore_ss_ussd_create_session(o, (enum tcore_ss_ussd_type)ussd->type, (void*)tcore_user_request_ref(ur), 0);
+       }
+    else
+       {
+               if(ussd->type == SS_USSD_TYPE_USER_INITIATED)
+        {
+                   dbg("[ error ] ussd session is already exist");
+                       g_free(user_data);
+                       return TCORE_RETURN_FAILURE;
+               }
+
+               tcore_ss_ussd_set_session_type(ussd_s, (enum tcore_ss_ussd_type)ussd->type);
+       }
+
+    hal = tcore_object_get_hal(o);
+       pending = tcore_pending_new(o, 0);
+
+       req = tcore_at_request_new(cmd_str, NULL, TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+
+       ret = _ss_request_message(pending, o, ur, on_confirmation_ss_ussd, user_data);
+
+       g_free(cmd_str);
+
+       if (!ret)
+       {
+           dbg("AT request sent failed ")
+               return TCORE_RETURN_FAILURE;
+       }
+
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_ss_set_aoc(CoreObject *o, UserRequest *ur)
+{
+       dbg("[ error ] unsupported function");
+       return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_ss_get_aoc(CoreObject *o, UserRequest *ur)
+{
+       dbg("[ error ] unsupported function");
+       return TCORE_RETURN_SUCCESS;
+}
+
+
+static struct tcore_call_control_operations call_ops = {
+       .answer_hold_and_accept = s_ss_manage_call_2_send,
+       .answer_replace                 = s_ss_manage_call_1_send,
+       .answer_reject                  = s_ss_manage_call_0_send,
+       .end_specific                   = s_ss_manage_call_1x_send,
+       .end_all_active                 = s_ss_manage_call_1_send,
+       .end_all_held                   = s_ss_manage_call_0_send,
+       .active                                 = s_ss_manage_call_2_send,
+       .hold                                   = s_ss_manage_call_2_send,
+       .swap                                   = s_ss_manage_call_2_send,
+       .join                                   = s_ss_manage_call_3_send,
+       .split                                  = s_ss_manage_call_2x_send,
+       .transfer                               = s_ss_manage_call_4_send,
+       .deflect                                = s_ss_manage_call_4dn_send,
+};
+
+static TReturn s_ss_manage_call_send(CoreObject* o, UserRequest* ur, const char* cmd, ConfirmCallback cb, void* user_data)
+{
+       TcorePending *pending = NULL;
+       TcoreATRequest *req;
+       gboolean ret = FALSE;
+
+       pending = tcore_pending_new(o, 0);
+
+       req = tcore_at_request_new(cmd, NULL, TCORE_AT_NO_RESULT);
+
+       dbg("cmd : %s, prefix(if any) :%s, cmd_len : %d", req->cmd, req->prefix, strlen(req->cmd));
+
+       tcore_pending_set_request_data(pending, 0, req);
+
+    ret = _ss_request_message(pending, o, ur, (TcorePendingResponseCallback)cb, user_data);
+
+    if (!ret)
+       {
+           dbg("AT request sent failed ")
+               return TCORE_RETURN_FAILURE;
+       }
+
+    return TCORE_RETURN_SUCCESS;
+}
+
+static TReturn s_ss_manage_call_0_send(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data)
+{
+       char* cmd_str = NULL;
+       gboolean ret = FALSE;
+
+    dbg("function enter");
+
+       cmd_str = g_strdup_printf("%s%s", "AT+CHLD=0", "\r");
+       dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str));
+
+    ret =  s_ss_manage_call_send(o, ur, cmd_str, cb, user_data);
+       g_free(cmd_str);
+       return ret;
+}
+
+static TReturn s_ss_manage_call_1_send(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data)
+{
+       char* cmd_str = NULL;
+       gboolean ret = FALSE;
+
+    dbg("function enter");
+       cmd_str = g_strdup_printf("%s%s", "AT+CHLD=1", "\r");
+       dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str));
+
+    ret =  s_ss_manage_call_send(o, ur, cmd_str, cb, user_data);
+       g_free(cmd_str);
+       return ret;
+}
+
+static TReturn s_ss_manage_call_1x_send(CoreObject* o, UserRequest* ur, const int id, ConfirmCallback cb, void* user_data)
+{
+
+    char* cmd_str = NULL;
+       gboolean ret = FALSE;
+
+    dbg("function enter");
+       cmd_str = g_strdup_printf("%s%d%s", "AT+CHLD=1", id,"\r");
+       dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str));
+
+    ret =  s_ss_manage_call_send(o, ur, cmd_str, cb, user_data);
+       g_free(cmd_str);
+       return ret;
+}
+
+static TReturn s_ss_manage_call_2_send(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data)
+{
+    char* cmd_str = NULL;
+       gboolean ret = FALSE;
+
+    dbg("function enter");
+
+       cmd_str = g_strdup_printf("%s%s", "AT+CHLD=2", "\r");
+       dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str));
+
+    ret =  s_ss_manage_call_send(o, ur, cmd_str, cb,  user_data);
+       g_free(cmd_str);
+       return ret;
+
+}
+
+static TReturn s_ss_manage_call_2x_send(CoreObject* o, UserRequest* ur, const int id, ConfirmCallback cb, void* user_data)
+{
+    char* cmd_str = NULL;
+       gboolean ret = FALSE;
+
+    dbg("function enter");
+
+       cmd_str = g_strdup_printf("%s%d%s", "AT+CHLD=2", id,"\r");
+       dbg("cmd : %s, prefix(if any) : %s, cmd_len : %d",cmd_str, "N/A", strlen(cmd_str));
+
+    ret =  s_ss_manage_call_send(o, ur, cmd_str, cb,  user_data);
+       g_free(cmd_str);
+       return ret;
+}
+
+static TReturn s_ss_manage_call_3_send(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data)
+{
+       char* cmd_str = NULL;
+    gboolean ret = FALSE;
+
+    dbg("function enter");
+
+       cmd_str = g_strdup_printf("%s%s", "AT+CHLD=3","\r");
+
+    ret =  s_ss_manage_call_send(o, ur, cmd_str, cb, user_data);
+       g_free(cmd_str);
+       return ret;
+}
+
+
+static TReturn s_ss_manage_call_4_send(CoreObject* o, UserRequest* ur, ConfirmCallback cb, void* user_data)
+{
+    char* cmd_str = NULL;
+    gboolean ret = FALSE;
+
+    dbg("function enter");
+       cmd_str = g_strdup_printf("%s%s", "AT+CHLD=4", "\r");
+
+    ret =  s_ss_manage_call_send(o, ur, cmd_str, cb, user_data);
+       g_free(cmd_str);
+       return ret;
+}
+
+static TReturn s_ss_manage_call_4dn_send(CoreObject* o, UserRequest* ur, const char* number, ConfirmCallback cb, void* user_data)
+{
+
+    char* cmd_str = NULL;
+    gboolean ret = FALSE;
+
+    dbg("function enter");
+       cmd_str = g_strdup_printf("%s%s%s", "AT+CHLD=4", number,"\r");
+
+    ret =  s_ss_manage_call_send(o, ur, cmd_str, cb, user_data);
+       g_free(cmd_str);
+
+       return ret;
+}
+
+gboolean s_ss_init(TcorePlugin *p, TcoreHal *h)
+{
+       CoreObject *so = 0, *co = 0;
+       struct property_call_info *data = 0;
+
+       so = tcore_ss_new(p, "ss", &ss_ops, h);
+       if (!so) {
+               dbg("[ error ] ss_new()");
+               return FALSE;
+       }
+
+       co = tcore_plugin_ref_core_object(p, "call");
+       if (!co) {
+               dbg("[ error ] plugin_ref_core_object");
+               return FALSE;
+       }
+
+       tcore_call_control_set_operations(co, &call_ops);
+
+       //tcore_object_add_callback(so, EVENT_NOTI_SS_INFO, on_notification_ss_info, 0);
+       //tcore_object_add_callback(so, EVENT_NOTI_SS_USSD, on_notification_ss_ussd, 0);
+
+    tcore_object_add_callback(so, "+CSSU", on_notification_ss_info, 0);
+    tcore_object_add_callback(so, "+CSSI", on_notification_ss_info, 0);
+       tcore_object_add_callback(so, "+CUSD", on_notification_ss_ussd, 0);
+
+       data = calloc(sizeof(struct property_call_info *), 1);
+       tcore_plugin_link_property(p, "SS", data);
+
+       return TRUE;
+}
+
+void s_ss_exit(TcorePlugin *p)
+{
+       CoreObject *o;
+       struct property_network_info *data;
+
+       o = tcore_plugin_ref_core_object(p, "ss");
+
+       data = tcore_plugin_ref_property(p, "SS");
+       if (data)
+               free(data);
+
+       tcore_ss_free(o);
+}
diff --git a/tel-plugin-imc.manifest b/tel-plugin-imc.manifest
new file mode 100755 (executable)
index 0000000..143fb79
--- /dev/null
@@ -0,0 +1,11 @@
+<manifest>
+       <request>
+               <domain name="telephony_framework"/>
+       </request>
+       <assign>
+               <filesystem path="/usr/lib/telephony/plugins/imc-plugin.so" label="telephony_framework"/>
+       </assign>
+       <request>
+               <domain name="telephony_framework"/>
+       </request>
+</manifest>