chat_play new option to let caller hear the same message.

This commit is contained in:
MelwareDE 2009-07-24 10:10:44 +00:00
parent 0c9abc7cbc
commit fcbc6d8caa
3 changed files with 16 additions and 1 deletions

1
README
View File

@ -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|<roomname>|<options>|controller)

View File

@ -1144,6 +1144,7 @@ capicommand(chat_play|<roomname>|<options>|<filename>|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

View File

@ -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));