README.sms 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. SMS() is an application to handles calls to/from text message capable phones and message centres using ETSI ES 201 912 protocol 1 FSK messaging over analogue calls.
  2. Basically it allows sending and receiving of text messages over the PSTN. It is compatible with BT Text service in the UK and works on ISDN and PSTN lines. It is designed to connect to an ISDN or zap interface directly and uses FSK so would probably not work over any sort of compressed link.
  3. Typical applications include:-
  4. 1. Connection to a message centre to send text messages - probably initiated via the manager interface or "outgoing" directory
  5. 2. Connection to an POTS line with an SMS capable phone to send messages - probably initiated via the manager interface or "Outgoing" directory
  6. 3. Acceptance of calls from the message centre (based on CLI) and storage of received messages
  7. 4. Acceptance of calls from a POTS line with an SMS capable phone and storage of received messages
  8. First argument is queue name
  9. Second is options
  10. a: SMS() is to act as the answering side, and so send the initial FSK frame
  11. s: SMS() is to act as a service centre side rather than as terminal equipment
  12. If a third argument is specified, then SMS does not handle the call at all,
  13. but takes the third argument as a destination number to send an SMS to, and
  14. the forth argument onward as a message to be queued. All this does is create
  15. the file in the me-sc directory. If 's' is set then the number is the source
  16. address and the message placed in the sc-me directory.
  17. All text messages are in /var/spool/asterisk/sms
  18. A log is recorded in /var/log/asterisk/sms
  19. There are two subdirectories called sc-me.<queuename> holding all
  20. messages from service centre to phone, and me-sc.<queuename> holding all
  21. messages from phone to service centre.
  22. In each directory are messages in files, one per file, using any filename not
  23. starting with a dot.
  24. When connected as a service centre, SMS(s) will send all messages waiting in
  25. the sc-me-<queuename> directory, deleting the files as it goes. Any
  26. received in this mode are placed in the me-sc-<queuename> directory.
  27. When connected as a client, SMS() will send all messages waiting in the
  28. me-sc-<queuename> directory, deleting the files as it goes. Any received in
  29. this mode are placed in the sc-me-<queuename> directory.
  30. Message files created by SMS() use a time stamp/reference based filename.
  31. The format of the sms file is lines that have the form of key=value
  32. Keys are :-
  33. oa Originating Address
  34. Telephone number, national number if just digits
  35. Telephone number starting with + then digits for international
  36. Ignored on sending messages to service centre (CLI used)
  37. da Destination Address
  38. Telephone number, national number if just digits
  39. Telephone number starting with + then digits for international
  40. scts Service Centre Time Stamp
  41. In the format YYYY-MM-DD HH:MM:SS
  42. pid Protocol Identifier (decimal octet value)
  43. dcs Data coding scheme (decimal octet value)
  44. mr Message reference (decimal octet value)
  45. ud The message (see escaping below)
  46. srr 0/1 Status Report Request
  47. rp 0/1 Return Path
  48. vp mins validity period
  49. Omitted fields have default values.
  50. Note that there is special format for ud, ud# instead of ud= which is followed
  51. by raw hex (2 characters per octet). This is used in output where characters
  52. other than 10,13,32-126,128-255 are included in the data. In this case a comment (line
  53. starting ;) is added showing the printable characters
  54. When generating files to send to a service centre, only da and ud need be
  55. specified. oa is ignored.
  56. When generating files to send to a phone, only oa and ud need be specified. da is ignored.
  57. When receing a message as a service centre, only the destination address is
  58. sent, so the originating address is set to the callerid.
  59. EXAMPLES
  60. The following are examples of use within the UK using BT Text SMS/landline
  61. service.
  62. This is a context to use with a manager script.
  63. [smsdial] ; create and send a text message, expects number+message and
  64. connect to 17094009
  65. exten = _X.,1,SMS(${CALLERIDNUM},,${EXTEN},${CALLERIDNAME})
  66. exten = _X.,2,SMS(${CALLERIDNUM})
  67. exten = _X.,3,Hangup
  68. The script sends
  69. action: originate
  70. callerid: message <from>
  71. exten: to
  72. channel: Local/17094009
  73. context: smsdial
  74. priority: 1
  75. You put the message as the name of the caller ID (messy, I know), the
  76. originating number and hence queue name as the number of the caller ID and the
  77. exten as the number to which the sms is to be sent. The context uses SMS to
  78. create the message in the queue and then SMS to communicate iwth 17094009 to
  79. actually send the message.
  80. Note that the 9 on the end of 17094009 is the sub address 9 meaning no sub
  81. address (BT specific). If a different digit is used then that is the sub
  82. address for the sending message source address (appended to the outgoing CLI
  83. by BT).
  84. For incoming calls you can use a context like this :-
  85. [incoming]
  86. exten = _XXXXXX/_8005875290,1,SMS(${EXTEN:3},a)
  87. exten = _XXXXXX/_8005875290,2,System(/usr/lib/asterisk/smsin ${EXTEN:3})
  88. exten = _XXXXXX/_80058752[0-8]0,1,SMS(${EXTEN:3}${CALLERIDNUM:8:1},a)
  89. exten = _XXXXXX/_80058752[0-8]0,2,System(/usr/lib/asterisk/smsin
  90. ${EXTEN:3}${CALLERIDNUM:8:1})
  91. exten = _XXXXXX/_80058752X0,3,Hangup
  92. In this case the called number we get from BT is 6 digits (XXXXXX) and we are
  93. using the last 3 digits as the queue name.
  94. Priority 1 causes the SMS to be received and processed for the incoming call.
  95. It is from 080058752X0. The two versions handle the queue name as 3 digits (no
  96. sub address) or 4 digits (with sub address). In both cases, after the call a
  97. script (smsin) is run - this is optional, but is useful to actually processed
  98. the received queued SMS. In our case we email them based on the target number.
  99. Priority 3 hangs up.
  100. If using the CAPI drivers they send the right CLI and so the _800... would be
  101. _0800...