Giter VIP home page Giter VIP logo

sms-forward's Introduction

As I switched to iPhone supporting Dual SIM (eSIM), this repository won't be maintained anymore.

sms-forward

npm version

Auto-forward incoming SMS from one mobile phone number to another phone number using a Huawei mobile broadband device (dongles, wingles).

Description

This Node.js module forwards incoming SMS from one mobile phone number (e.g. personal) to another one (e.g. work). The typical use case is someone equipped with a professional mobile phone, who wants to keep his/her personal phone number separate from work number, but does not want to carry both phones all the time.

This module acts as a "limited" SMS gateway: source phone number SIM (e.g. personal) is placed into a Huawei mobile broadband device which offers SMS APIs. The module scans incoming SMS and forwards them to a target phone number (e.g. work).

The detailed workflow is as follows:

  1. Scans for unread SMS in Inbox
  2. For each unread SMS:
    • Optionally lookup AddressBook to fetch sender fullname
    • Forward SMS to target phone number
    • Mark SMS as read

Prerequisites

  • Source phone number SIM dedicated for SMS forwarding
  • Huawei Mobile Broadband device. This has been tested with a (old) E355 model and a (new) E3372 model. E5331 was also reported to work successfully. If you are using another model, it would be great if you could report it
  • Always-on Linux/Mac computer/Raspberry Pi which executes this Node.js module
  • Node.js installed on previously mentioned computer

Installation

  1. npm install -g sms-forward
  2. copy and rename config.json.sample to config.json
  3. edit and save config.json accordingly (see Configuration section)
  4. node index.js

Configuration

config.json file shall contains the following keys/values:

Key Default Description
sms_target_number N/A The phone number to which SMSs are forwarded. This shall be prefixed with international number (e.g. +33) and MUST NOT CONTAIN ANY WHITESPACES. e.g. "+33612345678
sms_scan_frequency N/A SMS forwarding scan frequency in seconds. i.e. how often messages to be forwarded shall be checked. e.g. "30" (seconds)
huawei_modem_ip N/A The Huawei Modem's IP. e.g. "192.168.1.1"
huawei_modem_login N/A Optional - The Huawei Modem's login. e.g. "admin". Some Huawei dongles require a login/password authentication (e.g. E355), others do not (e.g. E3372)
huawei_modem_password N/A Optional - The Huawei Modem's login's password. e.g. "admin"
messages_retention_days N/A Optional - Messages older than provided days will be deleted in order to free up messages space (which is limited on Huawei devices). e.g. "30" (days)
macos_address_book_db_path N/A Optional - needed for message's originator's name resolution. Path of your MacOS AddressBook to resolve message's originator's name from phone number. You can find a list of databases by running the following command in a terminal: find ~/Library/Application\ Support/AddressBook/ -name "AddressBook-v22.abcddb" -exec ls -rtlah {} +, pick the last one in the list.
country N/A Optional - needed for message's originator's name resolution. Your 2-letters ISO 3166-2 code country. e.g. "FR" for France, "GB" for United Kingdom.

Configuration sample:

{
	"sms_target_number": "+33612345678",
	"sms_scan_frequency": 30,
	"huawei_modem_ip": "192.168.1.1",
	"huawei_modem_login": "admin",
	"huawei_modem_password": "admin",
	"messages_retention_days" : 30,
	"macos_address_book_db_path": "/Users/<MY_USER>/Library/Application Support/AddressBook//Sources/DE540B1E-A3CF-4655-B1F6-6DDC0B42CD5F/AddressBook-v22.abcddb",
	"country": "FR"
}

Limitations

  1. MMS (pictures/videos attached) are not supported (only SMS are supported).
  2. Source phone number' SIM is dedicated for SMS forwarding ("stuck" into the Huawei modem, i.e. you cannot use it on another phone). This can be overcome if your telco operator offers Multi-SIM: simply order additional SIMs attached to the same phone number.
  3. Cannot directly reply to forwarded SMS as the message's originator's phone number has been replaced with the fowarding source phone number. However, forwarded SMS mentions originator's number which can be used to quickly send a message to her/him (e.g. on iPhones, simply click on phone number to send a message).
  4. Forwarded message does not mention message's originator's name but only phone number. This can be problematic to identify the sender. This can be overcome with the included optional feature which resolves originator's name with phone number from macOS Contacts App (if you happen to run the module on a Mac). Developers (help needed) may extend this feature to other Contacts repositories (e.g. Google, Outlook, etc.).

Why?

Incoming calls (voice) can easily be redirected by activating Call Forwarding. i.e. all incoming calls (voice) are systematically forwarded to another mobile. This completely covers my use case, because the transfer will happen no matter if the phone is OFF or the SIM not connected to cellular network.

SMS, however, is a different story. No telco operator (that I know of) offers a SMS Forwarding feature (the equivalent of Call Forwarding for SMS).

