返回列表 發帖

CSL SMS encode/decode

I have a USB dongle (with a "Hello" Prepaid Card inserted) attached to my Asterisk server. Everyday,  a cron job will run a program to check the balance of the prepaid card. It's been running for over 2 years without any problem.

Today, I got the SMS that seems "encoded" from the CLI:
  1. [dongle0] Got SMS from 179179: '(QKA_ESYKA_A^MAr_keA eKaCSIA&FCeIARgAllpfdpfrX@B]IAhQKAdK[CS]S]OAlCYkKARgAnh\drv@lCYSIAhSYYAdd^C]_d`bn\@ YKCgKAlSgSiAPiiau^^`eKaCSI]PWGgY]F_[AL_eA'
複製代碼
Is there anyone know how to "decode" it?

I used Dongle for standby line and using following config to receive SMS even Chinese is OK. SMS will be email out to mailbox.

[from-trunk-dongle]
exten => sms,1,Noop(Incoming SMS from ${CALLERID(num)} ${BASE64_DECODE(${SMS_BASE64})})
exten => sms,2,System(echo "Subject: SMS received from ${CALLERID(num)}" > /var/log/asterisk/smsmail)
exten => sms,3,System(echo " " >> /var/log/asterisk/smsmail)
exten => sms,4,System(echo '${BASE64_DECODE(${SMS_BASE64})}' >> /var/log/asterisk/smsmail)
exten => sms,5,System(sendmail -f XXXXXX@gmail.com -t XXXXXXX@gmail.com < /var/log/asterisk/smsmail)
exten => sms,n,System(echo '${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} - ${DONGLENAME} - ${CALLERID(num)}: ${BASE64_DECODE(${SMS_BASE64})}' >> /var/log/asterisk/sms.txt)
exten => sms,n,Hangup()

TOP

回復 2# edmond25


    我有一个大陆联通沃信号码挂在piaf上,有时候也收到短信,但从来不知道内容,你的这个办法好,但不知道如何用在我的系统上!

TOP

安装及配置好 Chan_dongle 再把上面的,贴到 extensions_custom.conf 内,重启 asterisk

TOP

本帖最後由 woolungtea 於 2017-9-8 12:02 編輯

各位師兄 , 我重裝了raspbx 新舊版本 , 仍然pccw check balance ##21# 的SMS 無法decode , 也試了edmond25 提供的script , 都不成功 , 我2015年做是沒有問題的 , 請問有沒有什麼資料 ?

==> 後記 , 經再三測試 , 是Pccw 的 ussd ##21# 出亂碼 , 我用其他方法send 中文,日文 sms 都沒有問題 !!

TOP

各位師兄 , 我重裝了raspbx 新舊版本 , 仍然pccw check balance ##21# 的SMS 無法decode , 也試了edmond25  ...
woolungtea 發表於 2017-9-8 10:22



    ussd 定 sms 出問題?
我來緊都要用來check hello code.

TOP

I am okay wor

TOP

2017-09-12 19:07:20 - dongle0: Thanks for using CSL Prepaid SIM Card service, a short message will be sent to you shortly.

TOP

本帖最後由 mcdull 於 2017-9-13 02:39 編輯

The Mobile No of your Prepaid SIM card is xxxxxxxx, and the remaining value is $48.00; valid till 11/Mar/2018. Please visit http://prepaid.hkcsl.com for data usage enquiry.

btw ##21# 係飛線喎.

BTW, can you share the cronjob script for checking balance?

TOP

本帖最後由 ttmuskie 於 2017-9-13 10:42 編輯

I'm using python:
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. import os

  4. cmd = "sudo /usr/sbin/asterisk -rx 'dongle ussd dongle0 ##122#'"
  5. os.system(cmd)
複製代碼
Btw, for the encode/decode problem I've raised last year, it was fixed by itself (it mean I didn't change anything) after a week or so.

TOP

I'm using python:Btw, for the encode/decode problem I've raised last year, it was fixed by itself (i ...
ttmuskie 發表於 2017-9-13 10:34



    Thanks.  I had just put it in a shell script and put under the crontab.  Are you going to implement some alert if the amount is lower than a specific value? or the expiry date? These are more interesting to look at for automation.

TOP

Good suggestion

TOP

搵左幾日,原來 decode sms 既 PDU 係咁困難,啲library一係就只做send, 一係就勁難用.
有冇啲library係可以就咁用command line pass 個pdu string 就用到?

TOP

回復 6# mcdull

唔該晒先 , 亂碼只係出現係用hello SIM send ussd ##122# check balance 時 , 由於我見SMS 無問題 , 我無再理佢了

TOP

回復  mcdull

唔該晒先 , 亂碼只係出現係用hello SIM send ussd ##122# check balance 時 , 由於我見SMS  ...
woolungtea 發表於 2017-9-21 17:05



    而家啲SMS 野野都分開3-4個.. 好X煩...

TOP

返回列表