Troubles on receiving text messages

Troubles on receiving text messages SearchSearch
Author Message
Christian Sommer
New member
Username: Eagle

Post Number: 1
Registered: 01-2021
Posted on Sunday, January 17, 2021 - 08:42 pm:   

Hi
I'm trying to add a tracking service to my home server.
Therefor I'm using traccar on ubuntu 20.04 LTS.
Traccar is able to send and receive textmessages via smpp.
So I'm searching for a smpp server to use my own server and admin sim card.

I found your project.
Setup was very easy! Thank you! (Info for other home constructor: Raspberry Pi is not working ;-) )
After setup I've configured my admin user and smsc connection (using a USB modem)
Little hint: clicking on save of the smsc connection will not close the form. Clicking 'X' another line a popup appears and asks to save. Only clicking to another line will close the SMSC connection setup.

Test of sending and receiving text messages are both working.
Next was to set up a second user for tracking server and setup smpp service.
Both worked fine.

Now I noticed some troubles...
Routing incoming SMS are only possible to one user.
Why I need both users? The SMS received by the tracking user via smpp will be deleted after download via smpp. So this SMS are not shown in the inbox.
Next I tried something else...
I noticed I can configure "Recipient address(es) to route to this account" inside the SMS Users.
But: Configure both accounts with the phone number of the sim card will cause no errot, but it will not work: Messages will only routed to the first account but not to the second.

So I tried it with 2-way commands...
but there is no option for routing/copying to internal users.
I've tried to forward to my e-mail address, but this also does not work.
I noticed "Add to Group" but I don't know what this is for.

So:
How can I prevent sms from being deleted by downloading via SMPP?
If not, how can I route incoming messages to multiple users?
How can i configure the system to forward a copy of incoming messages to my mail address?


by the way: I've also tried to use NowSMS NextGen with a mysql DB. (utf8_general_ci)
On showing debug info there are many errors on not finding DB Tables.
Checking the DB shows the tables are there all uppercase.... (also the tables that are shown in syslog with error)

Regards
Chris
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6218
Registered: 08-2008
Posted on Monday, January 18, 2021 - 02:06 pm:   

Hi Chris,

We will be looking at Raspberry Pi in the future. Many of us use these devices for a variety of purposes ... it's just that our focus with NowSMS is on larger systems, not home servers.

Thanks for mentioning the issue with saving/updating USB modem configuration. I have seen an issue with this previously, but never fully investigated, so I will make sure we find and fix this issue.

Regarding routing the message to two places ... this thread might have a quick solution which allows a message to go both to SMPP and a 2-way command: https://support.nowsms.com/discus/messages/1/71888.html (I haven't tried this DuplicateUserMessagesFor2Way=Yes setting in NextGen, but our internal notes indicate that it should work.)

While the above may be a solution ... I'd normally suggest a more general solution. Use 2-way commands instead of routing directly to SMPP. In the 2-way command script, issue an HTTP request to submit the message back into NowSMS. (This PHP script might help: https://www.nowsms.com/doc/submitting-sms-messages/send-sms-text-message-with-php) In this URL, include the parameter LocalUser=xxxx to route to an SMPP account. To deliver to multiple SMPP accounts requires multiple HTTP requests.

Regarding 2-way SMS to e-mail ... enabling this requires additional configuration, but in trying this myself, I see that our current configuration dialogs over complicate the setup. I need to get our engineering team to fix configuration of e-mail related settings.

Regards,

Des
NowSMS Support
Christian Sommer
New member
Username: Eagle

Post Number: 2
Registered: 01-2021
Posted on Tuesday, January 19, 2021 - 12:46 am:   

Hi Des,

Thank you for your fast reply!

I'm sorry to inform you, DuplicateUserMessagesFor2Way=Yes doesn't work in Nextgen.

my smsgw.ini

[Inbound SMS Routing]
eagle=<Int.PhoneNumber>
Traccar=<Int.PhoneNumber>

[Modem - /dev/ttyUSB0]
PhoneNumber=<Int.PhoneNumber>
ReceiveMMS=No
ReceiveSMS=Yes
RouteName=USB0
SendMMS=No

