chat_play new option to let caller hear the same message.
This commit is contained in:
parent
0c9abc7cbc
commit
fcbc6d8caa
1
README
1
README
|
@ -288,6 +288,7 @@ Deactivate CCBS:
|
||||||
exten => s,1,capicommand(ccbsstop|${CCLINKAGEID})
|
exten => s,1,capicommand(ccbsstop|${CCLINKAGEID})
|
||||||
|
|
||||||
Chat (MeetMe/Conference):
|
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:
|
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.)
|
(This uses the DSPs onboard a Dialogic(R) Diva(R) Rev.2 Media Board.)
|
||||||
exten => s,1,capicommand(chat|<roomname>|<options>|controller)
|
exten => s,1,capicommand(chat|<roomname>|<options>|controller)
|
||||||
|
|
|
@ -1144,6 +1144,7 @@ capicommand(chat_play|<roomname>|<options>|<filename>|controller)
|
||||||
roomname - conference room name
|
roomname - conference room name
|
||||||
options
|
options
|
||||||
m - The caller will get music-on-hold while message is played
|
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.
|
filename - Voice message file name. Should be in aLaw (uLaw) format.
|
||||||
controller - CAPI controller
|
controller - CAPI controller
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "chan_capi_command.h"
|
#include "chan_capi_command.h"
|
||||||
|
|
||||||
#define CHAT_FLAG_MOH 0x0001
|
#define CHAT_FLAG_MOH 0x0001
|
||||||
|
#define CHAT_FLAG_SAMEMSG 0x0002
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
RoomMemberDefault = 0, /* Rx/Tx by default, muted by operator */
|
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) {
|
if (voice_message == NULL) {
|
||||||
ast_write(chan, f);
|
ast_write(chan, f);
|
||||||
} else {
|
} else {
|
||||||
|
struct ast_frame *fr2;
|
||||||
char* p = f->FRAME_DATA_PTR;
|
char* p = f->FRAME_DATA_PTR;
|
||||||
int len;
|
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);
|
memset (&p[len], 0x00, f->datalen-len);
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
|
if (flags & CHAT_FLAG_SAMEMSG) {
|
||||||
|
fr2 = ast_frdup(f);
|
||||||
|
ast_write(chan, fr2);
|
||||||
|
}
|
||||||
capi_write_frame(i, f);
|
capi_write_frame(i, f);
|
||||||
}
|
}
|
||||||
} while ((write_block_nr-- != 0) && (len > 0));
|
} while ((write_block_nr-- != 0) && (len > 0));
|
||||||
|
@ -701,7 +707,9 @@ int pbx_capi_chat_play(struct ast_channel *c, char *param)
|
||||||
case 'm':
|
case 'm':
|
||||||
flags |= CHAT_FLAG_MOH;
|
flags |= CHAT_FLAG_MOH;
|
||||||
break;
|
break;
|
||||||
|
case 's':
|
||||||
|
flags |= CHAT_FLAG_SAMEMSG;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
cc_log(LOG_WARNING, "Unknown chat option '%c'.\n",
|
cc_log(LOG_WARNING, "Unknown chat option '%c'.\n",
|
||||||
*options);
|
*options);
|
||||||
|
@ -710,6 +718,11 @@ int pbx_capi_chat_play(struct ast_channel *c, char *param)
|
||||||
options++;
|
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");
|
f = fopen(file_name, "rb");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
cc_log(LOG_WARNING, "can't open voice file (%s)\n", strerror(errno));
|
cc_log(LOG_WARNING, "can't open voice file (%s)\n", strerror(errno));
|
||||||
|
|
Loading…
Reference in New Issue