Sending MMI codes from bash script - bash

I am trying to make a little bash script that will activate call forwarding to some number on some condition using mobile broadband dongle connected to the usb port.
I can easily send sms messages, call USSD codes using either mmcli (ubuntu) or gammu, but I cannot run MMI codes. These codes have very similar syntax to USSD but are not the same.
Can I send MMI codes using any command line tool? If yes - how?

You can manage call forwarding directly by Gammu, see http://wammu.eu/docs/manual/gammu/#cmdoption-gammu-arg-divert

Related

Send SMS from Linux programmatically

I want to send SMS ideally using PHP in a Linux Environment. I have a GSM modem which I want to use to send SMS.
Can anybody please tell me an easy way to send SMS from Linux using a USB GSM modem?
Thank you
Your GSM modem will almost certainly support AT commands - you can see some history of AT, or Hayes, commands here: https://en.wikipedia.org/wiki/Hayes_command_set
The commands supported can vary from device to device but the simplest command sequence to send an SMS message is fairly standard - an example, showing the communication over the serial port, is:
AT+CMGF=1. [you send this]
OK [Modem responds]
AT+CMGS="+31628870634". [you send this]
> Yourtextmessage.→. [Modem responds with > and you send text followed by return at end]
+CMGS: 198 [Modem responds after a few moments when message is sent]
You should be able to find many more examples with a quick search including using PHP - e.g. (at the time of writing): https://gonzalo123.com/2011/03/21/howto-sendread-smss-using-a-gsm-modem-at-commands-and-php/
Its worth being aware that different modems may work differently - you will need to experiment to ensure you have a relabel solution.

Error on checking balance via USSD

I've been trying to check my balance from by 3g modem via AT commands and seem to be stuck.
The device infomation is as follows:
Manufacturer: QUALCOMM INCORPORATED
Model: M6281
Revision: SSD_M6281A-0.0.1 1 [Oct 02 2008 07:00:00]
The modem has USSD capability (advertised and also present in the factory installed dashboard).
I am connecting via putty to COM4 serial port which is my modems application port. All AT commands are working fine but I am getting an error on issuing the following via putty:
AT+CUSD=1,"*111#",15
This returns a simple "ERROR". *111# is my carrier's balance check code. I suspect that there is a formatting error somewhere but I can't figure out where.
Note: If I issue a blank ussd command:
AT+CUSD=1,"",15
then I get an OK (although I later get a response +CME ERROR: retry operation) ... If I write anything within the quotation marks however, it returns an "ERROR".
Ok, I finally found the way to fix this. Apparently there was a problem in the encoding. Here is what I did:
AT+CSCS="GSM" // change character set to GSM
AT+CUSD=1,"*111#",15 // Issued balance check ussd code
It now works fine.
The default encoding was UCS2, I'd appreciate if someone can share how to convert ussd codes to UCS2 encoding in putty.
Have you tried issuing request by AT+CUSD=1,"*111#" ? (without last parameter)
AT cmmands sometimes differ due to manufacturer implementation.

Scapy Windows sr1() not being answered

I'm using the Scapy library for Python 2.6 on Windows 7 in order to see if I can spoof my IP address (for non-malicious purposes, I'm curious how it works).
When I use the sr1() function, it sends the packet, but it gets nothing in return. I have to interrupt it manually using CTRL+C in order for it to stop receiving packets that are not an answer.
I've tried to use both Python-Scapy or the like-How can I create an HTTP GET request at the packet level and Scapy: no reply on raw ICMP packet, with no luck.
I have tried tracking it in Wireshark, but nothing showed up.
I know Scapy is not made for Windows, so that could be the issue. If so, I can get a Linux environment instead.
NOTE: Note that I am running this through the console version of Scapy, but I found the exact same results running it through Python scripts.
IP(dst="www.google.com")/TCP(dport=80,flags="S")
This TCP packet's sport will automatically set to be 20 (www-data) in Scapy.
And what is worse, www.google.com does not reply from the sport=20 (www-data)
try
IP(dst="www.google.com")/TCP(sport=65000,dport=80,flags="S")

How can I call an internal sip phone using a server with freeswitch

I want to make an internal call from a server with freeswitch to a sip phone that's registered and connected and has the extension of 1000
I'm fairly sure I use originate sofia and I've been trying several combinations with no result.
The sort of thing I've been trying is
originate sofia/internal/1000#[my IP address] &park{}
And I get the result
-ERR NO_USER_RESPONSE
I'm currently outside of my lab, but I believe you can use "user/1000" as the first destination. Also "sofia/internal/1000" should probably work.

SMS: AT commands

I am trying to set up an SMS gateway on my computer
here's some code I found:
AT
OK
AT+CMGF=1
OK
AT+CMGL="ALL"
+CMGL: 1,"REC READ","+85291234567",,"06/11/11,00:30:29+32"
Hello, welcome to our SMS tutorial.
+CMGL: 2,"REC READ","+85291234567",,"06/11/11,00:32:20+32"
A simple demo of SMS text messaging.
OK
can this be done in windows?
what steps do I have to take in order to set this up?
what is the compiler?
how do I get started?
These are AT commands, which are used with modems (or cell phones) who support that interface.
If you cell phone is connected to your computer by serial, you can open a HyperTerminal/Telnet/etc and communicate with it via AT commands.
There is no compiler or such, as this is merely a protocol for communicating with supporting devices.

Resources