Asterisk - The Open Source Telephony Project GIT-master-a358458
func_callerid.c
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 1999-2010, Digium, Inc.
5 *
6 * See http://www.asterisk.org for more information about
7 * the Asterisk project. Please do not directly contact
8 * any of the maintainers of this project for assistance;
9 * the project provides a web site, mailing lists and IRC
10 * channels for your use.
11 *
12 * This program is free software, distributed under the terms of
13 * the GNU General Public License Version 2. See the LICENSE file
14 * at the top of the source tree.
15 */
16
17/*! \file
18 *
19 * \brief Party ID related dialplan functions (Caller-ID, Connected-line, Redirecting)
20 *
21 * \ingroup functions
22 *
23 * See Also:
24 * \arg \ref AstCREDITS
25 */
26
27/*** MODULEINFO
28 <support_level>core</support_level>
29 ***/
30
31#include "asterisk.h"
32
33#include "asterisk/module.h"
34#include "asterisk/channel.h"
35#include "asterisk/pbx.h"
36#include "asterisk/utils.h"
37#include "asterisk/app.h"
38#include "asterisk/callerid.h"
39
40/*
41 * The CALLERID(pres) datatype is shorthand for getting/setting the
42 * combined value of name-pres and num-pres. Some channel drivers
43 * don't make a distinction, so it makes sense to only use one property
44 * to get/set it. The same applies to CONNECTEDLINE(pres),
45 * REDIRECTING(orig-pres), REDIRECTING(from-pres) and REDIRECTING(to-pres).
46 *
47 * Do not document the CALLERID(ton) datatype.
48 * It is an alias for num-plan.
49 *
50 * Do not document the CALLERID(ANI-subaddr-...) datatype.
51 * This is not used.
52 *
53 * Do not document the CONNECTEDLINE(source) datatype.
54 * It has turned out to not be needed. The source value is really
55 * only useful as a possible tracing aid.
56 *
57 * Do not document the CONNECTEDLINE(ton) datatype.
58 * It is an alias for num-plan.
59 *
60 * Do not document the REDIRECTING(pres) datatype.
61 * It has turned out that the from-pres and to-pres values must be kept
62 * separate. They represent two different parties and there is a case when
63 * they are active at the same time. The plain pres option will simply
64 * live on as a historical relic.
65 *
66 * Do not document the REDIRECTING(orig-ton), REDIRECTING(from-ton),
67 * or REDIRECTING(to-ton) datatypes.
68 * They are aliases for orig-num-plan, from-num-plan, and to-num-plan
69 * respectively.
70 */
71/*** DOCUMENTATION
72 <function name="CALLERID" language="en_US">
73 <synopsis>
74 Gets or sets Caller*ID data on the channel.
75 </synopsis>
76 <syntax>
77 <parameter name="datatype" required="true">
78 <para>The allowable datatypes are:</para>
79 <enumlist>
80 <enum name = "all" />
81 <enum name = "name" />
82 <enum name = "name-valid" />
83 <enum name = "name-charset" />
84 <enum name = "name-pres" />
85 <enum name = "num" />
86 <enum name = "num-valid" />
87 <enum name = "num-plan" />
88 <enum name = "num-pres" />
89 <enum name = "pres" />
90 <enum name = "subaddr" />
91 <enum name = "subaddr-valid" />
92 <enum name = "subaddr-type" />
93 <enum name = "subaddr-odd" />
94 <enum name = "tag" />
95 <enum name = "priv-all" />
96 <enum name = "priv-name" />
97 <enum name = "priv-name-valid" />
98 <enum name = "priv-name-charset" />
99 <enum name = "priv-name-pres" />
100 <enum name = "priv-num" />
101 <enum name = "priv-num-valid" />
102 <enum name = "priv-num-plan" />
103 <enum name = "priv-num-pres" />
104 <enum name = "priv-subaddr" />
105 <enum name = "priv-subaddr-valid" />
106 <enum name = "priv-subaddr-type" />
107 <enum name = "priv-subaddr-odd" />
108 <enum name = "priv-tag" />
109 <enum name = "ANI-all" />
110 <enum name = "ANI-name" />
111 <enum name = "ANI-name-valid" />
112 <enum name = "ANI-name-charset" />
113 <enum name = "ANI-name-pres" />
114 <enum name = "ANI-num" />
115 <enum name = "ANI-num-valid" />
116 <enum name = "ANI-num-plan" />
117 <enum name = "ANI-num-pres" />
118 <enum name = "ANI-tag" />
119 <enum name = "RDNIS" />
120 <enum name = "DNID" />
121 <enum name = "dnid-num-plan" />
122 <enum name = "dnid-subaddr" />
123 <enum name = "dnid-subaddr-valid" />
124 <enum name = "dnid-subaddr-type" />
125 <enum name = "dnid-subaddr-odd" />
126 </enumlist>
127 </parameter>
128 <parameter name="CID">
129 <para>Optional Caller*ID to parse instead of using the Caller*ID from the
130 channel. This parameter is only optional when reading the Caller*ID.</para>
131 </parameter>
132 </syntax>
133 <description>
134 <para>Gets or sets Caller*ID data on the channel. Uses channel callerid by
135 default or optional callerid, if specified.</para>
136 <para>The <replaceable>pres</replaceable> field gets/sets a combined value
137 for <replaceable>name-pres</replaceable> and
138 <replaceable>num-pres</replaceable>.</para>
139 <para>The allowable values for the <replaceable>name-charset</replaceable>
140 field are the following:</para>
141 <enumlist>
142 <enum name = "unknown"><para>Unknown</para></enum>
143 <enum name = "iso8859-1"><para>ISO8859-1</para></enum>
144 <enum name = "withdrawn"><para>Withdrawn</para></enum>
145 <enum name = "iso8859-2"><para>ISO8859-2</para></enum>
146 <enum name = "iso8859-3"><para>ISO8859-3</para></enum>
147 <enum name = "iso8859-4"><para>ISO8859-4</para></enum>
148 <enum name = "iso8859-5"><para>ISO8859-5</para></enum>
149 <enum name = "iso8859-7"><para>ISO8859-7</para></enum>
150 <enum name = "bmp"><para>ISO10646 Bmp String</para></enum>
151 <enum name = "utf8"><para>ISO10646 UTF-8 String</para></enum>
152 </enumlist>
153 <para>The allowable values for the <replaceable>num-pres</replaceable>,
154 <replaceable>name-pres</replaceable>, and <replaceable>pres</replaceable>
155 fields are the following:</para>
156 <enumlist>
157 <enum name="allowed_not_screened">
158 <para>Presentation Allowed, Not Screened.</para>
159 </enum>
160 <enum name="allowed_passed_screen">
161 <para>Presentation Allowed, Passed Screen.</para>
162 </enum>
163 <enum name="allowed_failed_screen">
164 <para>Presentation Allowed, Failed Screen.</para>
165 </enum>
166 <enum name="allowed">
167 <para>Presentation Allowed, Network Number.</para>
168 </enum>
169 <enum name="prohib_not_screened">
170 <para>Presentation Prohibited, Not Screened.</para>
171 </enum>
172 <enum name="prohib_passed_screen">
173 <para>Presentation Prohibited, Passed Screen.</para>
174 </enum>
175 <enum name="prohib_failed_screen">
176 <para>Presentation Prohibited, Failed Screen.</para>
177 </enum>
178 <enum name="prohib">
179 <para>Presentation Prohibited, Network Number.</para>
180 </enum>
181 <enum name="unavailable">
182 <para>Number Unavailable.</para>
183 </enum>
184 </enumlist>
185 <variablelist>
186 <variable name="CALL_QUALIFIER">
187 <para>This is a special Caller ID-related variable
188 that can be used to enable sending the Call Qualifier
189 parameter in MDMF (Multiple Data Message Format)
190 Caller ID spills.</para>
191 <para>This variable is not automatically set by Asterisk.
192 You are responsible for setting it if/when needed.</para>
193 <para>Supporting Caller ID units will display the LDC
194 (Long Distance Call) indicator when they receive this parameter.</para>
195 <para>This option must be used with a channel driver
196 that allows Asterisk to generate the Caller ID spill,
197 which currently only includes <literal>chan_dahdi</literal>.</para>
198 </variable>
199 </variablelist>
200 </description>
201 </function>
202 <function name="CONNECTEDLINE" language="en_US">
203 <synopsis>
204 Gets or sets Connected Line data on the channel.
205 </synopsis>
206 <syntax>
207 <parameter name="datatype" required="true">
208 <para>The allowable datatypes are:</para>
209 <enumlist>
210 <enum name = "all" />
211 <enum name = "name" />
212 <enum name = "name-valid" />
213 <enum name = "name-charset" />
214 <enum name = "name-pres" />
215 <enum name = "num" />
216 <enum name = "num-valid" />
217 <enum name = "num-plan" />
218 <enum name = "num-pres" />
219 <enum name = "pres" />
220 <enum name = "subaddr" />
221 <enum name = "subaddr-valid" />
222 <enum name = "subaddr-type" />
223 <enum name = "subaddr-odd" />
224 <enum name = "tag" />
225 <enum name = "priv-all" />
226 <enum name = "priv-name" />
227 <enum name = "priv-name-valid" />
228 <enum name = "priv-name-charset" />
229 <enum name = "priv-name-pres" />
230 <enum name = "priv-num" />
231 <enum name = "priv-num-valid" />
232 <enum name = "priv-num-plan" />
233 <enum name = "priv-num-pres" />
234 <enum name = "priv-subaddr" />
235 <enum name = "priv-subaddr-valid" />
236 <enum name = "priv-subaddr-type" />
237 <enum name = "priv-subaddr-odd" />
238 <enum name = "priv-tag" />
239 </enumlist>
240 </parameter>
241 <parameter name="i">
242 <para>If set, this will prevent the channel from sending out protocol
243 messages because of the value being set</para>
244 </parameter>
245 </syntax>
246 <description>
247 <para>Gets or sets Connected Line data on the channel.</para>
248 <para>The <replaceable>pres</replaceable> field gets/sets a combined value
249 for <replaceable>name-pres</replaceable> and
250 <replaceable>num-pres</replaceable>.</para>
251 <para>The allowable values for the <replaceable>name-charset</replaceable>
252 field are the following:</para>
253 <enumlist>
254 <enum name = "unknown"><para>Unknown</para></enum>
255 <enum name = "iso8859-1"><para>ISO8859-1</para></enum>
256 <enum name = "withdrawn"><para>Withdrawn</para></enum>
257 <enum name = "iso8859-2"><para>ISO8859-2</para></enum>
258 <enum name = "iso8859-3"><para>ISO8859-3</para></enum>
259 <enum name = "iso8859-4"><para>ISO8859-4</para></enum>
260 <enum name = "iso8859-5"><para>ISO8859-5</para></enum>
261 <enum name = "iso8859-7"><para>ISO8859-7</para></enum>
262 <enum name = "bmp"><para>ISO10646 Bmp String</para></enum>
263 <enum name = "utf8"><para>ISO10646 UTF-8 String</para></enum>
264 </enumlist>
265 <para>The allowable values for the <replaceable>num-pres</replaceable>,
266 <replaceable>name-pres</replaceable>, and <replaceable>pres</replaceable>
267 fields are the following:</para>
268 <enumlist>
269 <enum name="allowed_not_screened">
270 <para>Presentation Allowed, Not Screened.</para>
271 </enum>
272 <enum name="allowed_passed_screen">
273 <para>Presentation Allowed, Passed Screen.</para>
274 </enum>
275 <enum name="allowed_failed_screen">
276 <para>Presentation Allowed, Failed Screen.</para>
277 </enum>
278 <enum name="allowed">
279 <para>Presentation Allowed, Network Number.</para>
280 </enum>
281 <enum name="prohib_not_screened">
282 <para>Presentation Prohibited, Not Screened.</para>
283 </enum>
284 <enum name="prohib_passed_screen">
285 <para>Presentation Prohibited, Passed Screen.</para>
286 </enum>
287 <enum name="prohib_failed_screen">
288 <para>Presentation Prohibited, Failed Screen.</para>
289 </enum>
290 <enum name="prohib">
291 <para>Presentation Prohibited, Network Number.</para>
292 </enum>
293 <enum name="unavailable">
294 <para>Number Unavailable.</para>
295 </enum>
296 </enumlist>
297 </description>
298 </function>
299 <function name="REDIRECTING" language="en_US">
300 <synopsis>
301 Gets or sets Redirecting data on the channel.
302 </synopsis>
303 <syntax>
304 <parameter name="datatype" required="true">
305 <para>The allowable datatypes are:</para>
306 <enumlist>
307 <enum name = "orig-all" />
308 <enum name = "orig-name" />
309 <enum name = "orig-name-valid" />
310 <enum name = "orig-name-charset" />
311 <enum name = "orig-name-pres" />
312 <enum name = "orig-num" />
313 <enum name = "orig-num-valid" />
314 <enum name = "orig-num-plan" />
315 <enum name = "orig-num-pres" />
316 <enum name = "orig-pres" />
317 <enum name = "orig-subaddr" />
318 <enum name = "orig-subaddr-valid" />
319 <enum name = "orig-subaddr-type" />
320 <enum name = "orig-subaddr-odd" />
321 <enum name = "orig-tag" />
322 <enum name = "orig-reason" />
323 <enum name = "from-all" />
324 <enum name = "from-name" />
325 <enum name = "from-name-valid" />
326 <enum name = "from-name-charset" />
327 <enum name = "from-name-pres" />
328 <enum name = "from-num" />
329 <enum name = "from-num-valid" />
330 <enum name = "from-num-plan" />
331 <enum name = "from-num-pres" />
332 <enum name = "from-pres" />
333 <enum name = "from-subaddr" />
334 <enum name = "from-subaddr-valid" />
335 <enum name = "from-subaddr-type" />
336 <enum name = "from-subaddr-odd" />
337 <enum name = "from-tag" />
338 <enum name = "to-all" />
339 <enum name = "to-name" />
340 <enum name = "to-name-valid" />
341 <enum name = "to-name-charset" />
342 <enum name = "to-name-pres" />
343 <enum name = "to-num" />
344 <enum name = "to-num-valid" />
345 <enum name = "to-num-plan" />
346 <enum name = "to-num-pres" />
347 <enum name = "to-pres" />
348 <enum name = "to-subaddr" />
349 <enum name = "to-subaddr-valid" />
350 <enum name = "to-subaddr-type" />
351 <enum name = "to-subaddr-odd" />
352 <enum name = "to-tag" />
353 <enum name = "priv-orig-all" />
354 <enum name = "priv-orig-name" />
355 <enum name = "priv-orig-name-valid" />
356 <enum name = "priv-orig-name-charset" />
357 <enum name = "priv-orig-name-pres" />
358 <enum name = "priv-orig-num" />
359 <enum name = "priv-orig-num-valid" />
360 <enum name = "priv-orig-num-plan" />
361 <enum name = "priv-orig-num-pres" />
362 <enum name = "priv-orig-subaddr" />
363 <enum name = "priv-orig-subaddr-valid" />
364 <enum name = "priv-orig-subaddr-type" />
365 <enum name = "priv-orig-subaddr-odd" />
366 <enum name = "priv-orig-tag" />
367 <enum name = "priv-from-all" />
368 <enum name = "priv-from-name" />
369 <enum name = "priv-from-name-valid" />
370 <enum name = "priv-from-name-charset" />
371 <enum name = "priv-from-name-pres" />
372 <enum name = "priv-from-num" />
373 <enum name = "priv-from-num-valid" />
374 <enum name = "priv-from-num-plan" />
375 <enum name = "priv-from-num-pres" />
376 <enum name = "priv-from-subaddr" />
377 <enum name = "priv-from-subaddr-valid" />
378 <enum name = "priv-from-subaddr-type" />
379 <enum name = "priv-from-subaddr-odd" />
380 <enum name = "priv-from-tag" />
381 <enum name = "priv-to-all" />
382 <enum name = "priv-to-name" />
383 <enum name = "priv-to-name-valid" />
384 <enum name = "priv-to-name-charset" />
385 <enum name = "priv-to-name-pres" />
386 <enum name = "priv-to-num" />
387 <enum name = "priv-to-num-valid" />
388 <enum name = "priv-to-num-plan" />
389 <enum name = "priv-to-num-pres" />
390 <enum name = "priv-to-subaddr" />
391 <enum name = "priv-to-subaddr-valid" />
392 <enum name = "priv-to-subaddr-type" />
393 <enum name = "priv-to-subaddr-odd" />
394 <enum name = "priv-to-tag" />
395 <enum name = "reason" />
396 <enum name = "count" />
397 </enumlist>
398 </parameter>
399 <parameter name="i">
400 <para>If set, this will prevent the channel from sending out protocol
401 messages because of the value being set</para>
402 </parameter>
403 </syntax>
404 <description>
405 <para>Gets or sets Redirecting data on the channel.</para>
406 <para>The <replaceable>orig-pres</replaceable>,
407 <replaceable>from-pres</replaceable> and <replaceable>to-pres</replaceable>
408 fields get/set a combined value for the corresponding
409 <replaceable>...-name-pres</replaceable> and <replaceable>...-num-pres</replaceable>
410 fields.</para>
411 <para>The recognized values for the <replaceable>reason</replaceable>
412 and <replaceable>orig-reason</replaceable> fields are the following:</para>
413 <enumlist>
414 <enum name = "away"><para>Callee is Away</para></enum>
415 <enum name = "cf_dte"><para>Call Forwarding By The Called DTE</para></enum>
416 <enum name = "cfb"><para>Call Forwarding Busy</para></enum>
417 <enum name = "cfnr"><para>Call Forwarding No Reply</para></enum>
418 <enum name = "cfu"><para>Call Forwarding Unconditional</para></enum>
419 <enum name = "deflection"><para>Call Deflection</para></enum>
420 <enum name = "dnd"><para>Do Not Disturb</para></enum>
421 <enum name = "follow_me"><para>Follow Me</para></enum>
422 <enum name = "out_of_order"><para>Called DTE Out-Of-Order</para></enum>
423 <enum name = "send_to_vm"><para>Send the call to voicemail</para></enum>
424 <enum name = "time_of_day"><para>Time of Day</para></enum>
425 <enum name = "unavailable"><para>Callee is Unavailable</para></enum>
426 <enum name = "unknown"><para>Unknown</para></enum>
427 </enumlist>
428 <note><para>You can set a user defined reason string that SIP can
429 send/receive instead. The user defined reason string my need to be
430 quoted depending upon SIP or the peer's requirements. These strings
431 are treated as unknown by the non-SIP channel drivers.</para></note>
432 <para>The allowable values for the <replaceable>xxx-name-charset</replaceable>
433 field are the following:</para>
434 <enumlist>
435 <enum name = "unknown"><para>Unknown</para></enum>
436 <enum name = "iso8859-1"><para>ISO8859-1</para></enum>
437 <enum name = "withdrawn"><para>Withdrawn</para></enum>
438 <enum name = "iso8859-2"><para>ISO8859-2</para></enum>
439 <enum name = "iso8859-3"><para>ISO8859-3</para></enum>
440 <enum name = "iso8859-4"><para>ISO8859-4</para></enum>
441 <enum name = "iso8859-5"><para>ISO8859-5</para></enum>
442 <enum name = "iso8859-7"><para>ISO8859-7</para></enum>
443 <enum name = "bmp"><para>ISO10646 Bmp String</para></enum>
444 <enum name = "utf8"><para>ISO10646 UTF-8 String</para></enum>
445 </enumlist>
446 </description>
447 </function>
448 ***/
449
455
457 AST_APP_ARG(member); /*!< Member name */
458 AST_APP_ARG(opts); /*!< Options token */
459 AST_APP_ARG(other); /*!< Any remining unused arguments */
460 );
461
463 AST_APP_ARG(subnames[10]); /*!< Option member subnames */
464 );
465
468};
470 CONNECTED_LINE_OPT_DUMMY, /*!< Delete this if CONNECTED_LINE ever gets an option with parameters. */
471
472 /*! \note This entry _MUST_ be the last one in the enum */
475
479
482};
484 REDIRECTING_OPT_DUMMY, /*!< Delete this if REDIRECTING ever gets an option with parameters. */
485
486 /*! \note This entry _MUST_ be the last one in the enum */
489
493
494/*!
495 * \internal
496 * \brief Read values from the party name struct.
497 * \since 1.8
498 *
499 * \param buf Buffer to fill with read value.
500 * \param len Length of the buffer.
501 * \param argc Number of party member subnames.
502 * \param argv Party member subnames given.
503 * \param name Party name to get values from.
504 *
505 * \retval ID_FIELD_VALID on success.
506 * \retval ID_FIELD_UNKNOWN on unknown field name.
507 */
508static enum ID_FIELD_STATUS party_name_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_name *name)
509{
511
513
514 if (argc == 0) {
515 /* We want the name string */
516 if (name->valid && name->str) {
517 ast_copy_string(buf, name->str, len);
518 }
519 } else if (argc == 1 && !strcasecmp("valid", argv[0])) {
520 snprintf(buf, len, "%d", name->valid);
521 } else if (argc == 1 && !strcasecmp("charset", argv[0])) {
523 } else if (argc == 1 && !strncasecmp("pres", argv[0], 4)) {
524 /* Accept pres[entation] */
526 } else {
528 }
529
530 return status;
531}
532
533/*!
534 * \internal
535 * \brief Read values from the party number struct.
536 * \since 1.8
537 *
538 * \param buf Buffer to fill with read value.
539 * \param len Length of the buffer.
540 * \param argc Number of party member subnames.
541 * \param argv Party member subnames given.
542 * \param number Party number to get values from.
543 *
544 * \retval ID_FIELD_VALID on success.
545 * \retval ID_FIELD_UNKNOWN on unknown field name.
546 */
547static enum ID_FIELD_STATUS party_number_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_number *number)
548{
550
552
553 if (argc == 0) {
554 /* We want the number string */
555 if (number->valid && number->str) {
557 }
558 } else if (argc == 1 && !strcasecmp("valid", argv[0])) {
559 snprintf(buf, len, "%d", number->valid);
560 } else if (argc == 1 && !strcasecmp("plan", argv[0])) {
561 snprintf(buf, len, "%d", number->plan);
562 } else if (argc == 1 && !strncasecmp("pres", argv[0], 4)) {
563 /* Accept pres[entation] */
565 } else {
567 }
568
569 return status;
570}
571
572/*!
573 * \internal
574 * \brief Read values from the party subaddress struct.
575 * \since 1.8
576 *
577 * \param buf Buffer to fill with read value.
578 * \param len Length of the buffer.
579 * \param argc Number of party member subnames.
580 * \param argv Party member subnames given.
581 * \param subaddress Party subaddress to get values from.
582 *
583 * \retval ID_FIELD_VALID on success.
584 * \retval ID_FIELD_UNKNOWN on unknown field name.
585 */
586static enum ID_FIELD_STATUS party_subaddress_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_subaddress *subaddress)
587{
589
591
592 if (argc == 0) {
593 /* We want the subaddress string */
594 if (subaddress->str) {
595 ast_copy_string(buf, subaddress->str, len);
596 }
597 } else if (argc == 1 && !strcasecmp("valid", argv[0])) {
598 snprintf(buf, len, "%d", subaddress->valid);
599 } else if (argc == 1 && !strcasecmp("type", argv[0])) {
600 snprintf(buf, len, "%d", subaddress->type);
601 } else if (argc == 1 && !strcasecmp("odd", argv[0])) {
602 snprintf(buf, len, "%d", subaddress->odd_even_indicator);
603 } else {
605 }
606
607 return status;
608}
609
610/*!
611 * \internal
612 * \brief Read values from the party id struct.
613 * \since 1.8
614 *
615 * \param buf Buffer to fill with read value.
616 * \param len Length of the buffer.
617 * \param argc Number of party member subnames.
618 * \param argv Party member subnames given.
619 * \param id Party id to get values from.
620 *
621 * \retval ID_FIELD_VALID on success.
622 * \retval ID_FIELD_UNKNOWN on unknown field name.
623 */
624static enum ID_FIELD_STATUS party_id_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_id *id)
625{
627
628 if (argc == 0) {
629 /* Must have at least one subname. */
630 return ID_FIELD_UNKNOWN;
631 }
632
634
635 if (argc == 1 && !strcasecmp("all", argv[0])) {
636 snprintf(buf, len, "\"%s\" <%s>",
637 S_COR(id->name.valid, id->name.str, ""),
638 S_COR(id->number.valid, id->number.str, ""));
639 } else if (!strcasecmp("name", argv[0])) {
640 status = party_name_read(buf, len, argc - 1, argv + 1, &id->name);
641 } else if (!strncasecmp("num", argv[0], 3)) {
642 /* Accept num[ber] */
643 status = party_number_read(buf, len, argc - 1, argv + 1, &id->number);
644 } else if (!strncasecmp("subaddr", argv[0], 7)) {
645 /* Accept subaddr[ess] */
646 status = party_subaddress_read(buf, len, argc - 1, argv + 1, &id->subaddress);
647 } else if (argc == 1 && !strcasecmp("tag", argv[0])) {
648 if (id->tag) {
649 ast_copy_string(buf, id->tag, len);
650 }
651 } else if (argc == 1 && !strcasecmp("ton", argv[0])) {
652 /* ton is an alias for num-plan */
653 snprintf(buf, len, "%d", id->number.plan);
654 } else if (argc == 1 && !strncasecmp("pres", argv[0], 4)) {
655 /*
656 * Accept pres[entation]
657 * This is the combined name/number presentation.
658 */
661 } else {
663 }
664
665 return status;
666}
667
668/*!
669 * \internal
670 * \brief Write new values to the party name struct
671 * \since 1.8
672 *
673 * \param name Party name struct to write values
674 * \param argc Number of party member subnames.
675 * \param argv Party member subnames given.
676 * \param value Value to assign to the party name.
677 *
678 * \retval ID_FIELD_VALID on success.
679 * \retval ID_FIELD_INVALID on error with field value.
680 * \retval ID_FIELD_UNKNOWN on unknown field name.
681 */
682static enum ID_FIELD_STATUS party_name_write(struct ast_party_name *name, int argc, char *argv[], const char *value)
683{
684 char *val;
686
688
689 if (argc == 0) {
690 /* We are setting the name string */
691 name->valid = 1;
692 name->str = ast_strdup(value);
693 ast_trim_blanks(name->str);
694 } else if (argc == 1 && !strcasecmp("valid", argv[0])) {
695 name->valid = atoi(value) ? 1 : 0;
696 } else if (argc == 1 && !strcasecmp("charset", argv[0])) {
697 int char_set;
698
701
702 if (('0' <= val[0]) && (val[0] <= '9')) {
703 char_set = atoi(val);
704 } else {
706 }
707
708 if (char_set < 0) {
710 "Unknown name char-set '%s', value unchanged\n", val);
712 } else {
713 name->char_set = char_set;
714 }
715 } else if (argc == 1 && !strncasecmp("pres", argv[0], 4)) {
716 int pres;
717
718 /* Accept pres[entation] */
721
722 if (('0' <= val[0]) && (val[0] <= '9')) {
723 pres = atoi(val);
724 } else {
726 }
727
728 if (pres < 0) {
730 "Unknown name presentation '%s', value unchanged\n", val);
732 } else {
733 name->presentation = pres;
734 }
735 } else {
737 }
738
739 return status;
740}
741
742/*!
743 * \internal
744 * \brief Write new values to the party number struct
745 * \since 1.8
746 *
747 * \param number Party number struct to write values
748 * \param argc Number of party member subnames.
749 * \param argv Party member subnames given.
750 * \param value Value to assign to the party number.
751 *
752 * \retval ID_FIELD_VALID on success.
753 * \retval ID_FIELD_INVALID on error with field value.
754 * \retval ID_FIELD_UNKNOWN on unknown field name.
755 */
756static enum ID_FIELD_STATUS party_number_write(struct ast_party_number *number, int argc, char *argv[], const char *value)
757{
758 char *val;
760
762
763 if (argc == 0) {
764 /* We are setting the number string */
765 number->valid = 1;
766 number->str = ast_strdup(value);
768 } else if (argc == 1 && !strcasecmp("valid", argv[0])) {
769 number->valid = atoi(value) ? 1 : 0;
770 } else if (argc == 1 && !strcasecmp("plan", argv[0])) {
773
774 if (('0' <= val[0]) && (val[0] <= '9')) {
775 number->plan = atoi(val);
776 } else {
778 "Unknown type-of-number/numbering-plan '%s', value unchanged\n", val);
780 }
781 } else if (argc == 1 && !strncasecmp("pres", argv[0], 4)) {
782 int pres;
783
784 /* Accept pres[entation] */
787
788 if (('0' <= val[0]) && (val[0] <= '9')) {
789 pres = atoi(val);
790 } else {
792 }
793
794 if (pres < 0) {
796 "Unknown number presentation '%s', value unchanged\n", val);
798 } else {
799 number->presentation = pres;
800 }
801 } else {
803 }
804
805 return status;
806}
807
808/*!
809 * \internal
810 * \brief Write new values to the party subaddress struct
811 * \since 1.8
812 *
813 * \param subaddress Party subaddress struct to write values
814 * \param argc Number of party member subnames.
815 * \param argv Party member subnames given.
816 * \param value Value to assign to the party subaddress.
817 *
818 * \retval ID_FIELD_VALID on success.
819 * \retval ID_FIELD_INVALID on error with field value.
820 * \retval ID_FIELD_UNKNOWN on unknown field name.
821 */
822static enum ID_FIELD_STATUS party_subaddress_write(struct ast_party_subaddress *subaddress, int argc, char *argv[], const char *value)
823{
825
827
828 if (argc == 0) {
829 /* We are setting the subaddress string */
830 subaddress->str = ast_strdup(value);
831 ast_trim_blanks(subaddress->str);
832 } else if (argc == 1 && !strcasecmp("valid", argv[0])) {
833 subaddress->valid = atoi(value) ? 1 : 0;
834 } else if (argc == 1 && !strcasecmp("type", argv[0])) {
835 subaddress->type = atoi(value) ? 2 : 0;
836 } else if (argc == 1 && !strcasecmp("odd", argv[0])) {
837 subaddress->odd_even_indicator = atoi(value) ? 1 : 0;
838 } else {
840 }
841
842 return status;
843}
844
845/*!
846 * \internal
847 * \brief Write new values to the party id struct
848 * \since 1.8
849 *
850 * \param id Party ID struct to write values
851 * \param argc Number of party member subnames.
852 * \param argv Party member subnames given.
853 * \param value Value to assign to the party id.
854 *
855 * \retval ID_FIELD_VALID on success.
856 * \retval ID_FIELD_INVALID on error with field value.
857 * \retval ID_FIELD_UNKNOWN on unknown field name.
858 */
859static enum ID_FIELD_STATUS party_id_write(struct ast_party_id *id, int argc, char *argv[], const char *value)
860{
861 char *val;
863
864 if (argc == 0) {
865 /* Must have at least one subname. */
866 return ID_FIELD_UNKNOWN;
867 }
868
870
871 if (argc == 1 && !strcasecmp("all", argv[0])) {
872 char name[256];
873 char num[256];
874
875 ast_callerid_split(value, name, sizeof(name), num, sizeof(num));
876 id->name.valid = 1;
877 id->name.str = ast_strdup(name);
878 if (!id->name.str) {
879 return ID_FIELD_INVALID;
880 }
881 id->number.valid = 1;
882 id->number.str = ast_strdup(num);
883 if (!id->number.str) {
884 return ID_FIELD_INVALID;
885 }
886 } else if (!strcasecmp("name", argv[0])) {
887 status = party_name_write(&id->name, argc - 1, argv + 1, value);
888 } else if (!strncasecmp("num", argv[0], 3)) {
889 /* Accept num[ber] */
890 status = party_number_write(&id->number, argc - 1, argv + 1, value);
891 } else if (!strncasecmp("subaddr", argv[0], 7)) {
892 /* Accept subaddr[ess] */
893 status = party_subaddress_write(&id->subaddress, argc - 1, argv + 1, value);
894 } else if (argc == 1 && !strcasecmp("tag", argv[0])) {
895 id->tag = ast_strdup(value);
896 ast_trim_blanks(id->tag);
897 } else if (argc == 1 && !strcasecmp("ton", argv[0])) {
898 /* ton is an alias for num-plan */
899 argv[0] = "plan";
900 status = party_number_write(&id->number, argc, argv, value);
901 } else if (argc == 1 && !strncasecmp("pres", argv[0], 4)) {
902 int pres;
903
904 /*
905 * Accept pres[entation]
906 * This is the combined name/number presentation.
907 */
910
911 if (('0' <= val[0]) && (val[0] <= '9')) {
912 pres = atoi(val);
913 } else {
915 }
916
917 if (pres < 0) {
919 "Unknown combined presentation '%s', value unchanged\n", val);
921 } else {
922 id->name.presentation = pres;
923 id->number.presentation = pres;
924 }
925 } else {
927 }
928
929 return status;
930}
931
932/*!
933 * \internal
934 * \brief Read values from the caller-id information struct.
935 *
936 * \param chan Asterisk channel to read
937 * \param cmd Not used
938 * \param data Caller-id function datatype string
939 * \param buf Buffer to fill with read value.
940 * \param len Length of the buffer
941 *
942 * \retval 0 on success.
943 * \retval -1 on error.
944 */
945static int callerid_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
946{
947 char *parms;
948 struct ast_party_members member = { 0, };
950 AST_APP_ARG(member); /*!< Member name */
951 AST_APP_ARG(cid); /*!< Optional caller id to parse instead of from the channel. */
952 );
953
954 /* Ensure that the buffer is empty */
955 *buf = 0;
956
957 if (!chan) {
958 return -1;
959 }
960
961 parms = ast_strdupa(data);
963 if (args.argc == 0) {
964 /* Must have at least one argument. */
965 return -1;
966 }
967
969 if (member.argc == 0 || ARRAY_LEN(member.subnames) <= member.argc) {
970 /* Too few or too many subnames */
971 return -1;
972 }
973
974 if (args.argc == 2) {
975 char name[80];
976 char num[80];
977
978 ast_callerid_split(args.cid, name, sizeof(name), num, sizeof(num));
979
980 if (member.argc == 1 && !strcasecmp("all", member.subnames[0])) {
981 snprintf(buf, len, "\"%s\" <%s>", name, num);
982 } else if (member.argc == 1 && !strcasecmp("name", member.subnames[0])) {
984 } else if (member.argc == 1 && !strncasecmp("num", member.subnames[0], 3)) {
985 /* Accept num[ber] */
986 ast_copy_string(buf, num, len);
987 } else {
988 ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
989 }
990 } else {
992 ast_channel_lock(chan);
993
994 if (member.argc == 1 && !strcasecmp("rdnis", member.subnames[0])) {
995 if (ast_channel_redirecting(chan)->from.number.valid
996 && ast_channel_redirecting(chan)->from.number.str) {
997 ast_copy_string(buf, ast_channel_redirecting(chan)->from.number.str, len);
998 }
999 } else if (!strcasecmp("dnid", member.subnames[0])) {
1000 if (member.argc == 1) {
1001 /* Setup as if user had given dnid-num instead. */
1002 member.argc = 2;
1003 member.subnames[1] = "num";
1004 }
1005 if (!strncasecmp("num", member.subnames[1], 3)) {
1006 /*
1007 * Accept num[ber]
1008 * dnid-num...
1009 */
1010 if (member.argc == 2) {
1011 /* dnid-num */
1012 if (ast_channel_dialed(chan)->number.str) {
1014 }
1015 } else if (member.argc == 3 && !strcasecmp("plan", member.subnames[2])) {
1016 /* dnid-num-plan */
1017 snprintf(buf, len, "%d", ast_channel_dialed(chan)->number.plan);
1018 } else {
1019 ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
1020 }
1021 } else if (!strncasecmp("subaddr", member.subnames[1], 7)) {
1022 /*
1023 * Accept subaddr[ess]
1024 * dnid-subaddr...
1025 */
1026 status = party_subaddress_read(buf, len, member.argc - 2, member.subnames + 2,
1027 &ast_channel_dialed(chan)->subaddress);
1028 switch (status) {
1029 case ID_FIELD_VALID:
1030 case ID_FIELD_INVALID:
1031 break;
1032 default:
1033 ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
1034 break;
1035 }
1036 } else {
1037 ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
1038 }
1039 } else if (member.argc == 1 && !strcasecmp("ani2", member.subnames[0])) {
1040 snprintf(buf, len, "%d", ast_channel_caller(chan)->ani2);
1041 } else if (!strcasecmp("ani", member.subnames[0])) {
1042 if (member.argc == 1) {
1043 /* Setup as if user had given ani-num instead. */
1044 member.argc = 2;
1045 member.subnames[1] = "num";
1046 }
1047 status = party_id_read(buf, len, member.argc - 1, member.subnames + 1,
1048 &ast_channel_caller(chan)->ani);
1049 switch (status) {
1050 case ID_FIELD_VALID:
1051 case ID_FIELD_INVALID:
1052 break;
1053 default:
1054 ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
1055 break;
1056 }
1057 } else if (!strcasecmp("priv", member.subnames[0])) {
1058 status = party_id_read(buf, len, member.argc - 1, member.subnames + 1,
1059 &ast_channel_caller(chan)->priv);
1060 switch (status) {
1061 case ID_FIELD_VALID:
1062 case ID_FIELD_INVALID:
1063 break;
1064 default:
1065 ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
1066 break;
1067 }
1068 } else {
1069 status = party_id_read(buf, len, member.argc, member.subnames, &ast_channel_caller(chan)->id);
1070 switch (status) {
1071 case ID_FIELD_VALID:
1072 case ID_FIELD_INVALID:
1073 break;
1074 default:
1075 ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
1076 break;
1077 }
1078 }
1079
1080 ast_channel_unlock(chan);
1081 }
1082
1083 return 0;
1084}
1085
1086/*!
1087 * \internal
1088 * \brief Write new values to the caller-id information struct.
1089 *
1090 * \param chan Asterisk channel to update
1091 * \param cmd Not used
1092 * \param data Caller-id function datatype string
1093 * \param value Value to assign to the caller-id information struct.
1094 *
1095 * \retval 0 on success.
1096 * \retval -1 on error.
1097 */
1098static int callerid_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
1099{
1100 struct ast_party_caller caller;
1101 struct ast_party_dialed dialed;
1103 char *val;
1104 char *parms;
1105 struct ast_party_func_args args = { 0, };
1106 struct ast_party_members member = { 0, };
1107
1108 if (!value || !chan) {
1109 return -1;
1110 }
1111
1112 parms = ast_strdupa(data);
1114 if (args.argc == 0) {
1115 /* Must have at least one argument. */
1116 return -1;
1117 }
1118
1119 AST_NONSTANDARD_APP_ARGS(member, args.member, '-');
1120 if (member.argc == 0 || ARRAY_LEN(member.subnames) <= member.argc) {
1121 /* Too few or too many subnames */
1122 return -1;
1123 }
1124
1126
1127 ast_channel_lock(chan);
1128 if (member.argc == 1 && !strcasecmp("rdnis", member.subnames[0])) {
1130 ast_free(ast_channel_redirecting(chan)->from.number.str);
1132 } else if (!strcasecmp("dnid", member.subnames[0])) {
1134 if (member.argc == 1) {
1135 /* Setup as if user had given dnid-num instead. */
1136 member.argc = 2;
1137 member.subnames[1] = "num";
1138 }
1139 if (!strncasecmp("num", member.subnames[1], 3)) {
1140 /*
1141 * Accept num[ber]
1142 * dnid-num...
1143 */
1144 if (member.argc == 2) {
1145 /* dnid-num */
1146 dialed.number.str = ast_strdup(value);
1147 ast_trim_blanks(dialed.number.str);
1149 } else if (member.argc == 3 && !strcasecmp("plan", member.subnames[2])) {
1150 /* dnid-num-plan */
1153
1154 if (('0' <= val[0]) && (val[0] <= '9')) {
1155 ast_channel_dialed(chan)->number.plan = atoi(val);
1156 } else {
1158 "Unknown type-of-number/numbering-plan '%s', value unchanged\n", val);
1159 }
1160 } else {
1161 ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
1162 }
1163 } else if (!strncasecmp("subaddr", member.subnames[1], 7)) {
1164 /*
1165 * Accept subaddr[ess]
1166 * dnid-subaddr...
1167 */
1168 status = party_subaddress_write(&dialed.subaddress, member.argc - 2,
1169 member.subnames + 2, value);
1170 switch (status) {
1171 case ID_FIELD_VALID:
1173 break;
1174 case ID_FIELD_INVALID:
1175 break;
1176 default:
1177 ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
1178 break;
1179 }
1180 } else {
1181 ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
1182 }
1183 ast_party_dialed_free(&dialed);
1184 } else if (member.argc == 1 && !strcasecmp("ani2", member.subnames[0])) {
1187
1188 if (('0' <= val[0]) && (val[0] <= '9')) {
1189 ast_channel_caller(chan)->ani2 = atoi(val);
1190 } else {
1191 ast_log(LOG_ERROR, "Unknown callerid ani2 '%s', value unchanged\n", val);
1192 }
1193 } else if (!strcasecmp("ani", member.subnames[0])) {
1195 if (member.argc == 1) {
1196 /* Setup as if user had given ani-num instead. */
1197 member.argc = 2;
1198 member.subnames[1] = "num";
1199 }
1200 status = party_id_write(&caller.ani, member.argc - 1, member.subnames + 1, value);
1201 switch (status) {
1202 case ID_FIELD_VALID:
1204 break;
1205 case ID_FIELD_INVALID:
1206 break;
1207 default:
1208 ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
1209 break;
1210 }
1211 ast_party_caller_free(&caller);
1212 } else if (!strcasecmp("priv", member.subnames[0])) {
1214 status = party_id_write(&caller.priv, member.argc - 1, member.subnames + 1, value);
1215 switch (status) {
1216 case ID_FIELD_VALID:
1218 break;
1219 case ID_FIELD_INVALID:
1220 break;
1221 default:
1222 ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
1223 break;
1224 }
1225 ast_party_caller_free(&caller);
1226 } else {
1228 status = party_id_write(&caller.id, member.argc, member.subnames, value);
1229 switch (status) {
1230 case ID_FIELD_VALID:
1231 ast_channel_set_caller_event(chan, &caller, NULL);
1232 break;
1233 case ID_FIELD_INVALID:
1234 break;
1235 default:
1236 ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
1237 break;
1238 }
1239 ast_party_caller_free(&caller);
1240 }
1241 ast_channel_unlock(chan);
1242
1243 return 0;
1244}
1245
1246/*!
1247 * \internal
1248 * \brief Read values from the connected line information struct.
1249 *
1250 * \param chan Asterisk channel to read
1251 * \param cmd Not used
1252 * \param data Connected line function datatype string
1253 * \param buf Buffer to fill with read value.
1254 * \param len Length of the buffer
1255 *
1256 * \retval 0 on success.
1257 * \retval -1 on error.
1258 */
1259static int connectedline_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
1260{
1261 struct ast_party_members member = { 0, };
1262 char *read_what;
1264
1265 /* Ensure that the buffer is empty */
1266 *buf = 0;
1267
1268 if (!chan) {
1269 return -1;
1270 }
1271
1272 read_what = ast_strdupa(data);
1273 AST_NONSTANDARD_APP_ARGS(member, read_what, '-');
1274 if (member.argc == 0 || ARRAY_LEN(member.subnames) <= member.argc) {
1275 /* Too few or too many subnames */
1276 return -1;
1277 }
1278
1279 ast_channel_lock(chan);
1280
1281 if (member.argc == 1 && !strcasecmp("source", member.subnames[0])) {
1283 } else if (!strcasecmp("priv", member.subnames[0])) {
1284 status = party_id_read(buf, len, member.argc - 1, member.subnames + 1,
1285 &ast_channel_connected(chan)->priv);
1286 switch (status) {
1287 case ID_FIELD_VALID:
1288 case ID_FIELD_INVALID:
1289 break;
1290 default:
1291 ast_log(LOG_ERROR, "Unknown connectedline data type '%s'.\n", data);
1292 break;
1293 }
1294 } else {
1295 status = party_id_read(buf, len, member.argc, member.subnames, &ast_channel_connected(chan)->id);
1296 switch (status) {
1297 case ID_FIELD_VALID:
1298 case ID_FIELD_INVALID:
1299 break;
1300 default:
1301 ast_log(LOG_ERROR, "Unknown connectedline data type '%s'.\n", data);
1302 break;
1303 }
1304 }
1305
1306 ast_channel_unlock(chan);
1307
1308 return 0;
1309}
1310
1311/*!
1312 * \internal
1313 * \brief Write new values to the connected line information struct.
1314 *
1315 * \param chan Asterisk channel to update
1316 * \param cmd Not used
1317 * \param data Connected line function datatype string
1318 * \param value Value to assign to the connected line information struct.
1319 *
1320 * \retval 0 on success.
1321 * \retval -1 on error.
1322 */
1323static int connectedline_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
1324{
1326 char *val;
1327 char *parms;
1328 void (*set_it)(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update);
1329 struct ast_party_func_args args = { 0, };
1330 struct ast_party_members member = { 0, };
1331 struct ast_flags opts;
1332 char *opt_args[CONNECTED_LINE_OPT_ARG_ARRAY_SIZE];
1334
1335 if (!value || !chan) {
1336 return -1;
1337 }
1338
1339 parms = ast_strdupa(data);
1341 if (args.argc == 0) {
1342 /* Must have at least one argument. */
1343 return -1;
1344 }
1345
1346 AST_NONSTANDARD_APP_ARGS(member, args.member, '-');
1347 if (member.argc == 0 || ARRAY_LEN(member.subnames) <= member.argc) {
1348 /* Too few or too many subnames */
1349 return -1;
1350 }
1351
1352 if (ast_app_parse_options(connectedline_opts, &opts, opt_args, args.opts)) {
1353 /* General invalid option syntax. */
1354 return -1;
1355 }
1356
1357 /* Determine if the update indication inhibit option is present */
1360 } else {
1362 }
1363
1364 ast_channel_lock(chan);
1366 ast_channel_unlock(chan);
1367
1369
1370 if (member.argc == 1 && !strcasecmp("source", member.subnames[0])) {
1371 int source;
1372
1375
1376 if (('0' <= val[0]) && (val[0] <= '9')) {
1377 source = atoi(val);
1378 } else {
1380 }
1381
1382 if (source < 0) {
1383 ast_log(LOG_ERROR, "Unknown connectedline source '%s', value unchanged\n", val);
1384 } else {
1385 connected.source = source;
1386 set_it(chan, &connected, NULL);
1387 }
1388 } else if (!strcasecmp("priv", member.subnames[0])) {
1389 status = party_id_write(&connected.priv, member.argc - 1, member.subnames + 1, value);
1390 switch (status) {
1391 case ID_FIELD_VALID:
1392 set_it(chan, &connected, NULL);
1393 break;
1394 case ID_FIELD_INVALID:
1395 break;
1396 default:
1397 ast_log(LOG_ERROR, "Unknown connectedline data type '%s'.\n", data);
1398 break;
1399 }
1401 } else {
1402 status = party_id_write(&connected.id, member.argc, member.subnames, value);
1403 switch (status) {
1404 case ID_FIELD_VALID:
1405 set_it(chan, &connected, NULL);
1406 break;
1407 case ID_FIELD_INVALID:
1408 break;
1409 default:
1410 ast_log(LOG_ERROR, "Unknown connectedline data type '%s'.\n", data);
1411 break;
1412 }
1414 }
1415
1416 return 0;
1417}
1418
1419/*!
1420 * \internal
1421 * \brief Read values from the redirecting information struct.
1422 *
1423 * \param chan Asterisk channel to read
1424 * \param cmd Not used
1425 * \param data Redirecting function datatype string
1426 * \param buf Buffer to fill with read value.
1427 * \param len Length of the buffer
1428 *
1429 * \retval 0 on success.
1430 * \retval -1 on error.
1431 */
1432static int redirecting_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
1433{
1434 struct ast_party_members member = { 0, };
1435 char *read_what;
1436 const struct ast_party_redirecting *ast_redirecting;
1438
1439 /* Ensure that the buffer is empty */
1440 *buf = 0;
1441
1442 if (!chan) {
1443 return -1;
1444 }
1445
1446 read_what = ast_strdupa(data);
1447 AST_NONSTANDARD_APP_ARGS(member, read_what, '-');
1448 if (member.argc == 0 || ARRAY_LEN(member.subnames) <= member.argc) {
1449 /* Too few or too many subnames */
1450 return -1;
1451 }
1452
1453 ast_channel_lock(chan);
1454
1455 ast_redirecting = ast_channel_redirecting(chan);
1456 if (!strcasecmp("orig", member.subnames[0])) {
1457 if (member.argc == 2 && !strcasecmp("reason", member.subnames[1])) {
1459 ast_redirecting_reason_name(&ast_redirecting->orig_reason), len);
1460 } else {
1461 status = party_id_read(buf, len, member.argc - 1, member.subnames + 1,
1462 &ast_redirecting->orig);
1463 switch (status) {
1464 case ID_FIELD_VALID:
1465 case ID_FIELD_INVALID:
1466 break;
1467 default:
1468 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1469 break;
1470 }
1471 }
1472 } else if (!strcasecmp("from", member.subnames[0])) {
1473 status = party_id_read(buf, len, member.argc - 1, member.subnames + 1,
1474 &ast_redirecting->from);
1475 switch (status) {
1476 case ID_FIELD_VALID:
1477 case ID_FIELD_INVALID:
1478 break;
1479 default:
1480 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1481 break;
1482 }
1483 } else if (!strcasecmp("to", member.subnames[0])) {
1484 status = party_id_read(buf, len, member.argc - 1, member.subnames + 1,
1485 &ast_redirecting->to);
1486 switch (status) {
1487 case ID_FIELD_VALID:
1488 case ID_FIELD_INVALID:
1489 break;
1490 default:
1491 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1492 break;
1493 }
1494 } else if (member.argc == 1 && !strncasecmp("pres", member.subnames[0], 4)) {
1495 /*
1496 * Accept pres[entation]
1497 * This is the combined from name/number presentation.
1498 */
1501 ast_party_id_presentation(&ast_redirecting->from)), len);
1502 } else if (member.argc == 1 && !strcasecmp("reason", member.subnames[0])) {
1504 } else if (member.argc == 1 && !strcasecmp("count", member.subnames[0])) {
1505 snprintf(buf, len, "%d", ast_redirecting->count);
1506 } else if (1 < member.argc && !strcasecmp("priv", member.subnames[0])) {
1507 if (!strcasecmp("orig", member.subnames[1])) {
1508 status = party_id_read(buf, len, member.argc - 2, member.subnames + 2,
1509 &ast_redirecting->priv_orig);
1510 switch (status) {
1511 case ID_FIELD_VALID:
1512 case ID_FIELD_INVALID:
1513 break;
1514 default:
1515 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1516 break;
1517 }
1518 } else if (!strcasecmp("from", member.subnames[1])) {
1519 status = party_id_read(buf, len, member.argc - 2, member.subnames + 2,
1520 &ast_redirecting->priv_from);
1521 switch (status) {
1522 case ID_FIELD_VALID:
1523 case ID_FIELD_INVALID:
1524 break;
1525 default:
1526 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1527 break;
1528 }
1529 } else if (!strcasecmp("to", member.subnames[1])) {
1530 status = party_id_read(buf, len, member.argc - 2, member.subnames + 2,
1531 &ast_redirecting->priv_to);
1532 switch (status) {
1533 case ID_FIELD_VALID:
1534 case ID_FIELD_INVALID:
1535 break;
1536 default:
1537 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1538 break;
1539 }
1540 } else {
1541 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1542 }
1543 } else {
1544 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1545 }
1546
1547 ast_channel_unlock(chan);
1548
1549 return 0;
1550}
1551
1552/*!
1553 * \internal
1554 * \brief Write new values to the redirecting information struct.
1555 *
1556 * \param chan Asterisk channel to update
1557 * \param cmd Not used
1558 * \param data Redirecting function datatype string
1559 * \param value Value to assign to the redirecting information struct.
1560 *
1561 * \retval 0 on success.
1562 * \retval -1 on error.
1563 */
1564static int redirecting_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
1565{
1566 struct ast_party_redirecting redirecting;
1568 char *val;
1569 char *parms;
1570 void (*set_it)(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update);
1571 struct ast_party_func_args args = { 0, };
1572 struct ast_party_members member = { 0, };
1573 struct ast_flags opts;
1574 char *opt_args[REDIRECTING_OPT_ARG_ARRAY_SIZE];
1575
1576 if (!value || !chan) {
1577 return -1;
1578 }
1579
1580 parms = ast_strdupa(data);
1582 if (args.argc == 0) {
1583 /* Must have at least one argument. */
1584 return -1;
1585 }
1586
1587 AST_NONSTANDARD_APP_ARGS(member, args.member, '-');
1588 if (member.argc == 0 || ARRAY_LEN(member.subnames) <= member.argc) {
1589 /* Too few or too many subnames */
1590 return -1;
1591 }
1592
1593 if (ast_app_parse_options(redirecting_opts, &opts, opt_args, args.opts)) {
1594 /* General invalid option syntax. */
1595 return -1;
1596 }
1597
1598 /* Determine if the update indication inhibit option is present */
1601 } else {
1603 }
1604
1605 ast_channel_lock(chan);
1607 ast_channel_unlock(chan);
1608
1610
1611 if (!strcasecmp("orig", member.subnames[0])) {
1612 if (member.argc == 2 && !strcasecmp("reason", member.subnames[1])) {
1613 int reason;
1614
1617
1618 if (('0' <= val[0]) && (val[0] <= '9')) {
1619 reason = atoi(val);
1620 } else {
1622 }
1623
1624 if (reason < 0) {
1625 /* The argument passed into the function does not correspond to a pre-defined
1626 * reason, so we can just set the reason string to what was given and set the
1627 * code to be unknown
1628 */
1629 ast_log(LOG_WARNING, "Unknown redirecting reason '%s', defaulting to unknown\n", val);
1631 redirecting.orig_reason.str = val;
1632 set_it(chan, &redirecting, NULL);
1633 } else {
1634 redirecting.orig_reason.code = reason;
1635 redirecting.orig_reason.str = "";
1636 set_it(chan, &redirecting, NULL);
1637 }
1638 } else {
1639 status = party_id_write(&redirecting.orig, member.argc - 1, member.subnames + 1,
1640 value);
1641 switch (status) {
1642 case ID_FIELD_VALID:
1643 set_it(chan, &redirecting, NULL);
1644 break;
1645 case ID_FIELD_INVALID:
1646 break;
1647 default:
1648 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1649 break;
1650 }
1651 ast_party_redirecting_free(&redirecting);
1652 }
1653 } else if (!strcasecmp("from", member.subnames[0])) {
1654 status = party_id_write(&redirecting.from, member.argc - 1, member.subnames + 1,
1655 value);
1656 switch (status) {
1657 case ID_FIELD_VALID:
1658 set_it(chan, &redirecting, NULL);
1659 break;
1660 case ID_FIELD_INVALID:
1661 break;
1662 default:
1663 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1664 break;
1665 }
1666 ast_party_redirecting_free(&redirecting);
1667 } else if (!strcasecmp("to", member.subnames[0])) {
1668 status = party_id_write(&redirecting.to, member.argc - 1, member.subnames + 1, value);
1669 switch (status) {
1670 case ID_FIELD_VALID:
1671 set_it(chan, &redirecting, NULL);
1672 break;
1673 case ID_FIELD_INVALID:
1674 break;
1675 default:
1676 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1677 break;
1678 }
1679 ast_party_redirecting_free(&redirecting);
1680 } else if (member.argc == 1 && !strncasecmp("pres", member.subnames[0], 4)) {
1681 int pres;
1682
1685
1686 if (('0' <= val[0]) && (val[0] <= '9')) {
1687 pres = atoi(val);
1688 } else {
1690 }
1691
1692 if (pres < 0) {
1694 "Unknown redirecting combined presentation '%s', value unchanged\n", val);
1695 } else {
1696 redirecting.from.name.presentation = pres;
1697 redirecting.from.number.presentation = pres;
1698 redirecting.to.name.presentation = pres;
1699 redirecting.to.number.presentation = pres;
1700 set_it(chan, &redirecting, NULL);
1701 }
1702 } else if (member.argc == 1 && !strcasecmp("reason", member.subnames[0])) {
1703 int reason;
1704
1707
1708 if (('0' <= val[0]) && (val[0] <= '9')) {
1709 reason = atoi(val);
1710 } else {
1712 }
1713
1714 if (reason < 0) {
1715 /* The argument passed into the function does not correspond to a pre-defined
1716 * reason, so we can just set the reason string to what was given and set the
1717 * code to be unknown
1718 */
1719 ast_log(LOG_WARNING, "Unknown redirecting reason '%s', defaulting to unknown\n", val);
1721 redirecting.reason.str = val;
1722 set_it(chan, &redirecting, NULL);
1723 } else {
1724 redirecting.reason.code = reason;
1725 redirecting.reason.str = "";
1726 set_it(chan, &redirecting, NULL);
1727 }
1728 } else if (member.argc == 1 && !strcasecmp("count", member.subnames[0])) {
1731
1732 if (('0' <= val[0]) && (val[0] <= '9')) {
1733 redirecting.count = atoi(val);
1734 set_it(chan, &redirecting, NULL);
1735 } else {
1736 ast_log(LOG_ERROR, "Unknown redirecting count '%s', value unchanged\n", val);
1737 }
1738 } else if (1 < member.argc && !strcasecmp("priv", member.subnames[0])) {
1739 if (!strcasecmp("orig", member.subnames[1])) {
1740 status = party_id_write(&redirecting.priv_orig, member.argc - 2, member.subnames + 2,
1741 value);
1742 switch (status) {
1743 case ID_FIELD_VALID:
1744 set_it(chan, &redirecting, NULL);
1745 break;
1746 case ID_FIELD_INVALID:
1747 break;
1748 default:
1749 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1750 break;
1751 }
1752 ast_party_redirecting_free(&redirecting);
1753 } else if (!strcasecmp("from", member.subnames[1])) {
1754 status = party_id_write(&redirecting.priv_from, member.argc - 2, member.subnames + 2,
1755 value);
1756 switch (status) {
1757 case ID_FIELD_VALID:
1758 set_it(chan, &redirecting, NULL);
1759 break;
1760 case ID_FIELD_INVALID:
1761 break;
1762 default:
1763 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1764 break;
1765 }
1766 ast_party_redirecting_free(&redirecting);
1767 } else if (!strcasecmp("to", member.subnames[1])) {
1768 status = party_id_write(&redirecting.priv_to, member.argc - 2, member.subnames + 2, value);
1769 switch (status) {
1770 case ID_FIELD_VALID:
1771 set_it(chan, &redirecting, NULL);
1772 break;
1773 case ID_FIELD_INVALID:
1774 break;
1775 default:
1776 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1777 break;
1778 }
1779 ast_party_redirecting_free(&redirecting);
1780 } else {
1781 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1782 }
1783 } else {
1784 ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
1785 }
1786
1787 return 0;
1788}
1789
1791 .name = "CALLERID",
1792 .read = callerid_read,
1793 .read_max = 256,
1794 .write = callerid_write,
1795};
1796
1798 .name = "CONNECTEDLINE",
1799 .read = connectedline_read,
1800 .write = connectedline_write,
1801};
1802
1804 .name = "REDIRECTING",
1805 .read = redirecting_read,
1806 .write = redirecting_write,
1807};
1808
1809/*!
1810 * \internal
1811 * \brief Unload the function module
1812 *
1813 * \retval 0 on success.
1814 * \retval -1 on error.
1815 */
1816static int unload_module(void)
1817{
1821 return 0;
1822}
1823
1824/*!
1825 * \internal
1826 * \brief Load and initialize the function module.
1827 *
1828 * \retval AST_MODULE_LOAD_SUCCESS on success.
1829 * \retval AST_MODULE_LOAD_DECLINE on error.
1830 */
1831static int load_module(void)
1832{
1833 int res;
1834
1838
1839 if (res) {
1840 unload_module();
1842 }
1843
1845}
1846
1847/* Do not wrap the following line. */
1848AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Party ID related dialplan functions (Caller-ID, Connected-line, Redirecting)");
jack_status_t status
Definition: app_jack.c:146
enum queue_result id
Definition: app_queue.c:1638
Asterisk main include file. File version handling, generic pbx functions.
#define ast_free(a)
Definition: astmm.h:180
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:241
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:298
#define ast_log
Definition: astobj2.c:42
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
int ast_parse_caller_presentation(const char *data)
Convert caller ID text code to value (used in config file parsing)
Definition: callerid.c:1244
const char * ast_redirecting_reason_name(const struct ast_party_redirecting_reason *data)
Convert redirecting reason value to text code.
Definition: callerid.c:1350
const char * ast_party_name_charset_str(int data)
Convert ast_party_name.char_set value to text code.
Definition: callerid.c:1461
@ AST_REDIRECTING_REASON_UNKNOWN
Definition: callerid.h:485
int ast_party_name_charset_parse(const char *data)
Convert ast_party_name.char_set text code to value (used in config file parsing)
Definition: callerid.c:1435
int ast_redirecting_reason_parse(const char *data)
Convert redirecting reason text code to value (used in config file parsing)
Definition: callerid.c:1324
const char * ast_connected_line_source_name(int data)
Convert connected line update source value to text code.
Definition: callerid.c:1406
const char * ast_named_caller_presentation(int data)
Convert caller ID pres value to text code.
Definition: callerid.c:1283
int ast_connected_line_source_parse(const char *data)
Convert connected line update source text code to value (used in config file parsing)
Definition: callerid.c:1380
int ast_callerid_split(const char *src, char *name, int namelen, char *num, int numlen)
Definition: callerid.c:1193
const char *const subnames[]
Definition: chan_dahdi.c:916
General Asterisk PBX channel definitions.
void ast_party_dialed_set_init(struct ast_party_dialed *init, const struct ast_party_dialed *guide)
Initialize the given dialed structure using the given guide for a set update operation.
Definition: channel.c:1950
void ast_channel_set_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Set the redirecting id information in the Asterisk channel.
Definition: channel.c:9119
void ast_channel_set_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Set the connected line information in the Asterisk channel.
Definition: channel.c:8308
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
Definition: channel.c:1821
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
Definition: channel.c:2072
void ast_channel_set_caller_event(struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update)
Set the caller id information in the Asterisk channel and generate an AMI event if the caller id name...
Definition: channel.c:7372
#define ast_channel_lock(chan)
Definition: channel.h:2922
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
void ast_party_caller_set(struct ast_party_caller *dest, const struct ast_party_caller *src, const struct ast_set_party_caller *update)
Set the caller information based on another caller source.
Definition: channel.c:2007
void ast_channel_update_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Indicate that the connected line information has changed.
Definition: channel.c:9093
void ast_party_caller_set_init(struct ast_party_caller *init, const struct ast_party_caller *guide)
Initialize the given caller structure using the given guide for a set update operation.
Definition: channel.c:1999
void ast_party_dialed_free(struct ast_party_dialed *doomed)
Destroy the dialed party contents.
Definition: channel.c:1971
void ast_party_redirecting_set_init(struct ast_party_redirecting *init, const struct ast_party_redirecting *guide)
Initialize the given redirecting id structure using the given guide for a set update operation.
Definition: channel.c:2153
void ast_party_caller_free(struct ast_party_caller *doomed)
Destroy the caller party contents.
Definition: channel.c:2015
void ast_party_dialed_set(struct ast_party_dialed *dest, const struct ast_party_dialed *src)
Set the dialed information based on another dialed source.
Definition: channel.c:1958
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
void ast_channel_update_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Indicate that the redirecting id has changed.
Definition: channel.c:10284
void ast_party_redirecting_free(struct ast_party_redirecting *doomed)
Destroy the redirecting information contents.
Definition: channel.c:2179
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_party_connected_line_set_init(struct ast_party_connected_line *init, const struct ast_party_connected_line *guide)
Initialize the given connected line structure using the given guide for a set update operation.
Definition: channel.c:2045
#define ast_channel_unlock(chan)
Definition: channel.h:2923
static void update(int code_size, int y, int wi, int fi, int dq, int sr, int dqsez, struct g726_state *state_ptr)
Definition: codec_g726.c:367
char connected
Definition: eagi_proxy.c:82
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
static const char name[]
Definition: format_mp3.c:68
REDIRECTING_OPT_ARGS
@ REDIRECTING_OPT_ARG_ARRAY_SIZE
@ REDIRECTING_OPT_DUMMY
static enum ID_FIELD_STATUS party_id_write(struct ast_party_id *id, int argc, char *argv[], const char *value)
static enum ID_FIELD_STATUS party_name_write(struct ast_party_name *name, int argc, char *argv[], const char *value)
static enum ID_FIELD_STATUS party_number_write(struct ast_party_number *number, int argc, char *argv[], const char *value)
static int connectedline_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
ID_FIELD_STATUS
@ ID_FIELD_INVALID
@ ID_FIELD_VALID
@ ID_FIELD_UNKNOWN
CONNECTED_LINE_OPT_ARGS
@ CONNECTED_LINE_OPT_ARG_ARRAY_SIZE
@ CONNECTED_LINE_OPT_DUMMY
REDIRECTING_OPT_FLAGS
@ REDIRECTING_OPT_INHIBIT
static enum ID_FIELD_STATUS party_id_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_id *id)
static int redirecting_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
static enum ID_FIELD_STATUS party_subaddress_write(struct ast_party_subaddress *subaddress, int argc, char *argv[], const char *value)
static const struct ast_app_option redirecting_opts[128]
static enum ID_FIELD_STATUS party_name_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_name *name)
static enum ID_FIELD_STATUS party_subaddress_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_subaddress *subaddress)
static const struct ast_app_option connectedline_opts[128]
static enum ID_FIELD_STATUS party_number_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_number *number)
static int callerid_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
static int callerid_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static int load_module(void)
static struct ast_custom_function callerid_function
static int connectedline_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static struct ast_custom_function connectedline_function
static int unload_module(void)
CONNECTED_LINE_OPT_FLAGS
@ CONNECTED_LINE_OPT_INHIBIT
static int redirecting_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static struct ast_custom_function redirecting_function
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define END_OPTIONS
#define AST_DEFINE_APP_ARGS_TYPE(type, arglist)
Define a structure type to hold an application's arguments.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define BEGIN_OPTIONS
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
#define AST_NONSTANDARD_APP_ARGS(args, parse, sep)
Performs the 'nonstandard' argument separation process for an application.
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
Definition: main/app.c:3056
#define LOG_ERROR
#define LOG_WARNING
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
Definition: module.h:567
#define ASTERISK_GPL_KEY
The text the key() function should return.
Definition: module.h:46
@ AST_MODULE_LOAD_SUCCESS
Definition: module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
Core PBX routines and definitions.
#define ast_custom_function_register(acf)
Register a custom function.
Definition: pbx.h:1558
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
#define NULL
Definition: resample.c:96
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
Definition: strings.h:87
char * ast_trim_blanks(char *str)
Trims trailing whitespace characters from a string.
Definition: strings.h:186
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:425
char * ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
Definition: strings.h:161
Main Channel structure associated with a channel.
Data structure associated with a custom dialplan function.
Definition: pbx.h:118
const char * name
Definition: pbx.h:119
Structure used to handle boolean flags.
Definition: utils.h:199
Caller Party information.
Definition: channel.h:418
struct ast_party_id priv
Private caller party ID.
Definition: channel.h:430
struct ast_party_id id
Caller party ID.
Definition: channel.h:420
int ani2
Automatic Number Identification 2 (Info Digits)
Definition: channel.h:433
struct ast_party_id ani
Automatic Number Identification (ANI)
Definition: channel.h:427
Connected Line/Party information.
Definition: channel.h:456
Dialed/Called Party information.
Definition: channel.h:378
struct ast_party_dialed::@208 number
Dialed/Called number.
struct ast_party_subaddress subaddress
Dialed/Called subaddress.
Definition: channel.h:391
char * str
Subscriber phone number (Malloced)
Definition: channel.h:386
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
Definition: channel.h:388
Information needed to identify an endpoint in a call.
Definition: channel.h:338
struct ast_party_name name
Subscriber name.
Definition: channel.h:340
struct ast_party_number number
Subscriber phone number.
Definition: channel.h:342
Information needed to specify a name in a call.
Definition: channel.h:262
int presentation
Q.931 encoded presentation-indicator encoded field.
Definition: channel.h:277
Information needed to specify a number in a call.
Definition: channel.h:289
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
Definition: channel.h:295
unsigned char valid
TRUE if the number information is valid/present.
Definition: channel.h:297
char * str
Subscriber phone number (Malloced)
Definition: channel.h:291
int code
enum AST_REDIRECTING_REASON value for redirection
Definition: channel.h:510
char * str
a string value for the redirecting reason
Definition: channel.h:507
Redirecting Line information. RDNIS (Redirecting Directory Number Information Service) Where a call d...
Definition: channel.h:522
struct ast_party_id priv_to
Call is redirecting to a new party (Sent to the caller) - private representation.
Definition: channel.h:539
struct ast_party_redirecting_reason orig_reason
Reason for the redirection by the original party.
Definition: channel.h:545
struct ast_party_redirecting_reason reason
Reason for the redirection.
Definition: channel.h:542
struct ast_party_id priv_from
Who is redirecting the call (Sent to the party the call is redirected toward) - private representatio...
Definition: channel.h:536
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
Definition: channel.h:527
int count
Number of times the call was redirected.
Definition: channel.h:548
struct ast_party_id to
Call is redirecting to a new party (Sent to the caller)
Definition: channel.h:530
struct ast_party_id orig
Who originally redirected the call (Sent to the party the call is redirected toward)
Definition: channel.h:524
struct ast_party_id priv_orig
Who originally redirected the call (Sent to the party the call is redirected toward) - private repres...
Definition: channel.h:533
Information needed to specify a subaddress in a call.
Definition: channel.h:307
unsigned char odd_even_indicator
TRUE if odd number of address signals.
Definition: channel.h:326
unsigned char valid
TRUE if the subaddress information is valid/present.
Definition: channel.h:328
char * str
Malloced subaddress string.
Definition: channel.h:313
int type
Q.931 subaddress type.
Definition: channel.h:320
Indicate what information in ast_party_connected_line should be set.
Definition: channel.h:489
Indicate what information in ast_party_redirecting should be set.
Definition: channel.h:555
Number structure.
Definition: app_followme.c:154
Definition: ast_expr2.c:325
int value
Definition: syslog.c:37
const char * args
Utility functions.
#define ast_test_flag(p, flag)
Definition: utils.h:63
#define ARRAY_LEN(a)
Definition: utils.h:666