123 #ifndef _ASTERISK_CHANNEL_H 124 #define _ASTERISK_CHANNEL_H 131 #if defined(__cplusplus) || defined(c_plusplus) 135 #define AST_MAX_EXTENSION 80 136 #define AST_MAX_CONTEXT 80 148 #define AST_MAX_PUBLIC_UNIQUEID 149 154 #define AST_NUM_CHANNEL_BUCKETS 61 156 #define AST_NUM_CHANNEL_BUCKETS 1567 169 #define AST_MAX_UNIQUEID (AST_MAX_PUBLIC_UNIQUEID + 2 + 1) 171 #define AST_MAX_ACCOUNT_CODE 80 172 #define AST_CHANNEL_NAME 80 173 #define MAX_LANGUAGE 40 174 #define MAX_MUSICCLASS 80 175 #define AST_MAX_USER_FIELD 256 193 #define DATASTORE_INHERIT_FOREVER INT_MAX 195 #define AST_MAX_FDS 11 196 #define AST_EXTENDED_FDS 12 201 #define AST_ALERT_FD (AST_MAX_FDS-1) 202 #define AST_TIMING_FD (AST_MAX_FDS-2) 203 #define AST_AGENT_FD (AST_MAX_FDS-3) 204 #define AST_GENERATOR_FD (AST_MAX_FDS-4) 205 #define AST_JITTERBUFFER_FD (AST_MAX_FDS-5) 592 #define AST_CHAN_WRITE_INFO_T_VERSION 1 596 const char *
function;
676 int (*
const devicestate)(
const char *device_number);
677 int (*
const presencestate)(
const char *presence_provider,
char **subtype,
char **
message);
778 int (*
const setoption)(
struct ast_channel *chan,
int option,
void *
data,
int datalen);
781 int (*
const queryoption)(
struct ast_channel *chan,
int option,
void *
data,
int *datalen);
851 struct ast_epoll_data;
858 #define DEBUGCHAN_FLAG 0x80000000 861 #define FRAMECOUNT_INC(x) ( ((x) & DEBUGCHAN_FLAG) | (((x)+1) & ~DEBUGCHAN_FLAG) ) 1073 #define AST_FEATURE_DTMF_MASK (AST_FEATURE_REDIRECT | AST_FEATURE_DISCONNECT |\ 1074 AST_FEATURE_ATXFER | AST_FEATURE_AUTOMON | AST_FEATURE_PARKCALL | AST_FEATURE_AUTOMIXMON) 1080 struct timeval start_time;
1081 struct timeval nexteventts;
1082 struct timeval feature_start_time;
1241 const
char *
cid_name, const
char *acctcode,
1245 const
char *
file,
int line, const
char *function,
1246 const
char *name_fmt, ...);
1259 #define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, ...) \ 1260 __ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, NULL, \ 1261 __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) 1263 #define ast_channel_alloc_with_endpoint(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, endpoint, ...) \ 1264 __ast_channel_alloc((needqueue), (state), (cid_num), (cid_name), (acctcode), (exten), (context), (assignedids), (requestor), (amaflag), (endpoint), \ 1265 __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) 1283 #define ast_dummy_channel_alloc() __ast_dummy_channel_alloc(__FILE__, __LINE__, __PRETTY_FUNCTION__) 1396 const void *data,
size_t datalen);
1534 int timeout,
int *reason,
const char *cid_num,
const char *cid_name);
2002 int *fds,
int nfds,
int *exception,
int *outfd,
int *ms);
2339 #define AST_BRIDGE_DTMF_CHANNEL_0 (1 << 0) 2341 #define AST_BRIDGE_DTMF_CHANNEL_1 (1 << 1) 2802 pfd->events = POLLIN | POLLPRI;
2807 static inline int ast_fdisset(
struct pollfd *pfds,
int fd,
int maximum,
int *start)
2816 for (x = *start; x < maximum; x++)
2817 if (pfds[x].fd == fd) {
2820 return pfds[
x].revents;
2833 int datalen =
sizeof(
state);
2851 #define CHECK_BLOCKING(c) \ 2853 if (ast_test_flag(ast_channel_flags(c), AST_FLAG_BLOCKING)) { \ 2855 ast_log(LOG_DEBUG, "Thread LWP %d is blocking '%s', already blocked by thread LWP %d in procedure %s\n", \ 2856 ast_get_tid(), ast_channel_name(c), \ 2857 ast_channel_blocker_tid(c), ast_channel_blockproc(c)); \ 2860 ast_channel_blocker_tid_set((c), ast_get_tid()); \ 2861 ast_channel_blocker_set((c), pthread_self()); \ 2862 ast_channel_blockproc_set((c), __PRETTY_FUNCTION__); \ 2863 ast_set_flag(ast_channel_flags(c), AST_FLAG_BLOCKING); \ 2872 struct ast_namedgroups;
2902 #define ast_channel_lock(chan) ao2_lock(chan) 2903 #define ast_channel_unlock(chan) ao2_unlock(chan) 2904 #define ast_channel_trylock(chan) ao2_trylock(chan) 2909 #define ast_channel_lock_both(chan1, chan2) do { \ 2910 ast_channel_lock(chan1); \ 2911 while (ast_channel_trylock(chan2)) { \ 2912 ast_channel_unlock(chan1); \ 2914 ast_channel_lock(chan1); \ 2927 #define ast_channel_ref(c) ({ ao2_ref(c, +1); (c); }) 2938 #define ast_channel_unref(c) ({ ao2_ref(c, -1); (struct ast_channel *) (NULL); }) 2949 #define ast_channel_cleanup(c) ({ ao2_cleanup(c); (struct ast_channel *) (NULL); }) 3065 void *data,
int ao2_flags);
4146 #if defined(__cplusplus) || defined(c_plusplus) 4214 #define DECLARE_STRINGFIELD_SETTERS_FOR(field) \ 4215 void ast_channel_##field##_set(struct ast_channel *chan, const char *field); \ 4216 void ast_channel_##field##_build_va(struct ast_channel *chan, const char *fmt, va_list ap) __attribute__((format(printf, 2, 0))); \ 4217 void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) __attribute__((format(printf, 2, 3))) 4894 #define AST_MUTE_DIRECTION_READ (1 << 0) 4895 #define AST_MUTE_DIRECTION_WRITE (1 << 1) 5132 #define ast_channel_has_tech_function(chan, function) \ 5133 (ast_channel_tech(chan) ? ast_channel_tech(chan)->function != NULL : 0)
Channels with this particular technology are an implementation detail of Asterisk and should generall...
void(* ast_cc_callback_fn)(struct ast_channel *chan, struct ast_cc_config_params *cc_params, const char *monitor_type, const char *const device_name, const char *const dialstring, void *private_data)
Callback made from ast_cc_callback for certain channel types.
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
const ast_string_field peeraccount
void ast_party_connected_line_collect_caller(struct ast_party_connected_line *connected, struct ast_party_caller *caller)
Collect the caller party information into a connected line structure.
enum ast_channel_state ast_channel_state(const struct ast_channel *chan)
void ast_channel_dtmf_digit_to_emulate_set(struct ast_channel *chan, char value)
static char musicclass[MAX_MUSICCLASS]
static enum ast_t38_state ast_channel_get_t38_state(struct ast_channel *chan)
Retrieves the current T38 state of a channel.
struct ast_channel * ast_waitfor_n(struct ast_channel **chan, int n, int *ms)
Waits for input on a group of channels Wait for input on an array of channels for a given # of millis...
int ast_safe_sleep(struct ast_channel *chan, int ms)
Wait for a specified amount of time, looking for hangups.
void ast_party_name_copy(struct ast_party_name *dest, const struct ast_party_name *src)
Copy the source party name information to the destination party name.
void ast_channel_internal_bridge_channel_set(struct ast_channel *chan, struct ast_bridge_channel *value)
int ast_queue_hangup(struct ast_channel *chan)
Queue a hangup frame.
unsigned long long ast_group_t
void ast_channel_internal_alertpipe_clear(struct ast_channel *chan)
void ast_channel_snapshot_set(struct ast_channel *chan, struct ast_channel_snapshot *snapshot)
void ast_channel_fdno_set(struct ast_channel *chan, int value)
int ast_channel_early_bridge(struct ast_channel *c0, struct ast_channel *c1)
Bridge two channels together (early)
int ast_channel_vstreamid(const struct ast_channel *chan)
Information needed to identify an endpoint in a call.
enum sip_cc_notify_state state
const char * ast_channel_blockproc(const struct ast_channel *chan)
int ast_recvchar(struct ast_channel *chan, int timeout)
Receives a text character from a channel.
void ast_party_connected_line_init(struct ast_party_connected_line *init)
Initialize the given connected line structure.
static char accountcode[AST_MAX_ACCOUNT_CODE]
void ast_channel_timingfunc_set(struct ast_channel *chan, ast_timing_func_t value)
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
int presentation
Q.931 encoded presentation-indicator encoded field.
int ast_channel_fd_isset(const struct ast_channel *chan, int which)
void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani)
Set caller ID number, name and ANI and generate AMI event.
void ast_channel_req_accountcodes_precious(struct ast_channel *chan, const struct ast_channel *requestor, enum ast_channel_requestor_relationship relationship)
Setup new channel accountcodes from the requestor channel after ast_request().
static int indicate(void *data)
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
void ast_party_redirecting_set(struct ast_party_redirecting *dest, const struct ast_party_redirecting *src, const struct ast_set_party_redirecting *update)
Set the redirecting information based on another redirecting source.
struct ast_channel * ast_channel_get_by_exten(const char *exten, const char *context)
Find a channel by extension and context.
int ast_connected_line_build_data(unsigned char *data, size_t datalen, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Build the connected line information data frame.
void ast_channel_blocker_tid_set(struct ast_channel *chan, int tid)
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
char * str
Subscriber phone number (Malloced)
int64_t ast_channel_get_duration_ms(struct ast_channel *chan)
Obtain how long it's been, in milliseconds, since the channel was created.
int ast_channel_hold_state(const struct ast_channel *chan)
Asterisk locking-related definitions:
struct ast_channel * ast_channel_iterator_next(struct ast_channel_iterator *i)
Get the next channel for a channel iterator.
void ast_channel_internal_fd_clear(struct ast_channel *chan, int which)
int ast_channel_connected_line_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *connected_info, int is_caller, int frame)
Run a connected line interception macro and update a channel's connected line information.
void ast_channel_visible_indication_set(struct ast_channel *chan, int value)
char * str
Subscriber phone number (Malloced)
char chan_name[AST_CHANNEL_NAME]
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...
void ast_channel_timer_set(struct ast_channel *chan, struct ast_timer *value)
static char parkinglot[AST_MAX_CONTEXT]
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame without payload.
int ast_redirecting_parse_data(const unsigned char *data, size_t datalen, struct ast_party_redirecting *redirecting)
Parse redirecting indication frame data.
struct ast_party_caller caller
Channel Caller ID information.
struct ast_filestream * ast_channel_vstream(const struct ast_channel *chan)
void * ast_channel_generatordata(const struct ast_channel *chan)
int ast_write_text(struct ast_channel *chan, struct ast_frame *frame)
Write text frame to a channel This function writes the given frame to the indicated channel...
void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value)
int ast_channel_is_multistream(struct ast_channel *chan)
Determine if a channel is multi-stream capable.
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
int ast_channel_internal_alert_readfd(struct ast_channel *chan)
struct ast_party_id ast_channel_redirecting_effective_from(struct ast_channel *chan)
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value)
void ast_party_number_set_init(struct ast_party_number *init, const struct ast_party_number *guide)
Initialize the given party number structure using the given guide for a set update operation...
struct ast_cdr * ast_channel_cdr(const struct ast_channel *chan)
struct ast_channel_id linkedid
void ast_channel_dtmff_set(struct ast_channel *chan, struct ast_frame *value)
struct ast_stream_topology * ast_channel_get_stream_topology(const struct ast_channel *chan)
Retrieve the topology of streams on a channel.
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
ast_channel_requestor_relationship
channelreloadreason
Channel reload reasons for manager events at load or reload of configuration.
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_set_oldwriteformat(struct ast_channel *chan, struct ast_format *format)
struct ast_channel * parent_channel
struct ast_stream_topology * answer_topology
int ast_auto_answer(struct ast_channel *chan)
Answer a channel, if it's not already answered.
void ast_party_id_reset(struct ast_party_id *id)
Destroy and initialize the given party id structure.
Structure that contains features information.
void * ast_channel_tech_pvt(const struct ast_channel *chan)
const struct ast_channel_tech * ast_get_channel_tech(const char *name)
Get a channel technology structure by name.
int ast_channel_epfd(const 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...
char ast_channel_sending_dtmf_digit(const struct ast_channel *chan)
void ast_party_subaddress_copy(struct ast_party_subaddress *dest, const struct ast_party_subaddress *src)
Copy the source party subaddress information to the destination party subaddress. ...
unsigned int ast_channel_fout(const struct ast_channel *chan)
void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval offset)
Set when to hang a channel up.
struct ast_channel * ast_request_and_dial(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int timeout, int *reason, const char *cid_num, const char *cid_name)
Request a channel of a given type, with data as optional information used by the low level module and...
int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen, void *params)
static void update(int code_size, int y, int wi, int fi, int dq, int sr, int dqsez, struct g726_state *state_ptr)
void ast_channel_blockproc_set(struct ast_channel *chan, const char *value)
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
struct ast_channel * ast_call_forward(struct ast_channel *caller, struct ast_channel *orig, int *timeout, struct ast_format_cap *cap, struct outgoing_helper *oh, int *outstate)
Forwards a call to a new channel specified by the original channel's call_forward str...
void ast_channel_unregister(const struct ast_channel_tech *tech)
Unregister a channel technology.
void ast_channel_appl_set(struct ast_channel *chan, const char *value)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
int ast_channel_queryoption(struct ast_channel *channel, int option, void *data, int *datalen, int block)
Checks the value of an option.
static struct aco_type agent_type
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_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.
int64_t ast_channel_get_up_time_ms(struct ast_channel *chan)
Obtain how long it has been since the channel was answered in ms.
int ast_queue_unhold(struct ast_channel *chan)
Queue an unhold frame.
void ast_channel_framehooks_set(struct ast_channel *chan, struct ast_framehook_list *value)
int ast_channel_forward_endpoint(struct ast_channel *chan, struct ast_endpoint *endpoint)
Forward channel stasis messages to the given endpoint.
struct ast_variable * ast_channeltype_list(void)
return an ast_variable list of channeltypes
struct ast_channel * ast_channel_release(struct ast_channel *chan)
Unlink and release reference to a channel.
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
int ast_channel_supports_html(struct ast_channel *channel)
Checks for HTML support on a channel.
int ast_check_hangup_locked(struct ast_channel *chan)