---
 drivers/isimodem/ussd.c |   36 +++++++-----------------------------
 1 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/drivers/isimodem/ussd.c b/drivers/isimodem/ussd.c
index 8be20b6..10bee0f 100644
--- a/drivers/isimodem/ussd.c
+++ b/drivers/isimodem/ussd.c
@@ -47,6 +47,7 @@
 #include "isiutil.h"
 #include "ss.h"
 #include "debug.h"
+#include "ussdutil.h"
 
 struct ussd_data {
        GIsiClient *client;
@@ -73,44 +74,21 @@ static void ussd_parse(struct ofono_ussd *ussd, const void 
*restrict data,
                        size_t len)
 {
        const unsigned char *msg = data;
-       unsigned char buf[256];
-       unsigned char *unpacked;
-       long written;
-       int status;
+       int status = OFONO_USSD_STATUS_NOT_SUPPORTED;
        char *converted = NULL;
-       gboolean udhi;
-       enum sms_charset charset;
-       gboolean compressed;
-       gboolean iso639;
 
        if (!msg || len < 4)
-               goto error;
+               goto out;
 
        status = isi_type_to_status(msg[2]);
 
        if (msg[3] == 0 || (size_t)(msg[3] + 4) > len)
-               goto error;
-
-       if (!cbs_dcs_decode(msg[1], &udhi, NULL, &charset,
-                               &compressed, NULL, &iso639))
-               goto error;
-
-       if (udhi || compressed || iso639)
-               goto error;
-
-       if (charset != SMS_CHARSET_7BIT)
-               goto error;
-
-       unpacked = unpack_7bit_own_buf(msg + 4, msg[3], 0, TRUE,
-                                       SS_MAX_USSD_LENGTH, &written, 0, buf);
+               goto out;
 
-       converted = convert_gsm_to_utf8((const guint8 *)unpacked, written,
-                                       NULL, NULL, 0);
+       converted = ussd_decode(msg[1], msg[3], msg + 4);
 
-       goto out;
-
-error:
-       status = OFONO_USSD_STATUS_NOT_SUPPORTED;
+       if (converted)
+               status = OFONO_USSD_STATUS_NOTIFY;
 
 out:
        ofono_ussd_notify(ussd, status, converted);
-- 
1.7.0.4

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to