Index: include/asterisk/manager.h =================================================================== --- include/asterisk/manager.h (revision 47050) +++ include/asterisk/manager.h (working copy) @@ -55,6 +55,7 @@ #define EVENT_FLAG_AGENT (1 << 5) /* Ability to read/set agent info */ #define EVENT_FLAG_USER (1 << 6) /* Ability to read/set user info */ #define EVENT_FLAG_CONFIG (1 << 7) /* Ability to modify configurations */ +#define EVENT_FLAG_DTMF (1 << 8) /* Ability to read DTMF events */ /* Export manager structures */ #define AST_MAX_MANHEADERS 80 Index: main/channel.c =================================================================== --- main/channel.c (revision 47050) +++ main/channel.c (working copy) @@ -1925,6 +1925,19 @@ return 0; /* Time is up */ } +static void send_dtmf_event(const struct ast_channel *chan, const char *direction, const char digit, const char *begin, const char *end) +{ + manager_event(EVENT_FLAG_DTMF, + "DTMF", + "Channel: %s\r\n" + "Uniqueid: %s\r\n" + "Digit: %c\r\n" + "Direction: %s\r\n" + "Begin: %s\r\n" + "End: %s\r\n", + chan->name, chan->uniqueid, digit, direction, begin, end); +} + static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) { struct ast_frame *f = NULL; /* the return value */ @@ -2078,6 +2091,7 @@ } break; case AST_FRAME_DTMF_END: + send_dtmf_event(chan, "Received", f->subclass, "No", "Yes"); ast_log(LOG_DTMF, "DTMF end '%c' received on %s\n", f->subclass, chan->name); if (ast_test_flag(chan, AST_FLAG_DEFER_DTMF | AST_FLAG_EMULATE_DTMF)) { if (strlen(chan->dtmfq) < sizeof(chan->dtmfq) - 2) @@ -2098,6 +2112,7 @@ ast_clear_flag(chan, AST_FLAG_IN_DTMF); break; case AST_FRAME_DTMF_BEGIN: + send_dtmf_event(chan, "Received", f->subclass, "Yes", "No"); ast_log(LOG_DTMF, "DTMF begin '%c' received on %s\n", f->subclass, chan->name); if (ast_test_flag(chan, AST_FLAG_DEFER_DTMF)) { ast_frfree(f); @@ -2487,6 +2502,7 @@ chan->tech->indicate(chan, fr->subclass, fr->data, fr->datalen); break; case AST_FRAME_DTMF_BEGIN: + send_dtmf_event(chan, "Sent", fr->subclass, "Yes", "No"); ast_clear_flag(chan, AST_FLAG_BLOCKING); ast_channel_unlock(chan); res = ast_senddigit_begin(chan, fr->subclass); @@ -2494,6 +2510,7 @@ CHECK_BLOCKING(chan); break; case AST_FRAME_DTMF_END: + send_dtmf_event(chan, "Sent", fr->subclass, "No", "Yes"); ast_clear_flag(chan, AST_FLAG_BLOCKING); ast_channel_unlock(chan); res = ast_senddigit_end(chan, fr->subclass); Index: main/manager.c =================================================================== --- main/manager.c (revision 47050) +++ main/manager.c (working copy) @@ -277,6 +277,7 @@ { EVENT_FLAG_AGENT, "agent" }, { EVENT_FLAG_USER, "user" }, { EVENT_FLAG_CONFIG, "config" }, + { EVENT_FLAG_DTMF, "dtmf" }, { -1, "all" }, { 0, "none" }, };