[SMSGW]
AlertEMailMessageFailure=Yes
AlertEMailQueueSize=10
AlertEMailQuota=Yes
AlertEMailRecip=office@eagle.at
AlertEMailSender=office@eagle.at
AlertEMailSendMmscConnect=Yes
AlertEMailSendShutdown=Yes
AlertEMailSendSmscConnect=Yes
AlertEMailSendStartupError=Yes
AlertEMailSendStartupOK=Yes
AlertEMailSMTPPass=***<security;-)>***
AlertEMailSMTPPort=587
AlertEMailSMTPServer=smtp-mail.outlook.com
AlertEMailSMTPUser=office@eagle.at
AlertEMailSMTPUseSSL=Yes
DuplicateUserMessagesFor2Way=Yes
Modem1=Modem - /dev/ttyUSB0
ReceiveMMS=No
ReceiveSMS=Yes
SMPPPort=2775
WebDisableAdvOption=Yes
WebPort=8800

my MMSC.ini
[MMSC]
SMSEMailTemplate=@@FromAddress@@ /@@Subject@@ /@@Text@@

I've commented PhoneNumber and E-Mail pass out :-)


To use the php script, i've to set up a Apache/PHP Server, right?


I found a post in the forum about 2-way sms to e-mail:
It seems forwarding to e-mail does not use the mail server configured at "Manage E-Mail System Alerts".

Another info:
If you have 2 "SMS 2-Way Commands" with the same Keyword and I edit one line, it will edit also the second line.

I also found this:
https://www.nowsms.com/doc/submitting-sms-messages/url-parameters
in command properties I configured http url, but this throws an error
configured command: http://<ip-of-nowsms_nextgen-server>:8800/?PhoneNumber=<PhoneNumber>&Text=@@FULLSMS@@&LocalUser=Eagle
If i copy this URL into my browser, it works without error.


Regards
Chris
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6219
Registered: 08-2008
Posted on Tuesday, January 19, 2021 - 09:30 pm:   

Hi Chris,

The web browser ate my reply before I posted it, so hopefully I'm not forgetting anything as I recreate this reply.

We've fixed the issue with saving the GSM modem settings, and that will be included in a maintenance update in the next week or so. The save button does work, it's just not reloading the frame. For now, if you do need to make any changes, just reload the web page afterward.

Regarding sending e-mail from a 2-way command ...

The settings under "E-Mail to SMS/MMS" are what need to be configured. Select "Use IMAP or POP3 Mailbox".

We are going to be making some changes to how these configuration settings are defined.

For now, please note that the mailbox you define here should be dedicated to NowSMS, as NowSMS will process and delete e-mail messages from the mailbox.

Regarding PHP with or without Apache ...

Apache is the way most people interface with PHP scripts.

But I should mention that NowSMS does support PHP-FPM (FastCGI for Unix environments), so it is possible for NowSMS to process PHP scripts directly.

Basically, you just need to install php-fpm (sudo apt-get install php-fpm), and NowSMS will automatically detect that it is available.

