static apt_bool_t mrcp_server_agent_channel_remove(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel) { mrcp_connection_t *connection = channel->connection; mrcp_connection_channel_remove(connection,channel); apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Control Channel <%s> [%d]", channel->identifier.buf, apr_hash_count(connection->channel_table)); if(!connection->access_count) { if(connection == agent->null_connection) { if(apt_list_is_empty(agent->connection_list) == TRUE) { apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy Pending Connection"); mrcp_connection_destroy(agent->null_connection); agent->null_connection = NULL; agent->connection_list = NULL; } } else if(!connection->sock) { mrcp_connection_remove(agent,connection); /* set connection to be destroyed on channel destroy */ apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Mark Connection for Late Destroy"); channel->connection = connection; channel->removed = TRUE; } } /* send response */ return mrcp_control_channel_remove_respond(agent->vtable,channel,TRUE); }
static apt_bool_t mrcp_server_agent_channel_remove(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel) { mrcp_connection_t *connection = channel->connection; if(connection) { mrcp_connection_channel_remove(connection,channel); apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Control Channel <%s> [%d]", channel->identifier.buf, apr_hash_count(connection->channel_table)); if(!connection->access_count) { if(!connection->sock) { mrcp_connection_remove(agent,connection); /* set connection to be destroyed on channel destroy */ apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Mark Connection for Removal %s",connection->id); channel->connection = connection; channel->removed = TRUE; } } } else { apr_hash_set(agent->pending_channel_table,channel->identifier.buf,channel->identifier.length,NULL); apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Pending Control Channel <%s> [%d]", channel->identifier.buf, apr_hash_count(agent->pending_channel_table)); } /* send response */ return mrcp_control_channel_remove_respond(agent->vtable,channel,TRUE); }
static apt_bool_t mrcp_client_agent_channel_remove(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel) { if(channel->connection) { mrcp_connection_t *connection = channel->connection; mrcp_connection_channel_remove(connection,channel); apt_log(APT_PRIO_INFO,"Remove Control Channel <%s> [%d]", channel->identifier.buf, apr_hash_count(connection->channel_table)); if(!connection->access_count) { mrcp_client_agent_connection_remove(agent,connection); /* set connection to be destroyed on channel destroy */ channel->connection = connection; channel->removed = TRUE; } } /* send response */ return mrcp_control_channel_remove_respond(agent->vtable,channel); }
static mrcp_control_channel_t* mrcp_connection_channel_associate(mrcp_connection_agent_t *agent, mrcp_connection_t *connection, const mrcp_message_t *message) { apt_str_t identifier; mrcp_control_channel_t *channel; if(!connection || !message) { return NULL; } apt_id_resource_generate(&message->channel_id.session_id,&message->channel_id.resource_name,'@',&identifier,connection->pool); channel = mrcp_connection_channel_find(connection,&identifier); if(!channel) { channel = mrcp_connection_channel_find(agent->null_connection,&identifier); if(channel) { mrcp_connection_channel_remove(agent->null_connection,channel); mrcp_connection_channel_add(connection,channel); apt_log(APT_PRIO_INFO,"Move Control Channel <%s> to Connection [%d]", channel->identifier.buf, apr_hash_count(connection->channel_table)); } } return channel; }