summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--channels/chan_sip.c2
-rw-r--r--main/pbx.c8
2 files changed, 9 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index c02f022ef..51eaef2f8 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -17345,7 +17345,7 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sock
break;
}
- if (peer->endpoint) {
+ if (peer && peer->endpoint) {
ast_endpoint_blob_publish(peer->endpoint, ast_endpoint_state_type(), blob);
}
}
diff --git a/main/pbx.c b/main/pbx.c
index 4c95b278f..ec96344cb 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -9776,6 +9776,8 @@ struct pbx_outgoing {
char exten[AST_MAX_EXTENSION];
/*! \brief Dialplan priority */
int priority;
+ /*! \brief Result of the dial operation when dialed is set */
+ int dial_res;
/*! \brief Set when dialing is completed */
unsigned int dialed:1;
/*! \brief Set when execution is completed */
@@ -9806,6 +9808,7 @@ static void *pbx_outgoing_exec(void *data)
/* Notify anyone interested that dialing is complete */
ast_mutex_lock(&outgoing->lock);
res = ast_dial_run(outgoing->dial, NULL, 0);
+ outgoing->dial_res = res;
outgoing->dialed = 1;
ast_cond_signal(&outgoing->cond);
ast_mutex_unlock(&outgoing->lock);
@@ -9978,6 +9981,11 @@ static int pbx_outgoing_attempt(const char *type, struct ast_format_cap *cap, co
}
while (!outgoing->dialed) {
ast_cond_wait(&outgoing->cond, &outgoing->lock);
+
+ if (outgoing->dial_res != AST_DIAL_RESULT_ANSWERED) {
+ /* The dial operation failed. */
+ return -1;
+ }
}
if (channel && *channel) {
ast_channel_lock(*channel);