If you want to verify that the php-fpm service is active, use the command ls /var/run/php/*.sock to look for the active socket.

To enable NowSMS to run a PHP script, create a php directory under /var/lib/nowsms (sudo mkdir /var/lib/nowsms/php), and then save any PHP scripts in that directory with a .php extension.

For example, here's a good test.php to verify things are working:

<?php
phpinfo();
?>

From a web browser on the same machine, connect to http://127.0.0.1:8800/php/test.php

For security reasons, NowSMS will only process PHP scripts for requests that are made from the local computer. So if you try to access /php/test.php from a different computer, an error will be displayed.

The 127.0.0.1 URL can be used for a 2-way command.

(Note: localhost should work as an alternative to 127.0.0.1, but when I tested just now, I noticed that if IPv6 is enabled, NowSMS does not recognize that the request is local. This is being fixed.)

Regarding DuplicateUserMessagesFor2Way=Yes ...

This setting is working for me in a similar situation. I have an [Inbound SMS Routing] setting directing messages for the phone number associated with the modem into a local SMPP user account.

When I add this setting, the messages also get processed by a 2-way command.

Regarding

quote:

Another info:
If you have 2 "SMS 2-Way Commands" with the same Keyword and I edit one line, it will edit also the second line.




Yes, it would be better if we displayed an error in this case.

But the rules for keyword processing are that the longest matching keyword wins ... and only one keyword gets processed for any given message.

So, if the logic needed is more complex, a PHP script is usually the easiest solution.

Regards,

Des
NowSMS Support
Christian Sommer
New member
Username: Eagle

Post Number: 3
Registered: 01-2021
Posted on Wednesday, January 20, 2021 - 10:56 pm:   

Hi Des!

2Way SMS and php is working now. THANK YOU!


If I directly try to forward the sms via sendmail.php script I run into a loop, bcs the forwarded sms is an incoming and runs into 2way sms.

so I've the first feature request: a field "Apply to sender" (sender-phonenumber)
I've to use "*" Keyword, bcs my GPS tackers send several messages and theres no same keyword inside the messages. An internal forwarded sms will have an other phone number than an sms coming from my trackers and I'm able to define different rules on each sender.

Another way and 2nd feature request is a "do nothing" button
If I progress all messages through 2way sms I can define a Keyword at the start of the message.
So I've a keyword. At command properties I can set this keyword. But I don't want to do something else in 2way sms, it will be subitted direct in inbox.

The "*" keyword config will cause a loop; so I need to define a config with the new keyword.
A workaround will be to call another php script which will do nothing.

To create a all in one script will be possible for me, but I think the 2 features will do it a lot of easier for others, it will be much easier to configure and will be well-arranged at the system configuration.

Regards
Chris
Christian Sommer
New member
Username: Eagle

Post Number: 4
Registered: 01-2021
Posted on Wednesday, January 20, 2021 - 11:32 pm:   

Hi Des,

As an edit to my 1st feature request:
Maybe it will be useful to set the sender as first parameter.
So the Users will be able to set multible times the "*" keyword rules, differed by the sender.

Regards
Chris
Christian Sommer
New member
Username: Eagle

Post Number: 5
Registered: 01-2021
Posted on Thursday, January 21, 2021 - 09:55 pm:   

Hi Des!

Version 2012.01.21 solved a few things:

* Forwarding to a E-Mail address is working now (after configure E-Mail Settings).
* Save Button at SMSC Connections is also working now.

Question: Is it possible to configure a virtual Modem with a internal number?
2-way commands are working with "apply to recipient"
So I'm able to internal forwarded sms to another local user without starting the 2-way command once again and run into a loop.

Regards
Chris
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6220
Registered: 08-2008
Posted on Monday, January 25, 2021 - 04:36 pm:   

Hi Chris,

Sorry for the delay in response. In retrospect, my suggestion about using the DuplicateUserMessagesFor2Way=Yes setting was not a good idea. We rarely suggest this setting, as it drastically increases the probability of a loop. I hadn't even considered that by suggesting that you forward the message by resubmitting to a local user account would result in another duplicate because of this setting. It would probably be best to avoid this setting.

We're open to suggestions on how to improve the 2-way commands. It just seems that once we start considering different options, the logic desired becomes more and more complex, and using PHP seems to make more sense.

We do frequently get asked about adding the sender as a filtering parameter. The typical use case is that you want to limit what sender number(s) can access a particular script.

"Do nothing" as a potential 2-way command action makes sense.

I also like the idea of a potential action to be to route the message to a local user account.

If the command actions could support both processing an HTTP request and routing the message to a local user account, that would make sense.

But this still doesn't give you what you were looking for ... routing a single inbound message to multiple recipients. I'm still thinking PHP is the best way to handle this ... but without the DuplicateUserMessagesFor2Way=Yes setting.

The PHP script would resubmit the message to the virtual numbers that you see in the [Inbound SMS Routing] section. e.g, PhoneNumber=1234,9999

Or the PHP script would submit multiple times using, as only one LocalUser=xxxx parameter is supported per request.


quote:

Question: Is it possible to configure a virtual Modem with a internal number?
2-way commands are working with "apply to recipient"
So I'm able to internal forwarded sms to another local user without starting the 2-way command once again and run into a loop.




Unless I'm missing something, I think the key is avoiding my DuplicateUserMessagesFor2Way=Yes suggestion. Don't route the inbound SMS directly to a user account, let it go to 2-way SMS, and let the command resubmit to the virtual numbers.

Regards,

Des
NowSMS Support
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 8385
Registered: 10-2002
Posted on Monday, January 25, 2021 - 10:13 pm:   

Hi Chris,

Your initial post hinted at disappointment that we didn't have a NowSMS build that runs on Raspberry Pi. I just wanted to let you know that we have updated our download links with two additional versions, one of which is for RPi. See https://www.nowsms.com/techsupport/nextgen-install

Regards,

Bryce Norwood
NowSMS Support
Christian Sommer
New member
Username: Eagle

Post Number: 6
Registered: 01-2021
Posted on Sunday, January 31, 2021 - 08:08 pm:   

Hi Des,

I've reprogrammed my php script, so I disabled DuplicateUserMessagesFor2Way.
so I've no problems with a "loop"

How can I give virtual numbers to users?

I've 2 more problems:

1st: I've I receive a multi line sms, the inbox in NowSMSNG only shows a single line.
As feature request: a forward button will be cool (a reply and delete is there)
2nd: One of my tests got a loop
So my message log is very big... and a reload take some time
Is there a way to shrink the log or delete some lines?

Regards
Chris
Christian Sommer
New member
Username: Eagle

Post Number: 7
Registered: 01-2021
Posted on Sunday, January 31, 2021 - 08:17 pm:   

Hi Bryce,

Thank you for your update!

I've tested it on my raspberrys

Nowsms is slim enough to run a Pi2B but I will recommend a higher one.
I've also tested it on a Pi3B (which have a 64bit processor)

The Nowsms-setup will run on x86 but not on x64 systems (Ubuntu 20.04 LTS)

Regards
Chris
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 8389
Registered: 10-2002
Posted on Sunday, January 31, 2021 - 10:33 pm:   

Hi Chris,

Des should get back to you on Monday, but regarding the Raspberry Pi ...

I'd recommend a Pi 3 or 4.

Both of those are 64-bit processors , but Raspbian is a 32-bit OS.

It's kind of strange in the Linux world ...

A 64-bit processor can run either a 32-bit or 64-bit operating system. But a 64-bit operating system cannot run a 32-bit application, or vice versa.

That's why Raspbian is stuck on 32-bit OS ... there is a 64-bit beta, but there's no compelling reason to move to it, because there's a lot of community software that all would need to be rebuilt as 64-bit. Often, this is a simple process, but sometimes design choices in the software leads to unexpected problems when building for different environments.

This is in contrast to the PC and Mac worlds, where when 64-bit OS were introduced, they continued to support 32-bit applications, while adding support for 64-bit applications. (Apple eventually dropped 32-bit app support a number of years later, but this was in preparation for a migration from Intel to ARM architecture, where they developed a translation layer to run Intel x64 apps on ARM.)

When you say x86 and x64, that is actually referencing a different processor family. This is terminology specific to Intel/AMD processors, which are the processors that power both the PC and Mac worlds. x86 refers to the 32-bit architecture (introduced in the 80386 processor, where the "86" become a sort of family name for these processors), and x64 refers to the 64-bit processors. In the Linux world, they generally say AMD64 instead of x64.

ARM 32-bit environments are generally referred to as just ARM (or version specific such as ARMv6 or ARMv7), and 64-bit as ARM64 or aarch64.

The Raspberry Pi uses a processor built on the ARM architecture, so it can't run any x86 or x64 software, regardless of whether you install a 32-bit or 64-bit OS. The software needs to be recompiled and built to run on ARM.

We recently updated our Linux install instructions to provide links for both x64/AMD64 and ARM64 versions. But, we should probably update the Raspberry Pi page to also offer ARM64 download links. (Web page now updated.)

It would be nice if there was a way to bundle the versions into one download. We recently updated our Mac version download to use Apple's so-called "universal" format which allows us to bundle Intel (x64) and Apple Silicon (M1 / ARM64) versions together and allows the OS to decide which version to run.

Regards,

Bryce
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6223
Registered: 08-2008
Posted on Monday, February 01, 2021 - 10:29 pm:   

Hi Chris,


quote:

How can I give virtual numbers to users?




Virtual numbers only apply to internal routing. So, there's a good chance that I may not have understood your question correctly. So, this might be the answer that you are looking for.

There is a user account attribute "Recipient address(es) to route to this account". If a message is destined to a number listed here, it is queued for this user account.


quote:

I've 2 more problems:

1st: I've I receive a multi line sms, the inbox in NowSMSNG only shows a single line.




I see what you mean. We need to be inserting <br /> into the HTML to force it to display as a line break.

This should be easy to fix.


quote:

As feature request: a forward button will be cool (a reply and delete is there)




I like the idea.

And actually, we need to improve the UI on this page, because all the messages seem so bunched together that it is difficult to determine which Reply/Delete button goes with which message.

So maybe we can add a forward button when do some UI cleanup on this page.


quote:

2nd: One of my tests got a loop
So my message log is very big... and a reload take some time
Is there a way to shrink the log or delete some lines?




We do need to reduce the number of entries that we display by default. Until then, feel free to delete any nowsms-yyyymmdd.csv files in /var/lib/nowsms

Regards,

Des
NowSMS Support
Christian Sommer
New member
Username: Eagle

Post Number: 11
Registered: 01-2021
Posted on Tuesday, February 02, 2021 - 09:01 pm:   

Hi Des,

Thank you for your fast respone!

Regards
Chris

Add Your Message Here, or click here to start a new topic.
Post:
Bold text Italics Underline Create a hyperlink Insert a clipart image
Options: Automatically activate URLs in message
Action: