Python: SMS listen

Hi all,

I am developing a simple application on GM862 GPS modem using python script. I want to toggle a GPIO (General Purpose IO)pin on the board from a SMS. Like if a SMS text says “ON”, the pin should set to “1” and if it says “OFF”, pin should set to “0”.

I think I can do the toggling part but where I am facing difficulty is:

  1. How to detect an incoming SMS. On the Rsterm it does show the response as “+CMTI: SM, 2” but how to listen using a python script.

  2. How to extract the SMS text using python and use it for invoking desired tasks.

I would really appreciate if someone could guide me on this.

Thanks