add disable_ec app
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@506 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
8587eb9308
commit
15fe36a6d7
|
@ -1848,10 +1848,28 @@ SWITCH_STANDARD_API(oz_function)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SWITCH_STANDARD_APP(disable_ec_function)
|
||||||
|
{
|
||||||
|
private_t *tech_pvt;
|
||||||
|
int x = 0;
|
||||||
|
|
||||||
|
if (!switch_core_session_check_interface(session, openzap_endpoint_interface)) {
|
||||||
|
zap_log(ZAP_LOG_ERROR, "This application is only for OpenZAP channels.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tech_pvt = switch_core_session_get_private(session);
|
||||||
|
zap_channel_command(tech_pvt->zchan, ZAP_COMMAND_DISABLE_ECHOCANCEL, &x);
|
||||||
|
zap_channel_command(tech_pvt->zchan, ZAP_COMMAND_DISABLE_ECHOTRAIN, &x);
|
||||||
|
zap_log(ZAP_LOG_ERROR, "Echo Canceller Disabled\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_MODULE_LOAD_FUNCTION(mod_openzap_load)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_openzap_load)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch_api_interface_t *commands_api_interface;
|
switch_api_interface_t *commands_api_interface;
|
||||||
|
switch_application_interface_t *app_interface;
|
||||||
|
|
||||||
module_pool = pool;
|
module_pool = pool;
|
||||||
|
|
||||||
|
@ -1875,6 +1893,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_openzap_load)
|
||||||
|
|
||||||
SWITCH_ADD_API(commands_api_interface, "oz", "OpenZAP commands", oz_function, OZ_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "oz", "OpenZAP commands", oz_function, OZ_SYNTAX);
|
||||||
|
|
||||||
|
SWITCH_ADD_APP(app_interface, "disable_ec", "Disable Echo Canceller", "Disable Echo Canceller", disable_ec_function, "", SAF_NONE);
|
||||||
|
|
||||||
/* indicate that the module should continue to be loaded */
|
/* indicate that the module should continue to be loaded */
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,6 +260,10 @@ typedef enum {
|
||||||
ZAP_COMMAND_TRACE_OUTPUT,
|
ZAP_COMMAND_TRACE_OUTPUT,
|
||||||
ZAP_COMMAND_ENABLE_CALLERID_DETECT,
|
ZAP_COMMAND_ENABLE_CALLERID_DETECT,
|
||||||
ZAP_COMMAND_DISABLE_CALLERID_DETECT,
|
ZAP_COMMAND_DISABLE_CALLERID_DETECT,
|
||||||
|
ZAP_COMMAND_ENABLE_ECHOCANCEL,
|
||||||
|
ZAP_COMMAND_DISABLE_ECHOCANCEL,
|
||||||
|
ZAP_COMMAND_ENABLE_ECHOTRAIN,
|
||||||
|
ZAP_COMMAND_DISABLE_ECHOTRAIN,
|
||||||
ZAP_COMMAND_COUNT
|
ZAP_COMMAND_COUNT
|
||||||
} zap_command_t;
|
} zap_command_t;
|
||||||
|
|
||||||
|
|
|
@ -204,6 +204,7 @@ zap_size_t zap_buffer_write(zap_buffer_t *buffer, const void *data, zap_size_t d
|
||||||
|
|
||||||
if (freespace < datalen) {
|
if (freespace < datalen) {
|
||||||
zap_size_t new_size, new_block_size;
|
zap_size_t new_size, new_block_size;
|
||||||
|
void *data;
|
||||||
|
|
||||||
new_size = buffer->datalen + datalen;
|
new_size = buffer->datalen + datalen;
|
||||||
new_block_size = buffer->datalen + buffer->blocksize;
|
new_block_size = buffer->datalen + buffer->blocksize;
|
||||||
|
@ -212,10 +213,11 @@ zap_size_t zap_buffer_write(zap_buffer_t *buffer, const void *data, zap_size_t d
|
||||||
new_size = new_block_size;
|
new_size = new_block_size;
|
||||||
}
|
}
|
||||||
buffer->head = buffer->data;
|
buffer->head = buffer->data;
|
||||||
buffer->data = realloc(buffer->data, new_size);
|
data = realloc(buffer->data, new_size);
|
||||||
if (!buffer->data) {
|
if (!data) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
buffer->data = data;
|
||||||
buffer->head = buffer->data;
|
buffer->head = buffer->data;
|
||||||
buffer->datalen = new_size;
|
buffer->datalen = new_size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -377,6 +377,32 @@ static ZIO_COMMAND_FUNCTION(zt_command)
|
||||||
memset(&ztp, 0, sizeof(ztp));
|
memset(&ztp, 0, sizeof(ztp));
|
||||||
|
|
||||||
switch(command) {
|
switch(command) {
|
||||||
|
case ZAP_COMMAND_ENABLE_ECHOCANCEL:
|
||||||
|
{
|
||||||
|
int level = ZAP_COMMAND_OBJ_INT;
|
||||||
|
err = ioctl(zchan->sockfd, ZT_ECHOCANCEL, &level);
|
||||||
|
ZAP_COMMAND_OBJ_INT = level;
|
||||||
|
}
|
||||||
|
case ZAP_COMMAND_DISABLE_ECHOCANCEL:
|
||||||
|
{
|
||||||
|
int level = 0;
|
||||||
|
err = ioctl(zchan->sockfd, ZT_ECHOCANCEL, &level);
|
||||||
|
ZAP_COMMAND_OBJ_INT = level;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ZAP_COMMAND_ENABLE_ECHOTRAIN:
|
||||||
|
{
|
||||||
|
int level = ZAP_COMMAND_OBJ_INT;
|
||||||
|
err = ioctl(zchan->sockfd, ZT_ECHOTRAIN, &level);
|
||||||
|
ZAP_COMMAND_OBJ_INT = level;
|
||||||
|
}
|
||||||
|
case ZAP_COMMAND_DISABLE_ECHOTRAIN:
|
||||||
|
{
|
||||||
|
int level = 0;
|
||||||
|
err = ioctl(zchan->sockfd, ZT_ECHOTRAIN, &level);
|
||||||
|
ZAP_COMMAND_OBJ_INT = level;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case ZAP_COMMAND_OFFHOOK:
|
case ZAP_COMMAND_OFFHOOK:
|
||||||
{
|
{
|
||||||
int command = ZT_OFFHOOK;
|
int command = ZT_OFFHOOK;
|
||||||
|
|
Loading…
Reference in New Issue