~damg/ubuntu/quantal/asterisk/LP1097687

« back to all changes in this revision

Viewing changes to doc/tex/asterisk/node255.html

  • Committer: Bazaar Package Importer
  • Author(s): Lorenzo De Liso
  • Date: 2010-10-15 22:24:34 UTC
  • mfrom: (1.2.8 upstream) (8.3.8 sid)
  • Revision ID: james.westby@ubuntu.com-20101015222434-iy328q8in3lajzlv
Tags: 1:1.6.2.9-2ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/control:
    + Build-depend on hardening-wrapper
    + Change Maintainer
    + Removed Uploaders field.
    + Removed Debian Vcs-Svn entry and replaced with ubuntu-voip Vcs-Bzr,
      to reflect divergence in packages.
  - debian/rules: Make use of hardening-wrapper
  - debian/asterisk.init: chown /dev/dahdi
  - debian/backports/hardy: add file
  - debian/backports/asterisk.init.hardy: add file
 

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
8
8
<HTML>
9
9
<HEAD>
10
 
<TITLE>Using smsq</TITLE>
11
 
<META NAME="description" CONTENT="Using smsq">
 
10
<TITLE>extensions.conf</TITLE>
 
11
<META NAME="description" CONTENT="extensions.conf">
12
12
<META NAME="keywords" CONTENT="asterisk">
13
13
<META NAME="resource-type" CONTENT="document">
14
14
<META NAME="distribution" CONTENT="global">
20
20
 
21
21
<LINK REL="next" HREF="node256.html">
22
22
<LINK REL="previous" HREF="node254.html">
23
 
<LINK REL="up" HREF="node248.html">
 
23
<LINK REL="up" HREF="node249.html">
24
24
<LINK REL="next" HREF="node256.html">
25
25
</HEAD>
26
26
 
27
27
<BODY >
28
28
 
29
29
<DIV CLASS="navigation"><!--Navigation Panel-->
30
 
<A NAME="tex2html3992"
 
30
<A NAME="tex2html3995"
31
31
  HREF="node256.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="tex2html3988"
35
 
  HREF="node248.html">
 
34
<A NAME="tex2html3991"
 
35
  HREF="node249.html">
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="tex2html3982"
 
38
<A NAME="tex2html3985"
39
39
  HREF="node254.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="tex2html3990"
 
42
<A NAME="tex2html3993"
43
43
  HREF="node1.html">
44
44
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
45
45
 SRC="/usr/share/latex2html/icons/contents.png"></A>  
46
46
<BR>
47
 
<B> Next:</B> <A NAME="tex2html3993"
48
 
  HREF="node256.html">File formats</A>
49
 
<B> Up:</B> <A NAME="tex2html3989"
50
 
  HREF="node248.html">SMS</A>
51
 
<B> Previous:</B> <A NAME="tex2html3983"
52
 
  HREF="node254.html">extensions.conf</A>
53
 
 &nbsp; <B>  <A NAME="tex2html3991"
 
47
<B> Next:</B> <A NAME="tex2html3996"
 
48
  HREF="node256.html">Using smsq</A>
 
49
<B> Up:</B> <A NAME="tex2html3992"
 
50
  HREF="node249.html">SMS</A>
 
51
<B> Previous:</B> <A NAME="tex2html3986"
 
52
  HREF="node254.html">Sub address</A>
 
53
 &nbsp; <B>  <A NAME="tex2html3994"
54
54
  HREF="node1.html">Contents</A></B> 
55
55
<BR>
56
56
<BR></DIV>
57
57
<!--End of Navigation Panel-->
58
58
 
59
 
<H1><A NAME="SECTION001370000000000000000">
60
 
Using smsq</A>
 
59
<H1><A NAME="SECTION001360000000000000000">
 
60
extensions.conf</A>
61
61
</H1>
62
62
 
63
63
<P>
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
67
 
   Asterisk.
68
 
 
69
 
<P>
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
77
 
   (0).
78
 
 
79
 
<P>
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
83
 
   message(s).
84
 
 
85
 
<P>
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);
89
 
   smsq options:
90
 
<PRE>
91
 
   --help
92
 
   Show help text
93
 
   --usage
94
 
   Show usage
95
 
   --queue
96
 
   -q
97
 
   Specify a specific queue
98
 
   In no specified, messages are queued under queue "0"
99
 
   --da
100
 
   -d
101
 
   Specify destination address
102
 
   --oa
103
 
   -o
104
 
   Specify originating address
105
 
   This also implies that we are generating a mobile terminated message
106
 
   --ud
107
 
   -m
108
 
   Specify the actual message
109
 
   --ud-file
110
 
   -f
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
114
 
   message.
115
 
   --mt
116
 
   -t
117
 
   Mobile terminated message to be generated
118
 
   --mo
119
 
   Mobile originated message to be generated
120
 
   Default
121
 
   --tx
122
 
   Transmit message
123
 
   Default
124
 
   --rx
125
 
   -r
126
 
   Generate a message in the receive queue
127
 
   --UTF-8
128
 
   Treat the file as UTF-8 encoded (default)
