The OpenVox G400P
Having recently acquired one of these cards, I am finding documentation is a bit sparse. I hope to rectify this. What follows is gleaned from assorted web sites too numerous to mention individually, the chan_extra Source Code and my own dogged experimentation.
Receiving Text Messages
When a text (SMS) message is received, a call is set up to extension “sms” in the default context (usually “from-gsm”) specified in chan_extra.conf. Within this call, certain channel variables are set up as follows:
- ${SMSSRC} = the sender’s number
- ${SMSTXT} = the message text
- S{SMSPDU} = the PDU (hexadecimal codes representing message in binary format)
- ${SMSTIME} = the time at which the message was sent
- ${SMSTZ} = the time zone from which the message was sent
- ${DIALSTATUS} = set to “SMS_END”
These can be passed to an AGI script. For example, you could have this in your dialplan:
exten => sms,1,NoOp(Incoming SMS)
exten => sms,2,AGI(sms_to_email.agi,${SMSTXT},${SMSSRC})
exten => sms,3,Hangup()
This calls up an AGI script called /var/lib/asterisk/agi-bin/sms_to_email with the message text and sender’s number as its parameters. This can be written in any language with an AGI library.
Alternate, “quick and dirty” version (no AGI; requires a properly-configured MTA on the Asterisk server; untested at time of writing)
exten => sms,1,NoOp(Incoming SMS)
exten => sms,2,SYSTEM(echo "${SMSTXT}" | mail -s"Text from ${SMSSRC}" [email protected])
exten => sms,3,Hangup()
If there is no extension in this context called “sms” (or a wildcard with a pattern that “sms” would match), then the “s” extension will be run instead.