import time
from subprocess import *
import sys
+import gsmdecode
if len(sys.argv) != 2:
print "Usage: ussdquery.py <ussd number>"
child.sendeof();
-# Check if we need to decode answer
-# Compressed messages are not supported yet
-if encoding == '86':
- reply = reply.decode("hex")
-elif encoding == '72':
- reply = reply.decode("hex")
- p = Popen(['iconv', '-f', 'UCS-2BE', '-t', 'UTF8'], stdin=PIPE, stdout=PIPE);
- reply = p.communicate(reply)[0]
+# Decoding ansver
+reply = gsmdecode.decode(reply, int(encoding))
print reply;