diff --git a/include/asterisk/dial.h b/include/asterisk/dial.h index fe4b63e93b..e023fb342c 100644 --- a/include/asterisk/dial.h +++ b/include/asterisk/dial.h @@ -154,7 +154,7 @@ void ast_dial_set_state_callback(struct ast_dial *dial, ast_dial_state_callback /*! \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 + * \param timeout Maximum time allowed in milliseconds * \return nothing */ void ast_dial_set_global_timeout(struct ast_dial *dial, int timeout); @@ -162,7 +162,7 @@ void ast_dial_set_global_timeout(struct ast_dial *dial, int timeout); /*! \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 + * \param timeout Maximum time allowed in milliseconds * \return nothing */ void ast_dial_set_timeout(struct ast_dial *dial, int num, int timeout); diff --git a/main/dial.c b/main/dial.c index 199d05c2f8..2a9fdacecc 100644 --- a/main/dial.c +++ b/main/dial.c @@ -1037,7 +1037,7 @@ void ast_dial_set_global_timeout(struct ast_dial *dial, int timeout) { dial->timeout = timeout; - if (dial->timeout > 0 && dial->actual_timeout > dial->timeout) + if (dial->timeout > 0 && (dial->actual_timeout > dial->timeout || dial->actual_timeout == -1)) dial->actual_timeout = dial->timeout; return; @@ -1058,7 +1058,7 @@ void ast_dial_set_timeout(struct ast_dial *dial, int num, int timeout) channel->timeout = timeout; - if (channel->timeout > 0 && dial->actual_timeout > channel->timeout) + if (channel->timeout > 0 && (dial->actual_timeout > channel->timeout || dial->actual_timeout == -1)) dial->actual_timeout = channel->timeout; return;