Asterisk - The Open Source Telephony Project GIT-master-27fb039
Loading...
Searching...
No Matches
channel_internal_api.c
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2012, Digium, Inc.
5 *
6 * Mark Spencer <markster@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*! \file
20 *
21 * \brief Channel Accessor API
22 *
23 * This file is intended to be the only file that ever accesses the
24 * internals of an ast_channel. All other files should use the
25 * accessor functions defined here.
26 *
27 * \author Terry Wilson
28 */
29
30/*** MODULEINFO
31 <support_level>core</support_level>
32 ***/
33
34#include "asterisk.h"
35
36#include <unistd.h>
37#include <fcntl.h>
38
39#include "asterisk/alertpipe.h"
40#include "asterisk/paths.h"
41#include "asterisk/channel.h"
43#include "asterisk/endpoints.h"
48#include "asterisk/stream.h"
49#include "asterisk/test.h"
50#include "asterisk/vector.h"
51#include "channel_private.h"
52#include "channelstorage.h"
53
54/*! \brief The current channel storage driver */
56/*! \brief The current channel storage instance */
58
59/*! \brief The monotonically increasing integer counter for channel uniqueids */
60static int uniqueint;
61
62/* ACCESSORS */
63
64#define DEFINE_STRINGFIELD_SETTERS_FOR(field, assert_on_null) \
65void ast_channel_##field##_set(struct ast_channel *chan, const char *value) \
66{ \
67 if ((assert_on_null)) ast_assert(!ast_strlen_zero(value)); \
68 if (!strcmp(value, chan->field)) return; \
69 ast_string_field_set(chan, field, value); \
70} \
71 \
72void ast_channel_##field##_build_va(struct ast_channel *chan, const char *fmt, va_list ap) \
73{ \
74 ast_string_field_build_va(chan, field, fmt, ap); \
75} \
76void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) \
77{ \
78 va_list ap; \
79 va_start(ap, fmt); \
80 ast_channel_##field##_build_va(chan, fmt, ap); \
81 va_end(ap); \
82}
83
84#define DEFINE_STRINGFIELD_SETTERS_AND_INVALIDATE_FOR(field, publish, assert_on_null, invalidate) \
85void ast_channel_##field##_set(struct ast_channel *chan, const char *value) \
86{ \
87 if ((assert_on_null)) ast_assert(!ast_strlen_zero(value)); \
88 if (!strcmp(value, chan->field)) return; \
89 ast_string_field_set(chan, field, value); \
90 ast_channel_snapshot_invalidate_segment(chan, invalidate); \
91 if (publish && ast_channel_internal_is_finalized(chan)) ast_channel_publish_snapshot(chan); \
92} \
93 \
94void ast_channel_##field##_build_va(struct ast_channel *chan, const char *fmt, va_list ap) \
95{ \
96 ast_string_field_build_va(chan, field, fmt, ap); \
97 ast_channel_snapshot_invalidate_segment(chan, invalidate); \
98 if (publish && ast_channel_internal_is_finalized(chan)) ast_channel_publish_snapshot(chan); \
99} \
100void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) \
101{ \
102 va_list ap; \
103 va_start(ap, fmt); \
104 ast_channel_##field##_build_va(chan, fmt, ap); \
105 va_end(ap); \
106}
107
110DEFINE_STRINGFIELD_SETTERS_FOR(latest_musicclass, 0);
118
119#define DEFINE_STRINGFIELD_GETTER_FOR(field) const char *ast_channel_##field(const struct ast_channel *chan) \
120{ \
121 return chan->field; \
122}
123
135
136void ast_channel_name_set(struct ast_channel *chan, const char *value)
137{
140 if (!strcmp(value, chan->name)) return;
143}
144
151
152void ast_channel_name_build(struct ast_channel *chan, const char *fmt, ...)
153{
154 va_list ap;
156 va_start(ap, fmt);
157 ast_channel_name_build_va(chan, fmt, ap);
158 va_end(ap);
159}
160
161const char *ast_channel_uniqueid(const struct ast_channel *chan)
162{
163 ast_assert(chan->uniqueid.unique_id[0] != '\0');
164 return chan->uniqueid.unique_id;
165}
166
167const char *ast_channel_linkedid(const struct ast_channel *chan)
168{
169 ast_assert(chan->linkedid.unique_id[0] != '\0');
170 return chan->linkedid.unique_id;
171}
172
173const char *ast_channel_tenantid(const struct ast_channel *chan)
174{
175 /* It's ok for tenantid to be empty, so no need to assert */
176 return chan->linkedid.tenant_id;
177}
178
187
188const char *ast_channel_appl(const struct ast_channel *chan)
189{
190 return chan->appl;
191}
197const char *ast_channel_blockproc(const struct ast_channel *chan)
198{
199 return chan->blockproc;
200}
201void ast_channel_blockproc_set(struct ast_channel *chan, const char *value)
202{
203 chan->blockproc = value;
204}
205const char *ast_channel_data(const struct ast_channel *chan)
206{
207 return chan->data;
208}
214
215const char *ast_channel_context(const struct ast_channel *chan)
216{
217 return chan->context;
218}
219const char *ast_channel_lastcontext(const struct ast_channel *chan)
220{
221 return chan->lastcontext;
222}
223void ast_channel_context_set(struct ast_channel *chan, const char *value)
224{
225 if (!*chan->lastcontext || strcmp(value, chan->context)) {
226 /* only copy to last context when it changes, unless it's empty to begin with */
227 ast_copy_string(chan->lastcontext, chan->context, sizeof(chan->lastcontext));
228 }
229 ast_copy_string(chan->context, value, sizeof(chan->context));
231}
232const char *ast_channel_exten(const struct ast_channel *chan)
233{
234 return chan->exten;
235}
236const char *ast_channel_lastexten(const struct ast_channel *chan)
237{
238 return chan->lastexten;
239}
240void ast_channel_exten_set(struct ast_channel *chan, const char *value)
241{
242 if (!*chan->lastexten || strcmp(value, chan->exten)) {
243 /* only copy to last exten when it changes, unless it's empty to begin with */
244 ast_copy_string(chan->lastexten, chan->exten, sizeof(chan->lastexten));
245 }
246 ast_copy_string(chan->exten, value, sizeof(chan->exten));
248}
249
251{
252 return chan->dtmf_digit_to_emulate;
253}
258
260{
261 return chan->sending_dtmf_digit;
262}
264{
266}
267
268struct timeval ast_channel_sending_dtmf_tv(const struct ast_channel *chan)
269{
270 return chan->sending_dtmf_tv;
271}
272void ast_channel_sending_dtmf_tv_set(struct ast_channel *chan, struct timeval value)
273{
274 chan->sending_dtmf_tv = value;
275}
276
278{
279 return chan->amaflags;
280}
281
283{
284 if (chan->amaflags == value) {
285 return;
286 }
287 chan->amaflags = value;
289}
290int ast_channel_fdno(const struct ast_channel *chan)
291{
292 return chan->fdno;
293}
295{
296 chan->fdno = value;
297}
299{
300 return chan->hangupcause;
301}
308{
309 return chan->tech_hangupcause;
310}
316int ast_channel_priority(const struct ast_channel *chan)
317{
318 return chan->priority;
319}
325int ast_channel_rings(const struct ast_channel *chan)
326{
327 return chan->rings;
328}
330{
331 chan->rings = value;
332}
333int ast_channel_streamid(const struct ast_channel *chan)
334{
335 return chan->streamid;
336}
338{
339 chan->streamid = value;
340}
341int ast_channel_timingfd(const struct ast_channel *chan)
342{
343 return chan->timingfd;
344}
346{
347 chan->timingfd = value;
348}
350{
351 return chan->visible_indication;
352}
354{
356}
357int ast_channel_hold_state(const struct ast_channel *chan)
358{
359 return chan->hold_state;
360}
362{
363 chan->hold_state = value;
364}
365int ast_channel_vstreamid(const struct ast_channel *chan)
366{
367 return chan->vstreamid;
368}
370{
371 chan->vstreamid = value;
372}
373unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
374{
375 return chan->transfercapability;
376}
377void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value)
378{
380}
381unsigned int ast_channel_emulate_dtmf_duration(const struct ast_channel *chan)
382{
383 return chan->emulate_dtmf_duration;
384}
386{
388}
389unsigned int ast_channel_fin(const struct ast_channel *chan)
390{
391 return chan->fin;
392}
393void ast_channel_fin_set(struct ast_channel *chan, unsigned int value)
394{
395 chan->fin = value;
396}
397unsigned int ast_channel_fout(const struct ast_channel *chan)
398{
399 return chan->fout;
400}
401void ast_channel_fout_set(struct ast_channel *chan, unsigned int value)
402{
403 chan->fout = value;
404}
405unsigned long ast_channel_insmpl(const struct ast_channel *chan)
406{
407 return chan->insmpl;
408}
409void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value)
410{
411 chan->insmpl = value;
412}
413unsigned long ast_channel_outsmpl(const struct ast_channel *chan)
414{
415 return chan->outsmpl;
416}
417void ast_channel_outsmpl_set(struct ast_channel *chan, unsigned long value)
418{
419 chan->outsmpl = value;
420}
421void *ast_channel_generatordata(const struct ast_channel *chan)
422{
423 return chan->generatordata;
424}
426{
427 chan->generatordata = value;
428}
429void *ast_channel_music_state(const struct ast_channel *chan)
430{
431 return chan->music_state;
432}
434{
435 chan->music_state = value;
436}
437void *ast_channel_tech_pvt(const struct ast_channel *chan)
438{
439 return chan->tech_pvt;
440}
448void *ast_channel_timingdata(const struct ast_channel *chan)
449{
450 return chan->timingdata;
451}
453{
454 chan->timingdata = value;
455}
457{
458 return chan->audiohooks;
459}
461{
462 chan->audiohooks = value;
463}
464struct ast_cdr *ast_channel_cdr(const struct ast_channel *chan)
465{
466 return chan->cdr;
467}
468void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr *value)
469{
470 chan->cdr = value;
471}
472struct ast_channel *ast_channel_masq(const struct ast_channel *chan)
473{
474 return chan->masq;
475}
477{
478 chan->masq = value;
479}
480struct ast_channel *ast_channel_masqr(const struct ast_channel *chan)
481{
482 return chan->masqr;
483}
485{
486 chan->masqr = value;
487}
489{
490 return chan->stream;
491}
493{
494 chan->stream = value;
495}
497{
498 return chan->vstream;
499}
501{
502 chan->vstream = value;
503}
505{
506 return chan->nativeformats;
507}
508
510{
511 enum ast_media_type type;
512
513 ast_assert(chan != NULL);
514
516 if (chan->stream_topology) {
517 chan->default_streams[type] =
519 } else {
520 chan->default_streams[type] = NULL;
521 }
522 }
523}
524
532
534 struct ast_channel *chan, void *change_source)
535{
536 chan->stream_topology_change_source = change_source;
537}
538
543
545 struct ast_format_cap *value)
546{
547 SCOPE_ENTER(2, "%s: %sFormats: %s\n", S_OR(ast_channel_name(chan), "<initializing>"),
548 S_COR(ast_channel_is_multistream(chan), "Multistream", ""),
550
551 ast_assert(chan != NULL);
552
554
555 /* If chan->stream_topology is NULL, the channel is being destroyed
556 * and topology is destroyed.
557 */
558 if (!chan->stream_topology) {
559 SCOPE_EXIT_RTN("Channel is being initialized or destroyed\n");
560 }
561
562 if (!ast_channel_is_multistream(chan) || !value) {
563 struct ast_stream_topology *new_topology;
564
567 SCOPE_EXIT_RTN("New %stopology set\n", value ? "" : "empty ");
568 }
569 SCOPE_EXIT_RTN("Set native formats but not topology\n");
570}
571
573{
574 return chan->framehooks;
575}
577{
578 chan->framehooks = value;
579}
581{
582 return chan->generator;
583}
585{
586 chan->generator = value;
587}
588struct ast_pbx *ast_channel_pbx(const struct ast_channel *chan)
589{
590 return chan->pbx;
591}
592void ast_channel_pbx_set(struct ast_channel *chan, struct ast_pbx *value)
593{
594 chan->pbx = value;
595}
597{
598 return chan->sched;
599}
601{
602 chan->sched = value;
603}
604struct ast_timer *ast_channel_timer(const struct ast_channel *chan)
605{
606 return chan->timer;
607}
609{
610 chan->timer = value;
611}
612struct ast_tone_zone *ast_channel_zone(const struct ast_channel *chan)
613{
614 return chan->zone;
615}
617{
618 chan->zone = value;
619}
621{
622 return chan->readtrans;
623}
625{
626 chan->readtrans = value;
627}
629{
630 return chan->writetrans;
631}
633{
634 chan->writetrans = value;
635}
636const struct ast_channel_tech *ast_channel_tech(const struct ast_channel *chan)
637{
638 return chan->tech;
639}
641{
642 if (value->read_stream || value->write_stream) {
643 ast_assert(value->read_stream && value->write_stream);
644 }
645
646 chan->tech = value;
647}
649{
650 return chan->adsicpe;
651}
653{
654 chan->adsicpe = value;
655}
657{
658 return chan->state;
659}
661{
662 return chan->callid;
663}
665{
666 char call_identifier_from[AST_CALLID_BUFFER_LENGTH];
667 char call_identifier_to[AST_CALLID_BUFFER_LENGTH];
668 call_identifier_from[0] = '\0';
669 ast_callid_strnprint(call_identifier_to, sizeof(call_identifier_to), callid);
670 if (chan->callid) {
671 ast_callid_strnprint(call_identifier_from, sizeof(call_identifier_from), chan->callid);
672 ast_debug(3, "Channel Call ID changing from %s to %s\n", call_identifier_from, call_identifier_to);
673 }
674
675 chan->callid = callid;
676
677 ast_test_suite_event_notify("CallIDChange",
678 "State: CallIDChange\r\n"
679 "Channel: %s\r\n"
680 "CallID: %s\r\n"
681 "PriorCallID: %s",
682 ast_channel_name(chan),
683 call_identifier_to,
684 call_identifier_from);
685}
686
688{
689 chan->state = value;
690}
691void ast_channel_set_oldwriteformat(struct ast_channel *chan, struct ast_format *format)
692{
693 ao2_replace(chan->oldwriteformat, format);
694}
695void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
696{
697 ao2_replace(chan->rawreadformat, format);
698}
699void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
700{
701 ao2_replace(chan->rawwriteformat, format);
702}
703void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
704{
705 ao2_replace(chan->readformat, format);
706}
707void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
708{
709 ao2_replace(chan->writeformat, format);
710}
712{
713 return chan->oldwriteformat;
714}
716{
717 return chan->rawreadformat;
718}
720{
721 return chan->rawwriteformat;
722}
724{
725 return chan->readformat;
726}
728{
729 return chan->writeformat;
730}
732{
733 return &chan->hangup_handlers;
734}
736{
737 return &chan->datastores;
738}
740{
741 return &chan->autochans;
742}
744{
745 return &chan->readq;
746}
748{
749 return &chan->dtmff;
750}
751struct ast_jb *ast_channel_jb(struct ast_channel *chan)
752{
753 return &chan->jb;
754}
756{
757 return &chan->caller;
758}
760{
761 return &chan->connected;
762}
768{
769 return ast_party_id_merge(&chan->connected.id, &chan->connected.priv);
770}
772{
773 return &chan->dialed;
774}
776{
777 return &chan->redirecting;
778}
780{
781 return ast_party_id_merge(&chan->redirecting.orig, &chan->redirecting.priv_orig);
782}
784{
785 return ast_party_id_merge(&chan->redirecting.from, &chan->redirecting.priv_from);
786}
788{
789 return ast_party_id_merge(&chan->redirecting.to, &chan->redirecting.priv_to);
790}
791struct timeval *ast_channel_dtmf_tv(struct ast_channel *chan)
792{
793 return &chan->dtmf_tv;
794}
795struct timeval *ast_channel_whentohangup(struct ast_channel *chan)
796{
797 return &chan->whentohangup;
798}
800{
801 return &chan->varshead;
802}
804{
805 chan->dtmff = *value;
806}
807void ast_channel_jb_set(struct ast_channel *chan, struct ast_jb *value)
808{
809 chan->jb = *value;
810}
831void ast_channel_dtmf_tv_set(struct ast_channel *chan, struct timeval *value)
832{
833 chan->dtmf_tv = *value;
834}
835void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value)
836{
837 chan->whentohangup = *value;
838}
840{
841 chan->varshead = *value;
842}
843struct timeval ast_channel_creationtime(struct ast_channel *chan)
844{
845 return chan->creationtime;
846}
852
853struct timeval ast_channel_answertime(struct ast_channel *chan)
854{
855 return chan->answertime;
856}
857
858void ast_channel_answertime_set(struct ast_channel *chan, struct timeval *value)
859{
860 chan->answertime = *value;
861}
862
863/* Evil softhangup accessors */
865{
866 return chan->softhangup;
867}
869{
870 chan->softhangup = value;
871}
873{
874 chan->softhangup |= value;
875}
877{
878 chan ->softhangup &= ~value;
879}
880
882{
883 return chan->unbridged;
884}
885
887{
888 int res;
889 ast_channel_lock(chan);
891 ast_channel_unlock(chan);
892 return res;
893}
894
896{
897 chan->unbridged = !!value;
899}
900
907
909{
910 return chan->is_t38_active;
911}
912
914{
915 int res;
916
917 ast_channel_lock(chan);
919 ast_channel_unlock(chan);
920 return res;
921}
922
923void ast_channel_set_is_t38_active_nolock(struct ast_channel *chan, int is_t38_active)
924{
925 chan->is_t38_active = !!is_t38_active;
926}
927
928void ast_channel_set_is_t38_active(struct ast_channel *chan, int is_t38_active)
929{
930 ast_channel_lock(chan);
931 ast_channel_set_is_t38_active_nolock(chan, is_t38_active);
932 ast_channel_unlock(chan);
933}
934
936{
937 chan->callid = 0;
938}
939
940/* Typedef accessors */
942{
943 return chan->callgroup;
944}
946{
947 chan->callgroup = value;
948}
950{
951 return chan->pickupgroup;
952}
957struct ast_namedgroups *ast_channel_named_callgroups(const struct ast_channel *chan)
958{
959 return chan->named_callgroups;
960}
961void ast_channel_named_callgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
962{
965}
966struct ast_namedgroups *ast_channel_named_pickupgroups(const struct ast_channel *chan)
967{
968 return chan->named_pickupgroups;
969}
975
976/* Alertpipe functions */
978{
979 return ast_alertpipe_write(chan->alertpipe);
980}
981
986
991
993{
994 return ast_alertpipe_writable(chan->alertpipe);
995}
996
1001
1006
1011
1013{
1014 return ast_alertpipe_init(chan->alertpipe);
1015}
1016
1018{
1019 return ast_alertpipe_readfd(chan->alertpipe);
1020}
1021
1023{
1024 ast_alertpipe_swap(chan1->alertpipe, chan2->alertpipe);
1025}
1026
1027/* file descriptor array accessors */
1028void ast_channel_internal_fd_set(struct ast_channel *chan, int which, int value)
1029{
1030 int pos;
1031
1032 /* This ensures that if the vector has to grow with unused positions they will be
1033 * initialized to -1.
1034 */
1035 for (pos = AST_VECTOR_SIZE(&chan->fds); pos < which; pos++) {
1036 AST_VECTOR_REPLACE(&chan->fds, pos, -1);
1037 }
1038
1039 AST_VECTOR_REPLACE(&chan->fds, which, value);
1040}
1041void ast_channel_internal_fd_clear(struct ast_channel *chan, int which)
1042{
1043 if (which >= AST_VECTOR_SIZE(&chan->fds)) {
1044 return;
1045 }
1046
1047 AST_VECTOR_REPLACE(&chan->fds, which, -1);
1048}
1053int ast_channel_fd(const struct ast_channel *chan, int which)
1054{
1055 return (which >= AST_VECTOR_SIZE(&chan->fds)) ? -1 : AST_VECTOR_GET(&chan->fds, which);
1056}
1057int ast_channel_fd_isset(const struct ast_channel *chan, int which)
1058{
1059 return ast_channel_fd(chan, which) > -1;
1060}
1061
1062int ast_channel_fd_count(const struct ast_channel *chan)
1063{
1064 return AST_VECTOR_SIZE(&chan->fds);
1065}
1066
1068{
1069 int pos = AST_EXTENDED_FDS;
1070
1071 while (ast_channel_fd_isset(chan, pos)) {
1072 pos += 1;
1073 }
1074
1075 AST_VECTOR_REPLACE(&chan->fds, pos, value);
1076
1077 return pos;
1078}
1079
1080pthread_t ast_channel_blocker(const struct ast_channel *chan)
1081{
1082 return chan->blocker;
1083}
1084void ast_channel_blocker_set(struct ast_channel *chan, pthread_t value)
1085{
1086 chan->blocker = value;
1087}
1088
1090{
1091 return chan->blocker_tid;
1092}
1094{
1095 chan->blocker_tid = value;
1096}
1097
1099{
1100 return chan->timingfunc;
1101}
1106
1108{
1109 return chan->bridge;
1110}
1117
1126
1128{
1129 return &chan->flags;
1130}
1131
1132static int collect_names_cb(void *obj, void *arg, int flags)
1133{
1134 struct ast_control_pvt_cause_code *cause_code = obj;
1135 struct ast_str **str = arg;
1136
1137 ast_str_append(str, 0, "%s%s", (ast_str_strlen(*str) ? "," : ""), cause_code->chan_name);
1138
1139 return 0;
1140}
1141
1143{
1144 struct ast_str *chanlist = ast_str_create(128);
1145
1146 if (!chanlist) {
1147 return NULL;
1148 }
1149
1151
1152 return chanlist;
1153}
1154
1156{
1157 struct ao2_iterator causes;
1158 struct ast_control_pvt_cause_code *cause_code;
1159
1161 while ((cause_code = ao2_iterator_next(&causes))) {
1162 if (strcmp(cause_code->chan_name, chan_name)) {
1163 ao2_ref(cause_code, -1);
1164 continue;
1165 }
1166 if (!cause_code->cause_extended) {
1168 return cause_code;
1169 }
1170 ao2_ref(cause_code, -1);
1171 }
1173
1174 return NULL;
1175}
1176
1177struct ao2_iterator *ast_channel_dialed_causes_find_multiple(const struct ast_channel *chan, const char *chan_name)
1178{
1179 struct ao2_iterator *causes;
1180 struct ast_control_pvt_cause_code *cause_code;
1181
1183 while ((cause_code = ao2_iterator_next(causes))) {
1184 ao2_ref(cause_code, -1);
1185 }
1187
1189}
1190
1191static int remove_dialstatus_cb(void *obj, void *arg, int flags)
1192{
1193 struct ast_control_pvt_cause_code *cause_code = obj;
1194 char *str = ast_tech_to_upper(ast_strdupa(arg));
1195 char *pc_str = ast_tech_to_upper(ast_strdupa(cause_code->chan_name));
1196
1197 if (cause_code->cause_extended) {
1198 return 0;
1199 }
1200 return !strcmp(pc_str, str) ? CMP_MATCH | CMP_STOP : 0;
1201}
1202
1203int ast_channel_dialed_causes_add(const struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen)
1204{
1205 struct ast_control_pvt_cause_code *ao2_cause_code;
1206 char *arg = ast_strdupa(cause_code->chan_name);
1207
1209
1210 ao2_cause_code = ao2_alloc(datalen, NULL);
1211 if (ao2_cause_code) {
1212 memcpy(ao2_cause_code, cause_code, datalen);
1213 ao2_link(chan->dialed_causes, ao2_cause_code);
1214 ao2_ref(ao2_cause_code, -1);
1215 return 0;
1216 }
1217
1218 return -1;
1219}
1220
1225
1226/*! \brief Hash function for pvt cause code frames */
1227static int pvt_cause_hash_fn(const void *vpc, const int flags)
1228{
1229 const struct ast_control_pvt_cause_code *pc = vpc;
1231}
1232
1233/*! \brief Comparison function for pvt cause code frames */
1234static int pvt_cause_cmp_fn(void *obj, void *vstr, int flags)
1235{
1236 struct ast_control_pvt_cause_code *pc = obj;
1237 char *str = ast_tech_to_upper(ast_strdupa(vstr));
1238 char *pc_str = ast_tech_to_upper(ast_strdupa(pc->chan_name));
1239 return !strcmp(pc_str, str) ? CMP_MATCH | CMP_STOP : 0;
1240}
1241
1242#define DIALED_CAUSES_BUCKETS 37
1243
1244struct ast_channel *__ast_channel_internal_alloc_with_initializers(void (*destructor)(void *obj), const struct ast_assigned_ids *assignedids,
1245 const struct ast_channel *requestor, const struct ast_channel_initializers *initializers, const char *file, int line, const char *function)
1246{
1247 struct ast_channel *tmp;
1248
1249 tmp = __ao2_alloc(sizeof(*tmp), destructor,
1250 AO2_ALLOC_OPT_LOCK_MUTEX, "", file, line, function);
1251
1252 if (!tmp) {
1253 return NULL;
1254 }
1255
1256 if ((ast_string_field_init(tmp, 128))) {
1257 return ast_channel_unref(tmp);
1258 }
1259
1262 if (!tmp->dialed_causes) {
1263 return ast_channel_unref(tmp);
1264 }
1265
1266 /* Check initializers validity here for early abort. Unfortunately, we can't do much here because
1267 * tenant ID is part of linked ID, which would overwrite it further down. */
1268 if (initializers) {
1269 if (initializers->version == 0) {
1270 ast_log(LOG_ERROR, "Channel initializers must have a non-zero version.\n");
1271 return ast_channel_unref(tmp);
1272 } else if (initializers->version != AST_CHANNEL_INITIALIZERS_VERSION) {
1273 ast_log(LOG_ERROR, "ABI mismatch for ast_channel_initializers. "
1274 "Please ensure all modules were compiled for "
1275 "this version of Asterisk.\n");
1276 return ast_channel_unref(tmp);
1277 }
1278 }
1279
1280 /* set the creation time in the uniqueid */
1281 tmp->uniqueid.creation_time = time(NULL);
1283
1284 /* use provided id or default to historical {system-}time.# format */
1285 if (assignedids && !ast_strlen_zero(assignedids->uniqueid)) {
1286 ast_copy_string(tmp->uniqueid.unique_id, assignedids->uniqueid, sizeof(tmp->uniqueid.unique_id));
1288 snprintf(tmp->uniqueid.unique_id, sizeof(tmp->uniqueid.unique_id), "%li.%d",
1289 (long)(tmp->uniqueid.creation_time),
1291 } else {
1292 snprintf(tmp->uniqueid.unique_id, sizeof(tmp->uniqueid.unique_id), "%s-%li.%d",
1294 (long)(tmp->uniqueid.creation_time),
1296 }
1297
1298 /* copy linked id from parent channel if known */
1299 if (requestor) {
1300 tmp->linkedid = requestor->linkedid;
1301 } else {
1302 tmp->linkedid = tmp->uniqueid;
1303 }
1304
1305 /* Things like tenant ID need to be set here, otherwise they would be overwritten by
1306 * things like inheriting linked ID above. */
1307 if (initializers) {
1308 ast_copy_string(tmp->linkedid.tenant_id, initializers->tenantid, sizeof(tmp->linkedid.tenant_id));
1309 }
1310
1311 AST_VECTOR_INIT(&tmp->fds, AST_MAX_FDS);
1312
1313 /* Force all channel snapshot segments to be created on first use, so we don't have to check if
1314 * an old snapshot exists.
1315 */
1317
1318 return tmp;
1319}
1320
1321struct ast_channel *__ast_channel_internal_alloc(void (*destructor)(void *obj), const struct ast_assigned_ids *assignedids,
1322 const struct ast_channel *requestor, const char *file, int line, const char *function)
1323{
1324 return __ast_channel_internal_alloc_with_initializers(destructor, assignedids, requestor, NULL, file, line, function);
1325}
1326
1328{
1329 ast_assert(a->linkedid.creation_time != 0);
1330 ast_assert(b->linkedid.creation_time != 0);
1331
1332 if (a->linkedid.creation_time < b->linkedid.creation_time) {
1333 return a;
1334 }
1335 if (b->linkedid.creation_time < a->linkedid.creation_time) {
1336 return b;
1337 }
1338 if (a->linkedid.creation_unique < b->linkedid.creation_unique) {
1339 return a;
1340 }
1341 return b;
1342}
1343
1345{
1346 if (dest->linkedid.creation_time == source->linkedid.creation_time
1348 && !strcmp(dest->linkedid.unique_id, source->linkedid.unique_id)) {
1349 return;
1350 }
1351 dest->linkedid = source->linkedid;
1354}
1355
1357{
1358 struct ast_channel_id temp;
1359
1360 /* This operation is used as part of masquerading and so does not invalidate the peer
1361 * segment. This is due to the masquerade process invalidating all segments.
1362 */
1363
1364 /*
1365 * Since unique ids can be a key in the channel storage backend,
1366 * ensure that neither channel is linked in or the keys will be
1367 * invalid.
1368 */
1369 ast_assert(!a->linked_in_container && !b->linked_in_container);
1370
1371 temp = a->uniqueid;
1372 a->uniqueid = b->uniqueid;
1373 b->uniqueid = temp;
1374
1375 temp = a->linkedid;
1376 a->linkedid = b->linkedid;
1377 b->linkedid = temp;
1378}
1379
1381{
1382 struct stasis_topic *topic;
1383 struct stasis_forward *forward;
1384
1385 topic = a->topic;
1386 a->topic = b->topic;
1387 b->topic = topic;
1388
1389 forward = a->channel_forward;
1390 a->channel_forward = b->channel_forward;
1391 b->channel_forward = forward;
1392}
1393
1395{
1396 struct stasis_forward *temp;
1397
1398 temp = a->endpoint_forward;
1399 a->endpoint_forward = b->endpoint_forward;
1400 b->endpoint_forward = temp;
1401}
1402
1404{
1405 struct ast_channel_snapshot *snapshot;
1406
1407 snapshot = a->snapshot;
1408 a->snapshot = b->snapshot;
1409 b->snapshot = snapshot;
1410}
1411
1413{
1414 struct ast_endpoint *endpoint;
1415
1416 endpoint = a->endpoint;
1417 a->endpoint = b->endpoint;
1418 b->endpoint = endpoint;
1419}
1420
1421void ast_channel_internal_set_fake_ids(struct ast_channel *chan, const char *uniqueid, const char *linkedid)
1422{
1423 ast_copy_string(chan->uniqueid.unique_id, uniqueid, sizeof(chan->uniqueid.unique_id));
1424 ast_copy_string(chan->linkedid.unique_id, linkedid, sizeof(chan->linkedid.unique_id));
1425}
1426
1428{
1429 if (chan->dialed_causes) {
1430 ao2_t_ref(chan->dialed_causes, -1,
1431 "done with dialed causes since the channel is going away");
1432 chan->dialed_causes = NULL;
1433 }
1434
1436
1439
1440 ao2_cleanup(chan->topic);
1441 chan->topic = NULL;
1442
1444
1445 AST_VECTOR_FREE(&chan->fds);
1446}
1447
1449{
1450 chan->finalized = 1;
1451}
1452
1454{
1455 return chan->finalized;
1456}
1457
1459{
1460 if (!chan) {
1461 return ast_channel_topic_all();
1462 }
1463
1464 return chan->topic;
1465}
1466
1468 struct ast_endpoint *endpoint)
1469{
1470 ast_assert(chan != NULL);
1471 ast_assert(endpoint != NULL);
1472
1473 chan->endpoint_forward =
1475 ast_endpoint_topic(endpoint));
1476 if (!chan->endpoint_forward) {
1477 return -1;
1478 }
1479
1480 return 0;
1481}
1482
1484{
1485 char *topic_name;
1486 int ret;
1487 ast_assert(chan->topic == NULL);
1488
1489 if (ast_strlen_zero(chan->uniqueid.unique_id)) {
1490 static int dummy_id;
1491 ret = ast_asprintf(&topic_name, "channel:dummy-%d", ast_atomic_fetchadd_int(&dummy_id, +1));
1492 } else {
1493 ret = ast_asprintf(&topic_name, "channel:%s", chan->uniqueid.unique_id);
1494 }
1495
1496 if (ret < 0) {
1497 return -1;
1498 }
1499
1500 chan->topic = stasis_topic_create(topic_name);
1501 ast_free(topic_name);
1502 if (!chan->topic) {
1503 return -1;
1504 }
1505
1508 if (!chan->channel_forward) {
1509 ao2_ref(chan->topic, -1);
1510 chan->topic = NULL;
1511 return -1;
1512 }
1513
1514 return 0;
1515}
1516
1517AST_THREADSTORAGE(channel_errno);
1518
1520{
1521 enum ast_channel_error *error_code = ast_threadstorage_get(&channel_errno, sizeof(*error_code));
1522 if (!error_code) {
1523 return;
1524 }
1525
1526 *error_code = error;
1527}
1528
1530{
1531 enum ast_channel_error *error_code = ast_threadstorage_get(&channel_errno, sizeof(*error_code));
1532 if (!error_code) {
1534 }
1535
1536 return *error_code;
1537}
1538
1540 const struct ast_channel *chan)
1541{
1542 ast_assert(chan != NULL);
1543
1544 return chan->stream_topology;
1545}
1546
1548 struct ast_stream_topology *topology)
1549{
1550 struct ast_stream_topology *new_topology;
1551 SCOPE_ENTER(1, "%s: %s\n", ast_channel_name(chan),
1552 ast_str_tmp(256, ast_stream_topology_to_str(topology, &STR_TMP)));
1553
1554 ast_assert(chan != NULL);
1555
1556 /* A non-MULTISTREAM channel can't manipulate topology directly */
1558
1559 /* Unless the channel is being destroyed, we always want a topology on
1560 * it even if its empty.
1561 */
1562 if (!topology) {
1563 new_topology = ast_stream_topology_alloc();
1564 } else {
1565 new_topology = topology;
1566 }
1567
1568 if (new_topology) {
1569 ast_channel_internal_set_stream_topology(chan, new_topology);
1570 }
1571
1572 SCOPE_EXIT_RTN_VALUE(new_topology, "Used %s topology\n", topology ? "provided" : "empty");
1573}
1574
1576 enum ast_media_type type)
1577{
1578 ast_assert(chan != NULL);
1580
1581 return chan->default_streams[type];
1582}
1583
1585 struct ast_channel *chan2)
1586{
1587 struct ast_stream_topology *tmp_topology;
1588
1589 ast_assert(chan1 != NULL && chan2 != NULL);
1590
1591 tmp_topology = chan1->stream_topology;
1592 chan1->stream_topology = chan2->stream_topology;
1593 chan2->stream_topology = tmp_topology;
1594
1597}
1598
1600{
1601 return (chan && chan->tech && chan->tech->read_stream && chan->tech->write_stream);
1602}
1603
1605{
1606 return chan->snapshot;
1607}
1608
1610{
1611 ao2_cleanup(chan->snapshot);
1612 chan->snapshot = ao2_bump(snapshot);
1613}
1614
1616{
1617 return &chan->snapshot_segment_flags;
1618}
1619
1621{
1622 return chan->endpoint;
1623}
1624
1625void ast_channel_endpoint_set(struct ast_channel *chan, struct ast_endpoint *endpoint)
1626{
1627 if (chan->endpoint) {
1629 ao2_ref(chan->endpoint, -1);
1630 }
1631
1632 chan->endpoint = ao2_bump(endpoint);
1633
1634 if (chan->endpoint) {
1636 }
1637}
void ast_alertpipe_close(int alert_pipe[2])
Close an alert pipe.
Definition alertpipe.c:79
ssize_t ast_alertpipe_write(int alert_pipe[2])
Write an event to an alert pipe.
Definition alertpipe.c:120
void ast_alertpipe_swap(int alert_pipe_1[2], int alert_pipe_2[2])
Swap the file descriptors from two alert pipes.
Definition alertpipe.h:161
int attribute_pure ast_alertpipe_readable(int alert_pipe[2])
Determine if the alert pipe is readable.
Definition alertpipe.h:114
void ast_alertpipe_clear(int alert_pipe[2])
Sets the alert pipe file descriptors to default values.
Definition alertpipe.h:98
ast_alert_status_t ast_alertpipe_flush(int alert_pipe[2])
Consume all alerts written to the alert pipe.
Definition alertpipe.c:134
int ast_alertpipe_init(int alert_pipe[2])
Initialize an alert pipe.
Definition alertpipe.c:38
ast_alert_status_t
Definition alertpipe.h:24
int attribute_pure ast_alertpipe_readfd(int alert_pipe[2])
Get the alert pipe's read file descriptor.
Definition alertpipe.h:146
int attribute_pure ast_alertpipe_writable(int alert_pipe[2])
Determine if the alert pipe is writable.
Definition alertpipe.h:130
ast_alert_status_t ast_alertpipe_read(int alert_pipe[2])
Read an event from an alert pipe.
Definition alertpipe.c:102
const char * str
Definition app_jack.c:150
static char dialcontext[AST_MAX_CONTEXT]
Asterisk main include file. File version handling, generic pbx functions.
#define ast_free(a)
Definition astmm.h:180
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition astmm.h:298
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
Definition astmm.h:267
#define ast_log
Definition astobj2.c:42
#define ao2_t_ref(o, delta, tag)
Definition astobj2.h:460
#define ao2_iterator_next(iter)
Definition astobj2.h:1911
#define ao2_link(container, obj)
Add an object to a container.
Definition astobj2.h:1532
@ CMP_MATCH
Definition astobj2.h:1027
@ CMP_STOP
Definition astobj2.h:1028
@ AO2_ALLOC_OPT_LOCK_MUTEX
Definition astobj2.h:363
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
Definition astobj2.h:1693
#define ao2_cleanup(obj)
Definition astobj2.h:1934
#define ao2_find(container, arg, flags)
Definition astobj2.h:1736
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_replace(dst, src)
Replace one object reference with another cleaning up the original.
Definition astobj2.h:501
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition astobj2.h:459
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
Definition astobj2.h:480
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
@ OBJ_NODATA
Definition astobj2.h:1044
@ OBJ_MULTIPLE
Definition astobj2.h:1049
@ OBJ_UNLINK
Definition astobj2.h:1039
@ OBJ_SEARCH_KEY
The arg parameter is a search key, but is not an object.
Definition astobj2.h:1101
#define ao2_alloc(data_size, destructor_fn)
Definition astobj2.h:409
void * __ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn, unsigned int options, const char *tag, const char *file, int line, const char *func) attribute_warn_unused_result
Definition astobj2.c:768
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
Definition astobj2.h:1303
static char language[MAX_LANGUAGE]
Definition chan_iax2.c:348
static char accountcode[AST_MAX_ACCOUNT_CODE]
Definition chan_iax2.c:497
static const char type[]
static const struct causes_map causes[]
Definition channel.c:136
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
int(* ast_timing_func_t)(const void *data)
Definition channel.h:919
#define AST_EXTENDED_FDS
Definition channel.h:197
#define ast_channel_lock(chan)
Definition channel.h:2982
struct ast_namedgroups * ast_ref_namedgroups(struct ast_namedgroups *groups)
Definition channel.c:7750
unsigned long long ast_group_t
Definition channel.h:215
ast_channel_error
Definition channel.h:4903
@ AST_CHANNEL_ERROR_UNKNOWN
Definition channel.h:4905
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
Definition channel.c:1170
ama_flags
Channel AMA Flags.
Definition channel.h:1197
ast_channel_adsicpe
Definition channel.h:888
#define AST_CHANNEL_INITIALIZERS_VERSION
struct ABI version
Definition channel.h:620
#define AST_MAX_FDS
Definition channel.h:196
#define ast_channel_unref(c)
Decrease channel reference count.
Definition channel.h:3018
struct ast_party_id ast_party_id_merge(struct ast_party_id *base, struct ast_party_id *overlay)
Merge a given party id into another given party id.
Definition channel.c:1888
struct ast_namedgroups * ast_unref_namedgroups(struct ast_namedgroups *groups)
Definition channel.c:7744
#define ast_channel_unlock(chan)
Definition channel.h:2983
Internal channel functions for channel.c to use.
void ast_channel_internal_set_stream_topology_change_source(struct ast_channel *chan, void *change_source)
void ast_channel_internal_alertpipe_swap(struct ast_channel *chan1, struct ast_channel *chan2)
Swap the interal alertpipe between two channels.
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
static int remove_dialstatus_cb(void *obj, void *arg, int flags)
const char * ast_channel_linkedid(const struct ast_channel *chan)
int ast_channel_tech_hangupcause(const struct ast_channel *chan)
struct ast_bridge * ast_channel_internal_bridge(const struct ast_channel *chan)
void * ast_channel_get_stream_topology_change_source(struct ast_channel *chan)
Retrieve the source that initiated the last stream topology change.
struct timeval ast_channel_answertime(struct ast_channel *chan)
static void channel_set_default_streams(struct ast_channel *chan)
void ast_channel_rings_set(struct ast_channel *chan, int value)
void ast_channel_internal_copy_linkedid(struct ast_channel *dest, struct ast_channel *source)
Copy the full linkedid channel id structure from one channel to another.
void ast_channel_named_pickupgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
void ast_channel_name_set(struct ast_channel *chan, const char *value)
struct ast_channel * ast_channel_masq(const struct ast_channel *chan)
int ast_channel_blocker_tid(const struct ast_channel *chan)
void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream *value)
void ast_channel_appl_set(struct ast_channel *chan, const char *value)
void ast_channel_dtmff_set(struct ast_channel *chan, struct ast_frame *value)
void ast_channel_visible_indication_set(struct ast_channel *chan, int value)
const char * ast_channel_blockproc(const struct ast_channel *chan)
void ast_channel_caller_set(struct ast_channel *chan, struct ast_party_caller *value)
void ast_channel_internal_set_stream_topology(struct ast_channel *chan, struct ast_stream_topology *topology)
struct ast_stream_topology * ast_channel_set_stream_topology(struct ast_channel *chan, struct ast_stream_topology *topology)
Set the topology of streams on a channel.
void ast_channel_set_unbridged_nolock(struct ast_channel *chan, int value)
Variant of ast_channel_set_unbridged. Use this if the channel is already locked prior to calling.
struct ast_namedgroups * ast_channel_named_pickupgroups(const struct ast_channel *chan)
void * ast_channel_tech_pvt(const struct ast_channel *chan)
void ast_channel_internal_set_fake_ids(struct ast_channel *chan, const char *uniqueid, const char *linkedid)
Set uniqueid and linkedid string value only (not time)
const char * ast_channel_data(const struct ast_channel *chan)
void ast_channel_dialed_set(struct ast_channel *chan, struct ast_party_dialed *value)
struct ast_party_id ast_channel_redirecting_effective_to(struct ast_channel *chan)
struct ast_control_pvt_cause_code * ast_channel_dialed_causes_find(const struct ast_channel *chan, const char *chan_name)
Retrieve a ref-counted cause code information structure.
struct ast_format * ast_channel_rawreadformat(struct ast_channel *chan)
struct ast_party_id ast_channel_redirecting_effective_from(struct ast_channel *chan)
void * ast_channel_music_state(const struct ast_channel *chan)
void ast_channel_blockproc_set(struct ast_channel *chan, const char *value)
unsigned int ast_channel_fin(const struct ast_channel *chan)
void ast_channel_tech_hangupcause_set(struct ast_channel *chan, int value)
void ast_channel_callid_cleanup(struct ast_channel *chan)
void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value)
void ast_channel_set_oldwriteformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_softhangup_internal_flag_clear(struct ast_channel *chan, int value)
struct varshead * ast_channel_varshead(struct ast_channel *chan)
int ast_channel_rings(const struct ast_channel *chan)
void ast_channel_generator_set(struct ast_channel *chan, struct ast_generator *value)
void ast_channel_blocker_set(struct ast_channel *chan, pthread_t value)
void ast_channel_tenantid_set(struct ast_channel *chan, const char *value)
void ast_channel_sending_dtmf_digit_set(struct ast_channel *chan, char value)
void * ast_channel_timingdata(const struct ast_channel *chan)
#define DEFINE_STRINGFIELD_GETTER_FOR(field)
int ast_channel_internal_alert_readfd(struct ast_channel *chan)
const char * ast_channel_tenantid(const struct ast_channel *chan)
void ast_channel_dtmf_tv_set(struct ast_channel *chan, struct timeval *value)
int ast_channel_internal_is_finalized(struct ast_channel *chan)
struct ast_flags * ast_channel_snapshot_segment_flags(struct ast_channel *chan)
void ast_channel_internal_swap_endpoint_forward(struct ast_channel *a, struct ast_channel *b)
Swap endpoint_forward between two channels.
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
const struct ast_channelstorage_driver * current_channel_storage_driver
The current channel storage driver.
int ast_channel_fdno(const struct ast_channel *chan)
void ast_channel_internal_fd_clear_all(struct ast_channel *chan)
void ast_channel_internal_bridge_channel_set(struct ast_channel *chan, struct ast_bridge_channel *value)
void ast_channel_internal_alertpipe_close(struct ast_channel *chan)
struct ast_channel * __ast_channel_internal_alloc_with_initializers(void(*destructor)(void *obj), const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const struct ast_channel_initializers *initializers, const char *file, int line, const char *function)
struct stasis_topic * ast_channel_topic(struct ast_channel *chan)
A topic which publishes the events for a particular channel.
void ast_channel_answertime_set(struct ast_channel *chan, struct timeval *value)
struct ast_channelstorage_instance * current_channel_storage_instance
The current channel storage instance.
void ast_channel_hold_state_set(struct ast_channel *chan, int value)
struct ast_trans_pvt * ast_channel_readtrans(const struct ast_channel *chan)
const char * ast_channel_lastexten(const struct ast_channel *chan)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
void ast_channel_data_set(struct ast_channel *chan, const char *value)
void ast_channel_blocker_tid_set(struct ast_channel *chan, int value)
struct timeval ast_channel_sending_dtmf_tv(const struct ast_channel *chan)
void ast_channel_jb_set(struct ast_channel *chan, struct ast_jb *value)
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
enum ast_channel_error ast_channel_internal_errno(void)
void ast_channel_snapshot_set(struct ast_channel *chan, struct ast_channel_snapshot *snapshot)
struct ast_trans_pvt * ast_channel_writetrans(const struct ast_channel *chan)
static int uniqueint
The monotonically increasing integer counter for channel uniqueids.
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
struct ast_namedgroups * ast_channel_named_callgroups(const struct ast_channel *chan)
ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
void ast_channel_vstreamid_set(struct ast_channel *chan, int value)
#define DEFINE_STRINGFIELD_SETTERS_FOR(field, assert_on_null)
void ast_channel_internal_swap_stream_topology(struct ast_channel *chan1, struct ast_channel *chan2)
void ast_channel_timingdata_set(struct ast_channel *chan, void *value)
struct ast_format * ast_channel_oldwriteformat(struct ast_channel *chan)
int ast_channel_internal_alert_readable(struct ast_channel *chan)
struct ast_cdr * ast_channel_cdr(const struct ast_channel *chan)
void ast_channel_name_build_va(struct ast_channel *chan, const char *fmt, va_list ap)
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
void ast_channel_redirecting_set(struct ast_channel *chan, struct ast_party_redirecting *value)
int ast_channel_priority(const struct ast_channel *chan)
void ast_channel_writetrans_set(struct ast_channel *chan, struct ast_trans_pvt *value)
void ast_channel_streamid_set(struct ast_channel *chan, int value)
void ast_channel_callid_set(struct ast_channel *chan, ast_callid callid)
void ast_channel_generatordata_set(struct ast_channel *chan, void *value)
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
struct ast_str * ast_channel_dialed_causes_channels(const struct ast_channel *chan)
Retrieve a comma-separated list of channels for which dialed cause information is available.
void ast_channel_softhangup_internal_flag_set(struct ast_channel *chan, int value)
ast_callid ast_channel_callid(const struct ast_channel *chan)
const char * ast_channel_uniqueid(const struct ast_channel *chan)
void ast_channel_internal_swap_endpoints(struct ast_channel *a, struct ast_channel *b)
Swap endpoints between two channels.
const char * ast_channel_context(const struct ast_channel *chan)
char ast_channel_dtmf_digit_to_emulate(const struct ast_channel *chan)
unsigned long ast_channel_insmpl(const struct ast_channel *chan)
int ast_channel_fd_add(struct ast_channel *chan, int value)
Add a file descriptor to the channel without a fixed position.
ast_alert_status_t ast_channel_internal_alert_flush(struct ast_channel *chan)
void ast_channel_timingfd_set(struct ast_channel *chan, int value)
void ast_channel_endpoint_set(struct ast_channel *chan, struct ast_endpoint *endpoint)
pthread_t ast_channel_blocker(const struct ast_channel *chan)
void ast_channel_sending_dtmf_tv_set(struct ast_channel *chan, struct timeval value)
int ast_channel_is_t38_active_nolock(struct ast_channel *chan)
ast_channel_is_t38_active variant. Use this if the channel is already locked prior to calling.
void ast_channel_internal_swap_topics(struct ast_channel *a, struct ast_channel *b)
Swap topics beteween two channels.
const char * ast_channel_appl(const struct ast_channel *chan)
void ast_channel_internal_cleanup(struct ast_channel *chan)
int ast_channel_unbridged_nolock(struct ast_channel *chan)
ast_channel_unbridged variant. Use this if the channel is already locked prior to calling.
void ast_channel_framehooks_set(struct ast_channel *chan, struct ast_framehook_list *value)
struct timeval ast_channel_creationtime(struct ast_channel *chan)
struct ast_bridge_channel * ast_channel_internal_bridge_channel(const struct ast_channel *chan)
struct ast_framehook_list * ast_channel_framehooks(const struct ast_channel *chan)
void ast_channel_audiohooks_set(struct ast_channel *chan, struct ast_audiohook_list *value)
int ast_channel_fd(const struct ast_channel *chan, int which)
void ast_channel_timer_set(struct ast_channel *chan, struct ast_timer *value)
void ast_channel_internal_fd_set(struct ast_channel *chan, int which, int value)
void ast_channel_fin_set(struct ast_channel *chan, unsigned int value)
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
struct ast_audiohook_list * ast_channel_audiohooks(const struct ast_channel *chan)
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
enum ama_flags ast_channel_amaflags(const struct ast_channel *chan)
void ast_channel_readtrans_set(struct ast_channel *chan, struct ast_trans_pvt *value)
void ast_channel_name_build(struct ast_channel *chan, const char *fmt,...)
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
void ast_channel_internal_bridge_set(struct ast_channel *chan, struct ast_bridge *value)
void * ast_channel_generatordata(const struct ast_channel *chan)
struct ast_format * ast_channel_rawwriteformat(struct ast_channel *chan)
void ast_channel_set_is_t38_active_nolock(struct ast_channel *chan, int is_t38_active)
Variant of ast_channel_set_is_t38_active. Use this if the channel is already locked prior to calling.
unsigned int ast_channel_fout(const struct ast_channel *chan)
struct ast_stream_topology * ast_channel_get_stream_topology(const struct ast_channel *chan)
Retrieve the topology of streams on a channel.
void ast_channel_set_unbridged(struct ast_channel *chan, int value)
Sets the unbridged flag and queues a NULL frame on the channel to trigger a check by bridge_channel_w...
void ast_channel_outsmpl_set(struct ast_channel *chan, unsigned long value)
int ast_channel_hangupcause(const struct ast_channel *chan)
int ast_channel_timingfd(const struct ast_channel *chan)
void ast_channel_fdno_set(struct ast_channel *chan, int value)
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
void ast_channel_creationtime_set(struct ast_channel *chan, struct timeval *value)
struct ast_tone_zone * ast_channel_zone(const struct ast_channel *chan)
struct ast_party_id ast_channel_redirecting_effective_orig(struct ast_channel *chan)
int ast_channel_dialed_causes_add(const struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen)
Add cause code information to the channel.
void ast_channel_named_callgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
int ast_channel_alert_write(struct ast_channel *chan)
struct ast_channel * __ast_channel_internal_alloc(void(*destructor)(void *obj), const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *file, int line, const char *function)
const char * ast_channel_lastcontext(const struct ast_channel *chan)
int ast_channel_vstreamid(const struct ast_channel *chan)
struct ast_readq_list * ast_channel_readq(struct ast_channel *chan)
void ast_channel_set_is_t38_active(struct ast_channel *chan, int is_t38_active)
Sets the is_t38_active flag.
struct ast_jb * ast_channel_jb(struct ast_channel *chan)
ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan)
static int collect_names_cb(void *obj, void *arg, int flags)
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_dtmf_digit_to_emulate_set(struct ast_channel *chan, char value)
void ast_channel_softhangup_internal_flag_add(struct ast_channel *chan, int value)
struct timeval * ast_channel_whentohangup(struct ast_channel *chan)
struct ast_stream * ast_channel_get_default_stream(struct ast_channel *chan, enum ast_media_type type)
Retrieve the default stream of a specific media type on a channel.
struct ast_filestream * ast_channel_vstream(const struct ast_channel *chan)
ast_alert_status_t ast_channel_internal_alert_read(struct ast_channel *chan)
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
void ast_channel_internal_swap_uniqueid_and_linkedid(struct ast_channel *a, struct ast_channel *b)
Swap uniqueid and linkedid beteween two channels.
struct ast_generator * ast_channel_generator(const struct ast_channel *chan)
ast_group_t ast_channel_callgroup(const struct ast_channel *chan)
struct ast_party_id ast_channel_connected_effective_id(struct ast_channel *chan)
int ast_channel_unbridged(struct ast_channel *chan)
This function will check if the bridge needs to be re-evaluated due to external changes.
int ast_channel_hold_state(const struct ast_channel *chan)
void ast_channel_emulate_dtmf_duration_set(struct ast_channel *chan, unsigned int value)
void ast_channel_amaflags_set(struct ast_channel *chan, enum ama_flags value)
struct ao2_iterator * ast_channel_dialed_causes_find_multiple(const struct ast_channel *chan, const char *chan_name)
Retrieve a ref-counted cause code information structure iterator.
struct ast_party_connected_line * ast_channel_connected_indicated(struct ast_channel *chan)
struct ast_endpoint * ast_channel_endpoint(const struct ast_channel *chan)
void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr *value)
void ast_channel_context_set(struct ast_channel *chan, const char *value)
int ast_channel_streamid(const struct ast_channel *chan)
void ast_channel_connected_set(struct ast_channel *chan, struct ast_party_connected_line *value)
void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state value)
int ast_channel_internal_setup_topics(struct ast_channel *chan)
void ast_channel_timingfunc_set(struct ast_channel *chan, ast_timing_func_t value)
struct ast_sched_context * ast_channel_sched(const struct ast_channel *chan)
int ast_channel_forward_endpoint(struct ast_channel *chan, struct ast_endpoint *endpoint)
Forward channel stasis messages to the given endpoint.
int ast_channel_fd_count(const struct ast_channel *chan)
Retrieve the number of file decriptor positions present on the channel.
static int pvt_cause_cmp_fn(void *obj, void *vstr, int flags)
Comparison function for pvt cause code frames.
struct ast_frame * ast_channel_dtmff(struct ast_channel *chan)
void ast_channel_internal_swap_snapshots(struct ast_channel *a, struct ast_channel *b)
Swap snapshots beteween two channels.
void ast_channel_music_state_set(struct ast_channel *chan, void *value)
unsigned int ast_channel_emulate_dtmf_duration(const struct ast_channel *chan)
struct ast_filestream * ast_channel_stream(const struct ast_channel *chan)
void ast_channel_internal_fd_clear(struct ast_channel *chan, int which)
struct ast_pbx * ast_channel_pbx(const struct ast_channel *chan)
void ast_channel_fout_set(struct ast_channel *chan, unsigned int value)
struct ast_autochan_list * ast_channel_autochans(struct ast_channel *chan)
void ast_channel_zone_set(struct ast_channel *chan, struct ast_tone_zone *value)
struct ast_channel * ast_channel_masqr(const struct ast_channel *chan)
int ast_channel_softhangup_internal_flag(struct ast_channel *chan)
struct timeval * ast_channel_dtmf_tv(struct ast_channel *chan)
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
char ast_channel_sending_dtmf_digit(const struct ast_channel *chan)
int ast_channel_visible_indication(const struct ast_channel *chan)
struct ast_timer * ast_channel_timer(const struct ast_channel *chan)
struct ast_hangup_handler_list * ast_channel_hangup_handlers(struct ast_channel *chan)
void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value)
unsigned long ast_channel_outsmpl(const struct ast_channel *chan)
void ast_channel_masqr_set(struct ast_channel *chan, struct ast_channel *value)
void ast_channel_internal_finalize(struct ast_channel *chan)
void ast_channel_internal_alertpipe_clear(struct ast_channel *chan)
void ast_channel_priority_set(struct ast_channel *chan, int value)
#define DIALED_CAUSES_BUCKETS
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
void ast_channel_internal_errno_set(enum ast_channel_error error)
void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value)
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
static int pvt_cause_hash_fn(const void *vpc, const int flags)
Hash function for pvt cause code frames.
int ast_channel_fd_isset(const struct ast_channel *chan, int which)
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
void ast_channel_dialed_causes_clear(const struct ast_channel *chan)
Clear all cause information from the channel.
#define DEFINE_STRINGFIELD_SETTERS_AND_INVALIDATE_FOR(field, publish, assert_on_null, invalidate)
int ast_channel_is_multistream(struct ast_channel *chan)
Determine if a channel is multi-stream capable.
int ast_channel_internal_alertpipe_init(struct ast_channel *chan)
void ast_channel_sched_set(struct ast_channel *chan, struct ast_sched_context *value)
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
const char * ast_channel_exten(const struct ast_channel *chan)
int ast_channel_is_t38_active(struct ast_channel *chan)
This function will check if T.38 is active on the channel.
struct ast_datastore_list * ast_channel_datastores(struct ast_channel *chan)
void ast_channel_masq_set(struct ast_channel *chan, struct ast_channel *value)
void ast_channel_varshead_set(struct ast_channel *chan, struct varshead *value)
void ast_channel_pbx_set(struct ast_channel *chan, struct ast_pbx *value)
struct ast_channel * ast_channel_internal_oldest_linkedid(struct ast_channel *a, struct ast_channel *b)
Determine which channel has an older linkedid.
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_vstream_set(struct ast_channel *chan, struct ast_filestream *value)
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
int ast_channel_alert_writable(struct ast_channel *chan)
ast_channel_state
ast_channel states
ast_media_type
Types of media.
Definition codec.h:30
@ AST_MEDIA_TYPE_UNKNOWN
Definition codec.h:31
@ AST_MEDIA_TYPE_END
Definition codec.h:36
Endpoint abstractions.
int ast_endpoint_add_channel(struct ast_endpoint *endpoint, struct ast_channel *chan)
Adds a channel to the given endpoint.
int ast_endpoint_remove_channel(struct ast_endpoint *endpoint, struct ast_channel *chan)
Removes a channel from the given endpoint.
const char * ast_format_cap_get_names(const struct ast_format_cap *cap, struct ast_str **buf)
Get the names of codecs of a set of formats.
Definition format_cap.c:734
static const char name[]
Definition format_mp3.c:68
#define SCOPE_EXIT_RTN(...)
#define SCOPE_EXIT_RTN_VALUE(__return_value,...)
#define SCOPE_ENTER(level,...)
struct stasis_topic * ast_channel_topic_all(void)
A topic which publishes the events for all channels.
struct stasis_topic * ast_endpoint_topic(struct ast_endpoint *endpoint)
Returns the topic for a specific endpoint.
void ast_channel_snapshot_invalidate_segment(struct ast_channel *chan, enum ast_channel_snapshot_segment_invalidation segment)
Invalidate a channel snapshot segment from being reused.
void ast_channel_publish_snapshot(struct ast_channel *chan)
Publish a ast_channel_snapshot for a channel.
@ AST_CHANNEL_SNAPSHOT_INVALIDATE_PEER
@ AST_CHANNEL_SNAPSHOT_INVALIDATE_CALLER
@ AST_CHANNEL_SNAPSHOT_INVALIDATE_HANGUP
@ AST_CHANNEL_SNAPSHOT_INVALIDATE_BRIDGE
@ AST_CHANNEL_SNAPSHOT_INVALIDATE_BASE
@ AST_CHANNEL_SNAPSHOT_INVALIDATE_CONNECTED
@ AST_CHANNEL_SNAPSHOT_INVALIDATE_DIALPLAN
struct ast_frame ast_null_frame
Definition main/frame.c:79
void ast_callid_strnprint(char *buffer, size_t buffer_size, ast_callid callid)
copy a string representation of the callid into a target string
Definition logger.c:2258
#define ast_debug(level,...)
Log a DEBUG message.
#define AST_CALLID_BUFFER_LENGTH
unsigned int ast_callid
#define LOG_ERROR
Tone Indication Support.
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
Definition lock.h:764
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_SYSTEM_NAME
Definition options.c:171
#define NULL
Definition resample.c:96
struct stasis_forward * stasis_forward_cancel(struct stasis_forward *forward)
Definition stasis.c:1615
struct stasis_topic * stasis_topic_create(const char *name)
Create a new topic.
Definition stasis.c:684
struct stasis_forward * stasis_forward_all(struct stasis_topic *from_topic, struct stasis_topic *to_topic)
Create a subscription which forwards all messages from one topic to another.
Definition stasis.c:1645
Endpoint abstractions.
Media Stream API.
struct ast_stream_topology * ast_stream_topology_alloc(void)
Create a stream topology.
Definition stream.c:652
const char * ast_stream_topology_to_str(const struct ast_stream_topology *topology, struct ast_str **buf)
Get a string representing the topology for debugging/display purposes.
Definition stream.c:939
void ast_stream_topology_free(struct ast_stream_topology *topology)
Unreference and destroy a stream topology.
Definition stream.c:746
struct ast_stream_topology * ast_stream_topology_create_from_format_cap(struct ast_format_cap *cap)
A helper function that, given a format capabilities structure, creates a topology and separates the m...
Definition stream.c:851
struct ast_stream * ast_stream_topology_get_first_stream_by_type(const struct ast_stream_topology *topology, enum ast_media_type type)
Gets the first active stream of a specific type from the topology.
Definition stream.c:967
#define ast_string_field_build_va(x, field, fmt, args)
Set a field to a complex (built) value.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition strings.h:1139
size_t attribute_pure ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
Definition strings.h:730
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
Definition strings.h:80
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
Definition strings.h:1259
#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_tech_to_upper(char *dev_str)
Convert the tech portion of a device string to upper case.
Definition strings.h:1236
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition strings.h:65
#define ast_str_tmp(init_len, __expr)
Provides a temporary ast_str and returns a copy of its buffer.
Definition strings.h:1189
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
Definition strings.h:659
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition strings.h:425
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition astobj2.h:1821
Structure to pass both assignedid values to channel drivers.
Definition channel.h:606
const char * uniqueid
Definition channel.h:607
Structure that contains information regarding a channel in a bridge.
struct ast_channel * chan
Structure that contains information about a bridge.
Definition bridge.h:353
Responsible for call detail data.
Definition cdr.h:281
Channel UniqueId structure.
char unique_id[AST_MAX_UNIQUEID]
char tenant_id[AST_MAX_TENANT_ID]
Helper struct for initializing additional channel information on channel creation.
Definition channel.h:615
const char * tenantid
Definition channel.h:626
uint32_t version
struct ABI version
Definition channel.h:625
Structure representing a snapshot of channel state.
Structure to describe a channel "technology", ie a channel driver See for examples:
Definition channel.h:648
int(*const write_stream)(struct ast_channel *chan, int stream_num, struct ast_frame *frame)
Write a frame on a specific stream, in standard format (see frame.h)
Definition channel.h:773
struct ast_frame *(*const read_stream)(struct ast_channel *chan)
Read a frame (or chain of frames from the same stream), in standard format (see frame....
Definition channel.h:767
Main Channel structure associated with a channel.
struct ast_filestream * stream
struct ast_cdr * cdr
struct ast_stream * default_streams[AST_MEDIA_TYPE_END]
pthread_t blocker
struct ast_channel_id uniqueid
struct stasis_topic * topic
const char * appl
struct ast_bridge_channel * bridge_channel
struct ast_framehook_list * framehooks
char lastexten[AST_MAX_EXTENSION]
struct timeval creationtime
struct ast_frame dtmff
char lastcontext[AST_MAX_CONTEXT]
struct ast_sched_context * sched
struct ast_channel_snapshot * snapshot
struct ast_datastore_list datastores
unsigned long outsmpl
struct ast_tone_zone * zone
struct ao2_container * dialed_causes
ast_timing_func_t timingfunc
enum ast_channel_adsicpe adsicpe
struct ast_format * rawwriteformat
struct ast_generator * generator
struct ast_bridge * bridge
struct timeval sending_dtmf_tv
struct ast_party_connected_line connected
Channel Connected Line ID information.
struct ast_trans_pvt * writetrans
ast_callid callid
struct timeval whentohangup
unsigned short transfercapability
char dtmf_digit_to_emulate
unsigned int emulate_dtmf_duration
void * stream_topology_change_source
struct ast_readq_list readq
struct ast_format * rawreadformat
char exten[AST_MAX_EXTENSION]
struct timeval dtmf_tv
struct ast_party_connected_line connected_indicated
Channel Connected Line ID information that was last indicated.
const char * data
struct ast_namedgroups * named_pickupgroups
struct stasis_forward * endpoint_forward
struct ast_flags snapshot_segment_flags
unsigned long insmpl
struct ast_trans_pvt * readtrans
struct ast_namedgroups * named_callgroups
struct ast_hangup_handler_list hangup_handlers
struct ast_timer * timer
struct varshead varshead
unsigned int fin
const struct ast_channel_tech * tech
struct ast_endpoint * endpoint
struct ast_format * writeformat
struct ast_channel_id linkedid
enum ast_channel_state state
struct ast_party_redirecting redirecting
Redirecting/Diversion information.
struct ast_channel * masqr
ast_group_t pickupgroup
struct ast_party_dialed dialed
Dialed/Called information.
void * generatordata
char context[AST_MAX_CONTEXT]
struct ast_jb jb
struct ast_filestream * vstream
struct timeval answertime
struct ast_format * readformat
struct ast_audiohook_list * audiohooks
struct ast_format * oldwriteformat
struct stasis_forward * channel_forward
struct ast_channel * masq
struct ast_format_cap * nativeformats
const char * blockproc
struct ast_pbx * pbx
struct ast_flags flags
ast_group_t callgroup
unsigned int fout
struct ast_autochan_list autochans
struct ast_stream_topology * stream_topology
unsigned int finalized
struct ast_party_caller caller
Channel Caller ID information.
This structure is allocated by file.c in one chunk, together with buf_size and desc_size bytes of mem...
Definition mod_format.h:101
Structure used to handle boolean flags.
Definition utils.h:220
unsigned int flags
Definition utils.h:221
Format capabilities structure, holds formats + preference order + etc.
Definition format_cap.c:54
Definition of a media format.
Definition format.c:43
Data structure associated with a single frame of data.
General jitterbuffer state.
Caller Party information.
Definition channel.h:420
Connected Line/Party information.
Definition channel.h:458
Dialed/Called Party information.
Definition channel.h:380
Information needed to identify an endpoint in a call.
Definition channel.h:340
Redirecting Line information. RDNIS (Redirecting Directory Number Information Service) Where a call d...
Definition channel.h:524
Definition pbx.h:215
Support for dynamic strings.
Definition strings.h:623
A set of tones for a given locale.
Definition indications.h:74
Default structure for translators, with the basic fields and buffers, all allocated as part of the sa...
Definition translate.h:213
List of channel drivers.
Definition app_dial.c:804
Forwarding information.
Definition stasis.c:1598
int value
Definition syslog.c:37
Test Framework API.
#define ast_test_suite_event_notify(s, f,...)
Definition test.h:189
static struct test_val b
static struct test_val a
void * ast_threadstorage_get(struct ast_threadstorage *ts, size_t init_size)
Retrieve thread storage.
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
int error(const char *format,...)
#define ast_assert(a)
Definition utils.h:779
#define ast_set_flag(p, flag)
Definition utils.h:71
#define AST_FLAGS_ALL
Definition utils.h:217
Vector container support.
#define AST_VECTOR_REPLACE(vec, idx, elem)
Replace an element at a specific position in a vector, growing the vector if needed.
Definition vector.h:295
#define AST_VECTOR_RESET(vec, cleanup)
Reset vector.
Definition vector.h:636
#define AST_VECTOR_ELEM_CLEANUP_NOOP(elem)
Vector element cleanup that does nothing.
Definition vector.h:582
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
Definition vector.h:620
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
Definition vector.h:185
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
Definition vector.h:124
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
Definition vector.h:691