129
 
   --UCS-1
130
 
   Treat the file as raw 8 bit UCS-1 data, not UTF-8 encoded
131
 
   --UCS-2
132
 
   Treat the file as raw 16 bit bigendian USC-2 data
133
 
   --process
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.
138
 
   --motx-channel
139
 
   Specify the channel for motx calls
140
 
   May contain X to use sub address based on queue name or may be full
141
 
   number
142
 
   Default is Local/1709400X
143
 
   --motx-callerid
144
 
   Specify the caller ID for motx calls
145
 
   The default is the queue name without -X suffix
146
 
   --motx-wait
147
 
   Wait time for motx call
148
 
   Default 10
149
 
   --motx-delay
150
 
   Retry time for motx call
151
 
   Default 1
152
 
   --motx-retries
153
 
   Retries for motx call
154
 
   Default 10
155
 
   --mttx-channel
156
 
   Specify the channel for mttx calls
157
 
   Default is Local/ and the queue name without -X suffix
158
 
   --mtttx-callerid
159
 
   Specify the callerid for mttx calls
160
 
   May include X to use sub address based on queue name or may be full
161
 
   number
162
 
   Default is 080058752X0
163
 
   --mttx-wait
164
 
   Wait time for mttx call
165
 
   Default 10
166
 
   --mttx-delay
167
 
   Retry time for mttx call
168
 
   Default 30
169
 
   --mttx-retries
170
 
   Retries for mttx call
171
 
   Default 100
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
175
 
   Default 9
176
 
   --no-dial
177
 
   -x
178
 
   Create queue, but do not dial to send message
179
 
   --no-wait
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
183
 
   messages
184
 
   --concurrent
185
 
   How many concurrent calls to allow (per queue), default 1
186
 
   --mr
187
 
   -n
188
 
   Message reference
189
 
   --pid
190
 
   -p
191
 
   Protocol ID
192
 
   --dcs
193
 
   Data coding scheme
194
 
   --udh
195
 
   Specific hex string of user data header specified (not including the
196
 
   initial length byte)
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.
199
 
   --srr
200
 
   Status report requested
201
 
   --rp
202
 
   Return path requested
203
 
   --vp
204
 
   Specify validity period (seconds)
205
 
   --scts
206
 
   Specify timestamp (YYYY-MM-DDTHH:MM:SS)
207
 
   --spool-dir
208
 
   Spool dir (in which sms and outgoing are found)
209
 
   Default /var/spool/asterisk
210
 
</PRE>
211
 
 
212
 
<P>
213
 
Other arguments starting '-' or '<code>--</code>' are invalid and will cause an
214
 
   error. Any trailing arguments are processed as follows:-
215
 
 
216
 
<P>
217
 
 
218
 
<UL>
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
221
 
       destination address
222
 
 
223
 
<P>
224
 
</LI>
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
227
 
       queue name
228
 
 
229
 
<P>
230
 
</LI>
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
233
 
       concatenated.
234
 
 
235
 
<P>
236
 
</LI>
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
240
 
</LI>
241
 
</UL>
242
 
 
243
 
<P>
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
257
 
   the other.
258
 
 
259
 
<P>
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
269
 
   check.
270
 
 
271
 
<P>
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
281
 
<PRE>
282
 
   $queue
283
 
   Set if a queue specified
284
 
   $?srr
285
 
   srr is set (to blank) if srr defined and has value 1.
286
 
   $?rp
287
 
   rp is set (to blank) if rp defined and has value 1.
288
 
   $ud
289
 
   User data, UTF-8 encoding, including any control characters, but with
290
 
   nulls stripped out
291
 
   Useful for the content of emails, for example, as it includes any
292
 
   newlines, etc.
293
 
   $ude
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
297
 
   of emails, etc
298
 
   $ud8
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
301
 
   $ud16
302
 
   Hex UCS-2 coding of user data (4 hex digits per character)
303
 
   other
304
 
   Other fields set using their field name, e.g. mr, pid, dcs, etc. udh
305
 
   is a hex byte string
306
 
</PRE>
307
 
 
 
64
The following contexts are recommended.
 
65
 
 
66
<P>
 
67
</B></SMALL>
 
68
<UL>
 
69
<LI><PRE>
 
70
; Mobile Terminated, RX. This is used when an incoming call from the SMS arrive
 
71
s, with the queue (called number and sub address) in ${EXTEN}
 
72
; Running an app after receipt of the text allows the app to find all messages
 
73
in the queue and handle them, e.g. email them.
 
74
; The app may be something like   smsq --process=somecommand --queue=${EXTEN}
 
75
to run a command for each received message
 
76
; See below for usage
 
77
[smsmtrx]
 
78
exten = _X.,1, SMS(${EXTEN},a)
 
79
exten = _X.,2,System("someapptohandleincomingsms ${EXTEN}")
 
80
exten = _X.,3,Hangup
 
81
; Mobile originated, RX. This is receiving a message from a device, e.g.
 
82
; a Magic Messenger on a sip extension
 
83
; Running an app after receipt of the text allows the app to find all messages
 
84
; in the queue and handle then, e.g. sending them to the public SMSC
 
