From fcbc6d8caa23fd4be942554753dbd52c32d5f67d Mon Sep 17 00:00:00 2001 From: MelwareDE Date: Fri, 24 Jul 2009 10:10:44 +0000 Subject: [PATCH] chat_play new option to let caller hear the same message. --- README | 1 + README.media | 1 + chan_capi_chat.c | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README b/README index 4e9c158..dc39e33 100644 --- a/README +++ b/README @@ -288,6 +288,7 @@ Deactivate CCBS: exten => s,1,capicommand(ccbsstop|${CCLINKAGEID}) Chat (MeetMe/Conference): + See also README.media for details! If the CAPI card/driver supports it, the caller can be put into a chat-room: (This uses the DSPs onboard a Dialogic(R) Diva(R) Rev.2 Media Board.) exten => s,1,capicommand(chat|||controller) diff --git a/README.media b/README.media index fd11002..e7ef51d 100644 --- a/README.media +++ b/README.media @@ -1144,6 +1144,7 @@ capicommand(chat_play||||controller) roomname - conference room name options m - The caller will get music-on-hold while message is played + s - The caller will hear the same message that is played filename - Voice message file name. Should be in aLaw (uLaw) format. controller - CAPI controller diff --git a/chan_capi_chat.c b/chan_capi_chat.c index 64d07d2..da0ad0d 100644 --- a/chan_capi_chat.c +++ b/chan_capi_chat.c @@ -24,6 +24,7 @@ #include "chan_capi_command.h" #define CHAT_FLAG_MOH 0x0001 +#define CHAT_FLAG_SAMEMSG 0x0002 typedef enum { RoomMemberDefault = 0, /* Rx/Tx by default, muted by operator */ @@ -515,6 +516,7 @@ static void chat_handle_events(struct ast_channel *c, struct capi_pvt *i, if (voice_message == NULL) { ast_write(chan, f); } else { + struct ast_frame *fr2; char* p = f->FRAME_DATA_PTR; int len; @@ -524,6 +526,10 @@ static void chat_handle_events(struct ast_channel *c, struct capi_pvt *i, memset (&p[len], 0x00, f->datalen-len); len = 0; } + if (flags & CHAT_FLAG_SAMEMSG) { + fr2 = ast_frdup(f); + ast_write(chan, fr2); + } capi_write_frame(i, f); } } while ((write_block_nr-- != 0) && (len > 0)); @@ -701,7 +707,9 @@ int pbx_capi_chat_play(struct ast_channel *c, char *param) case 'm': flags |= CHAT_FLAG_MOH; break; - + case 's': + flags |= CHAT_FLAG_SAMEMSG; + break; default: cc_log(LOG_WARNING, "Unknown chat option '%c'.\n", *options); @@ -710,6 +718,11 @@ int pbx_capi_chat_play(struct ast_channel *c, char *param) options++; } + if (flags & (CHAT_FLAG_MOH | CHAT_FLAG_SAMEMSG)) { + cc_log(LOG_WARNING, "chat_play: option 's' overrides 'm'.\n"); + flags &= ~CHAT_FLAG_MOH; + } + f = fopen(file_name, "rb"); if (f == NULL) { cc_log(LOG_WARNING, "can't open voice file (%s)\n", strerror(errno));