Keywords: Mode: All keywords (AND) |
Mon Sep 02, 2013 02:34
|
warm:
The following script might work as an eventhandler. Take it as example, I have not tested it, just found some code and made minor modifications..
#!/bin/bash
if [ "$1" == "SENT" ]; then
if sed -e '/^$/ q' < "$2" | grep "^Alphabet: UCS2" > /dev/null; then
TMPFILE=`mktemp /tmp/smsd_XXXXXX`
sed -e '/^$/ q' < "$2" | sed -e 's/Alphabet: UCS2/Alphabet: UTF-8/g' > $TMPFILE
sed -e '1,/^$/ d' < "$2" | iconv -f UNICODEBIG -t UTF-8 >> $TMPFILE
mv $TMPFILE "$2"
fi
fi
Thanks. Seems works.
|
Tue Aug 27, 2013 06:46
|
warm: Sent messages are stored in specified folder but text part of the messages are encoded to UNICODEBIG. I would like to save text of the message in UTF-8 for reading in mc. Also I need to keep readable sms headers (To, Alphabet, Modem, e.t.c.)
How to do this ?
Is any way to do 'iconv -f UNICODEBIG -t UTF-8' to text of the messages ?
|
Tue May 22, 2012 08:45
|
warm: What architecture do You use Atheros AR7xxx/AR9xxx.The package will not work on another architecture or even on native one but with an older or newer libs. Also I use iconv and libiconv as I remember.
It seems You should compile pkg for yourself.
|
Tue May 22, 2012 04:04
|
warm: B.t.w. my router TP-Link 3020 works unrelaible with USB modem and USB flash. The problem is on hardware. I changed to active USB hab but no success.
It works maximum 46 days (for my) and then something happens ... flash r/w errors or modem hangs up. But nothing happens with router - router works fine.
I think problem is on bad USB chipset on SOHO routers. My 3G modem on Dlink dir-825 (reflashed by openwrt) works no more then 2-3 days, then I plug out and plug in modem and it works 2 days again :-).
So You should not get very relaible USB modem on hardware like small SOHO router. Only PC works relaible.
I want to try some GSM gateway with serial (no USB) interface but I can not find it by the low price - it costs more then my router :-).
|
Tue May 22, 2012 03:44
|
warm: ftp://mumba.tomsk.net/soft/smstools3_3.1.14-6_ar71xx.ipk
Look inside before installing and don't tell anyone my pin codes in configs :-)
|
Tue Mar 27, 2012 07:41
|
warm: Is it possible to get working delivery or status report on Huawei E150 and E1550 modems ?
I tried and it did not work on my setup.
I whould like to receive reports about sent sms. I send about 2k sms per month and I know that some numbers are not in net or phones are lost or there are others reasons when SMS does not reach the receiver number. That is why I need to see reports.
Can someone show some working examples for report configureation ?
Operating system name and version: archlinux, openwrt
Version of smsd: 3.1.14 with patches
Smsd installed from: sources
Name and model of a modem / phone: Huawei E150 and E1550, ZTE M180
Interface: all USB
|
Tue Mar 20, 2012 02:36
|
warm: Thanks for the patch. smsd does not segfault ... but it send one sms twice :). Here is how I did:
1. Stop smsd
2. issue command "sendsms s000105100 q" (check balance on Megafon)
3. Start smsd
4. Receove 2 answers
Log tels:
2012-03-20 09:19:35,5, GSM1: CGSN: 354638045661500
2012-03-20 09:19:35,5, GSM1: IMSI: 250023006625076 #<-- start smsd
2012-03-20 09:19:53,5, smsd: Moved file /var/spool/sms/outgoing/send_BfUw4h to /var/spool/sms/checked # <-- one file but then 2 sms sent
2012-03-20 09:19:55,5, GSM1: SMS sent, Message_id: 139, To: s000105100, sending time 6 sec.
2012-03-20 09:19:58,5, GSM1: SMS sent, Message_id: 140, To: s000105100, sending time 3 sec.
2012-03-20 09:19:59,5, GSM1: SMS received, From: 000105100
2012-03-20 09:20:00,5, GSM1: SMS received, From: 000105100
Next sms is sent once :-). But old smsd does so. There is another bug or my own "feature" :).
Today I'll test smsd better. Thanks.
|
Mon Mar 19, 2012 06:46
|
warm: Here is output of gdb:
tmp]# gdb -c /tmp/smsd.core.30777 /usr/bin/smsd
GNU gdb (GDB) 7.4
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/smsd...done.
[New LWP 30777]
warning: Can't read pathname for load map: Ошибка ввода/вывода.
Core was generated by `smsd -t'.
Program terminated with signal 11, Segmentation fault.
#0 0x00007f05c42a0bcf in vfprintf () from /lib/libc.so.6
(gdb)
(gdb)
(gdb) bt
#0 0x00007f05c42a0bcf in vfprintf () from /lib/libc.so.6
#1 0x00007f05c42cb2f2 in vsnprintf () from /lib/libc.so.6
#2 0x00007f05c42a7a62 in snprintf () from /lib/libc.so.6
#3 0x000000000041a573 in lockfile (filename=0x7fff262f5dd0 "/var/spool/sms/checked/send_bAjmEs")
at locking.c:45
#4 0x0000000000416f14 in movefilewithdestlock_new (
filename=0x7fff26306fe0 "/var/spool/sms/outgoing/send_bAjmEs",
directory=0x7fff26304e20 "/var/spool/sms/checked", keep_fname=1, store_original_fname=1,
prefix=0x4370f3 "", newfilename=0x7fff26305fe0 "") at extras.c:233
#5 0x0000000000407ac3 in mainspooler () at smsd.c:1749
#6 0x0000000000416786 in main (argc=2, argv=0x7fff26308408) at smsd.c:6911
(gdb)
But I don't know what it means ...
|
Sun Mar 18, 2012 09:32
|
warm: Just now I remembered about strace. Here is its output:
nanosleep({0, 100000}, NULL) = 0
nanosleep({0, 100000}, NULL) = 0
nanosleep({0, 100000}, NULL) = 0
nanosleep({0, 100000}, NULL) = 0
nanosleep({0, 100000}, NULL) = 0
stat("/var/spool/sms/outgoing/send_XjmYT3", {st_mode=S_IFREG|0660, st_size=17, ...}) = 0
close(5) = 0
open("/tmp/smsd_checkhandler_1.ibULz4", O_RDWR|O_CREAT|O_EXCL, 0600) = 5
close(5) = 0
open("/tmp/smsd_checkhandler_2.mGtLn7", O_RDWR|O_CREAT|O_EXCL, 0600) = 5
close(5) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=1196, ...}) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fe0b54b99d0) = 2370
wait4(2370, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 2370
--- {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=2370, si_status=0, si_utime=0, si_stime=0} (Child exited) ---
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=1196, ...}) = 0
stat("/tmp/smsd_checkhandler_1.ibULz4", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
unlink("/tmp/smsd_checkhandler_1.ibULz4") = 0
stat("/tmp/smsd_checkhandler_2.mGtLn7", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
unlink("/tmp/smsd_checkhandler_2.mGtLn7") = 0
open("/var/spool/sms/outgoing/send_XjmYT3", O_RDONLY) = 5
fstat(5, {st_mode=S_IFREG|0644, st_size=17, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe0b54dd000
read(5, "To: s000105100\n\nq", 4096) = 17
close(5) = 0
munmap(0x7fe0b54dd000, 4096) = 0
open("/var/spool/sms/outgoing/send_XjmYT3", O_RDONLY) = 5
fstat(5, {st_mode=S_IFREG|0644, st_size=17, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe0b54dd000
read(5, "To: s000105100\n\nq", 4096) = 17
read(5, "", 36864) = 0
close(5) = 0
munmap(0x7fe0b54dd000, 4096) = 0
stat("/var/spool/sms/checked/send_XjmYT3.LOCK", 0x7fff544bb4f0) = -1 ENOENT (No such file or directory)
open("/var/spool/sms/checked/send_XjmYT3.LOCK", O_WRONLY|O_CREAT|O_EXCL, 0644) = 5
--- {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x640774} (Segmentation fault) ---
+++ killed by SIGSEGV +++
It happends when I run sendsms.
My current config is:
# grep -v "#" /etc/smsd.conf | grep -v "^$"
devices = GSM1
logfile = /var/log/smsd/smsd.log
loglevel = notice
smart_logging = yes
report = /var/spool/sms/report
checkhandler = /usr/local/bin/checkhandler
eventhandler = /usr/local/bin/smsevent
date_filename = 2
date_filename_format = %Y%m%d_%H:%M:%S
datetime_format = %Y-%m-%d %H:%M:%S
[GSM1]
init = AT+CPMS="ME","ME","ME"
check_memory_method = 2
device = /dev/ttyUSB0
incoming = yes
decode_unicode_text = yes
pin = 1111
smsd compiled with iconv support to translate to UTF-8 on the fly. Exactly the same configuration works on openwrt with this modem. Patches for Makefile was taken from openwrt build discussed earlier on this forum. So again -- most likely this problem is in gcc or/and glibc which are very fresh in archlinux :-).
|
Sun Mar 18, 2012 09:15
|
warm: A few monthes I get segfault of smsd with fresh package build like this:
Mar 18 16:00:48 localhost kernel: [ 4372.756124] smsd[2204]: segfault at 640774 ip 00007fb76d2d1bcf sp 00007fff73ca70e0 error 4 in libc-2.15.so[7fb76d28a000+197000]
But there is old build about 1 year old which works fine. I think the problem is in new gcc and/or in new glibc. How can I figure out what is the problem ?
Today I tried to rebuild package smstools3 with nostrip and with gdb information compiled in (-g). smsd forks and I cannot see anything :-). I am not familiar with gdb. I tried do things described in https://wiki.archlinux.org/index.php/Debug_-_Getting_Traces#Getting_the_trace
Operating system name and version: Archlinux
Version of smsd: 3.1.14
Smsd installed from: sources (AUR)
Name and model of a modem / phone: Huawei E150 for now
Interface: USB
|
Tue Feb 21, 2012 04:26
|
warm: Thanks again, it works. If I do some mistake and correct it by backspace I get some artefacts on console (UTF-8 IO problem in openwrt with no locale support) I receive text in sms before this mistake :-). Also I get error in logs:
2012-02-21 11:14:28,5, GSM1: Unicode conversion error: Invalid sequnce
When I use iconv I use -c -s keys which prevent invalid chars and there is no error in same case.
When I do not misstakes there are no errors :).
|
Mon Feb 20, 2012 03:21
|
warm: What is "AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0" ? Look like some default minicom init string. Try to change it to ^MATZ^M if You don't know what this init string does.
Next, there is no input/output about entering the PIN code. Try to enter AT+CPIN? in minicom.
|
Sat Feb 18, 2012 02:20
|
warm: "decode_unicode_text = yes" turns on internal decoding of incoming messages and it works. Is any option for outgoing messages ?
Can not find the same option for outgoing SMS. I don't like to use script with iconv wich is not a part of iconv-full package in openwrt :-(. Every time copy iconv by hands is bad solution.
|
Thu Feb 16, 2012 02:13
|
warm: Yes, it compiled and works. B.t.w. smsd compiled from build tree in making openwrt image ("make" in trunk dir) is less in size and eats less memory then smsd binary compiled alone.
For now I have this Makefile (taken from this forum and modified):
include $(TOPDIR)/rules.mk
PKG_NAME:=smstools3
PKG_VERSION:=3.1.14
PKG_RELEASE:=6
#PKG_BUILD_DIR:=$(BUILD_DIR)/smstools3-$(PKG_VERSION)
PKG_BUILD_DIR:= $(BUILD_DIR)/$(PKG_NAME)
#PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
include $(INCLUDE_DIR)/package.mk
define Package/smstools3
SECTION:=net
CATEGORY:=Utilities
TITLE:=Sms Server Tools 3
URL:=http://smstools3.kekekasvi.com
DEPENDS:=+libiconv-full
endef
define Package/smstools3/description
The SMS Server Tools 3 is a SMS Gateway software which can send and receive
short messages through GSM modems and mobile phones.
Note: Not compiled with the OSSP mm Shared Memory Library (libmm) is only needed if statistics function is enabled.
This function is disabled by default.
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
$(Build/Patch)
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CC=$(TARGET_CC) \
USER_CFLAGS='$(TARGET_CFLAGS) $(EXTRA_CFLAGS) \
$(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS) \
-I$(STAGING_DIR)/usr/lib/libiconv-full/include' \
USER_LDFLAGS='$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS) \
-L$(STAGING_DIR)/usr/lib/libiconv-full/lib'
endef
define Package/smstools3/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/smsd $(1)/usr/bin/
$(INSTALL_DATA) ./scripts/sendsms $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/config/
$(INSTALL_DATA) ./files/examples/smsd.conf $(1)/etc/config/
# $(INSTALL_DIR) $(1)/usr/share/smstools3/examples
# $(INSTALL_DATA) ./files/examples/* $(1)/usr/share/smstools3/examples/
# $(INSTALL_DIR) $(1)/usr/share/smstools3/scripts
# $(INSTALL_DATA) ./files/scripts/* $(1)/usr/share/smstools3/scripts/
# $(INSTALL_DIR) $(1)/usr/share/smstools3/mod4wrt
# $(INSTALL_DATA) ./files/mod4wrt/* $(1)/usr/share/smstools3/mod4wrt/
endef
$(eval $(call BuildPackage,smstools3))
and patch (patches/10-Makefile.patch):
diff -pruN smstools3.orig/src/Makefile smstools3/src/Makefile
--- smstools3.orig/Makefile 2010-09-21 15:29:14.000000000 +0400
+++ smstools3/Makefile 2012-02-15 12:12:10.000000000 +0400
@@ -1,7 +1,10 @@
# In case of windows, use os_cygwin=yes setting in the configuration file (smsd.conf).
# Select your setup size:
-CFLAGS = -D NUMBER_OF_MODEMS=64
+CFLAGS = -D NUMBER_OF_MODEMS=1
+
+CFLAGS += $(USER_CFLAGS)
+LFLAGS += $(USER_LDFLAGS)
# Uncomment for Solaris
# CFLAGS += -D SOLARIS
@@ -12,10 +15,10 @@ CFLAGS = -D NUMBER_OF_MODEMS=64
CFLAGS += -D NOSTATS
# Comment this out if iconv is not available on the system
-#CFLAGS += -D USE_ICONV
+CFLAGS += -D USE_ICONV
# Uncomment this is iconv is used and it's not included in libc:
-#LFLAGS += -liconv
+LFLAGS += -liconv
# Uncomment this to force smsd to run in terminal mode
#CFLAGS += -D TERMINAL
Package has directory src with content from src dir of original tar.gz sources.
|
Thu Feb 16, 2012 01:53
|
warm: You should see Your new gcc flags in gcc output when recompiling
... -D NUMBER_OF_MODEMS=100 ...
"NUMBER_OF_MODEMS=100" with no white spaces I think.
|
Wed Feb 15, 2012 08:19
|
warm: Spasibo, zavtra poprobuu :-).
|
Wed Feb 15, 2012 08:06
|
warm: AFAIK smsd can handle up to 64 by default. See Makefile
# Select your setup size:
CFLAGS = -D NUMBER_OF_MODEMS=64
You can try 128 for example and recompile. Also each modem is handled by its own smsd process. Slow down ? I don't know why. B.t.w. one smsd uses noticeable amount of CPU, my one eats 2-4%. So if I would 30 modems then I should get 100% of CPU and slow donw because of CPU ...
In fact, I have only one modem, I can not check this and I'm not sure about CPU usage by more then one modem. This is my assumption.
|
Wed Feb 15, 2012 03:03
|
warm: Thanks very match! Now I have smsd with working internal decoder on openwrt.
But my package is ugly. To compile smsd I put full path in make file. Makefile of the smstools3 - not a package Makefile:
...
# Comment this out if iconv is not available on the system
CFLAGS += -D USE_ICONV -I/home/warm/src/openwrt/trunk/build_dir/target-mips_r2_uClibc-0.9.33/libiconv-1.1
1.1/ipkg-install/usr/include
# Uncomment this is iconv is used and it's not included in libc:
LFLAGS += -liconv -L/home/warm/src/openwrt/trunk/build_dir/target-mips_r2_uClibc-0.9.33/libiconv-1.11.1/ip
kg-install/usr/lib
...
I don't know how to do right in openwrt style ... I think I should use package Makefile with buildroot env variables or some patch but not full path to headers and lib dirs. Also I should write dependenses in package make file but libiconv-full is in feed dir - not in package dir where smstools3 placed.
So I don't know how to create package right. May be You can help with this ?
|
Tue Feb 14, 2012 15:59
|
warm: It decodes in something unreadable and I do not know type of encoding after this internal decoding. I tried this optoion in the past (and just now) - that is whi this option was commented out in my config
|
Tue Feb 14, 2012 14:57
|
warm: Seems because I get Alphabet: UCS2 sms and this option has no effect - it should affect on ISO or GSM alphabet only like documentation tells. I just tried this option and there was no effect. Received message has been saved in UNICODEBIG (aka UCS-2BE in iconv).
Here is my config:
devices = GSM1
logfile = /opt1/smstools3/log/smsd.log
loglevel = notice
#loglevel = 7
smart_logging = yes
report = /opt1/smstools3/report
incoming_utf8 = yes
#checkhandler = /opt1/smstools3/bin/checkhandler
#eventhandler = /opt1/smstools3/bin/smsevent
# to do files like GSM1.2007-09-02.xxxxxx
date_filename = 2
date_filename_format = %Y%m%d_%H:%M:%S
datetime_format = %Y-%m-%d %H:%M:%S
# ZTE MF180
[GSM1]
#report_device_details = yes
init = AT+CPMS="ME","ME","ME"
detect_unexpected_input = no
device = /dev/ttyUSB1
incoming = yes
check_memory_method = 2
pin = 1234
#decode_unicode_text = yes
|
Tue Feb 14, 2012 10:18
|
warm: Thanks it help.
With one modem smsd eats only 5% of RAM vs 15% before with default 64. pppd eats 6% :-).
|
Tue Feb 14, 2012 05:26
|
warm: After some svn update of trunk iconv works for now. There is another problem: I cannot port all the scripts for encoding SMS to openwrt.
I need received sms in UTF-8 if Alphabet is UCS2. To encode sms on PC I use "sms2unicode $2 | iconv -c -f UTF-16 -t UTF-8 >> $2.txt" in smsevent.
sms2unicode uses od. In openwrt od is only from busybox and it has no option "-t x1". Openwrt od's help looks like:
BusyBox v1.19.3 (2012-02-12 21:34:36 NOVT) multi-call binary.
Usage: od [-aBbcDdeFfHhIiLlOovXx] [FILE]
Print FILE (or stdin) unambiguously, as octal bytes by default
So sms2unicode does not wor with such od. I need help ... :-). Pleace help me to encode SMS in UCS2 to UTF-8.
openwrt has ash, awk, cut, egrep ...
sendsms seems works fine.
B.t.w. Why smsd uses so mutch memory ? It is a biggest process on my router by memory usage. pppd eats less RAM. pppd is more feature rech program. I almost have no RAM margin after starting smsd.
|
Sat Feb 11, 2012 14:04
|
warm: And now ... openwrt has no locale support and there is no need to do that for current. I can receive and read sms on english but can not send and receive sms on russian - this is iconv problem and I cannot make iconv to work. iconv does not copy it self into image only libs are copied (proken package ?). After copying iconv from source tree to openwrt by hands it does not work - segmentation fault when I do iconv -c -s -f UNICODEBIG -t UTF-8 <file>.
So this is not smstools3 problem.
|
Thu Feb 09, 2012 10:18
|
warm: Is it possible to send/receive SMS in national lang on OpenWRT ?
I have not tried yet smstools3 on openwrt but there were some problems first time I began to use smstools3 in usual linux -- problem was in locale settings. My server had no UTF-8 locale support and I could not to send SMS on russian (I had KOI-8 or C locale). When I sent SMS received one could not be readed - wrong chars, unreadable message.
After setting locale to ru_RU.utf8 problems are gone.
AFAIK openwrt has no locale support or has no fully supported locales. I find nothing about locale support in "make menuconfig" of openwrt.
So ... is it possible to get full featured SMS in openwrt ? I mean send/receive/checkhendler/eventhendler SMS on Russinan language for example.
Operating system name and version: OpenWRT
Version of smsd: 3.1.14
Smsd installed from: sources
Name and model of a modem / phone: Huawei E1550
Interface: USB
|
Fri Feb 03, 2012 14:24
|
warm: I got this problem after experimenting with AT^SYSCFG - tried to switch on 3g only and to use SIP over 3g internet. The result was not good enough and modem was returned on sms-service. So ... bands were configured wrong after that.
Hard googling ... and I find that AT command "AT^SYSCFG=2,2,3fffffff,0,2" turns on all bands.
I used this command once then rebooted modem and it has been registred
AT+CREG?
+CME ERROR: SIM PIN required
AT+CPIN=<my pin>
OK
AT+CREG?
+CREG: 0,1
OK
+CREG: 0,1 means registred. Before that there was 2,0 or 0,0 -- not registred.
The main madness was in working this modem with this SIM on Windows machine :-). Half of the day I spend in searches of solution ... Cruel device! :-)
|