Newer
Older
int ast_dial_option_disable(struct ast_dial *dial, int num, enum ast_dial_option option)
{
struct ast_dial_channel *channel = NULL;
/* Ensure we have required arguments */
if (!dial || AST_LIST_EMPTY(&dial->channels))
return -1;
if (!(channel = find_dial_channel(dial, num)))
return -1;
/* If the option is not enabled, return failure */
if (!channel->options[option])
return -1;
/* Execute callback of option to disable it if it exists */
if (option_types[option].disable)
option_types[option].disable(channel->options[option]);
/* Finally disable the option on the structure */
channel->options[option] = NULL;
return 0;
}
void ast_dial_set_state_callback(struct ast_dial *dial, ast_dial_state_callback callback)
{
dial->state_callback = callback;
}
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
/*! \brief Set the maximum time (globally) allowed for trying to ring phones
* \param dial The dial structure to apply the time limit to
* \param timeout Maximum time allowed
* \return nothing
*/
void ast_dial_set_global_timeout(struct ast_dial *dial, int timeout)
{
dial->timeout = timeout;
if (dial->timeout > 0 && dial->actual_timeout > dial->timeout)
dial->actual_timeout = dial->timeout;
return;
}
/*! \brief Set the maximum time (per channel) allowed for trying to ring the phone
* \param dial The dial structure the channel belongs to
* \param num Channel number to set timeout on
* \param timeout Maximum time allowed
* \return nothing
*/
void ast_dial_set_timeout(struct ast_dial *dial, int num, int timeout)
{
struct ast_dial_channel *channel = NULL;
if (!(channel = find_dial_channel(dial, num)))
return;
channel->timeout = timeout;
if (channel->timeout > 0 && dial->actual_timeout > channel->timeout)
dial->actual_timeout = channel->timeout;
return;
}