電訊茶室's Archiver

ttmuskie 發表於 2016-11-9 14:00

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:[code]
[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'
[/code]Is there anyone know how to "decode" it?

edmond25 發表於 2016-12-1 16:45

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 [email]XXXXXX@gmail.com[/email] -t [email]XXXXXXX@gmail.com[/email] < /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()

lookforyou 發表於 2016-12-1 19:32

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=43341&ptid=6978]2#[/url] [i]edmond25[/i] [/b]


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

edmond25 發表於 2016-12-2 17:09

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

woolungtea 發表於 2017-9-8 10:22

[i=s] 本帖最後由 woolungtea 於 2017-9-8 12:02 編輯 [/i]

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

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

mcdull 發表於 2017-9-8 21:19

[quote]各位師兄 , 我重裝了raspbx 新舊版本 , 仍然pccw check balance ##21# 的SMS 無法decode , 也試了edmond25  ...
[size=2][color=#999999]woolungtea 發表於 2017-9-8 10:22[/color] [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=43767&ptid=6978][img]http://www.telecom-cafe.com/forum/images/common/back.gif[/img][/url][/size][/quote]


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

mcdull 發表於 2017-9-13 02:28

I am okay wor

mcdull 發表於 2017-9-13 02:28

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

mcdull 發表於 2017-9-13 02:31

[i=s] 本帖最後由 mcdull 於 2017-9-13 02:39 編輯 [/i]

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

btw ##21# 係飛線喎.

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

ttmuskie 發表於 2017-9-13 10:34

[i=s] 本帖最後由 ttmuskie 於 2017-9-13 10:42 編輯 [/i]

I'm using python:[code]
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os

cmd = "sudo /usr/sbin/asterisk -rx 'dongle ussd dongle0 ##122#'"
os.system(cmd)
[/code]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.

mcdull 發表於 2017-9-13 10:45

[quote]I'm using python:Btw, for the encode/decode problem I've raised last year, it was fixed by itself (i ...
[size=2][color=#999999]ttmuskie 發表於 2017-9-13 10:34[/color] [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=43775&ptid=6978][img]http://www.telecom-cafe.com/forum/images/common/back.gif[/img][/url][/size][/quote]


    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.

ttmuskie 發表於 2017-9-13 12:28

Good suggestion :)

mcdull 發表於 2017-9-15 11:52

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

woolungtea 發表於 2017-9-21 17:05

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=43768&ptid=6978]6#[/url] [i]mcdull[/i] [/b]

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

mcdull 發表於 2017-9-21 21:12

[quote]回復  mcdull

唔該晒先 , 亂碼只係出現係用hello SIM send ussd ##122# check balance 時 , 由於我見SMS  ...
[size=2][color=#999999]woolungtea 發表於 2017-9-21 17:05[/color] [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=43784&ptid=6978][img]http://www.telecom-cafe.com/forum/images/common/back.gif[/img][/url][/size][/quote]


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

頁: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.