summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/asterisk/dial.h1
-rw-r--r--main/dial.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/include/asterisk/dial.h b/include/asterisk/dial.h
index ab9219811..c59257ce5 100644
--- a/include/asterisk/dial.h
+++ b/include/asterisk/dial.h
@@ -46,6 +46,7 @@ enum ast_dial_option {
AST_DIAL_OPTION_DISABLE_CALL_FORWARDING, /*!< Disable call forwarding on channels */
AST_DIAL_OPTION_PREDIAL, /*!< Execute a predial subroutine before dialing */
AST_DIAL_OPTION_DIAL_REPLACES_SELF, /*!< The dial operation is a replacement for the requester */
+ AST_DIAL_OPTION_SELF_DESTROY, /*!< Destroy self at end of ast_dial_run */
AST_DIAL_OPTION_MAX, /*!< End terminator -- must always remain last */
};
diff --git a/main/dial.c b/main/dial.c
index a27ac5b59..827b5ef23 100644
--- a/main/dial.c
+++ b/main/dial.c
@@ -206,6 +206,7 @@ static const struct ast_option_types option_types[] = {
{ AST_DIAL_OPTION_DISABLE_CALL_FORWARDING, NULL, NULL }, /*!< Disable call forwarding on channels */
{ AST_DIAL_OPTION_PREDIAL, predial_enable, predial_disable }, /*!< Execute a subroutine on the outbound channels prior to dialing */
{ AST_DIAL_OPTION_DIAL_REPLACES_SELF, NULL, NULL }, /*!< The dial operation is a replacement for the requester */
+ { AST_DIAL_OPTION_SELF_DESTROY, NULL, NULL}, /*!< Destroy self at end of ast_dial_run */
{ AST_DIAL_OPTION_MAX, NULL, NULL }, /*!< Terminator of list */
};
@@ -889,6 +890,13 @@ static enum ast_dial_result monitor_dial(struct ast_dial *dial, struct ast_chann
AST_LIST_UNLOCK(&dial->channels);
}
+ if (dial->options[AST_DIAL_OPTION_SELF_DESTROY]) {
+ enum ast_dial_result state = dial->state;
+
+ ast_dial_destroy(dial);
+ return state;
+ }
+
return dial->state;
}