diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-04-10 23:55:26 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-04-10 23:55:26 +0000 |
commit | c58ebc051cc4a990a4a09da11fad0d8035cbb3a4 (patch) | |
tree | 99d84dac4f22d74080c6c0f794870da27161333e | |
parent | c0ba6b88afa9c80c5f3a75b156e53f7325a5039f (diff) |
Issue 6082 - New DTMF event for manager
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@61324 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | configs/manager.conf.sample | 4 | ||||
-rw-r--r-- | include/asterisk/manager.h | 1 | ||||
-rw-r--r-- | main/channel.c | 17 | ||||
-rw-r--r-- | main/manager.c | 1 |
4 files changed, 21 insertions, 2 deletions
diff --git a/configs/manager.conf.sample b/configs/manager.conf.sample index 660ab843e..6f2eec859 100644 --- a/configs/manager.conf.sample +++ b/configs/manager.conf.sample @@ -58,5 +58,5 @@ bindaddr = 0.0.0.0 ; writetimeout = 100 ; ; Authorization for various classes -;read = system,call,log,verbose,command,agent,user,config -;write = system,call,log,verbose,command,agent,user,config +;read = system,call,log,verbose,command,agent,user,config,dtmf +;write = system,call,log,verbose,command,agent,user,config,dtmf diff --git a/include/asterisk/manager.h b/include/asterisk/manager.h index 8efcfba18..fd1ed4ac5 100644 --- a/include/asterisk/manager.h +++ b/include/asterisk/manager.h @@ -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 128 diff --git a/main/channel.c b/main/channel.c index 87be422a7..dd79c6fd4 100644 --- a/main/channel.c +++ b/main/channel.c @@ -2030,6 +2030,19 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd) 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 */ @@ -2196,6 +2209,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) } 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, duration %ld ms\n", f->subclass, chan->name, f->len); /* Queue it up if DTMF is deffered, or if DTMF emulation is forced. * However, only let emulation be forced if the other end cares about BEGIN frames */ @@ -2223,6 +2237,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) } 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_FLAG_END_DTMF_ONLY)) { ast_frfree(f); @@ -2617,6 +2632,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr) 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); @@ -2624,6 +2640,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr) 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, fr->len); diff --git a/main/manager.c b/main/manager.c index 2298cf247..8cff7ce04 100644 --- a/main/manager.c +++ b/main/manager.c @@ -308,6 +308,7 @@ static struct permalias { { EVENT_FLAG_AGENT, "agent" }, { EVENT_FLAG_USER, "user" }, { EVENT_FLAG_CONFIG, "config" }, + { EVENT_FLAG_DTMF, "dtmf" }, { -1, "all" }, { 0, "none" }, }; |