2012-06-03 36 views
0

我想讓我的callerid腳本發送一個通知給我的boxee盒連接電視。我已經有腳本使用mgetty工作,並在幾臺計算機上通知發送。發送json commonds與bash到boxeebox

這裏是我的cidscript.sh它獲取由mgetty的

#!/bin/sh 

# send message to computer 
ssh -o ConnectTimeout=10 [email protected] "DISPLAY=:0 notify-send 'Phone call from...  $CALLER_NAME  $CALLER_ID'" & 
sleep 0.2 
ssh -o ConnectTimeout=10 [email protected] "DISPLAY=:0 notify-send 'Phone call from...  $CALLER_NAME  $CALLER_ID'" & 
sleep 0.2 
ssh -o ConnectTimeout=10 [email protected] "DISPLAY=:0 notify-send 'Phone call from...  $CALLER_NAME  $CALLER_ID'" & 
sleep 0.2 
su mrplow -c "DISPLAY=:0.0 notify-send 'Phone call from...  $CALLER_NAME  $CALLER_ID'" & 
sleep 5 

# update logs 
echo `date +"%F %a %r"`"|$CALLER_ID|$CALLER_NAME" >> /home/mrplow/answering_machine/logs/incoming-calls.log 
scp -o ConnectTimeout=10 /home/mrplow/answering_machine/logs/incoming-calls.log [email protected]:/home/christine/Desktop/incoming-calls.log 

sleep 0.2 

exit 1 

我認爲JSON RPC將是獲得這個工作 我已經成功遠程登錄到Boxee的盒上的唯一途徑觸發原始的端口9090,然後配對我的設備

因此該腳本將需要發送的連接命令

{"jsonrpc": "2.0", "method": "Device.Connect", "params":{"deviceid": "############"}, "id": 1} 

那麼實際通知

{"jsonrpc": "2.0", "method": "GUI.NotificationShow", "params":{"msg" : "Phone call from...  $CALLER_NAME  $CALLER_ID"}, "id": 1} 

我想這無濟於事

curl -d '{"jsonrpc": "2.0", "method": "Device.Connect", "params":{"deviceid": "00112fa696c9"}, "id": 1}\ 
{"jsonrpc": "2.0", "method": "GUI.NotificationShow", "params":{"msg" : "test"}, "id": 1}' -i 192.168.1.6 9090 
+0

退房http://stackoverflow.com/q/813487/411902 –

回答

0

想通了......

echo { \"jsonrpc\": \"2.0\", \"method\": \"Device.Connect\", \"params\":{\"deviceid\": \"############\"}, \"id\": 1}\ 
{ \"jsonrpc\": \"2.0\", \"method\": \"GUI.NotificationShow\", \"params\":{\"msg\" : \"Phone call from...  $CALLER_NAME  $CALLER_ID\"}, \"id\": 1 } | telnet 192.168.1.6 9090 &> /dev/null