aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_agent.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-01 23:05:28 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-01 23:05:28 +0000
commit21d21f89c04ebaad6822311ceadd13275b357513 (patch)
tree86a6664b5cba70b924fdd1cef2ecbf93226e7d58 /channels/chan_agent.c
parent4d4470fe1560a6d00b17db78798f0cc9790fe74b (diff)
use string fields for some stuff in ast_channel
const-ify some more APIs remove 'type' field from ast_channel, in favor of the one in the channel's tech structure allow string field module users to specify the 'chunk size' for pool allocations update chan_alsa to be compatible with recent const-ification patches git-svn-id: http://svn.digium.com/svn/asterisk/trunk@9060 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_agent.c')
-rw-r--r--channels/chan_agent.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index e99a6f483..ff0308b7b 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -71,9 +71,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/astdb.h"
#include "asterisk/devicestate.h"
#include "asterisk/monitor.h"
+#include "asterisk/stringfields.h"
static const char desc[] = "Agent Proxy Channel";
-static const char channeltype[] = "Agent";
static const char tdesc[] = "Call Agent Proxy Channel";
static const char config[] = "agents.conf";
@@ -257,7 +257,7 @@ static struct ast_channel *agent_bridgedchannel(struct ast_channel *chan, struct
static void set_agentbycallerid(const char *callerid, const char *agent);
static const struct ast_channel_tech agent_tech = {
- .type = channeltype,
+ .type = "Agent",
.description = tdesc,
.capabilities = -1,
.requester = agent_request,
@@ -520,7 +520,7 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
CLEANUP(ast,p);
if (p->chan && !p->chan->_bridge) {
- if (strcasecmp(p->chan->type, "Local")) {
+ if (strcasecmp(p->chan->tech->type, "Local")) {
p->chan->_bridge = ast;
if (p->chan)
ast_log(LOG_DEBUG, "Bridge on '%s' being set to '%s' (3)\n", p->chan->name, p->chan->_bridge->name);
@@ -913,7 +913,7 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state)
tmp->rawwriteformat = p->chan->writeformat;
tmp->readformat = p->chan->readformat;
tmp->rawreadformat = p->chan->readformat;
- ast_copy_string(tmp->language, p->chan->language, sizeof(tmp->language));
+ ast_string_field_set(tmp, language, p->chan->language);
ast_copy_string(tmp->context, p->chan->context, sizeof(tmp->context));
ast_copy_string(tmp->exten, p->chan->exten, sizeof(tmp->exten));
} else {
@@ -924,10 +924,9 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state)
tmp->rawreadformat = AST_FORMAT_SLINEAR;
}
if (p->pending)
- snprintf(tmp->name, sizeof(tmp->name), "Agent/P%s-%d", p->agent, rand() & 0xffff);
+ ast_string_field_build(tmp, name, "Agent/P%s-%d", p->agent, rand() & 0xffff);
else
- snprintf(tmp->name, sizeof(tmp->name), "Agent/%s", p->agent);
- tmp->type = channeltype;
+ ast_string_field_build(tmp, name, "Agent/%s", p->agent);
/* Safe, agentlock already held */
ast_setstate(tmp, state);
tmp->tech_pvt = p;
@@ -2491,7 +2490,7 @@ int load_module()
{
/* Make sure we can register our agent channel type */
if (ast_channel_register(&agent_tech)) {
- ast_log(LOG_ERROR, "Unable to register channel class %s\n", channeltype);
+ ast_log(LOG_ERROR, "Unable to register channel class 'Agent'\n");
return -1;
}
/* Dialplan applications */