Keywords: Mode: All keywords (AND) |
Sun May 20, 2012 06:04
|
stom: Proliants tend to look for monitoring hw connected on serial ports, starting from the bios.
This confuses the mc35 which eventually hangs.
Apart from changing the cable to something minimal, a usb2serial cable which can be configured as virtual comport (preferably fddi chipset) which won't be probed at boot might also be a solution.
Regards
|
Sat Mar 24, 2012 07:50
|
stom: This is strange. In any case, it comes from the network.
No ideas. Is it possible to try with another sim/ carrier?
From the logs, smsd seems to work fine.
|
Sat Mar 24, 2012 04:29
|
stom: facility not subscribed error
This could be coming from the gsm network.
Have you tried putting the sim to a normal phone and sending sms to the same number?
You might also try receiving an sms and see if it works.
|
Mon Jan 02, 2012 09:57
|
stom: Well, check if the table rsms exist in the specific database
You can use mysql -u root -p from command line
show databases;
use smsd;
show tables;
|
Fri Dec 30, 2011 20:41
|
stom: The modem device setting is obviously wrong.
What you mention is the flash part of the modem that usually contains driver software.
Try locating the serial port again.
|
Thu Dec 29, 2011 14:35
|
stom: You need some way to transfer text files.
One solution would be ftp.
Another would be SMB,NFS
and another would be some php script and apache, that reads the file remotely over http and creates the files local on disk, inside the proper folders.
|
Thu Dec 29, 2011 14:31
|
stom: Is there a database in the new system named smsd ?
|
Thu Dec 29, 2011 12:57
|
stom: You need to write an action for the received sms, and expand from there...
Here is an example in perl. This script is called by sms3 server everytime a message is received.
Receives commands, and sends replies according to content.
If command is not understood, it is send to a default email.
With a little coding you can do what you wish.
The command ip will return ip address from interface ppp0. Modify as needed
command sw will execute the linux w command and return output via sms.
You can add commands as you like.
Runs on centos 5.x, you might need to install perl additional modules
cpan is your friend.
This script has been working from me for quite some time.
I have removed some custom commands that would be difficult to explain.
(but might be a few code leftovers.)
Some perl knowledge is required, nothing special though.
Also, if the script is run by hand, it parses a text file, and sets debug to 1
so you can fix your script without actually sending sms.
The file should be obtained from sms3d server incoming files.
Enjoy :)
#!/usr/bin/perl -w
use Date::Format;
use File::Temp ();
use Mail::Sendmail;
use File::ReadBackwards;
use Time::Local;
use strict;
my $disposition="MANUAL"; #Indicates debugging in logfile
my $smsfile="/usr/local/bin/testsms.txt"; #used for debugging
my $recipient='me@home.gr'; #recepient for emails
my $from='elastix@home.gr'; #originator for emails
my $logfile="/var/log/smshandler.log"; # script logging file (minimal)
my $ipfile="/var/log/iphist.log"; #ip change history
my $literfile="/var/spool/boiler/boilerliters.txt";
my $debug=1;
my @ssun ;
my @sbtop ;
my @sbbot ;
my @sconv ;
# This script is called everytime sms3d service does an action
# 3 parameters are passed Reasonforcalling, filename, deliveryreport file
my $smsdata;
my $smsno;
my $reportfile;
my @line;
if (defined($ARGV[0])) {$disposition=$ARGV[0];};
if (defined($ARGV[1])) {$smsfile=$ARGV[1];$debug=0;};
if (defined($ARGV[2])) {$reportfile=$ARGV[2];};
parse_sms();
if ($debug) {$disposition="RECEIVED";};
# fills in global $smsno and @line array - $smsdata is $line[12]
open(LOG,">>$logfile") || die("Cannot Open ",$logfile."\n");
print LOG time2str("%Y%m%d%H%M%S", time)," ",$disposition," File:",$smsfile."\n";
close LOG;
if ($disposition eq "RECEIVED") {parse_smsdata()}
if ($disposition eq "SENT") {}
if ($disposition eq "FAILED") {}
if ($disposition eq "CALL") {call_received()}
if ($disposition eq "REPORT") {sms__report_rcvd()} -
#send_sms("695433333", "hello");
########## --------------- Script Ends Here ---------------- #############
sub parse_smsdata {
my $sdata =uc($smsdata);
if (length($sdata)==2) {
if ($sdata eq "IP") {externip()}
if ($sdata eq "SW") {runw()}
}
else
{sms2email()}
return;
}
sub sms2email() {
my %mail;
%mail = (
from => $from, to => $recipient,subject => 'SMS Received',
text => $line[0].$line[3].$line[4].$line[11].$line[12]
);
$mail{'Content-type'} = 'text/plain; charset="iso-8859-7"';
sendmail(%mail) || print "Error: $Mail::Sendmail::error\n";
return;
}
sub externip {
my $localip = `ifconfig ppp0`;
my $fh =File::ReadBackwards->new( $ipfile) or die "cant read $ipfile";
my $bdata = $fh->readline;
my @iptime = split (" ",$bdata);
# print $iptime[0];
my @lip = split (" ",$localip);
my $msg=$lip[5]."\n".$lip[6]."\n".$lip[29]." ".$lip[30]." ".$lip[31]." ".$lip[32]."\n".
$lip[33]." ".$lip[34]." ".$lip[35]." ".$lip[36]."\n"."Since:".$iptime[0];
send_sms($smsno, $msg);
return;
}
sub parse_sms {
# splits incoming msn to from: no and sms data. Used globally
# my $count=0;
open(SMSIN,"<",$smsfile) || die("Cannot Open ",$smsfile."\n");
@line = <SMSIN>;
$smsno =($line[0]);
if ($smsno =~ 'From:'){
$smsno =~ s/From: //;
chomp($smsno);
}
$smsdata= $line[12];
close(SMSIN);
if (!$debug) {unlink $smsfile;}
return;
}
sub send_sms {
my $tmp = File::Temp->new( TEMPLATE => 'sms_XXXXX', UNLINK => 0, DIR => '/tmp', SUFFIX => '.txt' );
my($smsno, $data) =@_;
print $tmp,"\n";
open(SMSOUT,">",$tmp) || die("Cannot Open ",$tmp."\n");
print SMSOUT "To: ",$smsno,"\n","report: yes","\n\n";
print SMSOUT $data,"\n";
close SMSOUT;
system("mv", $tmp, "/var/spool/sms/outgoing");
return;
}
sub call_received {
#sends email for calls received to sms modem
my %mail = (
from => $from,
to => $recipient,
subject => 'Call Received',
text => $line[0].$line[1].$line[2].$line[3].$line[6]
);
$mail{'Content-type'} = 'text/plain; charset="iso-8859-7"';
sendmail(%mail) || print "Error: $Mail::Sendmail::error\n";
return;
}
sub sms_report_rcvd {
# delivery reports, doesn work yet
return;
}
sub runw {
my $w_in = `w`;
my@w_out=split("\n",$w_in);
send_sms($smsno, $w_out[0]);
return;
}
sub convertdate2number {
my ($datestr,$timestr)=@_;
my @tdate=split('/',$datestr);
my @ttime=split(":",$timestr);
(length($tdate[0])==1) ? ($tdate[0]="0".$tdate[0]):();
(length($tdate[1])==1) ? ($tdate[1]="0".$tdate[1]):();
(length($ttime[0])==1) ? ($ttime[0]="0".$ttime[0]):();
(length($ttime[1])==1) ? ($ttime[1]="0".$ttime[1]):();
# my $ndate=$tdate[2].$tdate[1].$tdate[0].$ttime[0].$ttime[1].$ttime[2];
my $ndate= timelocal($ttime[2],$ttime[1],$ttime[0],$tdate[0],$tdate[1]-1,$tdate[2]);
(length($ndate) gt 9) ? (die) :();
# print $ndate."\n";
# sleep (10);
return($ndate);
}
sub epochtime {
my ($now)= @_;
my $sec=time2str("%S", $now);
my $min=time2str("%M", $now);
my $hour=time2str("%H", $now);
my $mday=time2str("%d", $now);
my $mon=time2str("%m", $now);
my $year=time2str("%Y", $now);
my $retval=timelocal($sec,$min,$hour,$mday,$mon-1,$year)."\n";
if ($debug) {print $retval."\n";}
return($retval);
}
|
Fri Apr 15, 2011 17:19
|
stom: Nice !
I did the code changes, recompiled and worked like a charm!.
I was able to select special program via dtmf commands.
Now, if the earphone is connected to the pc's voice card can we have an external script forked, that would record the input for the "wait" seconds and then send it via email in mp3 format?
Just an idea.... (since providers don't always provide remaining calls via sms )
next step would be to do voice recognition on the received mp3 and produce text output.
Kind regards
|
Fri Apr 15, 2011 15:12
|
stom: Operating system name and version: centos 5.5
Version of smsd: 3.1.14
Smsd installed from: sources
Name and model of a modem / phone: mc35
Interface: serial
I'm trying to call a short number
To: s1286
Voicecall: yes
TONE: TIME: 25 1
but log says
2011-04-15 18:07:36,6, elastix: I have to make a voice call to s1286, with (1 times) DTMF 2
2011-04-15 18:07:36,7, elastix: -> ATD+s1286;
2011-04-15 18:07:36,7, elastix: Command is sent
2011-04-15 18:07:36,7, elastix: Waiting for 25 seconds
2011-04-15 18:07:37,7, elastix: <- +CME ERROR: 257
2011-04-15 18:07:37,6, elastix: The result of a voice call was +CME ERROR: 257
2011-04-15 18:07:37,7, elastix: -> AT+CHUP
Obviously +s1286 is not the correct number.
Am I missing something or it is a bug?
|
Fri Apr 15, 2011 11:20
|
stom: I have already commented in the code changes that you have in source to get greek characters to work correctly.
As long as capital letters are used, everything is send via special 8859-7 .
Special in the essence that only different characters are substituted, everything else remains Latin. This is not the case with 8859-7 which is also used a lot in emails, where the full character set is redefined above 127d.
Testing with Nokia and Ericsson mobiles seems to be ok.
I did come across a specific Nokia phone that didn't manage to send correct Greek characters, but was unable to pinpoint the problem (didn't have handset available locally
Nokia 6700 didnt work
Nokia N70 did work.
I'm using a siemens mc35 which is also known to have issues with greek characters under specific conditions.
|
Fri Apr 15, 2011 11:15
|
stom: Yes, just confirmed it works
[root@elastix ~]# chkconfig --level 345 sms3 on
[root@elastix ~]# chkconfig --list | grep sms3
sms3 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@elastix ~]#
And server started automatically after reboot
|
Fri Apr 15, 2011 10:37
|
stom: for example
#!/bin/sh
#
# bluetooth: Start/stop bluetooth services
#
# chkconfig: 2345 25 90
# description: Bluetooth services for service discovery, authentication, \
# Human Interface Devices, etc.
#
so there is no reason NOT to work outside BEGIN INIT INFO
(it does work inside BEGIN INIT for sure)
Now if there is any possibility to brake other OS, then outside of begin init should be fine too.
Regards
|
Fri Apr 15, 2011 09:59
|
stom: That was REALLY fast..
Compiled successfully
Many Many thanks
|
Fri Apr 15, 2011 09:42
|
stom: it seems that http://www.ossp.org/pkg/lib/mm/ is more or less deserted
ftp doesn't work, no progress is happening.
Can you possibly upload latest working sources here?
Thanks for the great work
Kind Regards
|
Fri Apr 15, 2011 09:38
|
stom: Operating system name and version: centos 5
Version of smsd: 3.1.14
Smsd installed from: sources
Name and model of a modem / phone:
Interface: serial
chkconfig still doesn't work in centos after the suggested fix.
Correct fix is
### BEGIN INIT INFO
# chkconfig: 345 20 80
# description: Sms server daemon
# Provides: smstools
# Required-Start: $syslog
# Required-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts smstools
### END INIT INFO
Regards
|