How to send SMS from a Mac terminal via a GSM modem?

I have a Mio A701 communicator that I would like to use as a GSM modem to send SMS from my Mac.

What I have found so far is that you can simply send AT commands directly from the terminal to special ports, for example, / dev / ttyUSB 0 if the modem is connected via the USB port or / dev / rfcomm 0 if the connection is through bluetooth. My problem is that when I try to issue a command, I get a "refused answer" response:

"AT+CMGS=test\r" > /dev/ttyUSB0
-bash: /dev/ttyUSB0: Permission denied

Also, "ls / dev" indicates that there are no ttyUSB0 or ​​rfcomm0 files there, so I cannot update permissions for these files.

Any help would be greatly appreciated, thanks in advance.

Update: the problem is resolved.
First of all, the Mio A701 seems to be the wrong choice as it does not support AT commands to send SMS.

This PHP code works fine with the Nokia 3310c connected via bluetooth:

$number="<phone number in international format with + sign>";
$message="Hello World\ntest"; // as far as I've tested \n successfully turns into a line break in SMS on Mio, Nokia and Alcatel phones
$port="/dev/tty.phone"; // this path was set in "Mac preferences" -> bluetooth -> "configure ports" for selected device


if($fd = fopen($port, 'a')) {
    fwrite($fd, "AT+CMGF=1\r"); // text mode for SMS
    sleep(2);
    fwrite($fd, "AT+CMGS=\"$number\"\r");
    sleep(2);
    fwrite($fd, "$message\032");
    sleep(2);
    $fh = null;
} else
    echo "Phone unreachable";
+3
source share
2 answers

The best way to send sms and ussd is to install smstools3 (not smstools ) and build on sample scripts .

+1
source

Try smsd utility from smstools package, hope this helps

0
source

Source: https://habr.com/ru/post/1729532/


All Articles