If AtCommandError exception is thrown with "+CMS ERROR: 500" output, it literally means "SMS could not be sent" (which you must have figured out by now). Those are the possible reasons:
- You lost coverage.
In this case, the modem will typically seem to hang for 10-15 seconds. The delay is caused by an attempt to scan and associate with the cellular network. Run get_networks() on humodem.Modem's instance to see what networks are in range. - You use wrong Service Senter.
Run get_service_center() on a humod.Modem's instance to see your service center; you can set a new value with set_service_center(). - Potentially everything that prevents an SMS from being sent.