The code can be literally found on the related wiki page (https://wiki.maemo.org/PyMaemo/Phone...d_SMS_examples) I have not tested this, but I used to have a similar script to act on incoming phonecalls.