aboutsummaryrefslogtreecommitdiffstats
path: root/apps
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 /apps
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 'apps')
-rw-r--r--apps/app_dial.c11
-rw-r--r--apps/app_disa.c3
-rw-r--r--apps/app_dumpchan.c2
-rw-r--r--apps/app_flash.c2
-rw-r--r--apps/app_meetme.c4
-rw-r--r--apps/app_queue.c7
-rw-r--r--apps/app_softhangup.c2
-rw-r--r--apps/app_transfer.c2
-rw-r--r--apps/app_voicemail.c5
-rw-r--r--apps/app_zapbarge.c2
-rw-r--r--apps/app_zapras.c2
-rw-r--r--apps/app_zapscan.c4
12 files changed, 25 insertions, 21 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 346cf4eaa..cfe25b81b 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -58,6 +58,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/rtp.h"
#include "asterisk/manager.h"
#include "asterisk/privacy.h"
+#include "asterisk/stringfields.h"
static char *tdesc = "Dialing Application";
@@ -498,7 +499,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
else
newcid = in->exten;
o->chan->cid.cid_num = strdup(newcid);
- ast_copy_string(o->chan->accountcode, winner->accountcode, sizeof(o->chan->accountcode));
+ ast_string_field_set(o->chan, accountcode, winner->accountcode);
o->chan->cdrflags = winner->cdrflags;
if (!o->chan->cid.cid_num)
ast_log(LOG_WARNING, "Out of memory\n");
@@ -513,7 +514,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
if (!o->chan->cid.cid_name)
ast_log(LOG_WARNING, "Out of memory\n");
}
- ast_copy_string(o->chan->accountcode, in->accountcode, sizeof(o->chan->accountcode));
+ ast_string_field_set(o->chan, accountcode, in->accountcode);
o->chan->cdrflags = in->cdrflags;
}
@@ -1089,11 +1090,11 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
tmp->chan->cid.cid_ani = strdup(chan->cid.cid_ani);
/* Copy language from incoming to outgoing */
- ast_copy_string(tmp->chan->language, chan->language, sizeof(tmp->chan->language));
- ast_copy_string(tmp->chan->accountcode, chan->accountcode, sizeof(tmp->chan->accountcode));
+ ast_string_field_set(tmp->chan, language, chan->language);
+ ast_string_field_set(tmp->chan, accountcode, chan->accountcode);
tmp->chan->cdrflags = chan->cdrflags;
if (ast_strlen_zero(tmp->chan->musicclass))
- ast_copy_string(tmp->chan->musicclass, chan->musicclass, sizeof(tmp->chan->musicclass));
+ ast_string_field_set(tmp->chan, musicclass, chan->musicclass);
if (chan->cid.cid_rdnis)
tmp->chan->cid.cid_rdnis = strdup(chan->cid.cid_rdnis);
/* Pass callingpres setting */
diff --git a/apps/app_disa.c b/apps/app_disa.c
index cbaae05a5..1c8cb6732 100644
--- a/apps/app_disa.c
+++ b/apps/app_disa.c
@@ -47,6 +47,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/translate.h"
#include "asterisk/ulaw.h"
#include "asterisk/callerid.h"
+#include "asterisk/stringfields.h"
static char *tdesc = "DISA (Direct Inward System Access) Application";
@@ -347,7 +348,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
}
if (!ast_strlen_zero(acctcode))
- ast_copy_string(chan->accountcode, acctcode, sizeof(chan->accountcode));
+ ast_string_field_set(chan, accountcode, acctcode);
if (special_noanswer) flags.flags = 0;
ast_cdr_reset(chan->cdr, &flags);
diff --git a/apps/app_dumpchan.c b/apps/app_dumpchan.c
index d690154f2..fbb2d82a4 100644
--- a/apps/app_dumpchan.c
+++ b/apps/app_dumpchan.c
@@ -106,7 +106,7 @@ static int ast_serialize_showchan(struct ast_channel *c, char *buf, size_t size)
"Data= %s\n"
"Blocking_in= %s\n",
c->name,
- c->type,
+ c->tech->type,
c->uniqueid,
(c->cid.cid_num ? c->cid.cid_num : "(N/A)"),
(c->cid.cid_name ? c->cid.cid_name : "(N/A)"),
diff --git a/apps/app_flash.c b/apps/app_flash.c
index 33542d283..84ed38934 100644
--- a/apps/app_flash.c
+++ b/apps/app_flash.c
@@ -82,7 +82,7 @@ static int flash_exec(struct ast_channel *chan, void *data)
struct localuser *u;
struct zt_params ztp;
LOCAL_USER_ADD(u);
- if (!strcasecmp(chan->type, "Zap")) {
+ if (!strcasecmp(chan->tech->type, "Zap")) {
memset(&ztp, 0, sizeof(ztp));
res = ioctl(chan->fds[0], ZT_GET_PARAMS, &ztp);
if (!res) {
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 7fd41c26f..ce233e3ca 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -996,7 +996,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
}
ast_indicate(chan, -1);
- retryzap = strcasecmp(chan->type, "Zap");
+ retryzap = strcasecmp(chan->tech->type, "Zap");
user->zapchannel = !retryzap;
zapretry:
@@ -1302,7 +1302,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
using_pseudo = 0;
}
ast_log(LOG_DEBUG, "Ooh, something swapped out under us, starting over\n");
- retryzap = strcasecmp(c->type, "Zap");
+ retryzap = strcasecmp(c->tech->type, "Zap");
user->zapchannel = !retryzap;
goto zapretry;
}
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 9d84965a7..e1acd27b6 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -91,6 +91,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/causes.h"
#include "asterisk/astdb.h"
#include "asterisk/devicestate.h"
+#include "asterisk/stringfields.h"
#define QUEUE_STRATEGY_RINGALL 0
#define QUEUE_STRATEGY_ROUNDROBIN 1
@@ -1735,7 +1736,7 @@ static struct localuser *wait_for_answer(struct queue_ent *qe, struct localuser
if (!o->chan->cid.cid_name)
ast_log(LOG_WARNING, "Out of memory\n");
}
- ast_copy_string(o->chan->accountcode, in->accountcode, sizeof(o->chan->accountcode));
+ ast_string_field_set(o->chan, accountcode, in->accountcode);
o->chan->cdrflags = in->cdrflags;
if (in->cid.cid_ani) {
@@ -2182,9 +2183,9 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
we will always return with -1 so that it is hung up properly after the
conversation. */
qe->handled++;
- if (!strcmp(qe->chan->type,"Zap"))
+ if (!strcmp(qe->chan->tech->type, "Zap"))
ast_channel_setoption(qe->chan, AST_OPTION_TONE_VERIFY, &nondataquality, sizeof(nondataquality), 0);
- if (!strcmp(peer->type,"Zap"))
+ if (!strcmp(peer->tech->type, "Zap"))
ast_channel_setoption(peer, AST_OPTION_TONE_VERIFY, &nondataquality, sizeof(nondataquality), 0);
/* Update parameters for the queue */
recalc_holdtime(qe);
diff --git a/apps/app_softhangup.c b/apps/app_softhangup.c
index bcc54a33f..374de0510 100644
--- a/apps/app_softhangup.c
+++ b/apps/app_softhangup.c
@@ -84,7 +84,7 @@ static int softhangup_exec(struct ast_channel *chan, void *data)
/* XXX watch out, i think it is wrong to access c-> after unlocking! */
if (all) {
/* CAPI is set up like CAPI[foo/bar]/clcnt */
- if (!strcmp(c->type,"CAPI"))
+ if (!strcmp(c->tech->type, "CAPI"))
cut = strrchr(name,'/');
/* Basically everything else is Foo/Bar-Z */
else
diff --git a/apps/app_transfer.c b/apps/app_transfer.c
index 41c6e35dd..6b459353a 100644
--- a/apps/app_transfer.c
+++ b/apps/app_transfer.c
@@ -113,7 +113,7 @@ static int transfer_exec(struct ast_channel *chan, void *data)
tech = dest;
dest = slash + 1;
/* Allow execution only if the Tech/destination agrees with the type of the channel */
- if (strncasecmp(chan->type, tech, len)) {
+ if (strncasecmp(chan->tech->type, tech, len)) {
pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE");
LOCAL_USER_REMOVE(u);
return 0;
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 28c73e8ae..eee1d3ddb 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -72,6 +72,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/localtime.h"
#include "asterisk/cli.h"
#include "asterisk/utils.h"
+#include "asterisk/stringfields.h"
#ifdef USE_ODBC_STORAGE
#include "asterisk/res_odbc.h"
#endif
@@ -2655,7 +2656,7 @@ static int resequence_mailbox(struct ast_vm_user *vmu, char *dir)
}
-static int say_and_wait(struct ast_channel *chan, int num, char *language)
+static int say_and_wait(struct ast_channel *chan, int num, const char *language)
{
int d;
d = ast_say_number(chan, num, AST_DIGIT_ANY, language, (char *) NULL);
@@ -5150,7 +5151,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
/* Set language from config to override channel language */
if (!ast_strlen_zero(vmu->language))
- ast_copy_string(chan->language, vmu->language, sizeof(chan->language));
+ ast_string_field_set(chan, language, vmu->language);
create_dirpath(vms.curdir, sizeof(vms.curdir), vmu->context, vms.username, "");
/* Retrieve old and new message counts */
res = open_mailbox(&vms, vmu, 1);
diff --git a/apps/app_zapbarge.c b/apps/app_zapbarge.c
index 3fb62f94f..7f28f0679 100644
--- a/apps/app_zapbarge.c
+++ b/apps/app_zapbarge.c
@@ -131,7 +131,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
goto outrun;
}
ast_indicate(chan, -1);
- retryzap = strcasecmp(chan->type, "Zap");
+ retryzap = strcasecmp(chan->tech->type, "Zap");
zapretry:
origfd = chan->fds[0];
if (retryzap) {
diff --git a/apps/app_zapras.c b/apps/app_zapras.c
index e884f64cc..d6960ec17 100644
--- a/apps/app_zapras.c
+++ b/apps/app_zapras.c
@@ -217,7 +217,7 @@ static int zapras_exec(struct ast_channel *chan, void *data)
/* Answer the channel if it's not up */
if (chan->_state != AST_STATE_UP)
ast_answer(chan);
- if (strcasecmp(chan->type, "Zap")) {
+ if (strcasecmp(chan->tech->type, "Zap")) {
/* If it's not a zap channel, we're done. Wait a couple of
seconds and then hangup... */
if (option_verbose > 1)
diff --git a/apps/app_zapscan.c b/apps/app_zapscan.c
index 987c3dab3..829e3b3c7 100644
--- a/apps/app_zapscan.c
+++ b/apps/app_zapscan.c
@@ -137,7 +137,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
goto outrun;
}
ast_indicate(chan, -1);
- retryzap = strcasecmp(chan->type, "Zap");
+ retryzap = strcasecmp(chan->tech->type, "Zap");
zapretry:
origfd = chan->fds[0];
if (retryzap) {
@@ -345,7 +345,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
continue;
}
}
- if ( tempchan && tempchan->type && (!strcmp(tempchan->type, "Zap")) && (tempchan != chan) ) {
+ if (tempchan && (!strcmp(tempchan->tech->type, "Zap")) && (tempchan != chan) ) {
ast_verbose(VERBOSE_PREFIX_3 "Zap channel %s is in-use, monitoring...\n", tempchan->name);
ast_copy_string(confstr, tempchan->name, sizeof(confstr));
ast_mutex_unlock(&tempchan->lock);