85
; The app may be something like   smsq --process=somecommand --queue=${EXTEN}
 
86
; to run a command for each received message
 
87
; See below for example usage
 
88
[smsmorx]
 
89
exten = _X.,1, SMS(${EXTEN},sa)
 
90
exten = _X.,2,System("someapptohandlelocalsms ${EXTEN}")
 
91
exten = _X.,3,Hangup
 
92
</PRE><SMALL CLASS="SCRIPTSIZE"><B>
 
93
</LI>
 
94
</UL>
 
95
<P>
 
96
smsmtrx is normally accessed by an incoming call from the SMSC. In the
 
97
   UK this call is from a CLI of 080058752X0 where X is the sub address.
 
98
   As such a typical usage in the extensions.conf at the point of
 
99
   handling an incoming call is:
 
100
</B></SMALL>
 
101
<UL>
 
102
<LI><PRE>
 
103
exten = _X./8005875290,1,Goto(smsmtrx,${EXTEN},1)
 
104
exten = _X./_80058752[0-8]0,1,Goto(smsmtrx,${EXTEN}-${CALLERID(num):8:1},1)
 
105
</PRE><SMALL CLASS="SCRIPTSIZE"><B>
 
106
</LI>
 
107
</UL>
 
108
<P>
 
109
Alternatively, if you have the correct national prefix on incoming
 
110
   CLI, e.g. using dahdi_hfc, you might use:
 
111
</B></SMALL>
 
112
<UL>
 
113
<LI><PRE>
 
114
exten = _X./08005875290,1,Goto(smsmtrx,${EXTEN},1)
 
115
exten = _X./_080058752[0-8]0,1,Goto(smsmtrx,${EXTEN}-${CALLERID(num):9:1},1)
 
116
</PRE><SMALL CLASS="SCRIPTSIZE"><B>
 
117
</LI>
 
118
</UL>
 
119
<P>
 
120
smsmorx is normally accessed by a call from a local sip device
 
121
   connected to a Magic Messenger. It could however by that you are
 
122
   operating Asterisk as a message centre for calls from outside. Either
 
123
   way, you look at the called number and goto smsmorx. In the UK, the
 
124
   SMSC number that would be dialed is 1709400X where X is the caller sub
 
125
   address. As such typical usage in extension.config at the point of
 
126
   handling a call from a sip phone is:
 
127
</B></SMALL>
 
128
<UL>
 
129
<LI><PRE>
 
130
exten = 17094009,1,Goto(smsmorx,${CALLERID(num)},1)
 
131
exten = _1709400[0-8],1,Goto(smsmorx,${CALLERID(num)}-{EXTEN:7:1},1)
 
132
</PRE><SMALL CLASS="SCRIPTSIZE"><B>
 
133
</LI>
 
134
</UL>
308
135
<P>
309
136
 
310
137
<DIV CLASS="navigation"><HR>
311
138
<!--Navigation Panel-->
312
 
<A NAME="tex2html3992"
 
139
<A NAME="tex2html3995"
313
140
  HREF="node256.html">
314
141
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
315
142
 SRC="/usr/share/latex2html/icons/next.png"></A> 
316
 
<A NAME="tex2html3988"
317
 
  HREF="node248.html">
 
143
<A NAME="tex2html3991"
 
144
  HREF="node249.html">
318
145
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
319
146
 SRC="/usr/share/latex2html/icons/up.png"></A> 
320
 
<A NAME="tex2html3982"
 
147
<A NAME="tex2html3985"
321
148
  HREF="node254.html">
322
149
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
323
150
 SRC="/usr/share/latex2html/icons/prev.png"></A> 
324
 
<A NAME="tex2html3990"
 
151
<A NAME="tex2html3993"
325
152
  HREF="node1.html">
326
153
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
327
154
 SRC="/usr/share/latex2html/icons/contents.png"></A>  
328
155
<BR>
329
 
<B> Next:</B> <A NAME="tex2html3993"
330
 
  HREF="node256.html">File formats</A>
331
 
<B> Up:</B> <A NAME="tex2html3989"
332
 
  HREF="node248.html">SMS</A>
333
 
<B> Previous:</B> <A NAME="tex2html3983"
334
 
  HREF="node254.html">extensions.conf</A>
335
 
 &nbsp; <B>  <A NAME="tex2html3991"
 
156
<B> Next:</B> <A NAME="tex2html3996"
 
157
  HREF="node256.html">Using smsq</A>
 
158
<B> Up:</B> <A NAME="tex2html3992"
 
159
  HREF="node249.html">SMS</A>
 
160
<B> Previous:</B> <A NAME="tex2html3986"
 
161
  HREF="node254.html">Sub address</A>
 
162
 &nbsp; <B>  <A NAME="tex2html3994"
336
163
  HREF="node1.html">Contents</A></B> </DIV>
337
164
<!--End of Navigation Panel-->
338
165
<ADDRESS>
339
166
lmadsen
340
 
2010-05-03
 
167
2010-06-17
341
168
</ADDRESS>
342
169
</BODY>
343
170
</HTML>