summaryrefslogtreecommitdiff
path: root/res/res_fax.c
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/res_fax.c
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/res_fax.c')
-rw-r--r--res/res_fax.c206
1 files changed, 103 insertions, 103 deletions
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;
}