diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2005-09-07 01:30:01 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2005-09-07 01:30:01 +0000 |
commit | 5fdc070109c757f0df4321d3cd5d0069b77b3f46 (patch) | |
tree | 8165a261cb124dd45a1b6129516aabef87fce470 /channels/chan_iax2.c | |
parent | 2f67f665779c1cbc714c9757143769e79845fd5c (diff) |
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
Diffstat (limited to 'channels/chan_iax2.c')
-rwxr-xr-x | channels/chan_iax2.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index b05544f24..9c1c5f489 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -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) |