Created
November 6, 2015 15:24
-
-
Save drscream/d7d316d2f08bd915f7e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/expect -f | |
#################################################### | |
# Copyright (c) 2010 Shane Mc Cormack | |
#################################################### | |
# This script is used to send text messages using | |
# any AT-Compatible SMS-Capable serial device. | |
#################################################### | |
if {[llength $argv] < 3} { | |
puts "Usage: $argv0 '<device>' '<number>' '<message>'"; | |
puts "<number> should be in international format."; | |
exit 1; | |
} | |
set device [lindex $argv 0] | |
set number [lindex $argv 1] | |
set message [lindex $argv 2] | |
set escape "\x1C"; | |
set timeout 25 | |
match_max 100000 | |
#puts "Spawning: /usr/bin/kermit -b 9600 -8 -l ${device} -C \"set exit warning off,set carrier-watch off,connect,exit\"" | |
spawn /usr/bin/kermit -b 9600 -8 -l ${device} -C "set exit warning off,set carrier-watch off,connect,exit" | |
expect -- "----------------------------------------------------" { send "AT+CPIN=\"5364\"\r\n" } | |
expect -- "OK" { send "AT+CMGF=1\r\n" } | |
expect -- "OK" { send "AT+CMGS=\"${number}\"\r" } | |
expect -- ">" { send "${message}\032" } | |
expect -- "OK" { | |
puts ""; | |
send "${escape}"; | |
send "c" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment