Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Dialing API. More...
Go to the source code of this file.
Typedefs | |
typedef void(* | ast_dial_state_callback) (struct ast_dial *) |
Enumerations | |
enum | ast_dial_option { AST_DIAL_OPTION_RINGING , AST_DIAL_OPTION_ANSWER_EXEC , AST_DIAL_OPTION_MUSIC , AST_DIAL_OPTION_DISABLE_CALL_FORWARDING , AST_DIAL_OPTION_PREDIAL , AST_DIAL_OPTION_DIAL_REPLACES_SELF , AST_DIAL_OPTION_SELF_DESTROY , AST_DIAL_OPTION_MAX } |
List of options that are applicable either globally or per dialed channel. More... | |
enum | ast_dial_result { AST_DIAL_RESULT_INVALID , AST_DIAL_RESULT_FAILED , AST_DIAL_RESULT_TRYING , AST_DIAL_RESULT_RINGING , AST_DIAL_RESULT_PROGRESS , AST_DIAL_RESULT_PROCEEDING , AST_DIAL_RESULT_ANSWERED , AST_DIAL_RESULT_TIMEOUT , AST_DIAL_RESULT_HANGUP , AST_DIAL_RESULT_UNANSWERED } |
List of return codes for dial run API calls. More... | |
Functions | |
struct ast_channel * | ast_dial_answered (struct ast_dial *dial) |
Return channel that answered. More... | |
struct ast_channel * | ast_dial_answered_steal (struct ast_dial *dial) |
Steal the channel that answered. More... | |
int | ast_dial_append (struct ast_dial *dial, const char *tech, const char *device, const struct ast_assigned_ids *assignedids) |
Append a channel. More... | |
int | ast_dial_append_channel (struct ast_dial *dial, struct ast_channel *chan) |
Append a channel using an actual channel object. More... | |
struct ast_dial * | ast_dial_create (void) |
New dialing structure. More... | |
int | ast_dial_destroy (struct ast_dial *dial) |
Destroys a dialing structure. More... | |
struct ast_channel * | ast_dial_get_channel (struct ast_dial *dial, int num) |
Get the dialing channel, if prerun has been executed. More... | |
void * | ast_dial_get_user_data (struct ast_dial *dial) |
Return the user data on a dial structure. More... | |
void | ast_dial_hangup (struct ast_dial *dial) |
Hangup channels. More... | |
enum ast_dial_result | ast_dial_join (struct ast_dial *dial) |
Cancel async thread. More... | |
int | ast_dial_option_disable (struct ast_dial *dial, int num, enum ast_dial_option option) |
Disables an option per channel. More... | |
int | ast_dial_option_enable (struct ast_dial *dial, int num, enum ast_dial_option option, void *data) |
Enables an option per channel. More... | |
int | ast_dial_option_global_disable (struct ast_dial *dial, enum ast_dial_option option) |
Disables an option globally. More... | |
int | ast_dial_option_global_enable (struct ast_dial *dial, enum ast_dial_option option, void *data) |
Enables an option globally. More... | |
int | ast_dial_prerun (struct ast_dial *dial, struct ast_channel *chan, struct ast_format_cap *cap) |
Request all appended channels, but do not dial. More... | |
int | ast_dial_reason (struct ast_dial *dial, int num) |
Get the reason an outgoing channel has failed. More... | |
enum ast_dial_result | ast_dial_run (struct ast_dial *dial, struct ast_channel *chan, int async) |
Execute dialing synchronously or asynchronously. More... | |
void | ast_dial_set_global_timeout (struct ast_dial *dial, int timeout) |
Set the maximum time (globally) allowed for trying to ring phones. More... | |
void | ast_dial_set_state_callback (struct ast_dial *dial, ast_dial_state_callback callback) |
Set a callback for state changes. More... | |
void | ast_dial_set_timeout (struct ast_dial *dial, int num, int timeout) |
Set the maximum time (per channel) allowed for trying to ring the phone. More... | |
void | ast_dial_set_user_data (struct ast_dial *dial, void *user_data) |
Set user data on a dial structure. More... | |
enum ast_dial_result | ast_dial_state (struct ast_dial *dial) |
Return state of dial. More... | |
const char * | ast_hangup_cause_to_dial_status (int hangup_cause) |
Convert a hangup cause to a publishable dial status. More... | |
Dialing API.
Definition in file dial.h.
enum ast_dial_option |
List of options that are applicable either globally or per dialed channel.
Definition at line 42 of file dial.h.
enum ast_dial_result |
List of return codes for dial run API calls.
Definition at line 54 of file dial.h.
struct ast_channel * ast_dial_answered | ( | struct ast_dial * | dial | ) |
Return channel that answered.
dial | Dialing structure |
Definition at line 977 of file dial.c.
References AST_DIAL_RESULT_ANSWERED, AST_LIST_FIRST, ast_dial::channels, NULL, and ast_dial::state.
Referenced by ari_originate_dial(), dial_trunk(), page_state_callback(), and sla_handle_dial_state_event().
struct ast_channel * ast_dial_answered_steal | ( | struct ast_dial * | dial | ) |
Steal the channel that answered.
dial | Dialing structure |
Definition at line 989 of file dial.c.
References AST_DIAL_RESULT_ANSWERED, AST_LIST_FIRST, ast_dial::channels, NULL, and ast_dial::state.
Referenced by ari_originate_dial(), do_notify(), pbx_outgoing_exec(), and recall_callback().
int ast_dial_append | ( | struct ast_dial * | dial, |
const char * | tech, | ||
const char * | device, | ||
const struct ast_assigned_ids * | assignedids | ||
) |
Append a channel.
Definition at line 280 of file dial.c.
References ast_calloc, ast_dial_channel::device, dial_append_common(), NULL, and ast_dial_channel::tech.
Referenced by ari_channels_handle_originate_with_id(), dial_trunk(), do_notify(), page_exec(), pbx_outgoing_attempt(), recalling_enter(), and sla_ring_station().
int ast_dial_append_channel | ( | struct ast_dial * | dial, |
struct ast_channel * | chan | ||
) |
Append a channel using an actual channel object.
dial | The ast_dial to add the channel to |
chan | The channel to add to the dial |
-1 | Failure |
non-zero | The position of the channel in the list of dialed channels |
Definition at line 295 of file dial.c.
References ast_calloc, ast_channel_name(), ast_free, ast_strdupa, ast_dial_channel::device, dial_append_common(), NULL, ast_dial_channel::owner, and ast_dial_channel::tech.
struct ast_dial * ast_dial_create | ( | void | ) |
New dialing structure.
Definition at line 223 of file dial.c.
References ast_dial::actual_timeout, ast_calloc, AST_LIST_HEAD_INIT, ast_mutex_init, AST_PTHREADT_NULL, ast_dial::channels, ast_dial::lock, NULL, ast_dial::thread, and ast_dial::timeout.
Referenced by ari_channels_handle_originate_with_id(), dial_trunk(), do_notify(), page_exec(), pbx_outgoing_attempt(), recalling_enter(), and sla_ring_station().
int ast_dial_destroy | ( | struct ast_dial * | dial | ) |
Destroys a dialing structure.
dial | Dialing structure to free |
0 | on success |
-1 | on failure |
Definition at line 1091 of file dial.c.
References ast_dial_channel::assignedid1, ast_dial_channel::assignedid2, AST_DIAL_OPTION_MAX, ast_free, ast_hangup(), AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_mutex_destroy, ast_dial::channels, ast_dial_channel::device, ast_option_types::disable, ast_dial_channel::list, ast_dial::lock, NULL, option_types, ast_dial::options, ast_dial_channel::options, ast_dial_channel::owner, and ast_dial_channel::tech.
Referenced by ari_channels_handle_originate_with_id(), ari_originate_dial(), dial_trunk(), do_notify(), monitor_dial(), page_exec(), pbx_outgoing_destroy(), recalling_exit(), run_station(), sla_handle_dial_state_event(), sla_hangup_stations(), sla_ring_station(), and sla_stop_ringing_station().
struct ast_channel * ast_dial_get_channel | ( | struct ast_dial * | dial, |
int | num | ||
) |
Get the dialing channel, if prerun has been executed.
dial | Dial structure |
num | Channel number to get channel of |
Definition at line 1258 of file dial.c.
References AST_LIST_EMPTY, ast_dial::channels, find_dial_channel(), NULL, ast_dial_channel::num, and ast_dial_channel::owner.
Referenced by ari_channels_handle_originate_with_id(), pbx_outgoing_attempt(), pbx_outgoing_state_callback(), and recalling_enter().
void * ast_dial_get_user_data | ( | struct ast_dial * | dial | ) |
Return the user data on a dial structure.
dial | The dial structure |
Definition at line 1279 of file dial.c.
References ast_dial::user_data.
Referenced by ari_originate_dial(), page_state_callback(), and recall_callback().
void ast_dial_hangup | ( | struct ast_dial * | dial | ) |
Hangup channels.
dial | Dialing structure |
Definition at line 1074 of file dial.c.
References ast_hangup(), AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_dial::channels, ast_dial_channel::list, NULL, and ast_dial_channel::owner.
Referenced by ast_dial_run(), and page_exec().
enum ast_dial_result ast_dial_join | ( | struct ast_dial * | dial | ) |
Cancel async thread.
dial | Dialing structure |
Definition at line 1017 of file dial.c.
References ast_channel_lock, ast_channel_unlock, AST_DIAL_RESULT_FAILED, AST_LIST_FIRST, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_mutex_lock, ast_mutex_unlock, AST_PTHREADT_NULL, AST_PTHREADT_STOP, ast_softhangup(), AST_SOFTHANGUP_EXPLICIT, ast_dial::channels, ast_dial_channel::list, ast_dial::lock, NULL, ast_dial_channel::owner, ast_dial::state, thread, and ast_dial::thread.
Referenced by dial_trunk(), page_exec(), recalling_exit(), run_station(), sla_handle_dial_state_event(), sla_hangup_stations(), sla_ring_station(), and sla_stop_ringing_station().
int ast_dial_option_disable | ( | struct ast_dial * | dial, |
int | num, | ||
enum ast_dial_option | option | ||
) |
Disables an option per channel.
dial | Dial structure |
num | Channel number to disable option on |
option | Option to disable |
0 | on success |
-1 | on failure |
Definition at line 1222 of file dial.c.
References AST_LIST_EMPTY, ast_dial::channels, ast_option_types::disable, find_dial_channel(), NULL, ast_dial_channel::num, option_types, and ast_dial_channel::options.
int ast_dial_option_enable | ( | struct ast_dial * | dial, |
int | num, | ||
enum ast_dial_option | option, | ||
void * | data | ||
) |
Enables an option per channel.
dial | Dial structure |
num | Channel number to enable option on |
option | Option to enable |
data | Data to pass to this option (not always needed) |
0 | on success |
-1 | on failure |
Definition at line 1181 of file dial.c.
References AST_LIST_EMPTY, ast_dial::channels, ast_option_types::enable, find_dial_channel(), NULL, ast_dial_channel::num, option_types, and ast_dial_channel::options.
int ast_dial_option_global_disable | ( | struct ast_dial * | dial, |
enum ast_dial_option | option | ||
) |
Disables an option globally.
dial | Dial structure to disable option on |
option | Option to disable |
0 | on success |
-1 | on failure |
Definition at line 1205 of file dial.c.
References ast_option_types::disable, NULL, option_types, and ast_dial::options.
int ast_dial_option_global_enable | ( | struct ast_dial * | dial, |
enum ast_dial_option | option, | ||
void * | data | ||
) |
Enables an option globally.
dial | Dial structure to enable option on |
option | Option to enable |
data | Data to pass to this option (not always needed) |
0 | on success |
-1 | on failure |
Definition at line 1145 of file dial.c.
References ast_option_types::enable, option_types, and ast_dial::options.
Referenced by do_notify(), page_exec(), and pbx_outgoing_attempt().
int ast_dial_prerun | ( | struct ast_dial * | dial, |
struct ast_channel * | chan, | ||
struct ast_format_cap * | cap | ||
) |
Request all appended channels, but do not dial.
dial | Dialing structure |
chan | Optional dialing channel |
cap | Optional requested capabilities |
-1 | failure |
0 | success |
Definition at line 431 of file dial.c.
References AST_DIAL_OPTION_PREDIAL, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, begin_dial_prerun(), ast_dial::channels, ast_dial_channel::list, and ast_dial::options.
Referenced by ari_channels_handle_originate_with_id(), pbx_outgoing_attempt(), and recalling_enter().
int ast_dial_reason | ( | struct ast_dial * | dial, |
int | num | ||
) |
Get the reason an outgoing channel has failed.
dial | Dial structure |
num | Channel number to get the reason from |
Definition at line 1247 of file dial.c.
References AST_LIST_EMPTY, ast_dial_channel::cause, ast_dial::channels, find_dial_channel(), and ast_dial_channel::num.
Referenced by pbx_outgoing_attempt().
enum ast_dial_result ast_dial_run | ( | struct ast_dial * | dial, |
struct ast_channel * | chan, | ||
int | async | ||
) |
Execute dialing synchronously or asynchronously.
Definition at line 935 of file dial.c.
References ast_debug, ast_dial_hangup(), AST_DIAL_RESULT_FAILED, AST_DIAL_RESULT_INVALID, AST_DIAL_RESULT_TRYING, AST_LIST_EMPTY, ast_pthread_create, ast_read_threadstorage_callid(), async_dial(), begin_dial(), ast_dial::callid, ast_dial::channels, monitor_dial(), NULL, ast_dial::state, and ast_dial::thread.
Referenced by ari_originate_dial(), dial_trunk(), do_notify(), page_exec(), pbx_outgoing_exec(), recalling_enter(), and sla_ring_station().
void ast_dial_set_global_timeout | ( | struct ast_dial * | dial, |
int | timeout | ||
) |
Set the maximum time (globally) allowed for trying to ring phones.
dial | The dial structure to apply the time limit to |
timeout | Maximum time allowed in milliseconds |
Definition at line 1284 of file dial.c.
References ast_dial::actual_timeout, ast_dial::timeout, and ast_dial_channel::timeout.
Referenced by ari_channels_handle_originate_with_id(), do_notify(), page_exec(), and pbx_outgoing_attempt().
void ast_dial_set_state_callback | ( | struct ast_dial * | dial, |
ast_dial_state_callback | callback | ||
) |
Set a callback for state changes.
dial | The dial structure to watch for state changes |
callback | the callback |
Definition at line 1269 of file dial.c.
References ast_dial::state_callback.
Referenced by page_exec(), pbx_outgoing_attempt(), recalling_enter(), and sla_ring_station().
void ast_dial_set_timeout | ( | struct ast_dial * | dial, |
int | num, | ||
int | timeout | ||
) |
Set the maximum time (per channel) allowed for trying to ring the phone.
dial | The dial structure the channel belongs to |
num | Channel number to set timeout on |
timeout | Maximum time allowed in milliseconds |
Definition at line 1294 of file dial.c.
References ast_dial::actual_timeout, find_dial_channel(), NULL, ast_dial_channel::num, and ast_dial_channel::timeout.
void ast_dial_set_user_data | ( | struct ast_dial * | dial, |
void * | user_data | ||
) |
Set user data on a dial structure.
dial | The dial structure to set a user data pointer on |
user_data | The user data pointer |
Definition at line 1274 of file dial.c.
References ast_dial::user_data.
Referenced by ari_channels_handle_originate_with_id(), page_exec(), and recalling_enter().
enum ast_dial_result ast_dial_state | ( | struct ast_dial * | dial | ) |
Return state of dial.
dial | Dialing structure |
Definition at line 1008 of file dial.c.
References ast_dial::state.
Referenced by dial_trunk(), page_state_callback(), pbx_outgoing_state_callback(), recall_callback(), and sla_handle_dial_state_event().
const char * ast_hangup_cause_to_dial_status | ( | int | hangup_cause | ) |
Convert a hangup cause to a publishable dial status.
Definition at line 749 of file dial.c.
References AST_CAUSE_BUSY, AST_CAUSE_CONGESTION, AST_CAUSE_NO_ANSWER, AST_CAUSE_NO_ROUTE_DESTINATION, and AST_CAUSE_UNREGISTERED.
Referenced by monitor_dial(), try_calling(), and wait_for_answer().