On Fri, 31 Mar 2000, John Homer wrote:
..
> hi pluggers, anyone tried one of those SMS clients on
> linux? sending msgs to GSM mobiles. advise me.let me
> know if it works.
It works. You can use Gnokii (www.gnokii.org) which only works with Nokia
phones but allows you to do cool things such as send oplogos (this is not
very reliable, but SMS send/receive is pretty stable).
Then there's gsmlib which only talks the GSM AT command set (e.g. it will
not work with for example a 3210 which doesnt have a GSM modem inside).
However gsmlib will work with any GSM AT-compliant phone but only the
generic stuff is supported (e.g. no oplogos or ringtones).
Here's a simple client I wrote (in Perl) for sending/receiving SMS
messages. You need gnokii and the Gnokii::GSM module from CPAN. I only
tested it on a 5110 and 6150 with the DAU-9P cable.
Note that this won't work with a 7110, 8210, 8850, 6210, or 6250 because
these use a DLR-3 cable and their FBUS protocol is not the same as 38xx
and 61xx phones. You need gsmlib for these phones.
Also note that if you have a 7110 or 8850, these have full IrDA support so
you can dispense with the cable, but you need to use AT commands (e.g.
GSMlib). For the 6110/6150, you simply use the IR port as a serial packet
device, and use gnokii.
p.s. gnokii supports only 2 types of FBUS protocols: 38xx style (3810,
8110, 8110i) and 61xx (5110, 6110, 6150, etc). In the $MODEL variable
below, set it to either "6110" or "3810" depending on which phone you
have.
--- begin code segment ---
#!/opt/perl5/bin/perl
use Gnokii::GSM;
use POSIX;
# clear screen
system ("clear");
# define these for your phone
$PORT = "/dev/ttyS1";
$MODEL = "6110";
$PROTOCOL = "SER";
print STDERR "Connecting to GSM phone.. ";
$conn = Gnokii::GSM->new ($PORT, $MODEL, $PROTOCOL)
or die "Couldn't connect to $MODEL on $PORT via $PROTOCOL.\n";
print STDERR "ok\n";
print STDERR "Loading phonebook.. ";
$conn->GetPhonebook();
%local_phonebook = undef;
foreach $i (@{$conn->{"Phonebook"}})
{
$pname = $i->{'Name'};
$pnum = $i->{'Number'};
$local_phonebook{$pname} = $pnum;
}
print STDERR "ok\n";
# prepare to send/receive SMS message
print STDERR "SMS Center Information:\n";
$conn->GetSMSCenter(1);
print STDERR "No: $conn->{'SMSCenter'}->{'No'}\n";
print STDERR "Name: $conn->{'SMSCenter'}->{'Name'}\n";
print STDERR "Number: $conn->{'SMSCenter'}->{'Number'}\n\n";;
# infinite loop
while (1) {
# get SMS status
$conn->GetSMSStatus();
start:
print STDERR "\nSMS Messages: $conn->{'SMSStatus'}->{'Number'}\n";
print STDERR "SMS Unread: $conn->{'SMSStatus'}->{'Unread'}\n\n";
print STDERR "Enter phone number: ";
chomp ($tphone = <>);
# if does not begin with '+' then look in phonebook
if (! ($tphone =~ /^\+/)) {
print STDERR "Checking phonebook.. ";
if ($local_phonebook{$tphone}) {
$phone_to_call = $local_phonebook{$tphone};
print STDERR "number for $tphone is",
"$phone_to_call\n";
} else {
print STDERR "$tphone not found\n";
goto start;
}
} else {
$phone_to_call = $tphone;
print STDERR "Phone number is $phone_to_call\n";
}
print STDERR "Enter message: ";
chomp ($mesg = <>);
$msghash = {};
$msghash->{'MessageText'} = $mesg;
$msghash->{'MessageCentre'} = "+6391702"; # hardwired for Globe
$msghash->{'Destination'} = $phone_to_call;
if ($conn->SendSMSMessage($msghash) == 14) {
print STDERR "SMS Message sent to $tphone\n";
} else {
print STDERR "SMS Message Send failed\n";
}
}
exit;
--- end code segment ---
Now didnt I tell you guys that Perl can do ANYTHING? :)))
---------------------------------------------------------------------
Orlando Andico <[EMAIL PROTECTED]> +63 (2) 937-2293
Mosaic Communications, Inc. +63 (917) 531-5893
Any sufficiently perverted technology is indistinguishable from Perl.
-
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]