有張儲值卡放 asterisk 用來收 SMS, 亦係主要打入電話.
平時都係飛線去另一手機, 不過, 月費太貴 cut 埋, 但全轉用網絡電話又有時收得好差. 要飛線又好唔方便, 因為 ussd code 唔知點解唔 work.
所以用 homeassistant 寫左個ssh remote script 用 AT command 去飛線.
command_on: 'ssh -o UserKnownHostsFile=/config/.ssh/knownhosts -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa xxx@192.168.1.X /usr/sbin/asterisk -rx \"dongle cmd $(ssh -o UserKnownHostsFile=/config/.ssh/knownhosts -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa xxx@192.168.1.X /usr/sbin/asterisk -rx \"dongle show devices\" | grep XXXX | cut -c1-8) AT+CCFC=0,3,+852????????\"'
問題來啦, 我想check佢飛線狀態, 雖然可以用 AT+CCFC=0,2 去查, 但結果會返回 asterisk console內, 不是 stdout. 咁我就讀唔返.
我亦唔想去 grep asterisk log, 咁攪勁複雜, 有冇計? |