add new channel option (via ast_channel_setoption()) to let channel drivers adjust txgain/rxgain if they are able (only Zap channels at this time)

modify app_chanspy to use new gain option
reformat app_chanspy to match coding guidelines
add user-controlled volume adjustment to app_meetme (issue #4170, heavily modified to actually work on Zap channels)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2005-09-07 01:30:01 +00:00
parent 2f67f66577
commit 5fdc070109
5 changed files with 477 additions and 222 deletions

View File

@@ -2992,18 +2992,29 @@ static int iax2_setoption(struct ast_channel *c, int option, void *data, int dat
{
struct ast_option_header *h;
int res;
h = malloc(datalen + sizeof(struct ast_option_header));
if (h) {
h->flag = AST_OPTION_FLAG_REQUEST;
h->option = htons(option);
memcpy(h->data, data, datalen);
res = send_command_locked(PTR_TO_CALLNO(c->tech_pvt), AST_FRAME_CONTROL,
AST_CONTROL_OPTION, 0, (unsigned char *)h, datalen + sizeof(struct ast_option_header), -1);
free(h);
return res;
} else
ast_log(LOG_WARNING, "Out of memory\n");
return -1;
switch (option) {
case AST_OPTION_TXGAIN:
case AST_OPTION_RXGAIN:
/* these two cannot be sent, because they require a result */
errno = ENOSYS;
return -1;
default:
h = malloc(datalen + sizeof(*h));
if (h) {
h->flag = AST_OPTION_FLAG_REQUEST;
h->option = htons(option);
memcpy(h->data, data, datalen);
res = send_command_locked(PTR_TO_CALLNO(c->tech_pvt), AST_FRAME_CONTROL,
AST_CONTROL_OPTION, 0, (unsigned char *) h,
datalen + sizeof(*h), -1);
free(h);
return res;
} else {
ast_log(LOG_WARNING, "Out of memory\n");
return -1;
}
}
}
static struct ast_frame *iax2_read(struct ast_channel *c)