There are some options out there but none of them completely meets my requirements:

  • Dual SIM can do the job, as iPhones (which I happen to own) feature eSIM support. However, you need a model starting from iPhone XS & XR.
  • A very limited set of telco operators, such as Kyivstar offers SMS Forward feature, however both phone numbers must be contracted with the same operator.
  • For iPhone, SMS and iMessages can be forwarded using Apple Continuity feature to other iDevices, provided they are connected with the same Apple ID and they are switched ON. That implies an always powered iPhone dedicated to the sole purpose of SMS forwarding, which is something I am not happy with.
  • For Android, apps such as SMS Forwarder are supposed to the job. But I highly suspect they have the same limitation than above (source phone must be always ON). Plus I do not own an Android phone.

References

This module heavily relies on the material found in the following links:

sms-forward's People

Contributors

matsuo3rd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sms-forward's Issues

Supported Huawei Dongles

Sorry if this is not the right forum for questions.
I have 2 Huawei dongles Model numbers E5331 and E5573C.
Do any of these work with this sms-forward application?

Cutout

is possible to modify this project to be a cutout?
for example we have these:
*Sender 1
*Sender 2
*Cutout
*Owner
When Sender 1 send message to Cutout it will automatically forwarded the message to Owner and when Owner reply to Cutout will also forwarded to Sender 1. Same as Sender 2.

Reply method please

I tested it on HUAWEI E3372 and it works great.. but how can i reply to specific number?? For example the program recieved message from A, B and C and forwarder it to X and X want to reply to B using this program??

not using optional db

Hello,

At first thank you for the code. I'm trying to expand to so it will auto answer on a incoming SMS.

While trying to do the first run, I changed the config and deleted macos ..... . In the readme you wrote it is optional.

when running node index.js I got the following error
C:\Users\johnl\AppData\Roaming\npm\node_modules\sms-forward\lib\MacOSAdressBookLookup.js:29
let db = new sqlite3.Database(macos_address_book_db_path, sqlite3.OPEN_READONLY, (err) => {
^

TypeError: Argument 0 must be a string
at loadAddressBookPhoneNumbers (C:\Users\johnl\AppData\Roaming\npm\node_modules\sms-forward\lib\MacOSAdressBookLookup.js:29:11)
at MacOSAdressBookLookup.init (C:\Users\johnl\AppData\Roaming\npm\node_modules\sms-forward\lib\MacOSAdressBookLookup.js:16:2)
at scanSMS (C:\Users\johnl\AppData\Roaming\npm\node_modules\sms-forward\index.js:24:20)
at Object. (C:\Users\johnl\AppData\Roaming\npm\node_modules\sms-forward\index.js:20:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)

I also tried to let macos .... stay in the JSON but making it "". Thisresults in :
[2018-10-7 23:35:57] SMS Forward started
[2018-10-7 23:35:57] SQLITE_ERROR: no such table: ZABCDPHONENUMBER
C:\Users\johnl\AppData\Roaming\npm\node_modules\sms-forward\node_modules\sqlite3\lib\trace.js:27
throw err;
^

TypeError: Cannot read property 'ZFULLNUMBER' of undefined
at db.each (C:\Users\johnl\AppData\Roaming\npm\node_modules\sms-forward\lib\MacOSAdressBookLookup.js:57:47)
at Statement.errBack (C:\Users\johnl\AppData\Roaming\npm\node_modules\sms-forward\node_modules\sqlite3\lib\sqlite3.js:16:21)
--> in Database#each('SELECT DISTINCT\n\t\t\t\t\tZABCDRECORD.ZFIRSTNAME,\n\t\t\t\t\tZABCDRECORD.ZLASTNAME,\n\t\t\t\t\tZABCDRECORD.ZMAIDENNAME,\n\t\t\t\t\tZABCDRECORD.ZMIDDLENAME,\n\t\t\t\t\tZABCDRECORD.ZNICKNAME,\n\t\t\t\t\tZABCDRECORD.ZSUFFIX,\n\t\t\t\t\tZABCDRECORD.ZTITLE,\n\t\t\t\t\tZABCDRECORD.ZJOBTITLE,\n\t\t\t\t\tZABCDRECORD.ZORGANIZATION,\n\t\t\t\t\tZABCDPHONENUMBER.ZFULLNUMBER\n\t\t\t\tFROM ZABCDPHONENUMBER\n\t\t\t\tLEFT JOIN ZABCDRECORD ON ZABCDPHONENUMBER.ZOWNER = ZABCDRECORD.Z_PK', [Function])
at Database.db.serialize (C:\Users\johnl\AppData\Roaming\npm\node_modules\sms-forward\lib\MacOSAdressBookLookup.js:38:6)
at loadAddressBookPhoneNumbers (C:\Users\johnl\AppData\Roaming\npm\node_modules\sms-forward\lib\MacOSAdressBookLookup.js:37:5)
at MacOSAdressBookLookup.init (C:\Users\johnl\AppData\Roaming\npm\node_modules\sms-forward\lib\MacOSAdressBookLookup.js:16:2)
at scanSMS (C:\Users\johnl\AppData\Roaming\npm\node_modules\sms-forward\index.js:24:20)
at Object. (C:\Users\johnl\AppData\Roaming\npm\node_modules\sms-forward\index.js:20:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)

Maybe this is for you helpfull to rewrite de readme so I cant do it right, give an example of the db which must be included or rewrite a part of the code?

Regards,

John Langhout

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.