diff --git a/include/asterisk/cel.h b/include/asterisk/cel.h index 353c061..99c2c6f 100644 --- a/include/asterisk/cel.h +++ b/include/asterisk/cel.h @@ -96,6 +96,10 @@ enum ast_cel_event_type { AST_CEL_PICKUP = 24, /*! \brief this call was forwarded somewhere else */ AST_CEL_FORWARD = 25, + /*! \brief channel is put on hold state */ + AST_CEL_HOLD_START = 26, + /*! \brief channel is released from hold state */ + AST_CEL_HOLD_END = 27, }; /*! diff --git a/main/cel.c b/main/cel.c index 32d8836..a7b857a 100644 --- a/main/cel.c +++ b/main/cel.c @@ -116,6 +116,8 @@ static const char * const cel_event_types[CEL_MAX_EVENT_IDS] = { [AST_CEL_3WAY_END] = "3WAY_END", [AST_CEL_HOOKFLASH] = "HOOKFLASH", [AST_CEL_LINKEDID_END] = "LINKEDID_END", + [AST_CEL_HOLD_START] = "HOLD_START", + [AST_CEL_HOLD_END] = "HOLD_END", }; /*! diff --git a/main/channel.c b/main/channel.c index e85a096..1f2e450 100644 --- a/main/channel.c +++ b/main/channel.c @@ -7545,6 +7545,10 @@ void ast_uninstall_music_functions(void) /*! \brief Turn on music on hold on a given channel */ int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass) { + ast_cel_report_event(chan, AST_CEL_HOLD_START, NULL, NULL, NULL); + + pbx_builtin_setvar_helper(chan, "HOLDING", "Yes"); + if (ast_moh_start_ptr) return ast_moh_start_ptr(chan, mclass, interpclass); @@ -7556,8 +7560,14 @@ int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *inte /*! \brief Turn off music on hold on a given channel */ void ast_moh_stop(struct ast_channel *chan) { + ast_cel_report_event(chan, AST_CEL_HOLD_END, NULL, NULL, NULL); + + /* Effectively remove variable */ + pbx_builtin_setvar_helper(chan, "HOLDING", NULL); + if (ast_moh_stop_ptr) ast_moh_stop_ptr(chan); + } void ast_moh_cleanup(struct ast_channel *chan)