summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorTerry Wilson <twilson@digium.com>2012-01-09 22:15:50 +0000
committerTerry Wilson <twilson@digium.com>2012-01-09 22:15:50 +0000
commit04da92c3799e546fa4d84bdaeebd499fb64aea7a (patch)
tree9617b8b2d6d06f96ba27c0baefc5b93eb9e3bc5b /res
parent64d1b247c407de2af029392a6c32a99bf11c7ded (diff)
Replace direct access to channel name with accessor functions
There are many benefits to making the ast_channel an opaque handle, from increasing maintainability to presenting ways to kill masquerades. This patch kicks things off by taking things a field at a time, renaming the field to '__do_not_use_${fieldname}' and then writing setters/getters and converting the existing code to using them. When all fields are done, we can move ast_channel to a C file from channel.h and lop off the '__do_not_use_'. This patch sets up main/channel_interal_api.c to be the only file that actually accesses the ast_channel's fields directly. The intent would be for any API functions in channel.c to use the accessor functions. No more monkeying around with channel internals. We should use our own APIs. The interesting changes in this patch are the addition of channel_internal_api.c, the moving of the AST_DATA stuff from channel.c to channel_internal_api.c (note: the AST_DATA stuff will have to be reworked to use accessor functions when ast_channel is really opaque), and some re-working of the way channel iterators/callbacks are handled so as to avoid creating fake ast_channels on the stack to pass in matching data by directly accessing fields (since "name" is a stringfield and the fake channel doesn't init the stringfields, you can't use the ast_channel_name_set() function). I went with ast_channel_name(chan) for a getter, and ast_channel_name_set(chan, name) for a setter. The majority of the grunt-work for this change was done by writing a semantic patch using Coccinelle ( http://coccinelle.lip6.fr/ ). Review: https://reviewboard.asterisk.org/r/1655/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/res_adsi.c2
-rw-r--r--res/res_agi.c54
-rw-r--r--res/res_calendar.c4
-rw-r--r--res/res_fax.c206
-rw-r--r--res/res_jabber.c4
-rw-r--r--res/res_monitor.c14
-rw-r--r--res/res_musiconhold.c32
-rw-r--r--res/res_mutestream.c4
-rw-r--r--res/snmp/agent.c14
9 files changed, 167 insertions, 167 deletions
diff --git a/res/res_adsi.c b/res/res_adsi.c
index 778752495..327ab130d 100644
--- a/res/res_adsi.c
+++ b/res/res_adsi.c
@@ -282,7 +282,7 @@ static int __adsi_transmit_messages(struct ast_channel *chan, unsigned char **ms
#endif
while ((x < 6) && msg[x]) {
if ((res = adsi_generate(buf + pos, msgtype[x], msg[x], msglen[x], x+1 - start, (x == 5) || !msg[x+1], ast_format_set(&tmpfmt, AST_FORMAT_ULAW,0))) < 0) {
- ast_log(LOG_WARNING, "Failed to generate ADSI message %d on channel %s\n", x + 1, chan->name);
+ ast_log(LOG_WARNING, "Failed to generate ADSI message %d on channel %s\n", x + 1, ast_channel_name(chan));
return -1;
}
ast_debug(1, "Message %d, of %d input bytes, %d output bytes\n", x + 1, msglen[x], res);
diff --git a/res/res_agi.c b/res/res_agi.c
index 1809c6d5a..a5cd5ecc8 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -956,7 +956,7 @@ int AST_OPTIONAL_API_NAME(ast_agi_send)(int fd, struct ast_channel *chan, char *
if (agidebug) {
if (chan) {
- ast_verbose("<%s>AGI Tx >> %s", chan->name, ast_str_buffer(buf));
+ ast_verbose("<%s>AGI Tx >> %s", ast_channel_name(chan), ast_str_buffer(buf));
} else {
ast_verbose("AGI Tx >> %s", ast_str_buffer(buf));
}
@@ -1010,7 +1010,7 @@ static struct agi_cmd *get_agi_cmd(struct ast_channel *chan)
ast_channel_unlock(chan);
if (!store) {
ast_log(LOG_ERROR, "Huh? Async AGI datastore disappeared on Channel %s!\n",
- chan->name);
+ ast_channel_name(chan));
return NULL;
}
agi_commands = store->data;
@@ -1029,7 +1029,7 @@ static int add_agi_cmd(struct ast_channel *chan, const char *cmd_buff, const cha
store = ast_channel_datastore_find(chan, &agi_commands_datastore_info, NULL);
if (!store) {
- ast_log(LOG_WARNING, "Channel %s is not setup for Async AGI.\n", chan->name);
+ ast_log(LOG_WARNING, "Channel %s is not setup for Async AGI.\n", ast_channel_name(chan));
return -1;
}
agi_commands = store->data;
@@ -1125,13 +1125,13 @@ static char *handle_cli_agi_add_cmd(struct ast_cli_entry *e, int cmd, struct ast
ast_channel_lock(chan);
if (add_agi_cmd(chan, a->argv[3], (a->argc > 4 ? a->argv[4] : ""))) {
- ast_cli(a->fd, "Failed to add AGI command to queue of channel %s\n", chan->name);
+ ast_cli(a->fd, "Failed to add AGI command to queue of channel %s\n", ast_channel_name(chan));
ast_channel_unlock(chan);
chan = ast_channel_unref(chan);
return CLI_FAILURE;
}
- ast_debug(1, "Added AGI command to channel %s queue\n", chan->name);
+ ast_debug(1, "Added AGI command to channel %s queue\n", ast_channel_name(chan));
ast_channel_unlock(chan);
chan = ast_channel_unref(chan);
@@ -1172,7 +1172,7 @@ static int action_add_agi_cmd(struct mansession *s, const struct message *m)
ast_channel_lock(chan);
if (add_agi_cmd(chan, cmdbuff, cmdid)) {
- snprintf(buf, sizeof(buf), "Failed to add AGI command to channel %s queue", chan->name);
+ snprintf(buf, sizeof(buf), "Failed to add AGI command to channel %s queue", ast_channel_name(chan));
astman_send_error(s, m, buf);
ast_channel_unlock(chan);
chan = ast_channel_unref(chan);
@@ -1206,7 +1206,7 @@ static enum agi_result async_agi_read_frame(struct ast_channel *chan)
f = ast_read(chan);
if (!f) {
- ast_debug(3, "No frame read on channel %s, going out ...\n", chan->name);
+ ast_debug(3, "No frame read on channel %s, going out ...\n", ast_channel_name(chan));
return AGI_RESULT_HANGUP;
}
if (f->frametype == AST_FRAME_CONTROL) {
@@ -1216,7 +1216,7 @@ static enum agi_result async_agi_read_frame(struct ast_channel *chan)
*/
switch (f->subclass.integer) {
case AST_CONTROL_HANGUP:
- ast_debug(3, "Got HANGUP frame on channel %s, going out ...\n", chan->name);
+ ast_debug(3, "Got HANGUP frame on channel %s, going out ...\n", ast_channel_name(chan));
ast_frfree(f);
return AGI_RESULT_HANGUP;
default:
@@ -1267,7 +1267,7 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i
/* add AsyncAGI datastore to the channel */
if (add_to_agi(chan)) {
- ast_log(LOG_ERROR, "Failed to start Async AGI on channel %s\n", chan->name);
+ ast_log(LOG_ERROR, "Failed to start Async AGI on channel %s\n", ast_channel_name(chan));
return AGI_RESULT_FAILURE;
}
@@ -1299,7 +1299,7 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i
res = read(fds[0], agi_buffer, AGI_BUF_SIZE);
if (!res) {
ast_log(LOG_ERROR, "Failed to read from Async AGI pipe on channel %s\n",
- chan->name);
+ ast_channel_name(chan));
returnstatus = AGI_RESULT_FAILURE;
goto async_agi_abort;
}
@@ -1311,7 +1311,7 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i
manager_event(EVENT_FLAG_AGI, "AsyncAGI",
"SubEvent: Start\r\n"
"Channel: %s\r\n"
- "Env: %s\r\n", chan->name, ami_buffer);
+ "Env: %s\r\n", ast_channel_name(chan), ami_buffer);
hungup = ast_check_hangup(chan);
for (;;) {
/*
@@ -1329,7 +1329,7 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i
res = read(fds[0], agi_buffer, AGI_BUF_SIZE);
if (!res) {
ast_log(LOG_ERROR, "Failed to read from Async AGI pipe on channel %s\n",
- chan->name);
+ ast_channel_name(chan));
free_agi_cmd(cmd);
returnstatus = AGI_RESULT_FAILURE;
goto async_agi_done;
@@ -1345,13 +1345,13 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i
manager_event(EVENT_FLAG_AGI, "AsyncAGI",
"SubEvent: Exec\r\n"
"Channel: %s\r\n"
- "Result: %s\r\n", chan->name, ami_buffer);
+ "Result: %s\r\n", ast_channel_name(chan), ami_buffer);
} else {
manager_event(EVENT_FLAG_AGI, "AsyncAGI",
"SubEvent: Exec\r\n"
"Channel: %s\r\n"
"CommandID: %s\r\n"
- "Result: %s\r\n", chan->name, cmd->cmd_id, ami_buffer);
+ "Result: %s\r\n", ast_channel_name(chan), cmd->cmd_id, ami_buffer);
}
free_agi_cmd(cmd);
@@ -1381,7 +1381,7 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i
/* Wait a bit for a frame to read or to poll for a new command. */
res = ast_waitfor(chan, timeout);
if (res < 0) {
- ast_debug(1, "ast_waitfor returned <= 0 on chan %s\n", chan->name);
+ ast_debug(1, "ast_waitfor returned <= 0 on chan %s\n", ast_channel_name(chan));
returnstatus = AGI_RESULT_FAILURE;
break;
}
@@ -1414,7 +1414,7 @@ async_agi_done:
controlled anymore by Async AGI */
manager_event(EVENT_FLAG_AGI, "AsyncAGI",
"SubEvent: End\r\n"
- "Channel: %s\r\n", chan->name);
+ "Channel: %s\r\n", ast_channel_name(chan));
async_agi_abort:
/* close the pipe */
@@ -1721,7 +1721,7 @@ static void setup_env(struct ast_channel *chan, char *request, int fd, int enhan
/* Print initial environment, with agi_request always being the first
thing */
ast_agi_send(fd, chan, "agi_request: %s\n", request);
- ast_agi_send(fd, chan, "agi_channel: %s\n", chan->name);
+ ast_agi_send(fd, chan, "agi_channel: %s\n", ast_channel_name(chan));
ast_agi_send(fd, chan, "agi_language: %s\n", chan->language);
ast_agi_send(fd, chan, "agi_type: %s\n", chan->tech->type);
ast_agi_send(fd, chan, "agi_uniqueid: %s\n", chan->uniqueid);
@@ -2413,7 +2413,7 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, const
if (silence > 0) {
res = ast_set_read_format(chan, &rfmt);
if (res)
- ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", chan->name);
+ ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", ast_channel_name(chan));
ast_dsp_free(sildet);
}
@@ -3380,7 +3380,7 @@ static enum agi_result agi_handle_command(struct ast_channel *chan, AGI *agi, ch
"SubEvent: Start\r\n"
"Channel: %s\r\n"
"CommandId: %d\r\n"
- "Command: %s\r\n", chan->name, command_id, ami_cmd);
+ "Command: %s\r\n", ast_channel_name(chan), command_id, ami_cmd);
parse_args(buf, &argc, argv);
c = find_command(argv, 0);
if (c && (!dead || (dead && c->dead))) {
@@ -3421,7 +3421,7 @@ static enum agi_result agi_handle_command(struct ast_channel *chan, AGI *agi, ch
"CommandId: %d\r\n"
"Command: %s\r\n"
"ResultCode: %d\r\n"
- "Result: %s\r\n", chan->name, command_id, ami_cmd, resultcode, ami_res);
+ "Result: %s\r\n", ast_channel_name(chan), command_id, ami_cmd, resultcode, ami_res);
switch (res) {
case RESULT_SHOWUSAGE:
if (ast_strlen_zero(c->usage)) {
@@ -3448,7 +3448,7 @@ static enum agi_result agi_handle_command(struct ast_channel *chan, AGI *agi, ch
"CommandId: %d\r\n"
"Command: %s\r\n"
"ResultCode: 511\r\n"
- "Result: Command not permitted on a dead channel\r\n", chan->name, command_id, ami_cmd);
+ "Result: Command not permitted on a dead channel\r\n", ast_channel_name(chan), command_id, ami_cmd);
} else {
ast_agi_send(agi->fd, chan, "510 Invalid or unknown command\n");
manager_event(EVENT_FLAG_AGI, "AGIExec",
@@ -3457,7 +3457,7 @@ static enum agi_result agi_handle_command(struct ast_channel *chan, AGI *agi, ch
"CommandId: %d\r\n"
"Command: %s\r\n"
"ResultCode: 510\r\n"
- "Result: Invalid or unknown command\r\n", chan->name, command_id, ami_cmd);
+ "Result: Invalid or unknown command\r\n", ast_channel_name(chan), command_id, ami_cmd);
}
return AGI_RESULT_SUCCESS;
}
@@ -3522,7 +3522,7 @@ static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi
/* Idle the channel until we get a command */
f = ast_read(c);
if (!f) {
- ast_debug(1, "%s hungup\n", chan->name);
+ ast_debug(1, "%s hungup\n", ast_channel_name(chan));
needhup = 1;
if (!returnstatus) {
returnstatus = AGI_RESULT_HANGUP;
@@ -3562,7 +3562,7 @@ static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi
if (!buf[0]) {
/* Program terminated */
- ast_verb(3, "<%s>AGI Script %s completed, returning %d\n", chan->name, request, returnstatus);
+ ast_verb(3, "<%s>AGI Script %s completed, returning %d\n", ast_channel_name(chan), request, returnstatus);
if (pid > 0)
waitpid(pid, status, 0);
/* No need to kill the pid anymore, since they closed us */
@@ -3583,7 +3583,7 @@ static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi
}
if (agidebug)
- ast_verbose("<%s>AGI Rx << %s\n", chan->name, buf);
+ ast_verbose("<%s>AGI Rx << %s\n", ast_channel_name(chan), buf);
cmd_status = agi_handle_command(chan, agi, buf, dead);
switch (cmd_status) {
case AGI_RESULT_FAILURE:
@@ -3926,13 +3926,13 @@ static int eagi_exec(struct ast_channel *chan, const char *data)
}
ast_format_copy(&readformat, &chan->readformat);
if (ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR)) {
- ast_log(LOG_WARNING, "Unable to set channel '%s' to linear mode\n", chan->name);
+ ast_log(LOG_WARNING, "Unable to set channel '%s' to linear mode\n", ast_channel_name(chan));
return -1;
}
res = agi_exec_full(chan, data, 1, 0);
if (!res) {
if (ast_set_read_format(chan, &readformat)) {
- ast_log(LOG_WARNING, "Unable to restore channel '%s' to format %s\n", chan->name, ast_getformatname(&readformat));
+ ast_log(LOG_WARNING, "Unable to restore channel '%s' to format %s\n", ast_channel_name(chan), ast_getformatname(&readformat));
}
}
return res;
diff --git a/res/res_calendar.c b/res/res_calendar.c
index 604d0b5c4..bc3689e8b 100644
--- a/res/res_calendar.c
+++ b/res/res_calendar.c
@@ -1279,7 +1279,7 @@ static int calendar_query_result_exec(struct ast_channel *chan, const char *cmd,
ast_channel_lock(chan);
if (!(datastore = ast_channel_datastore_find(chan, &eventlist_datastore_info, args.id))) {
- ast_log(LOG_WARNING, "There is no event notification datastore with id '%s' on '%s'!\n", args.id, chan->name);
+ ast_log(LOG_WARNING, "There is no event notification datastore with id '%s' on '%s'!\n", args.id, ast_channel_name(chan));
ast_channel_unlock(chan);
return -1;
}
@@ -1647,7 +1647,7 @@ static int calendar_event_read(struct ast_channel *chan, const char *cmd, char *
ast_channel_lock(chan);
if (!(datastore = ast_channel_datastore_find(chan, &event_notification_datastore, NULL))) {
- ast_log(LOG_WARNING, "There is no event notification datastore on '%s'!\n", chan->name);
+ ast_log(LOG_WARNING, "There is no event notification datastore on '%s'!\n", ast_channel_name(chan));
ast_channel_unlock(chan);
return -1;
}
diff --git a/res/res_fax.c b/res/res_fax.c
index e7070fff2..95d46f3bd 100644
--- a/res/res_fax.c
+++ b/res/res_fax.c
@@ -426,7 +426,7 @@ static struct ast_fax_session_details *find_details(struct ast_channel *chan)
return NULL;
}
if (!(details = datastore->data)) {
- ast_log(LOG_WARNING, "Huh? channel '%s' has a FAX datastore without data!\n", chan->name);
+ ast_log(LOG_WARNING, "Huh? channel '%s' has a FAX datastore without data!\n", ast_channel_name(chan));
ast_channel_unlock(chan);
return NULL;
}
@@ -522,12 +522,12 @@ static struct ast_fax_session_details *find_or_create_details(struct ast_channel
}
/* channel does not have one so we must create one */
if (!(details = session_details_new())) {
- ast_log(LOG_WARNING, "channel '%s' can't get a FAX details structure for the datastore!\n", chan->name);
+ ast_log(LOG_WARNING, "channel '%s' can't get a FAX details structure for the datastore!\n", ast_channel_name(chan));
return NULL;
}
if (!(datastore = ast_datastore_alloc(&fax_datastore, NULL))) {
ao2_ref(details, -1);
- ast_log(LOG_WARNING, "channel '%s' can't get a datastore!\n", chan->name);
+ ast_log(LOG_WARNING, "channel '%s' can't get a datastore!\n", ast_channel_name(chan));
return NULL;
}
/* add the datastore to the channel and increment the refcount */
@@ -1003,7 +1003,7 @@ static struct ast_fax_session *fax_session_new(struct ast_fax_session_details *d
ast_dsp_set_threshold(s->debug_info->dsp, 128);
}
- if (!(s->channame = ast_strdup(chan->name))) {
+ if (!(s->channame = ast_strdup(ast_channel_name(chan)))) {
fax_session_release(s, token);
ao2_ref(s, -1);
return NULL;
@@ -1138,7 +1138,7 @@ static int report_fax_status(struct ast_channel *chan, struct ast_fax_session_de
"%s%s",
(details->caps & AST_FAX_TECH_GATEWAY) ? "gateway" : (details->caps & AST_FAX_TECH_RECEIVE) ? "receive" : "send",
status,
- chan->name,
+ ast_channel_name(chan),
info.context,
info.exten,
info.cid,
@@ -1190,7 +1190,7 @@ static void set_channel_variables(struct ast_channel *chan, struct ast_fax_sessi
#define GENERIC_FAX_EXEC_ERROR(fax, chan, errorstr, reason) \
do { \
- ast_log(LOG_ERROR, "channel '%s' FAX session '%d' failure, reason: '%s' (%s)\n", chan->name, fax->id, reason, errorstr); \
+ ast_log(LOG_ERROR, "channel '%s' FAX session '%d' failure, reason: '%s' (%s)\n", ast_channel_name(chan), fax->id, reason, errorstr); \
GENERIC_FAX_EXEC_ERROR_QUIET(fax, chan, errorstr, reason); \
} while (0)
@@ -1216,14 +1216,14 @@ static int set_fax_t38_caps(struct ast_channel *chan, struct ast_fax_session_det
*/
struct ast_control_t38_parameters parameters = { .request_response = AST_T38_REQUEST_PARMS, };
if (ast_indicate_data(chan, AST_CONTROL_T38_PARAMETERS, &parameters, sizeof(parameters)) != AST_T38_REQUEST_PARMS) {
- ast_log(LOG_ERROR, "channel '%s' is in an unsupported T.38 negotiation state, cannot continue.\n", chan->name);
+ ast_log(LOG_ERROR, "channel '%s' is in an unsupported T.38 negotiation state, cannot continue.\n", ast_channel_name(chan));
return -1;
}
details->caps |= AST_FAX_TECH_T38;
break;
}
default:
- ast_log(LOG_ERROR, "channel '%s' is in an unsupported T.38 negotiation state, cannot continue.\n", chan->name);
+ ast_log(LOG_ERROR, "channel '%s' is in an unsupported T.38 negotiation state, cannot continue.\n", ast_channel_name(chan));
return -1;
}
@@ -1236,9 +1236,9 @@ static int disable_t38(struct ast_channel *chan)
struct ast_frame *frame = NULL;
struct ast_control_t38_parameters t38_parameters = { .request_response = AST_T38_REQUEST_TERMINATE, };
- ast_debug(1, "Shutting down T.38 on %s\n", chan->name);
+ ast_debug(1, "Shutting down T.38 on %s\n", ast_channel_name(chan));
if (ast_indicate_data(chan, AST_CONTROL_T38_PARAMETERS, &t38_parameters, sizeof(t38_parameters)) != 0) {
- ast_debug(1, "error while disabling T.38 on channel '%s'\n", chan->name);
+ ast_debug(1, "error while disabling T.38 on channel '%s'\n", ast_channel_name(chan));
return -1;
}
@@ -1248,12 +1248,12 @@ static int disable_t38(struct ast_channel *chan)
while (ms > 0) {
ms = ast_waitfor(chan, ms);
if (ms < 0) {
- ast_debug(1, "error while disabling T.38 on channel '%s'\n", chan->name);
+ ast_debug(1, "error while disabling T.38 on channel '%s'\n", ast_channel_name(chan));
return -1;
}
if (ms == 0) { /* all done, nothing happened */
- ast_debug(1, "channel '%s' timed-out during T.38 shutdown\n", chan->name);
+ ast_debug(1, "channel '%s' timed-out during T.38 shutdown\n", ast_channel_name(chan));
break;
}
@@ -1267,14 +1267,14 @@ static int disable_t38(struct ast_channel *chan)
switch (parameters->request_response) {
case AST_T38_TERMINATED:
- ast_debug(1, "Shut down T.38 on %s\n", chan->name);
+ ast_debug(1, "Shut down T.38 on %s\n", ast_channel_name(chan));
break;
case AST_T38_REFUSED:
- ast_log(LOG_WARNING, "channel '%s' refused to disable T.38\n", chan->name);
+ ast_log(LOG_WARNING, "channel '%s' refused to disable T.38\n", ast_channel_name(chan));
ast_frfree(frame);
return -1;
default:
- ast_log(LOG_ERROR, "channel '%s' failed to disable T.38\n", chan->name);
+ ast_log(LOG_ERROR, "channel '%s' failed to disable T.38\n", ast_channel_name(chan));
ast_frfree(frame);
return -1;
}
@@ -1333,7 +1333,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
ast_format_set(&expected_framesubclass.format, AST_FORMAT_SLINEAR, 0);
ast_format_copy(&orig_write_format, &chan->writeformat);
if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) {
- ast_log(LOG_ERROR, "channel '%s' failed to set write format to signed linear'.\n", chan->name);
+ ast_log(LOG_ERROR, "channel '%s' failed to set write format to signed linear'.\n", ast_channel_name(chan));
ao2_lock(faxregistry.container);
ao2_unlink(faxregistry.container, fax);
ao2_unlock(faxregistry.container);
@@ -1343,7 +1343,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
}
ast_format_copy(&orig_read_format, &chan->readformat);
if (ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) {
- ast_log(LOG_ERROR, "channel '%s' failed to set read format to signed linear.\n", chan->name);
+ ast_log(LOG_ERROR, "channel '%s' failed to set read format to signed linear.\n", ast_channel_name(chan));
ao2_lock(faxregistry.container);
ao2_unlink(faxregistry.container, fax);
ao2_unlock(faxregistry.container);
@@ -1356,7 +1356,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
fax->smoother = NULL;
}
if (!(fax->smoother = ast_smoother_new(320))) {
- ast_log(LOG_WARNING, "Channel '%s' FAX session '%d' failed to obtain a smoother.\n", chan->name, fax->id);
+ ast_log(LOG_WARNING, "Channel '%s' FAX session '%d' failed to obtain a smoother.\n", ast_channel_name(chan), fax->id);
}
} else {
expected_frametype = AST_FRAME_MODEM;
@@ -1380,7 +1380,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
report_fax_status(chan, details, "FAX Transmission In Progress");
- ast_debug(5, "channel %s will wait on FAX fd %d\n", chan->name, fax->fd);
+ ast_debug(5, "channel %s will wait on FAX fd %d\n", ast_channel_name(chan), fax->fd);
/* handle frames for the session */
ms = 1000;
@@ -1397,7 +1397,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
* FAX session complete before we exit the application. if needed,
* send the FAX stack silence so the modems can finish their session without
* any problems */
- ast_debug(1, "Channel '%s' did not return a frame; probably hung up.\n", chan->name);
+ ast_debug(1, "Channel '%s' did not return a frame; probably hung up.\n", ast_channel_name(chan));
GENERIC_FAX_EXEC_SET_VARS(fax, chan, "HANGUP", "remote channel hungup");
c = NULL;
chancount = 0;
@@ -1443,7 +1443,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
report_fax_status(chan, details, "T.38 Negotiated");
- ast_verb(3, "Channel '%s' switched to T.38 FAX session '%d'.\n", chan->name, fax->id);
+ ast_verb(3, "Channel '%s' switched to T.38 FAX session '%d'.\n", ast_channel_name(chan), fax->id);
}
} else if ((frame->frametype == expected_frametype) &&
(!memcmp(&frame->subclass, &expected_framesubclass, sizeof(frame->subclass)))) {
@@ -1496,7 +1496,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
GENERIC_FAX_EXEC_ERROR(fax, chan, "TIMEOUT", "fax session timed-out");
continue;
} else {
- ast_log(LOG_WARNING, "something bad happened while channel '%s' was polling.\n", chan->name);
+ ast_log(LOG_WARNING, "something bad happened while channel '%s' was polling.\n", ast_channel_name(chan));
GENERIC_FAX_EXEC_ERROR(fax, chan, "UNKNOWN", "error polling data");
res = ms;
break;
@@ -1509,14 +1509,14 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
GENERIC_FAX_EXEC_ERROR(fax, chan, "TIMEOUT", "fax session timed-out");
continue;
} else {
- ast_log(LOG_WARNING, "channel '%s' timed-out during the FAX transmission.\n", chan->name);
+ ast_log(LOG_WARNING, "channel '%s' timed-out during the FAX transmission.\n", ast_channel_name(chan));
GENERIC_FAX_EXEC_ERROR(fax, chan, "TIMEOUT", "fax session timed-out");
break;
}
}
}
}
- ast_debug(3, "channel '%s' - event loop stopped { timeout: %d, ms: %d, res: %d }\n", chan->name, timeout, ms, res);
+ ast_debug(3, "channel '%s' - event loop stopped { timeout: %d, ms: %d, res: %d }\n", ast_channel_name(chan), timeout, ms, res);
set_channel_variables(chan, details);
@@ -1558,7 +1558,7 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_
if (ast_channel_get_t38_state(chan) != T38_STATE_NEGOTIATING) {
/* generate 3 seconds of CED */
if (ast_playtones_start(chan, 1024, "!2100/3000", 1)) {
- ast_log(LOG_ERROR, "error generating CED tone on %s\n", chan->name);
+ ast_log(LOG_ERROR, "error generating CED tone on %s\n", ast_channel_name(chan));
return -1;
}
@@ -1566,7 +1566,7 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_
while (ms > 0) {
ms = ast_waitfor(chan, ms);
if (ms < 0) {
- ast_log(LOG_ERROR, "error while generating CED tone on %s\n", chan->name);
+ ast_log(LOG_ERROR, "error while generating CED tone on %s\n", ast_channel_name(chan));
ast_playtones_stop(chan);
return -1;
}
@@ -1576,7 +1576,7 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_
}
if (!(frame = ast_read(chan))) {
- ast_log(LOG_ERROR, "error reading frame while generating CED tone on %s\n", chan->name);
+ ast_log(LOG_ERROR, "error reading frame while generating CED tone on %s\n", ast_channel_name(chan));
ast_playtones_stop(chan);
return -1;
}
@@ -1597,7 +1597,7 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_
ast_playtones_stop(chan);
break;
case AST_T38_NEGOTIATED:
- ast_debug(1, "Negotiated T.38 for receive on %s\n", chan->name);
+ ast_debug(1, "Negotiated T.38 for receive on %s\n", ast_channel_name(chan));
t38_parameters_ast_to_fax(&details->their_t38_parameters, parameters);
details->caps &= ~AST_FAX_TECH_AUDIO;
report_fax_status(chan, details, "T.38 Negotiated");
@@ -1618,7 +1618,7 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_
}
/* request T.38 */
- ast_debug(1, "Negotiating T.38 for receive on %s\n", chan->name);
+ ast_debug(1, "Negotiating T.38 for receive on %s\n", ast_channel_name(chan));
/* wait up to five seconds for negotiation to complete */
ms = 5000;
@@ -1633,18 +1633,18 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_
while (ms > 0) {
ms = ast_waitfor(chan, ms);
if (ms < 0) {
- ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", chan->name);
+ ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", ast_channel_name(chan));
return -1;
}
if (ms == 0) { /* all done, nothing happened */
- ast_log(LOG_WARNING, "channel '%s' timed-out during the T.38 negotiation.\n", chan->name);
+ ast_log(LOG_WARNING, "channel '%s' timed-out during the T.38 negotiation.\n", ast_channel_name(chan));
details->caps &= ~AST_FAX_TECH_T38;
break;
}
if (!(frame = ast_read(chan))) {
- ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", chan->name);
+ ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", ast_channel_name(chan));
return -1;
}
@@ -1660,19 +1660,19 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_
ast_indicate_data(chan, AST_CONTROL_T38_PARAMETERS, &t38_parameters, sizeof(t38_parameters));
break;
case AST_T38_NEGOTIATED:
- ast_debug(1, "Negotiated T.38 for receive on %s\n", chan->name);
+ ast_debug(1, "Negotiated T.38 for receive on %s\n", ast_channel_name(chan));
t38_parameters_ast_to_fax(&details->their_t38_parameters, parameters);
details->caps &= ~AST_FAX_TECH_AUDIO;
report_fax_status(chan, details, "T.38 Negotiated");
ms = 0;
break;
case AST_T38_REFUSED:
- ast_log(LOG_WARNING, "channel '%s' refused to negotiate T.38\n", chan->name);
+ ast_log(LOG_WARNING, "channel '%s' refused to negotiate T.38\n", ast_channel_name(chan));
details->caps &= ~AST_FAX_TECH_T38;
ms = 0;
break;
default:
- ast_log(LOG_ERROR, "channel '%s' failed to negotiate T.38\n", chan->name);
+ ast_log(LOG_ERROR, "channel '%s' failed to negotiate T.38\n", ast_channel_name(chan));
details->caps &= ~AST_FAX_TECH_T38;
ms = 0;
break;
@@ -1688,7 +1688,7 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_
/* if we made it here, then T.38 failed, check the 'f' flag */
if (details->option.allow_audio != AST_FAX_OPTFLAG_TRUE) {
- ast_log(LOG_WARNING, "Audio FAX not allowed on channel '%s' and T.38 negotiation failed; aborting.\n", chan->name);
+ ast_log(LOG_WARNING, "Audio FAX not allowed on channel '%s' and T.38 negotiation failed; aborting.\n", ast_channel_name(chan));
return -1;
}
@@ -1828,7 +1828,7 @@ static int receivefax_exec(struct ast_channel *chan, const char *data)
strcpy(doc->filename, args.filename);
AST_LIST_INSERT_TAIL(&details->documents, doc, next);
- ast_verb(3, "Channel '%s' receiving FAX '%s'\n", chan->name, args.filename);
+ ast_verb(3, "Channel '%s' receiving FAX '%s'\n", ast_channel_name(chan), args.filename);
details->caps = AST_FAX_TECH_RECEIVE;
@@ -1862,7 +1862,7 @@ static int receivefax_exec(struct ast_channel *chan, const char *data)
if (ast_answer(chan)) {
ast_string_field_set(details, resultstr, "error answering channel");
set_channel_variables(chan, details);
- ast_log(LOG_WARNING, "Channel '%s' failed answer attempt.\n", chan->name);
+ ast_log(LOG_WARNING, "Channel '%s' failed answer attempt.\n", ast_channel_name(chan));
fax_session_release(s, token);
ao2_ref(s, -1);
ao2_ref(details, -1);
@@ -1892,7 +1892,7 @@ static int receivefax_exec(struct ast_channel *chan, const char *data)
fax_session_release(s, token);
ao2_ref(s, -1);
ao2_ref(details, -1);
- ast_log(LOG_ERROR, "error initializing channel '%s' in T.38 mode\n", chan->name);
+ ast_log(LOG_ERROR, "error initializing channel '%s' in T.38 mode\n", ast_channel_name(chan));
return -1;
}
} else {
@@ -1905,7 +1905,7 @@ static int receivefax_exec(struct ast_channel *chan, const char *data)
if (ast_channel_get_t38_state(chan) == T38_STATE_NEGOTIATED) {
if (disable_t38(chan)) {
- ast_debug(1, "error disabling T.38 mode on %s\n", chan->name);
+ ast_debug(1, "error disabling T.38 mode on %s\n", ast_channel_name(chan));
}
}
@@ -1925,7 +1925,7 @@ static int receivefax_exec(struct ast_channel *chan, const char *data)
"Resolution: %s\r\n"
"TransferRate: %s\r\n"
"FileName: %s\r\n",
- chan->name,
+ ast_channel_name(chan),
info.context,
info.exten,
info.cid,
@@ -1961,7 +1961,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det
/* don't send any audio if we've already received a T.38 reinvite */
if (ast_channel_get_t38_state(chan) != T38_STATE_NEGOTIATING) {
if (ast_playtones_start(chan, 1024, "!1100/500,!0/3000,!1100/500,!0/3000,!1100/500,!0/3000", 1)) {
- ast_log(LOG_ERROR, "error generating CNG tone on %s\n", chan->name);
+ ast_log(LOG_ERROR, "error generating CNG tone on %s\n", ast_channel_name(chan));
return -1;
}
}
@@ -1969,7 +1969,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det
while (ms > 0) {
ms = ast_waitfor(chan, ms);
if (ms < 0) {
- ast_log(LOG_ERROR, "error while generating CNG tone on %s\n", chan->name);
+ ast_log(LOG_ERROR, "error while generating CNG tone on %s\n", ast_channel_name(chan));
ast_playtones_stop(chan);
return -1;
}
@@ -1979,7 +1979,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det
}
if (!(frame = ast_read(chan))) {
- ast_log(LOG_ERROR, "error reading frame while generating CNG tone on %s\n", chan->name);
+ ast_log(LOG_ERROR, "error reading frame while generating CNG tone on %s\n", ast_channel_name(chan));
ast_playtones_stop(chan);
return -1;
}
@@ -2000,7 +2000,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det
ast_playtones_stop(chan);
break;
case AST_T38_NEGOTIATED:
- ast_debug(1, "Negotiated T.38 for send on %s\n", chan->name);
+ ast_debug(1, "Negotiated T.38 for send on %s\n", ast_channel_name(chan));
t38_parameters_ast_to_fax(&details->their_t38_parameters, parameters);
details->caps &= ~AST_FAX_TECH_AUDIO;
report_fax_status(chan, details, "T.38 Negotiated");
@@ -2021,7 +2021,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det
/* T.38 negotiation did not happen, initiate a switch if requested */
if (details->option.request_t38 == AST_FAX_OPTFLAG_TRUE) {
- ast_debug(1, "Negotiating T.38 for send on %s\n", chan->name);
+ ast_debug(1, "Negotiating T.38 for send on %s\n", ast_channel_name(chan));
/* wait up to five seconds for negotiation to complete */
ms = 5000;
@@ -2036,18 +2036,18 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det
while (ms > 0) {
ms = ast_waitfor(chan, ms);
if (ms < 0) {
- ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", chan->name);
+ ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", ast_channel_name(chan));
return -1;
}
if (ms == 0) { /* all done, nothing happened */
- ast_log(LOG_WARNING, "channel '%s' timed-out during the T.38 negotiation.\n", chan->name);
+ ast_log(LOG_WARNING, "channel '%s' timed-out during the T.38 negotiation.\n", ast_channel_name(chan));
details->caps &= ~AST_FAX_TECH_T38;
break;
}
if (!(frame = ast_read(chan))) {
- ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", chan->name);
+ ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", ast_channel_name(chan));
return -1;
}
@@ -2063,19 +2063,19 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det
ast_indicate_data(chan, AST_CONTROL_T38_PARAMETERS, &t38_parameters, sizeof(t38_parameters));
break;
case AST_T38_NEGOTIATED:
- ast_debug(1, "Negotiated T.38 for receive on %s\n", chan->name);
+ ast_debug(1, "Negotiated T.38 for receive on %s\n", ast_channel_name(chan));
t38_parameters_ast_to_fax(&details->their_t38_parameters, parameters);
details->caps &= ~AST_FAX_TECH_AUDIO;
report_fax_status(chan, details, "T.38 Negotiated");
ms = 0;
break;
case AST_T38_REFUSED:
- ast_log(LOG_WARNING, "channel '%s' refused to negotiate T.38\n", chan->name);
+ ast_log(LOG_WARNING, "channel '%s' refused to negotiate T.38\n", ast_channel_name(chan));
details->caps &= ~AST_FAX_TECH_T38;
ms = 0;
break;
default:
- ast_log(LOG_ERROR, "channel '%s' failed to negotiate T.38\n", chan->name);
+ ast_log(LOG_ERROR, "channel '%s' failed to negotiate T.38\n", ast_channel_name(chan));
details->caps &= ~AST_FAX_TECH_T38;
ms = 0;
break;
@@ -2093,7 +2093,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det
* carriers if we are going to fall back to audio mode */
if (details->option.allow_audio == AST_FAX_OPTFLAG_TRUE) {
if (ast_playtones_start(chan, 1024, "!1100/500,!0/3000", 1)) {
- ast_log(LOG_ERROR, "error generating second CNG tone on %s\n", chan->name);
+ ast_log(LOG_ERROR, "error generating second CNG tone on %s\n", ast_channel_name(chan));
return -1;
}
@@ -2101,7 +2101,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det
while (ms > 0) {
ms = ast_waitfor(chan, ms);
if (ms < 0) {
- ast_log(LOG_ERROR, "error while generating second CNG tone on %s\n", chan->name);
+ ast_log(LOG_ERROR, "error while generating second CNG tone on %s\n", ast_channel_name(chan));
ast_playtones_stop(chan);
return -1;
}
@@ -2111,7 +2111,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det
}
if (!(frame = ast_read(chan))) {
- ast_log(LOG_ERROR, "error reading frame while generating second CNG tone on %s\n", chan->name);
+ ast_log(LOG_ERROR, "error reading frame while generating second CNG tone on %s\n", ast_channel_name(chan));
ast_playtones_stop(chan);
return -1;
}
@@ -2132,7 +2132,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det
ast_playtones_stop(chan);
break;
case AST_T38_NEGOTIATED:
- ast_debug(1, "Negotiated T.38 for send on %s\n", chan->name);
+ ast_debug(1, "Negotiated T.38 for send on %s\n", ast_channel_name(chan));
t38_parameters_ast_to_fax(&details->their_t38_parameters, parameters);
details->caps &= ~AST_FAX_TECH_AUDIO;
report_fax_status(chan, details, "T.38 Negotiated");
@@ -2156,7 +2156,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det
/* if we made it here, then T.38 failed, check the 'f' flag */
if (details->option.allow_audio == AST_FAX_OPTFLAG_FALSE) {
- ast_log(LOG_WARNING, "Audio FAX not allowed on channel '%s' and T.38 negotiation failed; aborting.\n", chan->name);
+ ast_log(LOG_WARNING, "Audio FAX not allowed on channel '%s' and T.38 negotiation failed; aborting.\n", ast_channel_name(chan));
return -1;
}
@@ -2309,7 +2309,7 @@ static int sendfax_exec(struct ast_channel *chan, const char *data)
file_count++;
}
- ast_verb(3, "Channel '%s' sending FAX:\n", chan->name);
+ ast_verb(3, "Channel '%s' sending FAX:\n", ast_channel_name(chan));
AST_LIST_TRAVERSE(&details->documents, doc, next) {
ast_verb(3, " %s\n", doc->filename);
}
@@ -2354,7 +2354,7 @@ static int sendfax_exec(struct ast_channel *chan, const char *data)
if (ast_answer(chan)) {
ast_string_field_set(details, resultstr, "error answering channel");
set_channel_variables(chan, details);
- ast_log(LOG_WARNING, "Channel '%s' failed answer attempt.\n", chan->name);
+ ast_log(LOG_WARNING, "Channel '%s' failed answer attempt.\n", ast_channel_name(chan));
fax_session_release(s, token);
ao2_ref(s, -1);
ao2_ref(details, -1);
@@ -2384,7 +2384,7 @@ static int sendfax_exec(struct ast_channel *chan, const char *data)
fax_session_release(s, token);
ao2_ref(s, -1);
ao2_ref(details, -1);
- ast_log(LOG_ERROR, "error initializing channel '%s' in T.38 mode\n", chan->name);
+ ast_log(LOG_ERROR, "error initializing channel '%s' in T.38 mode\n", ast_channel_name(chan));
return -1;
}
} else {
@@ -2397,7 +2397,7 @@ static int sendfax_exec(struct ast_channel *chan, const char *data)
if (ast_channel_get_t38_state(chan) == T38_STATE_NEGOTIATED) {
if (disable_t38(chan)) {
- ast_debug(1, "error disabling T.38 mode on %s\n", chan->name);
+ ast_debug(1, "error disabling T.38 mode on %s\n", ast_channel_name(chan));
}
}
@@ -2423,7 +2423,7 @@ static int sendfax_exec(struct ast_channel *chan, const char *data)
"Resolution: %s\r\n"
"TransferRate: %s\r\n"
"%s\r\n",
- chan->name,
+ ast_channel_name(chan),
info.context,
info.exten,
info.cid,
@@ -2590,7 +2590,7 @@ static struct ast_frame *fax_gateway_request_t38(struct fax_gateway *gateway, st
struct ast_fax_session_details *details = find_details(chan);
if (!details) {
- ast_log(LOG_ERROR, "no FAX session details found on chan %s for T.38 gateway session, odd\n", chan->name);
+ ast_log(LOG_ERROR, "no FAX session details found on chan %s for T.38 gateway session, odd\n", ast_channel_name(chan));
ast_framehook_detach(chan, gateway->framehook);
return f;
}
@@ -2599,7 +2599,7 @@ static struct ast_frame *fax_gateway_request_t38(struct fax_gateway *gateway, st
ao2_ref(details, -1);
if (!(fp = ast_frisolate(&control_frame))) {
- ast_log(LOG_ERROR, "error generating T.38 request control frame on chan %s for T.38 gateway session\n", chan->name);
+ ast_log(LOG_ERROR, "error generating T.38 request control frame on chan %s for T.38 gateway session\n", ast_channel_name(chan));
return f;
}
@@ -2607,7 +2607,7 @@ static struct ast_frame *fax_gateway_request_t38(struct fax_gateway *gateway, st
gateway->timeout_start = ast_tvnow();
details->gateway_timeout = FAX_GATEWAY_TIMEOUT;
- ast_debug(1, "requesting T.38 for gateway session for %s\n", chan->name);
+ ast_debug(1, "requesting T.38 for gateway session for %s\n", ast_channel_name(chan));
return fp;
}
@@ -2628,10 +2628,10 @@ static struct ast_frame *fax_gateway_detect_v21(struct fax_gateway *gateway, str
if (gateway->detected_v21) {
destroy_v21_sessions(gateway);
if (ast_channel_get_t38_state(other) == T38_STATE_UNKNOWN) {
- ast_debug(1, "detected v21 preamble from %s\n", active->name);
+ ast_debug(1, "detected v21 preamble from %s\n", ast_channel_name(active));
return fax_gateway_request_t38(gateway, chan, f);
} else {
- ast_debug(1, "detected v21 preamble on %s, but %s does not support T.38 for T.38 gateway session\n", active->name, other->name);
+ ast_debug(1, "detected v21 preamble on %s, but %s does not support T.38 for T.38 gateway session\n", ast_channel_name(active), ast_channel_name(other));
}
}
@@ -2676,7 +2676,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
}
if (!(details = find_details(chan))) {
- ast_log(LOG_ERROR, "no FAX session details found on chan %s for T.38 gateway session, odd\n", chan->name);
+ ast_log(LOG_ERROR, "no FAX session details found on chan %s for T.38 gateway session, odd\n", ast_channel_name(chan));
ast_framehook_detach(chan, gateway->framehook);
return f;
}
@@ -2689,7 +2689,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
* other channel appears to support T.38, we'll pass
* the request through and only step in if the other
* channel rejects the request */
- ast_debug(1, "%s is attempting to negotiate T.38 with %s, we'll see what happens\n", active->name, other->name);
+ ast_debug(1, "%s is attempting to negotiate T.38 with %s, we'll see what happens\n", ast_channel_name(active), ast_channel_name(other));
t38_parameters_ast_to_fax(&details->their_t38_parameters, control_params);
gateway->t38_state = T38_STATE_UNKNOWN;
gateway->timeout_start = ast_tvnow();
@@ -2699,14 +2699,14 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
} else if (state == T38_STATE_UNAVAILABLE || state == T38_STATE_REJECTED) {
/* the other channel does not support T.38, we need to
* step in here */
- ast_debug(1, "%s is attempting to negotiate T.38 but %s does not support it\n", active->name, other->name);
- ast_debug(1, "starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", active->name, other->name);
+ ast_debug(1, "%s is attempting to negotiate T.38 but %s does not support it\n", ast_channel_name(active), ast_channel_name(other));
+ ast_debug(1, "starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(active), ast_channel_name(other));
t38_parameters_ast_to_fax(&details->their_t38_parameters, control_params);
t38_parameters_fax_to_ast(control_params, &details->our_t38_parameters);
if (fax_gateway_start(gateway, details, chan)) {
- ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", active->name, other->name);
+ ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(active), ast_channel_name(other));
gateway->t38_state = T38_STATE_REJECTED;
control_params->request_response = AST_T38_REFUSED;
@@ -2733,7 +2733,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
gateway->timeout_start = ast_tvnow();
details->gateway_timeout = FAX_GATEWAY_TIMEOUT;
- ast_debug(1, "%s is attempting to negotiate T.38 after we already sent a negotiation request based on v21 preamble detection\n", active->name);
+ ast_debug(1, "%s is attempting to negotiate T.38 after we already sent a negotiation request based on v21 preamble detection\n", ast_channel_name(active));
ao2_ref(details, -1);
return &ast_null_frame;
} else if (gateway->t38_state == T38_STATE_NEGOTIATED) {
@@ -2755,18 +2755,18 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
ast_string_field_set(details, error, "NATIVE_T38");
set_channel_variables(chan, details);
- ast_debug(1, "%s is attempting to negotiate T.38 after we already negotiated T.38 with %s, disabling the gateway\n", active->name, other->name);
+ ast_debug(1, "%s is attempting to negotiate T.38 after we already negotiated T.38 with %s, disabling the gateway\n", ast_channel_name(active), ast_channel_name(other));
ao2_ref(details, -1);
return &ast_null_frame;
} else {
- ast_log(LOG_WARNING, "%s is attempting to negotiate T.38 while %s is in an unsupported state\n", active->name, other->name);
+ ast_log(LOG_WARNING, "%s is attempting to negotiate T.38 while %s is in an unsupported state\n", ast_channel_name(active), ast_channel_name(other));
ao2_ref(details, -1);
return f;
}
} else if (gateway->t38_state == T38_STATE_NEGOTIATING
&& control_params->request_response == AST_T38_REFUSED) {
- ast_debug(1, "unable to negotiate T.38 on %s for fax gateway\n", active->name);
+ ast_debug(1, "unable to negotiate T.38 on %s for fax gateway\n", ast_channel_name(active));
/* our request to negotiate T.38 was refused, if the other
* channel supports T.38, they might still reinvite and save
@@ -2788,12 +2788,12 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
} else if (gateway->t38_state == T38_STATE_NEGOTIATING
&& control_params->request_response == AST_T38_NEGOTIATED) {
- ast_debug(1, "starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", active->name, other->name);
+ ast_debug(1, "starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(active), ast_channel_name(other));
t38_parameters_ast_to_fax(&details->their_t38_parameters, control_params);
if (fax_gateway_start(gateway, details, chan)) {
- ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", active->name, other->name);
+ ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(active), ast_channel_name(other));
gateway->t38_state = T38_STATE_NEGOTIATING;
control_params->request_response = AST_T38_REQUEST_TERMINATE;
@@ -2809,13 +2809,13 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
/* the other channel refused the request to negotiate T.38,
* we'll step in here and pretend the request was accepted */
- ast_debug(1, "%s attempted to negotiate T.38 but %s refused the request\n", other->name, active->name);
- ast_debug(1, "starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", other->name, active->name);
+ ast_debug(1, "%s attempted to negotiate T.38 but %s refused the request\n", ast_channel_name(other), ast_channel_name(active));
+ ast_debug(1, "starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(other), ast_channel_name(active));
t38_parameters_fax_to_ast(control_params, &details->our_t38_parameters);
if (fax_gateway_start(gateway, details, chan)) {
- ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", active->name, other->name);
+ ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(active), ast_channel_name(other));
gateway->t38_state = T38_STATE_REJECTED;
control_params->request_response = AST_T38_REFUSED;
@@ -2832,7 +2832,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
/* the channel wishes to end our short relationship, we shall
* oblige */
- ast_debug(1, "T.38 channel %s is requesting a shutdown of T.38, disabling the gateway\n", active->name);
+ ast_debug(1, "T.38 channel %s is requesting a shutdown of T.38, disabling the gateway\n", ast_channel_name(active));
ast_framehook_detach(chan, details->gateway_id);
details->gateway_id = -1;
@@ -2845,7 +2845,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
ao2_ref(details, -1);
return &ast_null_frame;
} else if (control_params->request_response == AST_T38_NEGOTIATED) {
- ast_debug(1, "T.38 successfully negotiated between %s and %s, no gateway necessary\n", active->name, other->name);
+ ast_debug(1, "T.38 successfully negotiated between %s and %s, no gateway necessary\n", ast_channel_name(active), ast_channel_name(other));
ast_framehook_detach(chan, details->gateway_id);
details->gateway_id = -1;
@@ -2858,7 +2858,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
ao2_ref(details, -1);
return f;
} else if (control_params->request_response == AST_T38_TERMINATED) {
- ast_debug(1, "T.38 disabled on channel %s\n", active->name);
+ ast_debug(1, "T.38 disabled on channel %s\n", ast_channel_name(active));
ast_framehook_detach(chan, details->gateway_id);
details->gateway_id = -1;
@@ -2917,7 +2917,7 @@ static struct ast_frame *fax_gateway_framehook(struct ast_channel *chan, struct
ao2_ref(details, 1);
} else {
if (!(details = find_details(chan))) {
- ast_log(LOG_ERROR, "no FAX session details found on chan %s for T.38 gateway session, odd\n", chan->name);
+ ast_log(LOG_ERROR, "no FAX session details found on chan %s for T.38 gateway session, odd\n", ast_channel_name(chan));
ast_framehook_detach(chan, gateway->framehook);
details->gateway_id = -1;
return f;
@@ -2963,7 +2963,7 @@ static struct ast_frame *fax_gateway_framehook(struct ast_channel *chan, struct
if (!gateway->bridged && peer) {
/* don't start a gateway if neither channel can handle T.38 */
if (ast_channel_get_t38_state(chan) == T38_STATE_UNAVAILABLE && ast_channel_get_t38_state(peer) == T38_STATE_UNAVAILABLE) {
- ast_debug(1, "not starting gateway for %s and %s; neither channel supports T.38\n", chan->name, peer->name);
+ ast_debug(1, "not starting gateway for %s and %s; neither channel supports T.38\n", ast_channel_name(chan), ast_channel_name(peer));
ast_framehook_detach(chan, gateway->framehook);
details->gateway_id = -1;
@@ -2999,7 +2999,7 @@ static struct ast_frame *fax_gateway_framehook(struct ast_channel *chan, struct
if (gateway->bridged && !ast_tvzero(gateway->timeout_start)) {
if (ast_tvdiff_ms(ast_tvnow(), gateway->timeout_start) > details->gateway_timeout) {
- ast_debug(1, "no fax activity between %s and %s after %d ms, disabling gateway\n", chan->name, peer->name, details->gateway_timeout);
+ ast_debug(1, "no fax activity between %s and %s after %d ms, disabling gateway\n", ast_channel_name(chan), ast_channel_name(peer), details->gateway_timeout);
ast_framehook_detach(chan, gateway->framehook);
details->gateway_id = -1;
@@ -3343,10 +3343,10 @@ static struct ast_frame *fax_detect_framehook(struct ast_channel *chan, struct a
S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
ast_channel_lock(chan);
ast_verb(2, "Redirecting '%s' to fax extension due to %s detection\n",
- chan->name, (result == 'f') ? "CNG" : "T38");
+ ast_channel_name(chan), (result == 'f') ? "CNG" : "T38");
pbx_builtin_setvar_helper(chan, "FAXEXTEN", chan->exten);
if (ast_async_goto(chan, target_context, "fax", 1)) {
- ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", chan->name, target_context);
+ ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(chan), target_context);
}
ast_frfree(f);
f = &ast_null_frame;
@@ -3826,7 +3826,7 @@ static int acf_faxopt_read(struct ast_channel *chan, const char *cmd, char *data
char *filenames;
if (!details) {
- ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s) because it has never been written.\n", chan->name, data);
+ ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s) because it has never been written.\n", ast_channel_name(chan), data);
return -1;
}
if (!strcasecmp(data, "ecm")) {
@@ -3840,20 +3840,20 @@ static int acf_faxopt_read(struct ast_channel *chan, const char *cmd, char *data
ast_copy_string(buf, details->error, len);
} else if (!strcasecmp(data, "filename")) {
if (AST_LIST_EMPTY(&details->documents)) {
- ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s) because it has never been written.\n", chan->name, data);
+ ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s) because it has never been written.\n", ast_channel_name(chan), data);
res = -1;
} else {
ast_copy_string(buf, AST_LIST_FIRST(&details->documents)->filename, len);
}
} else if (!strcasecmp(data, "filenames")) {
if (AST_LIST_EMPTY(&details->documents)) {
- ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s) because it has never been written.\n", chan->name, data);
+ ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s) because it has never been written.\n", ast_channel_name(chan), data);
res = -1;
} else if ((filenames = generate_filenames_string(details, "", ","))) {
ast_copy_string(buf, filenames, len);
ast_free(filenames);
} else {
- ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s), there was an error generating the filenames list.\n", chan->name, data);
+ ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s), there was an error generating the filenames list.\n", ast_channel_name(chan), data);
res = -1;
}
} else if (!strcasecmp(data, "headerinfo")) {
@@ -3881,7 +3881,7 @@ static int acf_faxopt_read(struct ast_channel *chan, const char *cmd, char *data
} else if ((!strcasecmp(data, "modem")) || (!strcasecmp(data, "modems"))) {
ast_fax_modem_to_str(details->modems, buf, len);
} else {
- ast_log(LOG_WARNING, "channel '%s' can't read FAXOPT(%s) because it is unhandled!\n", chan->name, data);
+ ast_log(LOG_WARNING, "channel '%s' can't read FAXOPT(%s) because it is unhandled!\n", ast_channel_name(chan), data);
res = -1;
}
ao2_ref(details, -1);
@@ -3896,10 +3896,10 @@ static int acf_faxopt_write(struct ast_channel *chan, const char *cmd, char *dat
struct ast_fax_session_details *details;
if (!(details = find_or_create_details(chan))) {
- ast_log(LOG_WARNING, "channel '%s' can't set FAXOPT(%s) to '%s' because it failed to create a datastore.\n", chan->name, data, value);
+ ast_log(LOG_WARNING, "channel '%s' can't set FAXOPT(%s) to '%s' because it failed to create a datastore.\n", ast_channel_name(chan), data, value);
return -1;
}
- ast_debug(3, "channel '%s' setting FAXOPT(%s) to '%s'\n", chan->name, data, value);
+ ast_debug(3, "channel '%s' setting FAXOPT(%s) to '%s'\n", ast_channel_name(chan), data, value);
if (!strcasecmp(data, "ecm")) {
const char *val = ast_skip_blanks(value);
@@ -3933,13 +3933,13 @@ static int acf_faxopt_write(struct ast_channel *chan, const char *cmd, char *dat
details->gateway_id = fax_gateway_attach(chan, details);
if (details->gateway_id < 0) {
- ast_log(LOG_ERROR, "Error attaching T.38 gateway to channel %s.\n", chan->name);
+ ast_log(LOG_ERROR, "Error attaching T.38 gateway to channel %s.\n", ast_channel_name(chan));
res = -1;
} else {
- ast_debug(1, "Attached T.38 gateway to channel %s.\n", chan->name);
+ ast_debug(1, "Attached T.38 gateway to channel %s.\n", ast_channel_name(chan));
}
} else {
- ast_log(LOG_WARNING, "Attempt to attach a T.38 gateway on channel (%s) with gateway already running.\n", chan->name);
+ ast_log(LOG_WARNING, "Attempt to attach a T.38 gateway on channel (%s) with gateway already running.\n", ast_channel_name(chan));
}
} else if (ast_false(val)) {
ast_framehook_detach(chan, details->gateway_id);
@@ -3978,13 +3978,13 @@ static int acf_faxopt_write(struct ast_channel *chan, const char *cmd, char *dat
faxdetect = fax_detect_attach(chan, fdtimeout, flags);
if (faxdetect < 0) {
- ast_log(LOG_ERROR, "Error attaching FAX detect to channel %s.\n", chan->name);
+ ast_log(LOG_ERROR, "Error attaching FAX detect to channel %s.\n", ast_channel_name(chan));
res = -1;
} else {
- ast_debug(1, "Attached FAX detect to channel %s.\n", chan->name);
+ ast_debug(1, "Attached FAX detect to channel %s.\n", ast_channel_name(chan));
}
} else {
- ast_log(LOG_WARNING, "Attempt to attach a FAX detect on channel (%s) with FAX detect already running.\n", chan->name);
+ ast_log(LOG_WARNING, "Attempt to attach a FAX detect on channel (%s) with FAX detect already running.\n", ast_channel_name(chan));
}
} else if (ast_false(val)) {
ast_framehook_detach(chan, details->faxdetect_id);
@@ -4009,7 +4009,7 @@ static int acf_faxopt_write(struct ast_channel *chan, const char *cmd, char *dat
} else if ((!strcasecmp(data, "modem")) || (!strcasecmp(data, "modems"))) {
update_modem_bits(&details->modems, value);
} else {
- ast_log(LOG_WARNING, "channel '%s' set FAXOPT(%s) to '%s' is unhandled!\n", chan->name, data, value);
+ ast_log(LOG_WARNING, "channel '%s' set FAXOPT(%s) to '%s' is unhandled!\n", ast_channel_name(chan), data, value);
res = -1;
}
diff --git a/res/res_jabber.c b/res/res_jabber.c
index f1e9c740c..b808e51ba 100644
--- a/res/res_jabber.c
+++ b/res/res_jabber.c
@@ -838,7 +838,7 @@ static int acf_jabberreceive_read(struct ast_channel *chan, const char *name, ch
start = ast_tvnow();
if (ast_autoservice_start(chan) < 0) {
- ast_log(LOG_WARNING, "Cannot start autoservice for channel %s\n", chan->name);
+ ast_log(LOG_WARNING, "Cannot start autoservice for channel %s\n", ast_channel_name(chan));
ASTOBJ_UNREF(client, ast_aji_client_destroy);
return -1;
}
@@ -910,7 +910,7 @@ static int acf_jabberreceive_read(struct ast_channel *chan, const char *name, ch
ASTOBJ_UNREF(client, ast_aji_client_destroy);
if (ast_autoservice_stop(chan) < 0) {
- ast_log(LOG_WARNING, "Cannot stop autoservice for channel %s\n", chan->name);
+ ast_log(LOG_WARNING, "Cannot stop autoservice for channel %s\n", ast_channel_name(chan));
}
/* return if we timed out */
diff --git a/res/res_monitor.c b/res/res_monitor.c
index 9dac05177..c5ecda4e4 100644
--- a/res/res_monitor.c
+++ b/res/res_monitor.c
@@ -333,7 +333,7 @@ int AST_OPTIONAL_API_NAME(ast_monitor_start)(struct ast_channel *chan, const cha
seq++;
ast_mutex_unlock(&monitorlock);
- channel_name = ast_strdupa(chan->name);
+ channel_name = ast_strdupa(ast_channel_name(chan));
while ((p = strchr(channel_name, '/'))) {
*p = '-';
}
@@ -392,10 +392,10 @@ int AST_OPTIONAL_API_NAME(ast_monitor_start)(struct ast_channel *chan, const cha
ast_manager_event(chan, EVENT_FLAG_CALL, "MonitorStart",
"Channel: %s\r\n"
"Uniqueid: %s\r\n",
- chan->name,
+ ast_channel_name(chan),
chan->uniqueid);
} else {
- ast_debug(1,"Cannot start monitoring %s, already monitored\n", chan->name);
+ ast_debug(1,"Cannot start monitoring %s, already monitored\n", ast_channel_name(chan));
res = -1;
}
@@ -510,7 +510,7 @@ int AST_OPTIONAL_API_NAME(ast_monitor_stop)(struct ast_channel *chan, int need_l
ast_manager_event(chan, EVENT_FLAG_CALL, "MonitorStop",
"Channel: %s\r\n"
"Uniqueid: %s\r\n",
- chan->name,
+ ast_channel_name(chan),
chan->uniqueid
);
pbx_builtin_setvar_helper(chan, "MONITORED", NULL);
@@ -558,7 +558,7 @@ static int unpause_monitor_exec(struct ast_channel *chan, const char *data)
int AST_OPTIONAL_API_NAME(ast_monitor_change_fname)(struct ast_channel *chan, const char *fname_base, int need_lock)
{
if (ast_strlen_zero(fname_base)) {
- ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to null\n", chan->name);
+ ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to null\n", ast_channel_name(chan));
return -1;
}
@@ -621,7 +621,7 @@ int AST_OPTIONAL_API_NAME(ast_monitor_change_fname)(struct ast_channel *chan, co
ast_copy_string(chan->monitor->filename_base, tmpstring, sizeof(chan->monitor->filename_base));
chan->monitor->filename_changed = 1;
} else {
- ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to %s, monitoring not started\n", chan->name, fname_base);
+ ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to %s, monitoring not started\n", ast_channel_name(chan), fname_base);
}
UNLOCK_IF_NEEDED(chan, need_lock);
@@ -759,7 +759,7 @@ static int start_monitor_action(struct mansession *s, const struct message *m)
if (ast_strlen_zero(fname)) {
/* No filename base specified, default to channel name as per CLI */
ast_channel_lock(c);
- fname = ast_strdupa(c->name);
+ fname = ast_strdupa(ast_channel_name(c));
ast_channel_unlock(c);
/* Channels have the format technology/channel_name - have to replace that / */
if ((d = strchr(fname, '/'))) {
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 21a2c97e8..0b04c9d39 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -268,11 +268,11 @@ static void moh_files_release(struct ast_channel *chan, void *data)
chan->stream = NULL;
}
- ast_verb(3, "Stopped music on hold on %s\n", chan->name);
+ ast_verb(3, "Stopped music on hold on %s\n", ast_channel_name(chan));
ast_format_clear(&state->mohwfmt); /* make sure to clear this format before restoring the original format. */
if (state->origwfmt.id && ast_set_write_format(chan, &state->origwfmt)) {
- ast_log(LOG_WARNING, "Unable to restore channel '%s' to format '%s'\n", chan->name, ast_getformatname(&state->origwfmt));
+ ast_log(LOG_WARNING, "Unable to restore channel '%s' to format '%s'\n", ast_channel_name(chan), ast_getformatname(&state->origwfmt));
}
state->save_pos = state->pos;
@@ -338,7 +338,7 @@ static int ast_moh_files_next(struct ast_channel *chan)
/* Record the pointer to the filename for position resuming later */
ast_copy_string(state->save_pos_filename, state->class->filearray[state->pos], sizeof(state->save_pos_filename));
- ast_debug(1, "%s Opened file %d '%s'\n", chan->name, state->pos, state->class->filearray[state->pos]);
+ ast_debug(1, "%s Opened file %d '%s'\n", ast_channel_name(chan), state->pos, state->class->filearray[state->pos]);
if (state->samples) {
size_t loc;
@@ -413,7 +413,7 @@ static int moh_files_generator(struct ast_channel *chan, void *data, int len, in
res = ast_write(chan, f);
ast_frfree(f);
if (res < 0) {
- ast_log(LOG_WARNING, "Failed to write frame to '%s': %s\n", chan->name, strerror(errno));
+ ast_log(LOG_WARNING, "Failed to write frame to '%s': %s\n", ast_channel_name(chan), strerror(errno));
return -1;
}
} else {
@@ -463,7 +463,7 @@ static void *moh_files_alloc(struct ast_channel *chan, void *params)
ast_copy_string(state->name, class->name, sizeof(state->name));
state->save_total = class->total_files;
- ast_verb(3, "Started music on hold, class '%s', on %s\n", class->name, chan->name);
+ ast_verb(3, "Started music on hold, class '%s', on %s\n", class->name, ast_channel_name(chan));
return chan->music_state;
}
@@ -782,7 +782,7 @@ static int play_moh_exec(struct ast_channel *chan, const char *data)
class = S_OR(args.class, NULL);
if (ast_moh_start(chan, class, NULL)) {
- ast_log(LOG_WARNING, "Unable to start music on hold class '%s' on channel %s\n", class, chan->name);
+ ast_log(LOG_WARNING, "Unable to start music on hold class '%s' on channel %s\n", class, ast_channel_name(chan));
return 0;
}
@@ -812,7 +812,7 @@ static int wait_moh_exec(struct ast_channel *chan, const char *data)
return -1;
}
if (ast_moh_start(chan, NULL, NULL)) {
- ast_log(LOG_WARNING, "Unable to start music on hold for %d seconds on channel %s\n", atoi(data), chan->name);
+ ast_log(LOG_WARNING, "Unable to start music on hold for %d seconds on channel %s\n", atoi(data), ast_channel_name(chan));
return 0;
}
res = ast_safe_sleep(chan, atoi(data) * 1000);
@@ -851,7 +851,7 @@ static int start_moh_exec(struct ast_channel *chan, const char *data)
class = S_OR(args.class, NULL);
if (ast_moh_start(chan, class, NULL))
- ast_log(LOG_WARNING, "Unable to start music on hold class '%s' on channel %s\n", class, chan->name);
+ ast_log(LOG_WARNING, "Unable to start music on hold class '%s' on channel %s\n", class, ast_channel_name(chan));
return 0;
}
@@ -948,10 +948,10 @@ static void moh_release(struct ast_channel *chan, void *data)
}
if (oldwfmt.id && ast_set_write_format(chan, &oldwfmt)) {
ast_log(LOG_WARNING, "Unable to restore channel '%s' to format %s\n",
- chan->name, ast_getformatname(&oldwfmt));
+ ast_channel_name(chan), ast_getformatname(&oldwfmt));
}
- ast_verb(3, "Stopped music on hold on %s\n", chan->name);
+ ast_verb(3, "Stopped music on hold on %s\n", ast_channel_name(chan));
}
}
@@ -980,13 +980,13 @@ static void *moh_alloc(struct ast_channel *chan, void *params)
if ((res = mohalloc(class))) {
ast_format_copy(&res->origwfmt, &chan->writeformat);
if (ast_set_write_format(chan, &class->format)) {
- ast_log(LOG_WARNING, "Unable to set channel '%s' to format '%s'\n", chan->name, ast_codec2str(&class->format));
+ ast_log(LOG_WARNING, "Unable to set channel '%s' to format '%s'\n", ast_channel_name(chan), ast_codec2str(&class->format));
moh_release(NULL, res);
res = NULL;
} else {
state->class = mohclass_ref(class, "Placing reference into state container");
}
- ast_verb(3, "Started music on hold, class '%s', on channel '%s'\n", class->name, chan->name);
+ ast_verb(3, "Started music on hold, class '%s', on channel '%s'\n", class->name, ast_channel_name(chan));
}
return res;
}
@@ -1000,7 +1000,7 @@ static int moh_generate(struct ast_channel *chan, void *data, int len, int sampl
len = ast_codec_get_len(&moh->parent->format, samples);
if (len > sizeof(buf) - AST_FRIENDLY_OFFSET) {
- ast_log(LOG_WARNING, "Only doing %d of %d requested bytes on %s\n", (int)sizeof(buf), len, chan->name);
+ ast_log(LOG_WARNING, "Only doing %d of %d requested bytes on %s\n", (int)sizeof(buf), len, ast_channel_name(chan));
len = sizeof(buf) - AST_FRIENDLY_OFFSET;
}
res = read(moh->pipe[0], buf + AST_FRIENDLY_OFFSET/2, len);
@@ -1012,7 +1012,7 @@ static int moh_generate(struct ast_channel *chan, void *data, int len, int sampl
moh->f.samples = ast_codec_get_samples(&moh->f);
if (ast_write(chan, &moh->f) < 0) {
- ast_log(LOG_WARNING, "Failed to write frame to '%s': %s\n", chan->name, strerror(errno));
+ ast_log(LOG_WARNING, "Failed to write frame to '%s': %s\n", ast_channel_name(chan), strerror(errno));
return -1;
}
@@ -1542,7 +1542,7 @@ static int local_ast_moh_start(struct ast_channel *chan, const char *mclass, con
"Channel: %s\r\n"
"UniqueID: %s\r\n"
"Class: %s\r\n",
- chan->name, chan->uniqueid,
+ ast_channel_name(chan), chan->uniqueid,
mohclass->name);
ast_set_flag(chan, AST_FLAG_MOH);
@@ -1575,7 +1575,7 @@ static void local_ast_moh_stop(struct ast_channel *chan)
"State: Stop\r\n"
"Channel: %s\r\n"
"UniqueID: %s\r\n",
- chan->name, chan->uniqueid);
+ ast_channel_name(chan), chan->uniqueid);
ast_channel_unlock(chan);
}
diff --git a/res/res_mutestream.c b/res/res_mutestream.c
index 92d01c7c7..04106656d 100644
--- a/res/res_mutestream.c
+++ b/res/res_mutestream.c
@@ -191,11 +191,11 @@ static int mute_add_audiohook(struct ast_channel *chan, struct mute_information
/* Activate the settings */
ast_channel_datastore_add(chan, datastore);
if (ast_audiohook_attach(chan, &mute->audiohook)) {
- ast_log(LOG_ERROR, "Failed to attach audiohook for muting channel %s\n", chan->name);
+ ast_log(LOG_ERROR, "Failed to attach audiohook for muting channel %s\n", ast_channel_name(chan));
return -1;
}
ast_module_ref(ast_module_info->self);
- ast_debug(2, "Initialized audiohook on channel %s\n", chan->name);
+ ast_debug(2, "Initialized audiohook on channel %s\n", ast_channel_name(chan));
return 0;
}
diff --git a/res/snmp/agent.c b/res/snmp/agent.c
index bd84c1b6b..ff5410d96 100644
--- a/res/snmp/agent.c
+++ b/res/snmp/agent.c
@@ -268,8 +268,8 @@ static u_char *ast_var_channels_table(struct variable *vp, oid *name, size_t *le
ret = (u_char *)&long_ret;
break;
case ASTCHANNAME:
- if (!ast_strlen_zero(chan->name)) {
- strncpy(string_ret, chan->name, sizeof(string_ret));
+ if (!ast_strlen_zero(ast_channel_name(chan))) {
+ strncpy(string_ret, ast_channel_name(chan), sizeof(string_ret));
string_ret[sizeof(string_ret) - 1] = '\0';
*var_len = strlen(string_ret);
ret = (u_char *)string_ret;
@@ -299,23 +299,23 @@ static u_char *ast_var_channels_table(struct variable *vp, oid *name, size_t *le
break;
case ASTCHANBRIDGE:
if ((bridge = ast_bridged_channel(chan)) != NULL) {
- strncpy(string_ret, bridge->name, sizeof(string_ret));
+ strncpy(string_ret, ast_channel_name(bridge), sizeof(string_ret));
string_ret[sizeof(string_ret) - 1] = '\0';
*var_len = strlen(string_ret);
ret = (u_char *)string_ret;
}
break;
case ASTCHANMASQ:
- if (chan->masq && !ast_strlen_zero(chan->masq->name)) {
- strncpy(string_ret, chan->masq->name, sizeof(string_ret));
+ if (chan->masq && !ast_strlen_zero(ast_channel_name(chan->masq))) {
+ strncpy(string_ret, ast_channel_name(chan->masq), sizeof(string_ret));
string_ret[sizeof(string_ret) - 1] = '\0';
*var_len = strlen(string_ret);
ret = (u_char *)string_ret;
}
break;
case ASTCHANMASQR:
- if (chan->masqr && !ast_strlen_zero(chan->masqr->name)) {
- strncpy(string_ret, chan->masqr->name, sizeof(string_ret));
+ if (chan->masqr && !ast_strlen_zero(ast_channel_name(chan->masqr))) {
+ strncpy(string_ret, ast_channel_name(chan->masqr), sizeof(string_ret));
string_ret[sizeof(string_ret) - 1] = '\0';
*var_len = strlen(string_ret);
ret = (u_char *)string_ret;