21
21
<LINK REL="next" HREF="node257.html">
22
22
<LINK REL="previous" HREF="node255.html">
23
<LINK REL="up" HREF="node248.html">
23
<LINK REL="up" HREF="node249.html">
24
24
<LINK REL="next" HREF="node257.html">
29
29
<DIV CLASS="navigation"><!--Navigation Panel-->
30
<A NAME="tex2html4004"
30
<A NAME="tex2html4007"
31
31
HREF="node257.html">
32
32
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
33
33
SRC="/usr/share/latex2html/icons/next.png"></A>
34
<A NAME="tex2html4000"
34
<A NAME="tex2html4003"
36
36
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
37
37
SRC="/usr/share/latex2html/icons/up.png"></A>
38
<A NAME="tex2html3994"
38
<A NAME="tex2html3997"
39
39
HREF="node255.html">
40
40
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
41
41
SRC="/usr/share/latex2html/icons/prev.png"></A>
42
<A NAME="tex2html4002"
42
<A NAME="tex2html4005"
44
44
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
45
45
SRC="/usr/share/latex2html/icons/contents.png"></A>
47
<B> Next:</B> <A NAME="tex2html4005"
48
HREF="node257.html">Delivery reports</A>
49
<B> Up:</B> <A NAME="tex2html4001"
50
HREF="node248.html">SMS</A>
51
<B> Previous:</B> <A NAME="tex2html3995"
52
HREF="node255.html">Using smsq</A>
53
<B> <A NAME="tex2html4003"
47
<B> Next:</B> <A NAME="tex2html4008"
48
HREF="node257.html">File formats</A>
49
<B> Up:</B> <A NAME="tex2html4004"
50
HREF="node249.html">SMS</A>
51
<B> Previous:</B> <A NAME="tex2html3998"
52
HREF="node255.html">extensions.conf</A>
53
<B> <A NAME="tex2html4006"
54
54
HREF="node1.html">Contents</A></B>
57
57
<!--End of Navigation Panel-->
59
<H1><A NAME="SECTION001380000000000000000">
59
<H1><A NAME="SECTION001370000000000000000">
64
By default all queues are held in a director /var/spool/asterisk/sms.
65
Within this directory are sub directories mtrx, mttx, morx, motx which
66
hold the received messages and the messages ready to send. Also,
67
/var/log/asterisk/sms is a log file of all messages handled.
70
The file name in each queue directory starts with the queue parameter
71
to SMS which is normally the CLI used for an outgoing message or the
72
called number on an incoming message, and may have -X (X being sub
73
address) appended. If no queue ID is known, then 0 is used by smsq by
74
default. After this is a dot, and then any text. Files are scanned for
75
matching queue ID and a dot at the start. This means temporary files
76
being created can be given a different name not starting with a queue
77
(we recommend a . on the start of the file name for temp files).
78
Files in these queues are in the form of a simple text file where each
79
line starts with a keyword and an = and then data. udh and ud have
80
options for hex encoding, see below.
83
UTF-8. The user data (ud) field is treated as being UTF-8 encoded
84
unless the DCS is specified indicating 8 bit format. If 8 bit format
85
is specified then the user data is sent as is.
86
The keywords are as follows:
88
oa Originating address
89
The phone number from which the message came
90
Present on mobile terminated messages and is the CLI for morx messages
93
The phone number to which the message is sent
94
Present on mobile originated messages
96
The service centre time stamp
97
Format YYYY-MM-DDTHH:MM:SS
98
Present on mobile terminated messages
100
One byte decimal protocol ID
101
See GSM specs for more details
104
One byte decimal data coding scheme
105
If omitted, a sensible default is used (see below)
106
See GSM specs for more details
108
One byte decimal message reference
109
Present on mobile originated messages, added by default if absent
111
0 or 1 for status report request
112
Does not work in UK yet, not implemented in app_sms yet
115
See GSM specs for details
117
Validity period in seconds
118
Does not work in UK yet
120
Hex string of user data header prepended to the SMS contents,
121
excluding initial length byte.
122
Consistent with ud, this is specified as udh# rather than udh=
123
If blank, this means that the udhi flag will be set but any user data
124
header must be in the ud field
126
User data, may be text, or hex, see below
130
udh is specified as as udh# followed by hex (2 hex digits per byte).
131
If present, then the user data header indicator bit is set, and the
132
length plus the user data header is added to the start of the user
133
data, with padding if necessary (to septet boundary in 7 bit format).
134
User data can hold an USC character codes U+0000 to U+FFFF. Any other
135
characters are coded as U+FEFF
138
ud can be specified as ud= followed by UTF-8 encoded text if it
139
contains no control characters, i.e. only (U+0020 to U+FFFF). Any
140
invalid UTF-8 sequences are treated as is (U+0080-U+00FF).
143
ud can also be specified as ud# followed by hex (2 hex digits per
144
byte) containing characters U+0000 to U+00FF only.
147
ud can also be specified as ud## followed by hex (4 hex digits per
148
byte) containing UCS-2 characters.
151
When written by app_sms (e.g. incoming messages), the file is written
152
with ud= if it can be (no control characters). If it cannot, the a
153
comment line ;ud= is used to show the user data for human readability
154
and ud# or ud## is used.
64
smsq is a simple helper application designed to make it easy to send
65
messages from a command line. it is intended to run on the Asterisk
66
box and have direct access to the queue directories for SMS and for
70
In its simplest form you can send an SMS by a command such as
71
smsq 0123456789 This is a test to 0123456789
72
This would create a queue file for a mobile originated TX message in
73
queue 0 to send the text "This is a test to 0123456789" to 0123456789.
74
It would then place a file in the /var/spool/asterisk/outgoing
75
directory to initiate a call to 17094009 (the default message centre
76
in smsq) attached to application SMS with argument of the queue name
80
Normally smsq will queue a message ready to send, and will then create
81
a file in the Asterisk outgoing directory causing Asterisk to actually
82
connect to the message centre or device and actually send the pending
86
Using <code>--process</code>, smsq can however be used on received queues to run a
87
command for each file (matching the queue if specified) with various
88
environment variables set based on the message (see below);
97
Specify a specific queue
98
In no specified, messages are queued under queue "0"
101
Specify destination address
104
Specify originating address
105
This also implies that we are generating a mobile terminated message
108
Specify the actual message
111
Specify a file to be read for the context of the message
112
A blank filename (e.g. --ud-file= on its own) means read stdin. Very
113
useful when using via ssh where command line parsing could mess up the
117
Mobile terminated message to be generated
119
Mobile originated message to be generated
126
Generate a message in the receive queue
128
Treat the file as UTF-8 encoded (default)
130
Treat the file as raw 8 bit UCS-1 data, not UTF-8 encoded
132
Treat the file as raw 16 bit bigendian USC-2 data
134
Specific a command to process for each file in the queue
135
Implies --rx and --mt if not otherwise specified.
136
Sets environment variables for every possible variable, and also ud,
137
ud8 (USC-1 hex), and ud16 (USC-2 hex) for each call. Removes files.
139
Specify the channel for motx calls
140
May contain X to use sub address based on queue name or may be full
142
Default is Local/1709400X
144
Specify the caller ID for motx calls
145
The default is the queue name without -X suffix
147
Wait time for motx call
150
Retry time for motx call
153
Retries for motx call
156
Specify the channel for mttx calls
157
Default is Local/ and the queue name without -X suffix
159
Specify the callerid for mttx calls
160
May include X to use sub address based on queue name or may be full
162
Default is 080058752X0
164
Wait time for mttx call
167
Retry time for mttx call
170
Retries for mttx call
172
--default-sub-address
173
The default sub address assumed (e.g. for X in CLI and dialled numbers
174
as above) when none added (-X) to queue
178
Create queue, but do not dial to send message
180
Do not wait if a call appears to be in progress
181
This could have a small window where a message is queued but not
182
sent, so regular calls to smsq should be done to pick up any missed
185
How many concurrent calls to allow (per queue), default 1
195
Specific hex string of user data header specified (not including the
197
May be a blank string to indicate header is included in the user data
198
already but user data header indication to be set.
200
Status report requested
202
Return path requested
204
Specify validity period (seconds)
206
Specify timestamp (YYYY-MM-DDTHH:MM:SS)
208
Spool dir (in which sms and outgoing are found)
209
Default /var/spool/asterisk
213
Other arguments starting '-' or '<code>--</code>' are invalid and will cause an
214
error. Any trailing arguments are processed as follows:-
219
<LI>If the message is mobile originating and no destination address
220
has been specified, then the first argument is assumed to be a
225
<LI>If the message is mobile terminating and no destination address
226
has been specified, then the first argument is assumed to be the
231
<LI>If there is no user data, or user data file specified, then any
232
following arguments are assumed to be the message, which are
237
<LI>If no user data is specified, then no message is sent. However,
238
unless <code>--no-dial</code> is specified, smsq checks for pending messages
239
and generates an outgoing anyway
244
Note that when smsq attempts to make a file in
245
/var/spool/asterisk/outgoing, it checks if there is already a call
246
queued for that queue. It will try several filenames, up to the
247
<code>--concurrent</code> setting. If these files exist, then this means Asterisk
248
is already queued to send all messages for that queue, and so Asterisk
249
should pick up the message just queued. However, this alone could
250
create a race condition, so if the files exist then smsq will wait up
251
to 3 seconds to confirm it still exists or if the queued messages have
252
been sent already. The <code>--no-wait</code> turns off this behaviour. Basically,
253
this means that if you have a lot of messages to send all at once,
254
Asterisk will not make unlimited concurrent calls to the same message
255
centre or device for the same queue. This is because it is generally
256
more efficient to make one call and send all of the messages one after
260
smsq can be used with no arguments, or with a queue name only, and it
261
will check for any pending messages and cause an outgoing if there are
262
any. It only sets up one outgoing call at a time based on the first
263
queued message it finds. A outgoing call will normally send all queued
264
messages for that queue. One way to use smsq would be to run with no
265
queue name (so any queue) every minute or every few seconds to send
266
pending message. This is not normally necessary unless <code>--no-dial</code> is
267
selected. Note that smsq does only check motx or mttx depending on the
268
options selected, so it would need to be called twice as a general
272
UTF-8 is used to parse command line arguments for user data, and is
273
the default when reading a file. If an invalid UTF-8 sequence is
274
found, it is treated as UCS-1 data (i.e, as is).
275
The <code>--process</code> option causes smsq to scan the specified queue (default
276
is mtrx) for messages (matching the queue specified, or any if queue
277
not specified) and run a command and delete the file. The command is
278
run with a number of environment variables set as follows. Note that
279
these are unset if not needed and not just taken from the calling
280
environment. This allows simple processing of incoming messages
283
Set if a queue specified
285
srr is set (to blank) if srr defined and has value 1.
287
rp is set (to blank) if rp defined and has value 1.
289
User data, UTF-8 encoding, including any control characters, but with
291
Useful for the content of emails, for example, as it includes any
294
User data, escaped UTF-8, including all characters, but control
295
characters \n, \r, \t, \f, \xxx and \ is escaped as \\
296
Useful guaranteed one line printable text, so useful in Subject lines
299
Hex UCS-1 coding of user data (2 hex digits per character)
300
Present only if all user data is in range U+0000 to U+00FF
302
Hex UCS-2 coding of user data (4 hex digits per character)
304
Other fields set using their field name, e.g. mr, pid, dcs, etc. udh
158
310
<DIV CLASS="navigation"><HR>
159
311
<!--Navigation Panel-->
160
<A NAME="tex2html4004"
312
<A NAME="tex2html4007"
161
313
HREF="node257.html">
162
314
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
163
315
SRC="/usr/share/latex2html/icons/next.png"></A>
164
<A NAME="tex2html4000"
316
<A NAME="tex2html4003"
166
318
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
167
319
SRC="/usr/share/latex2html/icons/up.png"></A>
168
<A NAME="tex2html3994"
320
<A NAME="tex2html3997"
169
321
HREF="node255.html">
170
322
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
171
323
SRC="/usr/share/latex2html/icons/prev.png"></A>
172
<A NAME="tex2html4002"
324
<A NAME="tex2html4005"
173
325
HREF="node1.html">
174
326
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
175
327
SRC="/usr/share/latex2html/icons/contents.png"></A>
177
<B> Next:</B> <A NAME="tex2html4005"
178
HREF="node257.html">Delivery reports</A>
179
<B> Up:</B> <A NAME="tex2html4001"
180
HREF="node248.html">SMS</A>
181
<B> Previous:</B> <A NAME="tex2html3995"
182
HREF="node255.html">Using smsq</A>
183
<B> <A NAME="tex2html4003"
329
<B> Next:</B> <A NAME="tex2html4008"
330
HREF="node257.html">File formats</A>
331
<B> Up:</B> <A NAME="tex2html4004"
332
HREF="node249.html">SMS</A>
333
<B> Previous:</B> <A NAME="tex2html3998"
334
HREF="node255.html">extensions.conf</A>
335
<B> <A NAME="tex2html4006"
184
336
HREF="node1.html">Contents</A></B> </DIV>
185
337
<!--End of Navigation Panel-->