Replace direct access to channel name with accessor functions
authorTerry Wilson <twilson@digium.com>
Mon, 9 Jan 2012 22:15:50 +0000 (22:15 +0000)
committerTerry Wilson <twilson@digium.com>
Mon, 9 Jan 2012 22:15:50 +0000 (22:15 +0000)
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

103 files changed:
addons/chan_mobile.c
addons/chan_ooh323.c
apps/app_adsiprog.c
apps/app_alarmreceiver.c
apps/app_amd.c
apps/app_chanisavail.c
apps/app_chanspy.c
apps/app_confbridge.c
apps/app_dahdibarge.c
apps/app_dahdiras.c
apps/app_dial.c
apps/app_directed_pickup.c
apps/app_disa.c
apps/app_dumpchan.c
apps/app_externalivr.c
apps/app_fax.c
apps/app_flash.c
apps/app_followme.c
apps/app_getcpeid.c
apps/app_jack.c
apps/app_macro.c
apps/app_meetme.c
apps/app_milliwatt.c
apps/app_minivm.c
apps/app_mixmonitor.c
apps/app_page.c
apps/app_parkandannounce.c
apps/app_playback.c
apps/app_queue.c
apps/app_readexten.c
apps/app_record.c
apps/app_rpt.c
apps/app_sms.c
apps/app_softhangup.c
apps/app_stack.c
apps/app_talkdetect.c
apps/app_test.c
apps/app_voicemail.c
apps/app_waitforsilence.c
bridges/bridge_multiplexed.c
channels/chan_agent.c
channels/chan_alsa.c
channels/chan_console.c
channels/chan_dahdi.c
channels/chan_gtalk.c
channels/chan_h323.c
channels/chan_iax2.c
channels/chan_jingle.c
channels/chan_local.c
channels/chan_mgcp.c
channels/chan_misdn.c
channels/chan_nbs.c
channels/chan_oss.c
channels/chan_phone.c
channels/chan_sip.c
channels/chan_skinny.c
channels/chan_unistim.c
channels/chan_usbradio.c
channels/chan_vpb.cc
channels/console_video.c
channels/sig_analog.c
channels/sig_pri.c
channels/sig_ss7.c
funcs/func_audiohookinherit.c
funcs/func_channel.c
funcs/func_frame_trace.c
funcs/func_global.c
funcs/func_groupcount.c
funcs/func_lock.c
include/asterisk/channel.h
main/abstract_jb.c
main/aoc.c
main/app.c
main/autochan.c
main/bridging.c
main/ccss.c
main/cdr.c
main/cel.c
main/channel.c
main/channel_internal_api.c [new file with mode: 0644]
main/cli.c
main/dial.c
main/dsp.c
main/features.c
main/file.c
main/indications.c
main/manager.c
main/pbx.c
main/rtp_engine.c
main/say.c
main/udptl.c
pbx/pbx_dundi.c
pbx/pbx_lua.c
pbx/pbx_realtime.c
res/res_adsi.c
res/res_agi.c
res/res_calendar.c
res/res_fax.c
res/res_jabber.c
res/res_monitor.c
res/res_musiconhold.c
res/res_mutestream.c
res/snmp/agent.c

index 743f811..defbe19 100644 (file)
@@ -960,11 +960,11 @@ static int mbl_call(struct ast_channel *ast, char *dest, int timeout)
        }
 
        if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) {
        }
 
        if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) {
-               ast_log(LOG_WARNING, "mbl_call called on %s, neither down nor reserved\n", ast->name);
+               ast_log(LOG_WARNING, "mbl_call called on %s, neither down nor reserved\n", ast_channel_name(ast));
                return -1;
        }
 
                return -1;
        }
 
-       ast_debug(1, "Calling %s on %s\n", dest, ast->name);
+       ast_debug(1, "Calling %s on %s\n", dest, ast_channel_name(ast));
 
        ast_mutex_lock(&pvt->lock);
        if (pvt->type == MBL_TYPE_PHONE) {
 
        ast_mutex_lock(&pvt->lock);
        if (pvt->type == MBL_TYPE_PHONE) {
index 2e04bc5..c1a69bc 100644 (file)
@@ -469,7 +469,7 @@ static struct ast_channel *ooh323_new(struct ooh323_pvt *i, int state,
                ast_setstate(ch, state);
                if (state != AST_STATE_DOWN) {
                        if (ast_pbx_start(ch)) {
                ast_setstate(ch, state);
                if (state != AST_STATE_DOWN) {
                        if (ast_pbx_start(ch)) {
-                               ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ch->name);
+                               ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ast_channel_name(ch));
                                ast_channel_unlock(ch);
                                ast_hangup(ch);
                                ch = NULL;
                                ast_channel_unlock(ch);
                                ast_hangup(ch);
                                ch = NULL;
@@ -477,7 +477,7 @@ static struct ast_channel *ooh323_new(struct ooh323_pvt *i, int state,
                }
 
                manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate", "Channel: %s\r\nChanneltype: %s\r\n"
                }
 
                manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate", "Channel: %s\r\nChanneltype: %s\r\n"
-                               "CallRef: %d\r\n", ch->name, "OOH323", i->call_reference);
+                               "CallRef: %d\r\n", ast_channel_name(ch), "OOH323", i->call_reference);
        } else
                ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
 
        } else
                ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
 
@@ -927,7 +927,7 @@ static int ooh323_call(struct ast_channel *ast, char *dest, int timeout)
 
        if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) {
                ast_log(LOG_WARNING, "ooh323_call called on %s, neither down nor "
 
        if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) {
                ast_log(LOG_WARNING, "ooh323_call called on %s, neither down nor "
-                                                               "reserved\n", ast->name);
+                                                               "reserved\n", ast_channel_name(ast));
                return -1;
        }
        ast_mutex_lock(&p->lock);
                return -1;
        }
        ast_mutex_lock(&p->lock);
@@ -1096,7 +1096,7 @@ static int ooh323_answer(struct ast_channel *ast)
                        }
                        ast_setstate(ast, AST_STATE_UP);
                        if (option_debug)
                        }
                        ast_setstate(ast, AST_STATE_UP);
                        if (option_debug)
-                               ast_debug(1, "ooh323_answer(%s)\n", ast->name);
+                               ast_debug(1, "ooh323_answer(%s)\n", ast_channel_name(ast));
                        ast_channel_unlock(ast);
                        ooAnswerCall(p->callToken);
                }
                        ast_channel_unlock(ast);
                        ooAnswerCall(p->callToken);
                }
@@ -1141,7 +1141,7 @@ static int ooh323_write(struct ast_channel *ast, struct ast_frame *f)
 
                if (f->frametype == AST_FRAME_MODEM) {
                        ast_debug(1, "Send UDPTL %d/%d len %d for %s\n",
 
                if (f->frametype == AST_FRAME_MODEM) {
                        ast_debug(1, "Send UDPTL %d/%d len %d for %s\n",
-                               f->frametype, f->subclass.integer, f->datalen, ast->name);
+                               f->frametype, f->subclass.integer, f->datalen, ast_channel_name(ast));
                        if (p->udptl)
                                res = ast_udptl_write(p->udptl, f);
                        ast_mutex_unlock(&p->lock);
                        if (p->udptl)
                                res = ast_udptl_write(p->udptl, f);
                        ast_mutex_unlock(&p->lock);
@@ -1388,7 +1388,7 @@ static int ooh323_queryoption(struct ast_channel *ast, int option, void *data, i
        ast_mutex_lock(&p->lock);
 
        if (gH323Debug)
        ast_mutex_lock(&p->lock);
 
        if (gH323Debug)
-               ast_verb(0, "----- ooh323_queryoption %d on channel %s\n", option, ast->name);
+               ast_verb(0, "----- ooh323_queryoption %d on channel %s\n", option, ast_channel_name(ast));
         
        switch (option) {
 
         
        switch (option) {
 
@@ -1418,7 +1418,7 @@ static int ooh323_queryoption(struct ast_channel *ast, int option, void *data, i
                        cp = (char *) data;
                        *cp = p->vad ? 1 : 0;
                        ast_debug(1, "Reporting digit detection %sabled on %s\n",
                        cp = (char *) data;
                        *cp = p->vad ? 1 : 0;
                        ast_debug(1, "Reporting digit detection %sabled on %s\n",
-                                                        *cp ? "en" : "dis", ast->name);
+                                                        *cp ? "en" : "dis", ast_channel_name(ast));
 
                        res = 0;
                        break;
 
                        res = 0;
                        break;
@@ -1428,7 +1428,7 @@ static int ooh323_queryoption(struct ast_channel *ast, int option, void *data, i
        }
 
        if (gH323Debug)
        }
 
        if (gH323Debug)
-               ast_verb(0, "+++++ ooh323_queryoption %d on channel %s\n", option, ast->name);
+               ast_verb(0, "+++++ ooh323_queryoption %d on channel %s\n", option, ast_channel_name(ast));
         
        ast_mutex_unlock(&p->lock);
 
         
        ast_mutex_unlock(&p->lock);
 
@@ -2103,7 +2103,7 @@ int onCallEstablished(ooCallData *call)
                        ast_queue_control(c, AST_CONTROL_ANSWER);
                        ast_channel_unlock(p->owner);
                        manager_event(EVENT_FLAG_SYSTEM,"ChannelUpdate","Channel: %s\r\nChanneltype: %s\r\n"
                        ast_queue_control(c, AST_CONTROL_ANSWER);
                        ast_channel_unlock(p->owner);
                        manager_event(EVENT_FLAG_SYSTEM,"ChannelUpdate","Channel: %s\r\nChanneltype: %s\r\n"
-                               "CallRef: %d\r\n", c->name, "OOH323", p->call_reference);
+                               "CallRef: %d\r\n", ast_channel_name(c), "OOH323", p->call_reference);
                }
                ast_mutex_unlock(&p->lock);
 
                }
                ast_mutex_unlock(&p->lock);
 
@@ -3844,7 +3844,7 @@ int ooh323_destroy(struct ooh323_pvt *p)
                                ast_debug(1, "Failed to grab lock, trying again\n");
                                DEADLOCK_AVOIDANCE(&cur->lock);
                        }           
                                ast_debug(1, "Failed to grab lock, trying again\n");
                                DEADLOCK_AVOIDANCE(&cur->lock);
                        }           
-                       ast_debug(1, "Detaching from %s\n", cur->owner->name);
+                       ast_debug(1, "Detaching from %s\n", ast_channel_name(cur->owner));
                        cur->owner->tech_pvt = NULL;
                        ast_channel_unlock(cur->owner);
                        cur->owner = NULL;
                        cur->owner->tech_pvt = NULL;
                        ast_channel_unlock(cur->owner);
                        cur->owner = NULL;
@@ -4179,7 +4179,7 @@ static int ooh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance
        int mode;
 
        if (gH323Debug)
        int mode;
 
        if (gH323Debug)
-               ast_verb(0, "---   ooh323_set_peer - %s\n", chan->name);
+               ast_verb(0, "---   ooh323_set_peer - %s\n", ast_channel_name(chan));
 
        if (!rtp) {
                return 0;
 
        if (!rtp) {
                return 0;
@@ -4469,7 +4469,7 @@ void setup_udptl_connection(ooCallData *call, const char *remoteIp,
        ast_sockaddr_set_port(&them, remotePort);
 
        ast_udptl_set_peer(p->udptl, &them);
        ast_sockaddr_set_port(&them, remotePort);
 
        ast_udptl_set_peer(p->udptl, &them);
-       ast_udptl_set_tag(p->udptl, "%s", p->owner->name);
+       ast_udptl_set_tag(p->udptl, "%s", ast_channel_name(p->owner));
        p->t38_tx_enable = 1;
        p->lastTxT38 = time(NULL);
        if (p->t38support == T38_ENABLED) {
        p->t38_tx_enable = 1;
        p->lastTxT38 = time(NULL);
        if (p->t38support == T38_ENABLED) {
@@ -4592,7 +4592,7 @@ struct ast_frame *ooh323_rtp_read(struct ast_channel *ast, struct ooh323_pvt *p)
                f = ast_udptl_read(p->udptl);           /* UDPTL t.38 data */
                if (gH323Debug) {
                         ast_debug(1, "Got UDPTL %d/%d len %d for %s\n",
                f = ast_udptl_read(p->udptl);           /* UDPTL t.38 data */
                if (gH323Debug) {
                         ast_debug(1, "Got UDPTL %d/%d len %d for %s\n",
-                               f->frametype, f->subclass.integer, f->datalen, ast->name);
+                               f->frametype, f->subclass.integer, f->datalen, ast_channel_name(ast));
                }
                break;
 
                }
                break;
 
@@ -4633,10 +4633,10 @@ struct ast_frame *ooh323_rtp_read(struct ast_channel *ast, struct ooh323_pvt *p)
                        if ((strcmp(p->owner->exten, "fax")) &&
                            (ast_exists_extension(p->owner, target_context, "fax", 1,
                            S_COR(p->owner->caller.id.number.valid, p->owner->caller.id.number.str, NULL)))) {
                        if ((strcmp(p->owner->exten, "fax")) &&
                            (ast_exists_extension(p->owner, target_context, "fax", 1,
                            S_COR(p->owner->caller.id.number.valid, p->owner->caller.id.number.str, NULL)))) {
-                               ast_verb(2, "Redirecting '%s' to fax extension due to CNG detection\n", p->owner->name);
+                               ast_verb(2, "Redirecting '%s' to fax extension due to CNG detection\n", ast_channel_name(p->owner));
                                pbx_builtin_setvar_helper(p->owner, "FAXEXTEN", p->owner->exten);
                                if (ast_async_goto(p->owner, target_context, "fax", 1)) {
                                pbx_builtin_setvar_helper(p->owner, "FAXEXTEN", p->owner->exten);
                                if (ast_async_goto(p->owner, target_context, "fax", 1)) {
-                                       ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", p->owner->name,target_context);
+                                       ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(p->owner),target_context);
                                }
                                p->faxdetected = 1;
                                if (dfr) {
                                }
                                p->faxdetected = 1;
                                if (dfr) {
@@ -4711,10 +4711,10 @@ void onModeChanged(ooCallData *call, int t38mode) {
                                if ((strcmp(p->owner->exten, "fax")) &&
                                        (ast_exists_extension(p->owner, target_context, "fax", 1,
                                        S_COR(p->owner->caller.id.number.valid, p->owner->caller.id.number.str, NULL)))) {
                                if ((strcmp(p->owner->exten, "fax")) &&
                                        (ast_exists_extension(p->owner, target_context, "fax", 1,
                                        S_COR(p->owner->caller.id.number.valid, p->owner->caller.id.number.str, NULL)))) {
-                                       ast_verb(2, "Redirecting '%s' to fax extension due to CNG detection\n", p->owner->name);
+                                       ast_verb(2, "Redirecting '%s' to fax extension due to CNG detection\n", ast_channel_name(p->owner));
                                        pbx_builtin_setvar_helper(p->owner, "FAXEXTEN", p->owner->exten);
                                        if (ast_async_goto(p->owner, target_context, "fax", 1)) {
                                        pbx_builtin_setvar_helper(p->owner, "FAXEXTEN", p->owner->exten);
                                        if (ast_async_goto(p->owner, target_context, "fax", 1)) {
-                                               ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", p->owner->name,target_context);
+                                               ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(p->owner),target_context);
                                        }
                                 }
                                 p->faxdetected = 1;
                                        }
                                 }
                                 p->faxdetected = 1;
index 430d825..518a021 100644 (file)
@@ -1469,7 +1469,7 @@ static int adsi_prog(struct ast_channel *chan, const char *script)
        if (ast_adsi_begin_download(chan, scr->desc, scr->fdn, scr->sec, scr->ver)) {
                /* User rejected us for some reason */
                ast_verb(3, "User rejected download attempt\n");
        if (ast_adsi_begin_download(chan, scr->desc, scr->fdn, scr->sec, scr->ver)) {
                /* User rejected us for some reason */
                ast_verb(3, "User rejected download attempt\n");
-               ast_log(LOG_NOTICE, "User rejected download on channel %s\n", chan->name);
+               ast_log(LOG_NOTICE, "User rejected download on channel %s\n", ast_channel_name(chan));
                ast_free(scr);
                return -1;
        }
                ast_free(scr);
                return -1;
        }
@@ -1554,7 +1554,7 @@ static int adsi_prog(struct ast_channel *chan, const char *script)
        if (ast_adsi_end_download(chan)) {
                /* Download failed for some reason */
                ast_verb(3, "Download attempt failed\n");
        if (ast_adsi_end_download(chan)) {
                /* Download failed for some reason */
                ast_verb(3, "Download attempt failed\n");
-               ast_log(LOG_NOTICE, "Download failed on %s\n", chan->name);
+               ast_log(LOG_NOTICE, "Download failed on %s\n", ast_channel_name(chan));
                ast_free(scr);
                return -1;
        }
                ast_free(scr);
                return -1;
        }
index 1a4f922..20171e0 100644 (file)
@@ -210,8 +210,8 @@ static int send_tone_burst(struct ast_channel *chan, float freq, int duration, i
                                break;
                        }
                        if (ast_write(chan, &wf)) {
                                break;
                        }
                        if (ast_write(chan, &wf)) {
-                               ast_verb(4, "AlarmReceiver: Failed to write frame on %s\n", chan->name);
-                               ast_log(LOG_WARNING, "AlarmReceiver Failed to write frame on %s\n",chan->name);
+                               ast_verb(4, "AlarmReceiver: Failed to write frame on %s\n", ast_channel_name(chan));
+                               ast_log(LOG_WARNING, "AlarmReceiver Failed to write frame on %s\n",ast_channel_name(chan));
                                res = -1;
                                ast_frfree(f);
                                break;
                                res = -1;
                                ast_frfree(f);
                                break;
@@ -245,8 +245,8 @@ static int receive_dtmf_digits(struct ast_channel *chan, char *digit_string, int
        for (;;) {
                /* if outa time, leave */
                if (ast_tvdiff_ms(ast_tvnow(), lastdigittime) > ((i > 0) ? sdto : fdto)) {
        for (;;) {
                /* if outa time, leave */
                if (ast_tvdiff_ms(ast_tvnow(), lastdigittime) > ((i > 0) ? sdto : fdto)) {
-                       ast_verb(4, "AlarmReceiver: DTMF Digit Timeout on %s\n", chan->name);
-                       ast_debug(1,"AlarmReceiver: DTMF timeout on chan %s\n",chan->name);
+                       ast_verb(4, "AlarmReceiver: DTMF Digit Timeout on %s\n", ast_channel_name(chan));
+                       ast_debug(1,"AlarmReceiver: DTMF timeout on chan %s\n",ast_channel_name(chan));
                        res = 1;
                        break;
                }
                        res = 1;
                        break;
                }
@@ -583,12 +583,12 @@ static int alarmreceiver_exec(struct ast_channel *chan, const char *data)
        ast_verb(4, "AlarmReceiver: Setting read and write formats to ULAW\n");
 
        if (ast_set_write_format_by_id(chan,AST_FORMAT_ULAW)) {
        ast_verb(4, "AlarmReceiver: Setting read and write formats to ULAW\n");
 
        if (ast_set_write_format_by_id(chan,AST_FORMAT_ULAW)) {
-               ast_log(LOG_WARNING, "AlarmReceiver: Unable to set write format to Mu-law on %s\n",chan->name);
+               ast_log(LOG_WARNING, "AlarmReceiver: Unable to set write format to Mu-law on %s\n",ast_channel_name(chan));
                return -1;
        }
 
        if (ast_set_read_format_by_id(chan,AST_FORMAT_ULAW)) {
                return -1;
        }
 
        if (ast_set_read_format_by_id(chan,AST_FORMAT_ULAW)) {
-               ast_log(LOG_WARNING, "AlarmReceiver: Unable to set read format to Mu-law on %s\n",chan->name);
+               ast_log(LOG_WARNING, "AlarmReceiver: Unable to set read format to Mu-law on %s\n",ast_channel_name(chan));
                return -1;
        }
 
                return -1;
        }
 
index 35c5005..0e03010 100644 (file)
@@ -192,7 +192,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
        );
 
        ast_format_clear(&readFormat);
        );
 
        ast_format_clear(&readFormat);
-       ast_verb(3, "AMD: %s %s %s (Fmt: %s)\n", chan->name,
+       ast_verb(3, "AMD: %s %s %s (Fmt: %s)\n", ast_channel_name(chan),
                S_COR(chan->caller.ani.number.valid, chan->caller.ani.number.str, "(N/A)"),
                S_COR(chan->redirecting.from.number.valid, chan->redirecting.from.number.str, "(N/A)"),
                ast_getformatname(&chan->readformat));
                S_COR(chan->caller.ani.number.valid, chan->caller.ani.number.str, "(N/A)"),
                S_COR(chan->redirecting.from.number.valid, chan->redirecting.from.number.str, "(N/A)"),
                ast_getformatname(&chan->readformat));
@@ -246,7 +246,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
        /* Set read format to signed linear so we get signed linear frames in */
        ast_format_copy(&readFormat, &chan->readformat);
        if (ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR) < 0 ) {
        /* Set read format to signed linear so we get signed linear frames in */
        ast_format_copy(&readFormat, &chan->readformat);
        if (ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR) < 0 ) {
-               ast_log(LOG_WARNING, "AMD: Channel [%s]. Unable to set to linear mode, giving up\n", chan->name );
+               ast_log(LOG_WARNING, "AMD: Channel [%s]. Unable to set to linear mode, giving up\n", ast_channel_name(chan));
                pbx_builtin_setvar_helper(chan , "AMDSTATUS", "");
                pbx_builtin_setvar_helper(chan , "AMDCAUSE", "");
                return;
                pbx_builtin_setvar_helper(chan , "AMDSTATUS", "");
                pbx_builtin_setvar_helper(chan , "AMDCAUSE", "");
                return;
@@ -254,7 +254,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
 
        /* Create a new DSP that will detect the silence */
        if (!(silenceDetector = ast_dsp_new())) {
 
        /* Create a new DSP that will detect the silence */
        if (!(silenceDetector = ast_dsp_new())) {
-               ast_log(LOG_WARNING, "AMD: Channel [%s]. Unable to create silence detector :(\n", chan->name );
+               ast_log(LOG_WARNING, "AMD: Channel [%s]. Unable to create silence detector :(\n", ast_channel_name(chan));
                pbx_builtin_setvar_helper(chan , "AMDSTATUS", "");
                pbx_builtin_setvar_helper(chan , "AMDCAUSE", "");
                return;
                pbx_builtin_setvar_helper(chan , "AMDSTATUS", "");
                pbx_builtin_setvar_helper(chan , "AMDCAUSE", "");
                return;
@@ -268,7 +268,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
 
                /* If we fail to read in a frame, that means they hung up */
                if (!(f = ast_read(chan))) {
 
                /* If we fail to read in a frame, that means they hung up */
                if (!(f = ast_read(chan))) {
-                       ast_verb(3, "AMD: Channel [%s]. HANGUP\n", chan->name);
+                       ast_verb(3, "AMD: Channel [%s]. HANGUP\n", ast_channel_name(chan));
                        ast_debug(1, "Got hangup\n");
                        strcpy(amdStatus, "HANGUP");
                        res = 1;
                        ast_debug(1, "Got hangup\n");
                        strcpy(amdStatus, "HANGUP");
                        res = 1;
@@ -285,7 +285,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
 
                        iTotalTime += framelength;
                        if (iTotalTime >= totalAnalysisTime) {
 
                        iTotalTime += framelength;
                        if (iTotalTime >= totalAnalysisTime) {
-                               ast_verb(3, "AMD: Channel [%s]. Too long...\n", chan->name );
+                               ast_verb(3, "AMD: Channel [%s]. Too long...\n", ast_channel_name(chan));
                                ast_frfree(f);
                                strcpy(amdStatus , "NOTSURE");
                                sprintf(amdCause , "TOOLONG-%d", iTotalTime);
                                ast_frfree(f);
                                strcpy(amdStatus , "NOTSURE");
                                sprintf(amdCause , "TOOLONG-%d", iTotalTime);
@@ -305,11 +305,11 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
                                
                                if (silenceDuration >= betweenWordsSilence) {
                                        if (currentState != STATE_IN_SILENCE ) {
                                
                                if (silenceDuration >= betweenWordsSilence) {
                                        if (currentState != STATE_IN_SILENCE ) {
-                                               ast_verb(3, "AMD: Channel [%s]. Changed state to STATE_IN_SILENCE\n", chan->name);
+                                               ast_verb(3, "AMD: Channel [%s]. Changed state to STATE_IN_SILENCE\n", ast_channel_name(chan));
                                        }
                                        /* Find words less than word duration */
                                        if (consecutiveVoiceDuration < minimumWordLength && consecutiveVoiceDuration > 0){
                                        }
                                        /* Find words less than word duration */
                                        if (consecutiveVoiceDuration < minimumWordLength && consecutiveVoiceDuration > 0){
-                                               ast_verb(3, "AMD: Channel [%s]. Short Word Duration: %d\n", chan->name, consecutiveVoiceDuration);
+                                               ast_verb(3, "AMD: Channel [%s]. Short Word Duration: %d\n", ast_channel_name(chan), consecutiveVoiceDuration);
                                        }
                                        currentState  = STATE_IN_SILENCE;
                                        consecutiveVoiceDuration = 0;
                                        }
                                        currentState  = STATE_IN_SILENCE;
                                        consecutiveVoiceDuration = 0;
@@ -317,7 +317,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
 
                                if (inInitialSilence == 1  && silenceDuration >= initialSilence) {
                                        ast_verb(3, "AMD: Channel [%s]. ANSWERING MACHINE: silenceDuration:%d initialSilence:%d\n",
 
                                if (inInitialSilence == 1  && silenceDuration >= initialSilence) {
                                        ast_verb(3, "AMD: Channel [%s]. ANSWERING MACHINE: silenceDuration:%d initialSilence:%d\n",
-                                               chan->name, silenceDuration, initialSilence);
+                                               ast_channel_name(chan), silenceDuration, initialSilence);
                                        ast_frfree(f);
                                        strcpy(amdStatus , "MACHINE");
                                        sprintf(amdCause , "INITIALSILENCE-%d-%d", silenceDuration, initialSilence);
                                        ast_frfree(f);
                                        strcpy(amdStatus , "MACHINE");
                                        sprintf(amdCause , "INITIALSILENCE-%d-%d", silenceDuration, initialSilence);
@@ -327,7 +327,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
                                
                                if (silenceDuration >= afterGreetingSilence  &&  inGreeting == 1) {
                                        ast_verb(3, "AMD: Channel [%s]. HUMAN: silenceDuration:%d afterGreetingSilence:%d\n",
                                
                                if (silenceDuration >= afterGreetingSilence  &&  inGreeting == 1) {
                                        ast_verb(3, "AMD: Channel [%s]. HUMAN: silenceDuration:%d afterGreetingSilence:%d\n",
-                                               chan->name, silenceDuration, afterGreetingSilence);
+                                               ast_channel_name(chan), silenceDuration, afterGreetingSilence);
                                        ast_frfree(f);
                                        strcpy(amdStatus , "HUMAN");
                                        sprintf(amdCause , "HUMAN-%d-%d", silenceDuration, afterGreetingSilence);
                                        ast_frfree(f);
                                        strcpy(amdStatus , "HUMAN");
                                        sprintf(amdCause , "HUMAN-%d-%d", silenceDuration, afterGreetingSilence);
@@ -343,18 +343,18 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
                                   number of words if my previous state was Silence, which means that I moved into a word. */
                                if (consecutiveVoiceDuration >= minimumWordLength && currentState == STATE_IN_SILENCE) {
                                        iWordsCount++;
                                   number of words if my previous state was Silence, which means that I moved into a word. */
                                if (consecutiveVoiceDuration >= minimumWordLength && currentState == STATE_IN_SILENCE) {
                                        iWordsCount++;
-                                       ast_verb(3, "AMD: Channel [%s]. Word detected. iWordsCount:%d\n", chan->name, iWordsCount);
+                                       ast_verb(3, "AMD: Channel [%s]. Word detected. iWordsCount:%d\n", ast_channel_name(chan), iWordsCount);
                                        currentState = STATE_IN_WORD;
                                }
                                if (consecutiveVoiceDuration >= maximumWordLength){
                                        currentState = STATE_IN_WORD;
                                }
                                if (consecutiveVoiceDuration >= maximumWordLength){
-                                       ast_verb(3, "AMD: Channel [%s]. Maximum Word Length detected. [%d]\n", chan->name, consecutiveVoiceDuration);
+                                       ast_verb(3, "AMD: Channel [%s]. Maximum Word Length detected. [%d]\n", ast_channel_name(chan), consecutiveVoiceDuration);
                                        ast_frfree(f);
                                        strcpy(amdStatus , "MACHINE");
                                        sprintf(amdCause , "MAXWORDLENGTH-%d", consecutiveVoiceDuration);
                                        break;
                                }
                                if (iWordsCount >= maximumNumberOfWords) {
                                        ast_frfree(f);
                                        strcpy(amdStatus , "MACHINE");
                                        sprintf(amdCause , "MAXWORDLENGTH-%d", consecutiveVoiceDuration);
                                        break;
                                }
                                if (iWordsCount >= maximumNumberOfWords) {
-                                       ast_verb(3, "AMD: Channel [%s]. ANSWERING MACHINE: iWordsCount:%d\n", chan->name, iWordsCount);
+                                       ast_verb(3, "AMD: Channel [%s]. ANSWERING MACHINE: iWordsCount:%d\n", ast_channel_name(chan), iWordsCount);
                                        ast_frfree(f);
                                        strcpy(amdStatus , "MACHINE");
                                        sprintf(amdCause , "MAXWORDS-%d-%d", iWordsCount, maximumNumberOfWords);
                                        ast_frfree(f);
                                        strcpy(amdStatus , "MACHINE");
                                        sprintf(amdCause , "MAXWORDS-%d-%d", iWordsCount, maximumNumberOfWords);
@@ -363,7 +363,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
                                }
 
                                if (inGreeting == 1 && voiceDuration >= greeting) {
                                }
 
                                if (inGreeting == 1 && voiceDuration >= greeting) {
-                                       ast_verb(3, "AMD: Channel [%s]. ANSWERING MACHINE: voiceDuration:%d greeting:%d\n", chan->name, voiceDuration, greeting);
+                                       ast_verb(3, "AMD: Channel [%s]. ANSWERING MACHINE: voiceDuration:%d greeting:%d\n", ast_channel_name(chan), voiceDuration, greeting);
                                        ast_frfree(f);
                                        strcpy(amdStatus , "MACHINE");
                                        sprintf(amdCause , "LONGGREETING-%d-%d", voiceDuration, greeting);
                                        ast_frfree(f);
                                        strcpy(amdStatus , "MACHINE");
                                        sprintf(amdCause , "LONGGREETING-%d-%d", voiceDuration, greeting);
@@ -373,13 +373,13 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
 
                                if (voiceDuration >= minimumWordLength ) {
                                        if (silenceDuration > 0)
 
                                if (voiceDuration >= minimumWordLength ) {
                                        if (silenceDuration > 0)
-                                               ast_verb(3, "AMD: Channel [%s]. Detected Talk, previous silence duration: %d\n", chan->name, silenceDuration);
+                                               ast_verb(3, "AMD: Channel [%s]. Detected Talk, previous silence duration: %d\n", ast_channel_name(chan), silenceDuration);
                                        silenceDuration = 0;
                                }
                                if (consecutiveVoiceDuration >= minimumWordLength && inGreeting == 0) {
                                        /* Only go in here once to change the greeting flag when we detect the 1st word */
                                        if (silenceDuration > 0)
                                        silenceDuration = 0;
                                }
                                if (consecutiveVoiceDuration >= minimumWordLength && inGreeting == 0) {
                                        /* Only go in here once to change the greeting flag when we detect the 1st word */
                                        if (silenceDuration > 0)
-                                               ast_verb(3, "AMD: Channel [%s]. Before Greeting Time:  silenceDuration: %d voiceDuration: %d\n", chan->name, silenceDuration, voiceDuration);
+                                               ast_verb(3, "AMD: Channel [%s]. Before Greeting Time:  silenceDuration: %d voiceDuration: %d\n", ast_channel_name(chan), silenceDuration, voiceDuration);
                                        inInitialSilence = 0;
                                        inGreeting = 1;
                                }
                                        inInitialSilence = 0;
                                        inGreeting = 1;
                                }
@@ -391,7 +391,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
        
        if (!res) {
                /* It took too long to get a frame back. Giving up. */
        
        if (!res) {
                /* It took too long to get a frame back. Giving up. */
-               ast_verb(3, "AMD: Channel [%s]. Too long...\n", chan->name);
+               ast_verb(3, "AMD: Channel [%s]. Too long...\n", ast_channel_name(chan));
                strcpy(amdStatus , "NOTSURE");
                sprintf(amdCause , "TOOLONG-%d", iTotalTime);
        }
                strcpy(amdStatus , "NOTSURE");
                sprintf(amdCause , "TOOLONG-%d", iTotalTime);
        }
@@ -402,7 +402,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
 
        /* Restore channel read format */
        if (readFormat.id && ast_set_read_format(chan, &readFormat))
 
        /* Restore channel read format */
        if (readFormat.id && ast_set_read_format(chan, &readFormat))
-               ast_log(LOG_WARNING, "AMD: Unable to restore read format on '%s'\n", chan->name);
+               ast_log(LOG_WARNING, "AMD: Unable to restore read format on '%s'\n", ast_channel_name(chan));
 
        /* Free the DSP used to detect silence */
        ast_dsp_free(silenceDetector);
 
        /* Free the DSP used to detect silence */
        ast_dsp_free(silenceDetector);
index 86ce341..37ba214 100644 (file)
@@ -170,7 +170,7 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
                        snprintf(tmp, sizeof(tmp), "%d", status);
                        ast_str_append(&tmp_availstat, 0, "%s%s", ast_str_strlen(tmp_availstat) ? "&" : "", tmp);
                        if ((inuse <= 1) && (tempchan = ast_request(tech, chan->nativeformats, chan, number, &status))) {
                        snprintf(tmp, sizeof(tmp), "%d", status);
                        ast_str_append(&tmp_availstat, 0, "%s%s", ast_str_strlen(tmp_availstat) ? "&" : "", tmp);
                        if ((inuse <= 1) && (tempchan = ast_request(tech, chan->nativeformats, chan, number, &status))) {
-                                       ast_str_append(&tmp_availchan, 0, "%s%s", ast_str_strlen(tmp_availchan) ? "&" : "", tempchan->name);
+                                       ast_str_append(&tmp_availchan, 0, "%s%s", ast_str_strlen(tmp_availchan) ? "&" : "", ast_channel_name(tempchan));
                                        
                                        snprintf(tmp, sizeof(tmp), "%s/%s", tech, number);
                                        ast_str_append(&tmp_availorig, 0, "%s%s", ast_str_strlen(tmp_availorig) ? "&" : "", tmp);
                                        
                                        snprintf(tmp, sizeof(tmp), "%s/%s", tech, number);
                                        ast_str_append(&tmp_availorig, 0, "%s%s", ast_str_strlen(tmp_availorig) ? "&" : "", tmp);
index 278098c..af816f3 100644 (file)
@@ -484,7 +484,7 @@ static int start_spying(struct ast_autochan *autochan, const char *spychan_name,
        int res = 0;
        struct ast_channel *peer = NULL;
 
        int res = 0;
        struct ast_channel *peer = NULL;
 
-       ast_log(LOG_NOTICE, "Attaching %s to %s\n", spychan_name, autochan->chan->name);
+       ast_log(LOG_NOTICE, "Attaching %s to %s\n", spychan_name, ast_channel_name(autochan->chan));
 
        ast_set_flag(audiohook, AST_AUDIOHOOK_TRIGGER_SYNC | AST_AUDIOHOOK_SMALL_QUEUE);
        res = ast_audiohook_attach(autochan->chan, audiohook);
 
        ast_set_flag(audiohook, AST_AUDIOHOOK_TRIGGER_SYNC | AST_AUDIOHOOK_SMALL_QUEUE);
        res = ast_audiohook_attach(autochan->chan, audiohook);
@@ -524,7 +524,7 @@ static int channel_spy(struct ast_channel *chan, struct ast_autochan *spyee_auto
        struct ast_channel *chans[] = { chan, spyee_autochan->chan };
 
        ast_channel_lock(chan);
        struct ast_channel *chans[] = { chan, spyee_autochan->chan };
 
        ast_channel_lock(chan);
-       spyer_name = ast_strdupa(chan->name);
+       spyer_name = ast_strdupa(ast_channel_name(chan));
        ast_channel_unlock(chan);
 
        /* We now hold the channel lock on spyee */
        ast_channel_unlock(chan);
 
        /* We now hold the channel lock on spyee */
@@ -534,7 +534,7 @@ static int channel_spy(struct ast_channel *chan, struct ast_autochan *spyee_auto
        }
 
        ast_channel_lock(spyee_autochan->chan);
        }
 
        ast_channel_lock(spyee_autochan->chan);
-       name = ast_strdupa(spyee_autochan->chan->name);
+       name = ast_strdupa(ast_channel_name(spyee_autochan->chan));
        ast_channel_unlock(spyee_autochan->chan);
 
        ast_verb(2, "Spying on channel %s\n", name);
        ast_channel_unlock(spyee_autochan->chan);
 
        ast_verb(2, "Spying on channel %s\n", name);
@@ -685,7 +685,7 @@ static int channel_spy(struct ast_channel *chan, struct ast_autochan *spyee_auto
                        (*volfactor)++;
                        if (*volfactor > 4)
                                *volfactor = -4;
                        (*volfactor)++;
                        if (*volfactor > 4)
                                *volfactor = -4;
-                       ast_verb(3, "Setting spy volume on %s to %d\n", chan->name, *volfactor);
+                       ast_verb(3, "Setting spy volume on %s to %d\n", ast_channel_name(chan), *volfactor);
 
                        csth.volfactor = *volfactor;
                        csth.spy_audiohook.options.read_volume = csth.volfactor;
 
                        csth.volfactor = *volfactor;
                        csth.spy_audiohook.options.read_volume = csth.volfactor;
@@ -747,7 +747,7 @@ redo:
                return NULL;
        }
 
                return NULL;
        }
 
-       if (!strncmp(next->name, "DAHDI/pseudo", pseudo_len)) {
+       if (!strncmp(ast_channel_name(next), "DAHDI/pseudo", pseudo_len)) {
                goto redo;
        } else if (next == chan) {
                goto redo;
                goto redo;
        } else if (next == chan) {
                goto redo;
@@ -925,7 +925,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
 
                                snprintf(buffer, sizeof(buffer) - 1, ":%s:", myenforced);
 
 
                                snprintf(buffer, sizeof(buffer) - 1, ":%s:", myenforced);
 
-                               ast_copy_string(ext + 1, autochan->chan->name, sizeof(ext) - 1);
+                               ast_copy_string(ext + 1, ast_channel_name(autochan->chan), sizeof(ext) - 1);
                                if ((end = strchr(ext, '-'))) {
                                        *end++ = ':';
                                        *end = '\0';
                                if ((end = strchr(ext, '-'))) {
                                        *end++ = ':';
                                        *end = '\0';
@@ -943,7 +943,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
                        }
 
                        strcpy(peer_name, "spy-");
                        }
 
                        strcpy(peer_name, "spy-");
-                       strncat(peer_name, autochan->chan->name, AST_NAME_STRLEN - 4 - 1);
+                       strncat(peer_name, ast_channel_name(autochan->chan), AST_NAME_STRLEN - 4 - 1);
                        ptr = strchr(peer_name, '/');
                        *ptr++ = '\0';
                        ptr = strsep(&ptr, "-");
                        ptr = strchr(peer_name, '/');
                        *ptr++ = '\0';
                        ptr = strsep(&ptr, "-");
index d5609b7..8683c95 100644 (file)
@@ -545,7 +545,7 @@ static void send_join_event(struct ast_channel *chan, const char *conf_name)
                "Conference: %s\r\n"
                "CallerIDnum: %s\r\n"
                "CallerIDname: %s\r\n",
                "Conference: %s\r\n"
                "CallerIDnum: %s\r\n"
                "CallerIDname: %s\r\n",
-               chan->name,
+               ast_channel_name(chan),
                chan->uniqueid,
                conf_name,
                S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "<unknown>"),
                chan->uniqueid,
                conf_name,
                S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "<unknown>"),
@@ -561,7 +561,7 @@ static void send_leave_event(struct ast_channel *chan, const char *conf_name)
                "Conference: %s\r\n"
                "CallerIDnum: %s\r\n"
                "CallerIDname: %s\r\n",
                "Conference: %s\r\n"
                "CallerIDnum: %s\r\n"
                "CallerIDname: %s\r\n",
-               chan->name,
+               ast_channel_name(chan),
                chan->uniqueid,
                conf_name,
                S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "<unknown>"),
                chan->uniqueid,
                conf_name,
                S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "<unknown>"),
@@ -1165,7 +1165,7 @@ static int play_sound_helper(struct conference_bridge *conference_bridge, const
                ast_say_number(conference_bridge->playback_chan, say_number, "", conference_bridge->playback_chan->language, NULL);
        }
 
                ast_say_number(conference_bridge->playback_chan, say_number, "", conference_bridge->playback_chan->language, NULL);
        }
 
-       ast_debug(1, "Departing underlying channel '%s' from bridge '%p'\n", underlying_channel->name, conference_bridge->bridge);
+       ast_debug(1, "Departing underlying channel '%s' from bridge '%p'\n", ast_channel_name(underlying_channel), conference_bridge->bridge);
        ast_bridge_depart(conference_bridge->bridge, underlying_channel);
 
        ast_mutex_unlock(&conference_bridge->playback_lock);
        ast_bridge_depart(conference_bridge->bridge, underlying_channel);
 
        ast_mutex_unlock(&conference_bridge->playback_lock);
@@ -1228,7 +1228,7 @@ static void conf_handle_talker_cb(struct ast_bridge *bridge, struct ast_bridge_c
              "Uniqueid: %s\r\n"
              "Conference: %s\r\n"
              "TalkingStatus: %s\r\n",
              "Uniqueid: %s\r\n"
              "Conference: %s\r\n"
              "TalkingStatus: %s\r\n",
-             bridge_channel->chan->name, bridge_channel->chan->uniqueid, conf_name, talking ? "on" : "off");
+             ast_channel_name(bridge_channel->chan), bridge_channel->chan->uniqueid, conf_name, talking ? "on" : "off");
 }
 
 static int conf_get_pin(struct ast_channel *chan, struct conference_bridge_user *conference_bridge_user)
 }
 
 static int conf_get_pin(struct ast_channel *chan, struct conference_bridge_user *conference_bridge_user)
@@ -1548,7 +1548,7 @@ static int action_toggle_mute(struct conference_bridge *conference_bridge,
        /* Mute or unmute yourself, note we only allow manipulation if they aren't waiting for a marked user or if marked users exist */
        if (!ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_WAITMARKED) || conference_bridge->markedusers) {
                conference_bridge_user->features.mute = (!conference_bridge_user->features.mute ? 1 : 0);
        /* Mute or unmute yourself, note we only allow manipulation if they aren't waiting for a marked user or if marked users exist */
        if (!ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_WAITMARKED) || conference_bridge->markedusers) {
                conference_bridge_user->features.mute = (!conference_bridge_user->features.mute ? 1 : 0);
-               ast_test_suite_event_notify("CONF_MUTE", "Message: participant %s %s\r\nConference: %s\r\nChannel: %s", chan->name, conference_bridge_user->features.mute ? "muted" : "unmuted", conference_bridge_user->b_profile.name, chan->name);
+               ast_test_suite_event_notify("CONF_MUTE", "Message: participant %s %s\r\nConference: %s\r\nChannel: %s", ast_channel_name(chan), conference_bridge_user->features.mute ? "muted" : "unmuted", conference_bridge_user->b_profile.name, ast_channel_name(chan));
        }
        return ast_stream_and_wait(chan, (conference_bridge_user->features.mute ?
                conf_get_sound(CONF_SOUND_MUTED, conference_bridge_user->b_profile.sounds) :
        }
        return ast_stream_and_wait(chan, (conference_bridge_user->features.mute ?
                conf_get_sound(CONF_SOUND_MUTED, conference_bridge_user->b_profile.sounds) :
@@ -1684,7 +1684,7 @@ static int action_kick_last(struct conference_bridge *conference_bridge,
                        conf_get_sound(CONF_SOUND_ERROR_MENU, conference_bridge_user->b_profile.sounds),
                        "");
                ast_log(LOG_WARNING, "Only admin users can use the kick_last menu action. Channel %s of conf %s is not an admin.\n",
                        conf_get_sound(CONF_SOUND_ERROR_MENU, conference_bridge_user->b_profile.sounds),
                        "");
                ast_log(LOG_WARNING, "Only admin users can use the kick_last menu action. Channel %s of conf %s is not an admin.\n",
-                       bridge_channel->chan->name,
+                       ast_channel_name(bridge_channel->chan),
                        conference_bridge->name);
                return -1;
        }
                        conference_bridge->name);
                return -1;
        }
@@ -1938,12 +1938,12 @@ static char *handle_cli_confbridge_kick(struct ast_cli_entry *e, int cmd, struct
        }
        ao2_lock(bridge);
        AST_LIST_TRAVERSE(&bridge->users_list, participant, list) {
        }
        ao2_lock(bridge);
        AST_LIST_TRAVERSE(&bridge->users_list, participant, list) {
-               if (!strncmp(a->argv[3], participant->chan->name, strlen(participant->chan->name))) {
+               if (!strncmp(a->argv[3], ast_channel_name(participant->chan), strlen(ast_channel_name(participant->chan)))) {
                        break;
                }
        }
        if (participant) {
                        break;
                }
        }
        if (participant) {
-               ast_cli(a->fd, "Kicking %s from confbridge %s\n", participant->chan->name, bridge->name);
+               ast_cli(a->fd, "Kicking %s from confbridge %s\n", ast_channel_name(participant->chan), bridge->name);
                participant->kicked = 1;
                ast_bridge_remove(bridge->bridge, participant->chan);
        }
                participant->kicked = 1;
                ast_bridge_remove(bridge->bridge, participant->chan);
        }
@@ -1996,7 +1996,7 @@ static char *handle_cli_confbridge_list(struct ast_cli_entry *e, int cmd, struct
                ast_cli(a->fd, "============================= ================ ================ ================ ================\n");
                ao2_lock(bridge);
                AST_LIST_TRAVERSE(&bridge->users_list, participant, list) {
                ast_cli(a->fd, "============================= ================ ================ ================ ================\n");
                ao2_lock(bridge);
                AST_LIST_TRAVERSE(&bridge->users_list, participant, list) {
-                       ast_cli(a->fd, "%-29s ", participant->chan->name);
+                       ast_cli(a->fd, "%-29s ", ast_channel_name(participant->chan));
                        ast_cli(a->fd, "%-17s", participant->u_profile.name);
                        ast_cli(a->fd, "%-17s", participant->b_profile.name);
                        ast_cli(a->fd, "%-17s", participant->menu_name);
                        ast_cli(a->fd, "%-17s", participant->u_profile.name);
                        ast_cli(a->fd, "%-17s", participant->b_profile.name);
                        ast_cli(a->fd, "%-17s", participant->menu_name);
@@ -2057,13 +2057,13 @@ static int generic_mute_unmute_helper(int mute, const char *conference, const ch
        }
        ao2_lock(bridge);
        AST_LIST_TRAVERSE(&bridge->users_list, participant, list) {
        }
        ao2_lock(bridge);
        AST_LIST_TRAVERSE(&bridge->users_list, participant, list) {
-               if (!strncmp(user, participant->chan->name, strlen(user))) {
+               if (!strncmp(user, ast_channel_name(participant->chan), strlen(user))) {
                        break;
                }
        }
        if (participant) {
                participant->features.mute = mute;
                        break;
                }
        }
        if (participant) {
                participant->features.mute = mute;
-               ast_test_suite_event_notify("CONF_MUTE", "Message: participant %s %s\r\nConference: %s\r\nChannel: %s", participant->chan->name, participant->features.mute ? "muted" : "unmuted", bridge->b_profile.name, participant->chan->name);
+               ast_test_suite_event_notify("CONF_MUTE", "Message: participant %s %s\r\nConference: %s\r\nChannel: %s", ast_channel_name(participant->chan), participant->features.mute ? "muted" : "unmuted", bridge->b_profile.name, ast_channel_name(participant->chan));
        } else {
                res = -2;;
        }
        } else {
                res = -2;;
        }
@@ -2340,7 +2340,7 @@ static int action_confbridgelist(struct mansession *s, const struct message *m)
                        bridge->name,
                        S_COR(participant->chan->caller.id.number.valid, participant->chan->caller.id.number.str, "<unknown>"),
                        S_COR(participant->chan->caller.id.name.valid, participant->chan->caller.id.name.str, "<no name>"),
                        bridge->name,
                        S_COR(participant->chan->caller.id.number.valid, participant->chan->caller.id.number.str, "<unknown>"),
                        S_COR(participant->chan->caller.id.name.valid, participant->chan->caller.id.name.str, "<no name>"),
-                       participant->chan->name,
+                       ast_channel_name(participant->chan),
                        ast_test_flag(&participant->u_profile, USER_OPT_ADMIN) ? "Yes" : "No",
                        ast_test_flag(&participant->u_profile, USER_OPT_MARKEDUSER) ? "Yes" : "No");
        }
                        ast_test_flag(&participant->u_profile, USER_OPT_ADMIN) ? "Yes" : "No",
                        ast_test_flag(&participant->u_profile, USER_OPT_MARKEDUSER) ? "Yes" : "No");
        }
@@ -2508,7 +2508,7 @@ static int action_confbridgekick(struct mansession *s, const struct message *m)
 
        ao2_lock(bridge);
        AST_LIST_TRAVERSE(&bridge->users_list, participant, list) {
 
        ao2_lock(bridge);
        AST_LIST_TRAVERSE(&bridge->users_list, participant, list) {
-               if (!strcasecmp(participant->chan->name, channel)) {
+               if (!strcasecmp(ast_channel_name(participant->chan), channel)) {
                        participant->kicked = 1;
                        ast_bridge_remove(bridge->bridge, participant->chan);
                        found = 1;
                        participant->kicked = 1;
                        ast_bridge_remove(bridge->bridge, participant->chan);
                        found = 1;
@@ -2635,7 +2635,7 @@ static int action_confbridgesetsinglevideosrc(struct mansession *s, const struct
        /* find channel and set as video src. */
        ao2_lock(bridge);
        AST_LIST_TRAVERSE(&bridge->users_list, participant, list) {
        /* find channel and set as video src. */
        ao2_lock(bridge);
        AST_LIST_TRAVERSE(&bridge->users_list, participant, list) {
-               if (!strncmp(channel, participant->chan->name, strlen(channel))) {
+               if (!strncmp(channel, ast_channel_name(participant->chan), strlen(channel))) {
                        ast_bridge_set_single_src_video_mode(bridge->bridge, participant->chan);
                        break;
                }
                        ast_bridge_set_single_src_video_mode(bridge->bridge, participant->chan);
                        break;
                }
index bb0120c..5384c68 100644 (file)
@@ -117,13 +117,13 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
 
        /* Set it into U-law mode (write) */
        if (ast_set_write_format_by_id(chan, AST_FORMAT_ULAW) < 0) {
 
        /* Set it into U-law mode (write) */
        if (ast_set_write_format_by_id(chan, AST_FORMAT_ULAW) < 0) {
-               ast_log(LOG_WARNING, "Unable to set '%s' to write ulaw mode\n", chan->name);
+               ast_log(LOG_WARNING, "Unable to set '%s' to write ulaw mode\n", ast_channel_name(chan));
                goto outrun;
        }
 
        /* Set it into U-law mode (read) */
        if (ast_set_read_format_by_id(chan, AST_FORMAT_ULAW) < 0) {
                goto outrun;
        }
 
        /* Set it into U-law mode (read) */
        if (ast_set_read_format_by_id(chan, AST_FORMAT_ULAW) < 0) {
-               ast_log(LOG_WARNING, "Unable to set '%s' to read ulaw mode\n", chan->name);
+               ast_log(LOG_WARNING, "Unable to set '%s' to read ulaw mode\n", ast_channel_name(chan));
                goto outrun;
        }
        ast_indicate(chan, -1);
                goto outrun;
        }
        ast_indicate(chan, -1);
@@ -192,7 +192,7 @@ dahdiretry:
                close(fd);
                goto outrun;
        }
                close(fd);
                goto outrun;
        }
-       ast_debug(1, "Placed channel %s in DAHDI channel %d monitor\n", chan->name, confno);
+       ast_debug(1, "Placed channel %s in DAHDI channel %d monitor\n", ast_channel_name(chan), confno);
 
        for(;;) {
                outfd = -1;
 
        for(;;) {
                outfd = -1;
index fbaf984..dcf0caf 100644 (file)
@@ -141,7 +141,7 @@ static void run_ras(struct ast_channel *chan, char *args)
        
        res = ioctl(chan->fds[0], DAHDI_GET_BUFINFO, &savebi);
        if(res) {
        
        res = ioctl(chan->fds[0], DAHDI_GET_BUFINFO, &savebi);
        if(res) {
-               ast_log(LOG_WARNING, "Unable to check buffer policy on channel %s\n", chan->name);
+               ast_log(LOG_WARNING, "Unable to check buffer policy on channel %s\n", ast_channel_name(chan));
                return;
        }
 
                return;
        }
 
@@ -154,7 +154,7 @@ static void run_ras(struct ast_channel *chan, char *args)
                        if (!res) {
                                /* Check for hangup */
                                if (ast_check_hangup(chan) && !signalled) {
                        if (!res) {
                                /* Check for hangup */
                                if (ast_check_hangup(chan) && !signalled) {
-                                       ast_debug(1, "Channel '%s' hungup.  Signalling RAS at %d to die...\n", chan->name, pid);
+                                       ast_debug(1, "Channel '%s' hungup.  Signalling RAS at %d to die...\n", ast_channel_name(chan), pid);
                                        kill(pid, SIGTERM);
                                        signalled=1;
                                }
                                        kill(pid, SIGTERM);
                                        signalled=1;
                                }
@@ -166,12 +166,12 @@ static void run_ras(struct ast_channel *chan, char *args)
                                ast_log(LOG_WARNING, "wait4 returned %d: %s\n", res, strerror(errno));
                        }
                        if (WIFEXITED(status)) {
                                ast_log(LOG_WARNING, "wait4 returned %d: %s\n", res, strerror(errno));
                        }
                        if (WIFEXITED(status)) {
-                               ast_verb(3, "RAS on %s terminated with status %d\n", chan->name, WEXITSTATUS(status));
+                               ast_verb(3, "RAS on %s terminated with status %d\n", ast_channel_name(chan), WEXITSTATUS(status));
                        } else if (WIFSIGNALED(status)) {
                                ast_verb(3, "RAS on %s terminated with signal %d\n", 
                        } else if (WIFSIGNALED(status)) {
                                ast_verb(3, "RAS on %s terminated with signal %d\n", 
-                                        chan->name, WTERMSIG(status));
+                                        ast_channel_name(chan), WTERMSIG(status));
                        } else {
                        } else {
-                               ast_verb(3, "RAS on %s terminated weirdly.\n", chan->name);
+                               ast_verb(3, "RAS on %s terminated weirdly.\n", ast_channel_name(chan));
                        }
                        /* Throw back into audio mode */
                        x = 1;
                        }
                        /* Throw back into audio mode */
                        x = 1;
@@ -180,7 +180,7 @@ static void run_ras(struct ast_channel *chan, char *args)
                        /* Restore saved values */
                        res = ioctl(chan->fds[0], DAHDI_SET_BUFINFO, &savebi);
                        if (res < 0) {
                        /* Restore saved values */
                        res = ioctl(chan->fds[0], DAHDI_SET_BUFINFO, &savebi);
                        if (res < 0) {
-                               ast_log(LOG_WARNING, "Unable to set buffer policy on channel %s\n", chan->name);
+                               ast_log(LOG_WARNING, "Unable to set buffer policy on channel %s\n", ast_channel_name(chan));
                        }
                        break;
                }
                        }
                        break;
                }
@@ -205,17 +205,17 @@ static int dahdiras_exec(struct ast_channel *chan, const char *data)
        if (strcasecmp(chan->tech->type, "DAHDI")) {
                /* If it's not a DAHDI channel, we're done.  Wait a couple of
                   seconds and then hangup... */
        if (strcasecmp(chan->tech->type, "DAHDI")) {
                /* If it's not a DAHDI channel, we're done.  Wait a couple of
                   seconds and then hangup... */
-               ast_verb(2, "Channel %s is not a DAHDI channel\n", chan->name);
+               ast_verb(2, "Channel %s is not a DAHDI channel\n", ast_channel_name(chan));
                sleep(2);
        } else {
                memset(&dahdip, 0, sizeof(dahdip));
                if (ioctl(chan->fds[0], DAHDI_GET_PARAMS, &dahdip)) {
                        ast_log(LOG_WARNING, "Unable to get DAHDI parameters\n");
                } else if (dahdip.sigtype != DAHDI_SIG_CLEAR) {
                sleep(2);
        } else {
                memset(&dahdip, 0, sizeof(dahdip));
                if (ioctl(chan->fds[0], DAHDI_GET_PARAMS, &dahdip)) {
                        ast_log(LOG_WARNING, "Unable to get DAHDI parameters\n");
                } else if (dahdip.sigtype != DAHDI_SIG_CLEAR) {
-                       ast_verb(2, "Channel %s is not a clear channel\n", chan->name);
+                       ast_verb(2, "Channel %s is not a clear channel\n", ast_channel_name(chan));
                } else {
                        /* Everything should be okay.  Run PPP. */
                } else {
                        /* Everything should be okay.  Run PPP. */
-                       ast_verb(3, "Starting RAS on %s\n", chan->name);
+                       ast_verb(3, "Starting RAS on %s\n", ast_channel_name(chan));
                        /* Execute RAS */
                        run_ras(chan, args);
                }
                        /* Execute RAS */
                        run_ras(chan, args);
                }
index 24bff27..2c7f50a 100644 (file)
@@ -801,7 +801,7 @@ static void senddialevent(struct ast_channel *src, struct ast_channel *dst, cons
                "UniqueID: %s\r\n"
                "DestUniqueID: %s\r\n"
                "Dialstring: %s\r\n",
                "UniqueID: %s\r\n"
                "DestUniqueID: %s\r\n"
                "Dialstring: %s\r\n",
-               src->name, dst->name,
+               ast_channel_name(src), ast_channel_name(dst),
                S_COR(src->caller.id.number.valid, src->caller.id.number.str, "<unknown>"),
                S_COR(src->caller.id.name.valid, src->caller.id.name.str, "<unknown>"),
                S_COR(src->connected.id.number.valid, src->connected.id.number.str, "<unknown>"),
                S_COR(src->caller.id.number.valid, src->caller.id.number.str, "<unknown>"),
                S_COR(src->caller.id.name.valid, src->caller.id.name.str, "<unknown>"),
                S_COR(src->connected.id.number.valid, src->connected.id.number.str, "<unknown>"),
@@ -817,7 +817,7 @@ static void senddialendevent(struct ast_channel *src, const char *dialstatus)
                "Channel: %s\r\n"
                "UniqueID: %s\r\n"
                "DialStatus: %s\r\n",
                "Channel: %s\r\n"
                "UniqueID: %s\r\n"
                "DialStatus: %s\r\n",
-               src->name, src->uniqueid, dialstatus);
+               ast_channel_name(src), src->uniqueid, dialstatus);
 }
 
 /*!
 }
 
 /*!
@@ -861,10 +861,10 @@ static void do_forward(struct chanlist *o,
        ast_cel_report_event(in, AST_CEL_FORWARD, NULL, c->call_forward, NULL);
 
        /* Before processing channel, go ahead and check for forwarding */
        ast_cel_report_event(in, AST_CEL_FORWARD, NULL, c->call_forward, NULL);
 
        /* Before processing channel, go ahead and check for forwarding */
-       ast_verb(3, "Now forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, c->name);
+       ast_verb(3, "Now forwarding %s to '%s/%s' (thanks to %s)\n", ast_channel_name(in), tech, stuff, ast_channel_name(c));
        /* If we have been told to ignore forwards, just set this channel to null and continue processing extensions normally */
        if (ast_test_flag64(peerflags, OPT_IGNORE_FORWARDING)) {
        /* If we have been told to ignore forwards, just set this channel to null and continue processing extensions normally */
        if (ast_test_flag64(peerflags, OPT_IGNORE_FORWARDING)) {
-               ast_verb(3, "Forwarding %s to '%s/%s' prevented.\n", in->name, tech, stuff);
+               ast_verb(3, "Forwarding %s to '%s/%s' prevented.\n", ast_channel_name(in), tech, stuff);
                c = o->chan = NULL;
                cause = AST_CAUSE_BUSY;
        } else {
                c = o->chan = NULL;
                cause = AST_CAUSE_BUSY;
        } else {
@@ -880,7 +880,7 @@ static void do_forward(struct chanlist *o,
                         * any Dial operations that happen later won't record CC interfaces.
                         */
                        ast_ignore_cc(o->chan);
                         * any Dial operations that happen later won't record CC interfaces.
                         */
                        ast_ignore_cc(o->chan);
-                       ast_log(LOG_NOTICE, "Not accepting call completion offers from call-forward recipient %s\n", o->chan->name);
+                       ast_log(LOG_NOTICE, "Not accepting call completion offers from call-forward recipient %s\n", ast_channel_name(o->chan));
                } else
                        ast_log(LOG_NOTICE,
                                "Forwarding failed to create channel to dial '%s/%s' (cause = %d)\n",
                } else
                        ast_log(LOG_NOTICE,
                                "Forwarding failed to create channel to dial '%s/%s' (cause = %d)\n",
@@ -1102,7 +1102,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                continue;
                        if (ast_test_flag64(o, DIAL_STILLGOING) && c->_state == AST_STATE_UP) {
                                if (!peer) {
                                continue;
                        if (ast_test_flag64(o, DIAL_STILLGOING) && c->_state == AST_STATE_UP) {
                                if (!peer) {
-                                       ast_verb(3, "%s answered %s\n", c->name, in->name);
+                                       ast_verb(3, "%s answered %s\n", ast_channel_name(c), ast_channel_name(in));
                                        if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
                                                if (o->pending_connected_update) {
                                                        if (ast_channel_connected_line_macro(c, in, &o->connected, 1, 0)) {
                                        if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
                                                if (o->pending_connected_update) {
                                                        if (ast_channel_connected_line_macro(c, in, &o->connected, 1, 0)) {
@@ -1172,7 +1172,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                case AST_CONTROL_ANSWER:
                                        /* This is our guy if someone answered. */
                                        if (!peer) {
                                case AST_CONTROL_ANSWER:
                                        /* This is our guy if someone answered. */
                                        if (!peer) {
-                                               ast_verb(3, "%s answered %s\n", c->name, in->name);
+                                               ast_verb(3, "%s answered %s\n", ast_channel_name(c), ast_channel_name(in));
                                                if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
                                                        if (o->pending_connected_update) {
                                                                if (ast_channel_connected_line_macro(c, in, &o->connected, 1, 0)) {
                                                if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
                                                        if (o->pending_connected_update) {
                                                                if (ast_channel_connected_line_macro(c, in, &o->connected, 1, 0)) {
@@ -1218,7 +1218,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                        c->hangupcause = AST_CAUSE_NORMAL_CLEARING;
                                        break;
                                case AST_CONTROL_BUSY:
                                        c->hangupcause = AST_CAUSE_NORMAL_CLEARING;
                                        break;
                                case AST_CONTROL_BUSY:
-                                       ast_verb(3, "%s is busy\n", c->name);
+                                       ast_verb(3, "%s is busy\n", ast_channel_name(c));
                                        in->hangupcause = c->hangupcause;
                                        ast_hangup(c);
                                        c = o->chan = NULL;
                                        in->hangupcause = c->hangupcause;
                                        ast_hangup(c);
                                        c = o->chan = NULL;
@@ -1226,7 +1226,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                        handle_cause(AST_CAUSE_BUSY, &num);
                                        break;
                                case AST_CONTROL_CONGESTION:
                                        handle_cause(AST_CAUSE_BUSY, &num);
                                        break;
                                case AST_CONTROL_CONGESTION:
-                                       ast_verb(3, "%s is circuit-busy\n", c->name);
+                                       ast_verb(3, "%s is circuit-busy\n", ast_channel_name(c));
                                        in->hangupcause = c->hangupcause;
                                        ast_hangup(c);
                                        c = o->chan = NULL;
                                        in->hangupcause = c->hangupcause;
                                        ast_hangup(c);
                                        c = o->chan = NULL;
@@ -1261,7 +1261,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                         */
                                        ++num_ringing;
                                        if (ignore_cc || cc_frame_received || num_ringing == numlines) {
                                         */
                                        ++num_ringing;
                                        if (ignore_cc || cc_frame_received || num_ringing == numlines) {
-                                               ast_verb(3, "%s is ringing\n", c->name);
+                                               ast_verb(3, "%s is ringing\n", ast_channel_name(c));
                                                /* Setup early media if appropriate */
                                                if (single && CAN_EARLY_BRIDGE(peerflags, in, c))
                                                        ast_channel_early_bridge(in, c);
                                                /* Setup early media if appropriate */
                                                if (single && CAN_EARLY_BRIDGE(peerflags, in, c))
                                                        ast_channel_early_bridge(in, c);
@@ -1272,7 +1272,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                        }
                                        break;
                                case AST_CONTROL_PROGRESS:
                                        }
                                        break;
                                case AST_CONTROL_PROGRESS:
-                                       ast_verb(3, "%s is making progress passing it to %s\n", c->name, in->name);
+                                       ast_verb(3, "%s is making progress passing it to %s\n", ast_channel_name(c), ast_channel_name(in));
                                        /* Setup early media if appropriate */
                                        if (single && CAN_EARLY_BRIDGE(peerflags, in, c))
                                                ast_channel_early_bridge(in, c);
                                        /* Setup early media if appropriate */
                                        if (single && CAN_EARLY_BRIDGE(peerflags, in, c))
                                                ast_channel_early_bridge(in, c);
@@ -1289,19 +1289,19 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                        }
                                        break;
                                case AST_CONTROL_VIDUPDATE:
                                        }
                                        break;
                                case AST_CONTROL_VIDUPDATE:
-                                       ast_verb(3, "%s requested a video update, passing it to %s\n", c->name, in->name);
+                                       ast_verb(3, "%s requested a video update, passing it to %s\n", ast_channel_name(c), ast_channel_name(in));
                                        ast_indicate(in, AST_CONTROL_VIDUPDATE);
                                        break;
                                case AST_CONTROL_SRCUPDATE:
                                        ast_indicate(in, AST_CONTROL_VIDUPDATE);
                                        break;
                                case AST_CONTROL_SRCUPDATE:
-                                       ast_verb(3, "%s requested a source update, passing it to %s\n", c->name, in->name);
+                                       ast_verb(3, "%s requested a source update, passing it to %s\n", ast_channel_name(c), ast_channel_name(in));
                                        ast_indicate(in, AST_CONTROL_SRCUPDATE);
                                        break;
                                case AST_CONTROL_CONNECTED_LINE:
                                        if (ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
                                        ast_indicate(in, AST_CONTROL_SRCUPDATE);
                                        break;
                                case AST_CONTROL_CONNECTED_LINE:
                                        if (ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
-                                               ast_verb(3, "Connected line update to %s prevented.\n", in->name);
+                                               ast_verb(3, "Connected line update to %s prevented.\n", ast_channel_name(in));
                                        } else if (!single) {
                                                struct ast_party_connected_line connected;
                                        } else if (!single) {
                                                struct ast_party_connected_line connected;
-                                               ast_verb(3, "%s connected line has changed. Saving it until answer for %s\n", c->name, in->name);
+                                               ast_verb(3, "%s connected line has changed. Saving it until answer for %s\n", ast_channel_name(c), ast_channel_name(in));
                                                ast_party_connected_line_set_init(&connected, &o->connected);
                                                ast_connected_line_parse_data(f->data.ptr, f->datalen, &connected);
                                                ast_party_connected_line_set(&o->connected, &connected, NULL);
                                                ast_party_connected_line_set_init(&connected, &o->connected);
                                                ast_connected_line_parse_data(f->data.ptr, f->datalen, &connected);
                                                ast_party_connected_line_set(&o->connected, &connected, NULL);
@@ -1326,9 +1326,9 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                        break;
                                case AST_CONTROL_REDIRECTING:
                                        if (ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
                                        break;
                                case AST_CONTROL_REDIRECTING:
                                        if (ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
-                                               ast_verb(3, "Redirecting update to %s prevented.\n", in->name);
+                                               ast_verb(3, "Redirecting update to %s prevented.\n", ast_channel_name(in));
                                        } else if (single) {
                                        } else if (single) {
-                                               ast_verb(3, "%s redirecting info has changed, passing it to %s\n", c->name, in->name);
+                                               ast_verb(3, "%s redirecting info has changed, passing it to %s\n", ast_channel_name(c), ast_channel_name(in));
                                                if (ast_channel_redirecting_macro(c, in, f, 1, 1)) {
                                                        ast_indicate_data(in, AST_CONTROL_REDIRECTING, f->data.ptr, f->datalen);
                                                }
                                                if (ast_channel_redirecting_macro(c, in, f, 1, 1)) {
                                                        ast_indicate_data(in, AST_CONTROL_REDIRECTING, f->data.ptr, f->datalen);
                                                }
@@ -1336,18 +1336,18 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                        }
                                        break;
                                case AST_CONTROL_PROCEEDING:
                                        }
                                        break;
                                case AST_CONTROL_PROCEEDING:
-                                       ast_verb(3, "%s is proceeding passing it to %s\n", c->name, in->name);
+                                       ast_verb(3, "%s is proceeding passing it to %s\n", ast_channel_name(c), ast_channel_name(in));
                                        if (single && CAN_EARLY_BRIDGE(peerflags, in, c))
                                                ast_channel_early_bridge(in, c);
                                        if (!ast_test_flag64(outgoing, OPT_RINGBACK))
                                                ast_indicate(in, AST_CONTROL_PROCEEDING);
                                        break;
                                case AST_CONTROL_HOLD:
                                        if (single && CAN_EARLY_BRIDGE(peerflags, in, c))
                                                ast_channel_early_bridge(in, c);
                                        if (!ast_test_flag64(outgoing, OPT_RINGBACK))
                                                ast_indicate(in, AST_CONTROL_PROCEEDING);
                                        break;
                                case AST_CONTROL_HOLD:
-                                       ast_verb(3, "Call on %s placed on hold\n", c->name);
+                                       ast_verb(3, "Call on %s placed on hold\n", ast_channel_name(c));
                                        ast_indicate(in, AST_CONTROL_HOLD);
                                        break;
                                case AST_CONTROL_UNHOLD:
                                        ast_indicate(in, AST_CONTROL_HOLD);
                                        break;
                                case AST_CONTROL_UNHOLD:
-                                       ast_verb(3, "Call on %s left from hold\n", c->name);
+                                       ast_verb(3, "Call on %s left from hold\n", ast_channel_name(c));
                                        ast_indicate(in, AST_CONTROL_UNHOLD);
                                        break;
                                case AST_CONTROL_OFFHOOK:
                                        ast_indicate(in, AST_CONTROL_UNHOLD);
                                        break;
                                case AST_CONTROL_OFFHOOK:
@@ -1362,7 +1362,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                        break;
                                case -1:
                                        if (!ast_test_flag64(outgoing, OPT_RINGBACK | OPT_MUSICBACK)) {
                                        break;
                                case -1:
                                        if (!ast_test_flag64(outgoing, OPT_RINGBACK | OPT_MUSICBACK)) {
-                                               ast_verb(3, "%s stopped sounds\n", c->name);
+                                               ast_verb(3, "%s stopped sounds\n", ast_channel_name(c));
                                                ast_indicate(in, -1);
                                                pa->sentringing = 0;
                                        }
                                                ast_indicate(in, -1);
                                                pa->sentringing = 0;
                                        }
@@ -1484,7 +1484,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                        case AST_CONTROL_VIDUPDATE:
                                        case AST_CONTROL_SRCUPDATE:
                                                ast_verb(3, "%s requested special control %d, passing it to %s\n",
                                        case AST_CONTROL_VIDUPDATE:
                                        case AST_CONTROL_SRCUPDATE:
                                                ast_verb(3, "%s requested special control %d, passing it to %s\n",
-                                                       in->name, f->subclass.integer, o->chan->name);
+                                                       ast_channel_name(in), f->subclass.integer, ast_channel_name(o->chan));
                                                ast_indicate_data(o->chan, f->subclass.integer, f->data.ptr, f->datalen);
                                                break;
                                        case AST_CONTROL_CONNECTED_LINE:
                                                ast_indicate_data(o->chan, f->subclass.integer, f->data.ptr, f->datalen);
                                                break;
                                        case AST_CONTROL_CONNECTED_LINE:
@@ -1722,7 +1722,7 @@ static int setup_privacy_args(struct privacy_args *pa,
        } else {
                char *tnam, *tn2;
 
        } else {
                char *tnam, *tn2;
 
-               tnam = ast_strdupa(chan->name);
+               tnam = ast_strdupa(ast_channel_name(chan));
                /* clean the channel name so slashes don't try to end up in disk file name */
                for (tn2 = tnam; *tn2; tn2++) {
                        if (*tn2 == '/')  /* any other chars to be afraid of? */
                /* clean the channel name so slashes don't try to end up in disk file name */
                for (tn2 = tnam; *tn2; tn2++) {
                        if (*tn2 == '/')  /* any other chars to be afraid of? */
@@ -2342,7 +2342,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
 
                /* Save the info in cdr's that we called them */
                if (chan->cdr)
 
                /* Save the info in cdr's that we called them */
                if (chan->cdr)
-                       ast_cdr_setdestchan(chan->cdr, tc->name);
+                       ast_cdr_setdestchan(chan->cdr, ast_channel_name(tc));
 
                /* check the results of ast_call */
                if (res) {
 
                /* check the results of ast_call */
                if (res) {
@@ -2460,11 +2460,11 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
                outgoing = NULL;
                /* If appropriate, log that we have a destination channel and set the answer time */
                if (chan->cdr) {
                outgoing = NULL;
                /* If appropriate, log that we have a destination channel and set the answer time */
                if (chan->cdr) {
-                       ast_cdr_setdestchan(chan->cdr, peer->name);
+                       ast_cdr_setdestchan(chan->cdr, ast_channel_name(peer));
                        ast_cdr_setanswer(chan->cdr, peer->cdr->answer);
                }
                        ast_cdr_setanswer(chan->cdr, peer->cdr->answer);
                }
-               if (peer->name)
-                       pbx_builtin_setvar_helper(chan, "DIALEDPEERNAME", peer->name);
+               if (ast_channel_name(peer))
+                       pbx_builtin_setvar_helper(chan, "DIALEDPEERNAME", ast_channel_name(peer));
                
                ast_channel_lock(peer);
                number = pbx_builtin_getvar_helper(peer, "DIALEDPEERNUMBER"); 
                
                ast_channel_lock(peer);
                number = pbx_builtin_getvar_helper(peer, "DIALEDPEERNUMBER"); 
@@ -2813,7 +2813,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
                        /* Make sure channels are compatible */
                        res = ast_channel_make_compatible(chan, peer);
                        if (res < 0) {
                        /* Make sure channels are compatible */
                        res = ast_channel_make_compatible(chan, peer);
                        if (res < 0) {
-                               ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", chan->name, peer->name);
+                               ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", ast_channel_name(chan), ast_channel_name(peer));
                                ast_hangup(peer);
                                res = -1;
                                goto done;
                                ast_hangup(peer);
                                res = -1;
                                goto done;
@@ -2852,8 +2852,8 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
 
                        if (found && res9) {
                                /* Something bad happened, or a hangup has been requested. */
 
                        if (found && res9) {
                                /* Something bad happened, or a hangup has been requested. */
-                               ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", peer->context, peer->exten, peer->priority, peer->name);
-                               ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", peer->context, peer->exten, peer->priority, peer->name);
+                               ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", peer->context, peer->exten, peer->priority, ast_channel_name(peer));
+                               ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", peer->context, peer->exten, peer->priority, ast_channel_name(peer));
                        }
                        ast_set2_flag(peer, autoloopflag, AST_FLAG_IN_AUTOLOOP);  /* set it back the way it was */
                }
                        }
                        ast_set2_flag(peer, autoloopflag, AST_FLAG_IN_AUTOLOOP);  /* set it back the way it was */
                }
index b01ec4c..4fda832 100644 (file)
@@ -113,7 +113,7 @@ static int pickup_by_name_cb(void *obj, void *arg, void *data, int flags)
        struct pickup_by_name_args *args = data;
 
        ast_channel_lock(target);
        struct pickup_by_name_args *args = data;
 
        ast_channel_lock(target);
-       if (!strncasecmp(target->name, args->name, args->len) && ast_can_pickup(target)) {
+       if (!strncasecmp(ast_channel_name(target), args->name, args->len) && ast_can_pickup(target)) {
                /* Return with the channel still locked on purpose */
                return CMP_MATCH | CMP_STOP;
        }
                /* Return with the channel still locked on purpose */
                return CMP_MATCH | CMP_STOP;
        }
@@ -183,7 +183,7 @@ static int pickup_by_exten(struct ast_channel *chan, const char *exten, const ch
        while ((target = ast_channel_iterator_next(iter))) {
                ast_channel_lock(target);
                if ((chan != target) && ast_can_pickup(target)) {
        while ((target = ast_channel_iterator_next(iter))) {
                ast_channel_lock(target);
                if ((chan != target) && ast_can_pickup(target)) {
-                       ast_log(LOG_NOTICE, "%s pickup by %s\n", target->name, chan->name);
+                       ast_log(LOG_NOTICE, "%s pickup by %s\n", ast_channel_name(target), ast_channel_name(chan));
                        break;
                }
                ast_channel_unlock(target);
                        break;
                }
                ast_channel_unlock(target);
@@ -259,7 +259,7 @@ static int pickup_by_group(struct ast_channel *chan)
        /* The found channel is already locked. */
        target = ast_channel_callback(find_channel_by_group, NULL, chan, 0);
        if (target) {
        /* The found channel is already locked. */
        target = ast_channel_callback(find_channel_by_group, NULL, chan, 0);
        if (target) {
-               ast_log(LOG_NOTICE, "pickup %s attempt by %s\n", target->name, chan->name);
+               ast_log(LOG_NOTICE, "pickup %s attempt by %s\n", ast_channel_name(target), ast_channel_name(chan));
                res = ast_do_pickup(chan, target);
                ast_channel_unlock(target);
                target = ast_channel_unref(target);
                res = ast_do_pickup(chan, target);
                ast_channel_unlock(target);
                target = ast_channel_unref(target);
@@ -308,7 +308,7 @@ static int find_by_part(void *obj, void *arg, void *data, int flags)
        int len = strlen(part);
 
        ast_channel_lock(target);
        int len = strlen(part);
 
        ast_channel_lock(target);
-       if (len <= strlen(target->name) && !strncmp(target->name, part, len)
+       if (len <= strlen(ast_channel_name(target)) && !strncmp(ast_channel_name(target), part, len)
                && ast_can_pickup(target)) {
                /* Return with the channel still locked on purpose */
                return CMP_MATCH | CMP_STOP;
                && ast_can_pickup(target)) {
                /* Return with the channel still locked on purpose */
                return CMP_MATCH | CMP_STOP;
@@ -359,7 +359,7 @@ static int pickupchan_exec(struct ast_channel *chan, const char *data)
 
        /* Parse channel */
        while (!ast_strlen_zero(args.channel) && (pickup = strsep(&args.channel, "&"))) {
 
        /* Parse channel */
        while (!ast_strlen_zero(args.channel) && (pickup = strsep(&args.channel, "&"))) {
-               if (!strncasecmp(chan->name, pickup, strlen(pickup))) {
+               if (!strncasecmp(ast_channel_name(chan), pickup, strlen(pickup))) {
                        ast_log(LOG_NOTICE, "Cannot pickup your own channel %s.\n", pickup);
                } else {
                        if (partial_pickup) {
                        ast_log(LOG_NOTICE, "Cannot pickup your own channel %s.\n", pickup);
                } else {
                        if (partial_pickup) {
index 3ca0800..ce175bc 100644 (file)
@@ -210,7 +210,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
                  /* if outa time, give em reorder */
                if (ast_tvdiff_ms(ast_tvnow(), lastdigittime) > ((k&2) ? digittimeout : firstdigittimeout)) {
                        ast_debug(1,"DISA %s entry timeout on chan %s\n",
                  /* if outa time, give em reorder */
                if (ast_tvdiff_ms(ast_tvnow(), lastdigittime) > ((k&2) ? digittimeout : firstdigittimeout)) {
                        ast_debug(1,"DISA %s entry timeout on chan %s\n",
-                               ((k&1) ? "extension" : "password"),chan->name);
+                               ((k&1) ? "extension" : "password"),ast_channel_name(chan));
                        break;
                }
 
                        break;
                }
 
@@ -256,7 +256,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
                                        if (sscanf(args.passcode,"%30d",&j) < 1) { /* nope, it must be a filename */
                                                fp = fopen(args.passcode,"r");
                                                if (!fp) {
                                        if (sscanf(args.passcode,"%30d",&j) < 1) { /* nope, it must be a filename */
                                                fp = fopen(args.passcode,"r");
                                                if (!fp) {
-                                                       ast_log(LOG_WARNING,"DISA password file %s not found on chan %s\n",args.passcode,chan->name);
+                                                       ast_log(LOG_WARNING,"DISA password file %s not found on chan %s\n",args.passcode,ast_channel_name(chan));
                                                        ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
                                                        return -1;
                                                }
                                                        ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
                                                        return -1;
                                                }
@@ -294,12 +294,12 @@ static int disa_exec(struct ast_channel *chan, const char *data)
                                        }
                                        /* compare the two */
                                        if (strcmp(exten,args.passcode)) {
                                        }
                                        /* compare the two */
                                        if (strcmp(exten,args.passcode)) {
-                                               ast_log(LOG_WARNING,"DISA on chan %s got bad password %s\n",chan->name,exten);
+                                               ast_log(LOG_WARNING,"DISA on chan %s got bad password %s\n",ast_channel_name(chan),exten);
                                                goto reorder;
 
                                        }
                                         /* password good, set to dial state */
                                                goto reorder;
 
                                        }
                                         /* password good, set to dial state */
-                                       ast_debug(1,"DISA on chan %s password is good\n",chan->name);
+                                       ast_debug(1,"DISA on chan %s password is good\n",ast_channel_name(chan));
                                        play_dialtone(chan, args.mailbox);
 
                                        k|=1; /* In number mode */
                                        play_dialtone(chan, args.mailbox);
 
                                        k|=1; /* In number mode */
@@ -307,7 +307,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
                                        exten[sizeof(acctcode)] = 0;
                                        ast_copy_string(acctcode, exten, sizeof(acctcode));
                                        exten[0] = 0;
                                        exten[sizeof(acctcode)] = 0;
                                        ast_copy_string(acctcode, exten, sizeof(acctcode));
                                        exten[0] = 0;
-                                       ast_debug(1,"Successful DISA log-in on chan %s\n", chan->name);
+                                       ast_debug(1,"Successful DISA log-in on chan %s\n", ast_channel_name(chan));
                                        continue;
                                }
                        } else {
                                        continue;
                                }
                        } else {
index 0a9fa68..9b0096f 100644 (file)
@@ -127,7 +127,7 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size)
                "Application=        %s\n"
                "Data=               %s\n"
                "Blocking_in=        %s\n",
                "Application=        %s\n"
                "Data=               %s\n"
                "Blocking_in=        %s\n",
-               c->name,
+               ast_channel_name(c),
                c->tech->type,
                c->uniqueid,
                c->linkedid,
                c->tech->type,
                c->uniqueid,
                c->linkedid,
@@ -158,8 +158,8 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size)
                hour,
                min,
                sec,
                hour,
                min,
                sec,
-               c->_bridge ? c->_bridge->name : "<none>",
-               ast_bridged_channel(c) ? ast_bridged_channel(c)->name : "<none>", 
+               c->_bridge ? ast_channel_name(c->_bridge) : "<none>",
+               ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>", 
                c->context,
                c->exten,
                c->priority,
                c->context,
                c->exten,
                c->priority,
@@ -191,7 +191,7 @@ static int dumpchan_exec(struct ast_channel *chan, const char *data)
                        "Info:\n"
                        "%s\n"
                        "Variables:\n"
                        "Info:\n"
                        "%s\n"
                        "Variables:\n"
-                       "%s%s\n", chan->name, line, info, ast_str_buffer(vars), line);
+                       "%s%s\n", ast_channel_name(chan), line, info, ast_str_buffer(vars), line);
        }
 
        return 0;
        }
 
        return 0;
index 4eb99c1..d8ff60a 100644 (file)
@@ -97,7 +97,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 static const char app[] = "ExternalIVR";
 
 /* XXX the parser in gcc 2.95 gets confused if you don't put a space between 'name' and the comma */
 static const char app[] = "ExternalIVR";
 
 /* XXX the parser in gcc 2.95 gets confused if you don't put a space between 'name' and the comma */
-#define ast_chan_log(level, channel, format, ...) ast_log(level, "%s: " format, channel->name , ## __VA_ARGS__)
+#define ast_chan_log(level, channel, format, ...) ast_log(level, "%s: " format, ast_channel_name(channel) , ## __VA_ARGS__)
 
 /* Commands */
 #define EIVR_CMD_APND 'A' /* append to prompt queue */
 
 /* Commands */
 #define EIVR_CMD_APND 'A' /* append to prompt queue */
index 5285ba8..e4cf44f 100644 (file)
@@ -265,7 +265,7 @@ static void phase_e_handler(t30_state_t *f, void *user_data, int result)
                "Resolution: %d\r\n"
                "TransferRate: %d\r\n"
                "FileName: %s\r\n",
                "Resolution: %d\r\n"
                "TransferRate: %d\r\n"
                "FileName: %s\r\n",
-               s->chan->name,
+               ast_channel_name(s->chan),
                s->chan->exten,
                S_COR(s->chan->caller.id.number.valid, s->chan->caller.id.number.str, ""),
                S_COR(s->chan->caller.id.name.valid, s->chan->caller.id.name.str, ""),
                s->chan->exten,
                S_COR(s->chan->caller.id.number.valid, s->chan->caller.id.number.str, ""),
                S_COR(s->chan->caller.id.name.valid, s->chan->caller.id.name.str, ""),
@@ -350,7 +350,7 @@ static int fax_generator_generate(struct ast_channel *chan, void *data, int len,
                AST_FRAME_SET_BUFFER(&outf, buffer, AST_FRIENDLY_OFFSET, len * sizeof(int16_t));
 
                if (ast_write(chan, &outf) < 0) {
                AST_FRAME_SET_BUFFER(&outf, buffer, AST_FRIENDLY_OFFSET, len * sizeof(int16_t));
 
                if (ast_write(chan, &outf) < 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;
                }
        }
                        return -1;
                }
        }
@@ -408,11 +408,11 @@ static int transmit_audio(fax_session *s)
                        unsigned int timeout = 5000;
                        int ms;
 
                        unsigned int timeout = 5000;
                        int ms;
 
-                       ast_debug(1, "Negotiating T.38 for receive on %s\n", s->chan->name);
+                       ast_debug(1, "Negotiating T.38 for receive on %s\n", ast_channel_name(s->chan));
                        while (timeout > 0) {
                                ms = ast_waitfor(s->chan, 1000);
                                if (ms < 0) {
                        while (timeout > 0) {
                                ms = ast_waitfor(s->chan, 1000);
                                if (ms < 0) {
-                                       ast_log(LOG_WARNING, "something bad happened while channel '%s' was polling.\n", s->chan->name);
+                                       ast_log(LOG_WARNING, "something bad happened while channel '%s' was polling.\n", ast_channel_name(s->chan));
                                        return -1;
                                }
                                if (!ms) {
                                        return -1;
                                }
                                if (!ms) {
@@ -421,7 +421,7 @@ static int transmit_audio(fax_session *s)
                                                timeout -= 1000;
                                                continue;
                                        } else {
                                                timeout -= 1000;
                                                continue;
                                        } else {
-                                               ast_log(LOG_WARNING, "channel '%s' timed-out during the T.38 negotiation.\n", s->chan->name);
+                                               ast_log(LOG_WARNING, "channel '%s' timed-out during the T.38 negotiation.\n", ast_channel_name(s->chan));
                                                break;
                                        }
                                }
                                                break;
                                        }
                                }
@@ -435,14 +435,14 @@ static int transmit_audio(fax_session *s)
 
                                        switch (parameters->request_response) {
                                        case AST_T38_NEGOTIATED:
 
                                        switch (parameters->request_response) {
                                        case AST_T38_NEGOTIATED:
-                                               ast_debug(1, "Negotiated T.38 for receive on %s\n", s->chan->name);
+                                               ast_debug(1, "Negotiated T.38 for receive on %s\n", ast_channel_name(s->chan));
                                                res = 1;
                                                break;
                                        case AST_T38_REFUSED:
                                                res = 1;
                                                break;
                                        case AST_T38_REFUSED:
-                                               ast_log(LOG_WARNING, "channel '%s' refused to negotiate T.38\n", s->chan->name);
+                                               ast_log(LOG_WARNING, "channel '%s' refused to negotiate T.38\n", ast_channel_name(s->chan));
                                                break;
                                        default:
                                                break;
                                        default:
-                                               ast_log(LOG_ERROR, "channel '%s' failed to negotiate T.38\n", s->chan->name);
+                                               ast_log(LOG_ERROR, "channel '%s' failed to negotiate T.38\n", ast_channel_name(s->chan));
                                                break;
                                        }
                                        ast_frfree(inf);
                                                break;
                                        }
                                        ast_frfree(inf);
@@ -594,12 +594,12 @@ static int transmit_audio(fax_session *s)
 done:
        if (original_write_fmt.id != AST_FORMAT_SLINEAR) {
                if (ast_set_write_format(s->chan, &original_write_fmt) < 0)
 done:
        if (original_write_fmt.id != AST_FORMAT_SLINEAR) {
                if (ast_set_write_format(s->chan, &original_write_fmt) < 0)
-                       ast_log(LOG_WARNING, "Unable to restore write format on '%s'\n", s->chan->name);
+                       ast_log(LOG_WARNING, "Unable to restore write format on '%s'\n", ast_channel_name(s->chan));
        }
 
        if (original_read_fmt.id != AST_FORMAT_SLINEAR) {
                if (ast_set_read_format(s->chan, &original_read_fmt) < 0)
        }
 
        if (original_read_fmt.id != AST_FORMAT_SLINEAR) {
                if (ast_set_read_format(s->chan, &original_read_fmt) < 0)
-                       ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", s->chan->name);
+                       ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", ast_channel_name(s->chan));
        }
 
        return res;
        }
 
        return res;
@@ -735,11 +735,11 @@ disable_t38:
                        unsigned int timeout = 5000;
                        int ms;
 
                        unsigned int timeout = 5000;
                        int ms;
 
-                       ast_debug(1, "Shutting down T.38 on %s\n", s->chan->name);
+                       ast_debug(1, "Shutting down T.38 on %s\n", ast_channel_name(s->chan));
                        while (timeout > 0) {
                                ms = ast_waitfor(s->chan, 1000);
                                if (ms < 0) {
                        while (timeout > 0) {
                                ms = ast_waitfor(s->chan, 1000);
                                if (ms < 0) {
-                                       ast_log(LOG_WARNING, "something bad happened while channel '%s' was polling.\n", s->chan->name);
+                                       ast_log(LOG_WARNING, "something bad happened while channel '%s' was polling.\n", ast_channel_name(s->chan));
                                        return -1;
                                }
                                if (!ms) {
                                        return -1;
                                }
                                if (!ms) {
@@ -748,7 +748,7 @@ disable_t38:
                                                timeout -= 1000;
                                                continue;
                                        } else {
                                                timeout -= 1000;
                                                continue;
                                        } else {
-                                               ast_log(LOG_WARNING, "channel '%s' timed-out during the T.38 shutdown.\n", s->chan->name);
+                                               ast_log(LOG_WARNING, "channel '%s' timed-out during the T.38 shutdown.\n", ast_channel_name(s->chan));
                                                break;
                                        }
                                }
                                                break;
                                        }
                                }
@@ -762,13 +762,13 @@ disable_t38:
 
                                        switch (parameters->request_response) {
                                        case AST_T38_TERMINATED:
 
                                        switch (parameters->request_response) {
                                        case AST_T38_TERMINATED:
-                                               ast_debug(1, "Shut down T.38 on %s\n", s->chan->name);
+                                               ast_debug(1, "Shut down T.38 on %s\n", ast_channel_name(s->chan));
                                                break;
                                        case AST_T38_REFUSED:
                                                break;
                                        case AST_T38_REFUSED:
-                                               ast_log(LOG_WARNING, "channel '%s' refused to disable T.38\n", s->chan->name);
+                                               ast_log(LOG_WARNING, "channel '%s' refused to disable T.38\n", ast_channel_name(s->chan));
                                                break;
                                        default:
                                                break;
                                        default:
-                                               ast_log(LOG_ERROR, "channel '%s' failed to disable T.38\n", s->chan->name);
+                                               ast_log(LOG_ERROR, "channel '%s' failed to disable T.38\n", ast_channel_name(s->chan));
                                                break;
                                        }
                                        ast_frfree(inf);
                                                break;
                                        }
                                        ast_frfree(inf);
@@ -802,7 +802,7 @@ static int transmit(fax_session *s)
                 * Theoretically asterisk should already have answered before running the app */
                res = ast_answer(s->chan);
                if (res) {
                 * Theoretically asterisk should already have answered before running the app */
                res = ast_answer(s->chan);
                if (res) {
-                       ast_log(LOG_WARNING, "Could not answer channel '%s'\n", s->chan->name);
+                       ast_log(LOG_WARNING, "Could not answer channel '%s'\n", ast_channel_name(s->chan));
                        return res;
                }
        }
                        return res;
                }
        }
index 3273b5b..283953b 100644 (file)
@@ -80,7 +80,7 @@ static int flash_exec(struct ast_channel *chan, const char *data)
        struct dahdi_params dahdip;
 
        if (strcasecmp(chan->tech->type, "DAHDI")) {
        struct dahdi_params dahdip;
 
        if (strcasecmp(chan->tech->type, "DAHDI")) {
-               ast_log(LOG_WARNING, "%s is not a DAHDI channel\n", chan->name);
+               ast_log(LOG_WARNING, "%s is not a DAHDI channel\n", ast_channel_name(chan));
                return -1;
        }
        
                return -1;
        }
        
@@ -96,13 +96,13 @@ static int flash_exec(struct ast_channel *chan, const char *data)
                                        dahdi_wait_event(chan->fds[0]);
                                }
                                res = ast_safe_sleep(chan, 1000);
                                        dahdi_wait_event(chan->fds[0]);
                                }
                                res = ast_safe_sleep(chan, 1000);
-                               ast_verb(3, "Flashed channel %s\n", chan->name);
+                               ast_verb(3, "Flashed channel %s\n", ast_channel_name(chan));
                        } else
                        } else
-                               ast_log(LOG_WARNING, "Unable to flash channel %s: %s\n", chan->name, strerror(errno));
+                               ast_log(LOG_WARNING, "Unable to flash channel %s: %s\n", ast_channel_name(chan), strerror(errno));
                } else
                } else
-                       ast_log(LOG_WARNING, "%s is not an FXO Channel\n", chan->name);
+                       ast_log(LOG_WARNING, "%s is not an FXO Channel\n", ast_channel_name(chan));
        } else
        } else
-               ast_log(LOG_WARNING, "Unable to get parameters of %s: %s\n", chan->name, strerror(errno));
+               ast_log(LOG_WARNING, "Unable to get parameters of %s: %s\n", ast_channel_name(chan), strerror(errno));
 
        return res;
 }
 
        return res;
 }
index 6d46a1f..d3e8f47 100644 (file)
@@ -681,7 +681,7 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
                                if (f->frametype == AST_FRAME_CONTROL) {
                                        switch (f->subclass.integer) {
                                        case AST_CONTROL_HANGUP:
                                if (f->frametype == AST_FRAME_CONTROL) {
                                        switch (f->subclass.integer) {
                                        case AST_CONTROL_HANGUP:
-                                               ast_verb(3, "%s received a hangup frame.\n", winner->name);
+                                               ast_verb(3, "%s received a hangup frame.\n", ast_channel_name(winner));
                                                if (f->data.uint32) {
                                                        winner->hangupcause = f->data.uint32;
                                                }
                                                if (f->data.uint32) {
                                                        winner->hangupcause = f->data.uint32;
                                                }
@@ -692,7 +692,7 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
                                                }
                                                break;
                                        case AST_CONTROL_ANSWER:
                                                }
                                                break;
                                        case AST_CONTROL_ANSWER:
-                                               ast_verb(3, "%s answered %s\n", winner->name, caller->name);
+                                               ast_verb(3, "%s answered %s\n", ast_channel_name(winner), ast_channel_name(caller));
                                                /* If call has been answered, then the eventual hangup is likely to be normal hangup */ 
                                                winner->hangupcause = AST_CAUSE_NORMAL_CLEARING;
                                                caller->hangupcause = AST_CAUSE_NORMAL_CLEARING;
                                                /* If call has been answered, then the eventual hangup is likely to be normal hangup */ 
                                                winner->hangupcause = AST_CAUSE_NORMAL_CLEARING;
                                                caller->hangupcause = AST_CAUSE_NORMAL_CLEARING;
@@ -720,38 +720,38 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
                                                }
                                                break;
                                        case AST_CONTROL_BUSY:
                                                }
                                                break;
                                        case AST_CONTROL_BUSY:
-                                               ast_verb(3, "%s is busy\n", winner->name);
+                                               ast_verb(3, "%s is busy\n", ast_channel_name(winner));
                                                break;
                                        case AST_CONTROL_CONGESTION:
                                                break;
                                        case AST_CONTROL_CONGESTION:
-                                               ast_verb(3, "%s is circuit-busy\n", winner->name);
+                                               ast_verb(3, "%s is circuit-busy\n", ast_channel_name(winner));
                                                break;
                                        case AST_CONTROL_RINGING:
                                                break;
                                        case AST_CONTROL_RINGING:
-                                               ast_verb(3, "%s is ringing\n", winner->name);
+                                               ast_verb(3, "%s is ringing\n", ast_channel_name(winner));
                                                break;
                                        case AST_CONTROL_PROGRESS:
                                                break;
                                        case AST_CONTROL_PROGRESS:
-                                               ast_verb(3, "%s is making progress passing it to %s\n", winner->name, caller->name);
+                                               ast_verb(3, "%s is making progress passing it to %s\n", ast_channel_name(winner), ast_channel_name(caller));
                                                break;
                                        case AST_CONTROL_VIDUPDATE:
                                                break;
                                        case AST_CONTROL_VIDUPDATE:
-                                               ast_verb(3, "%s requested a video update, passing it to %s\n", winner->name, caller->name);
+                                               ast_verb(3, "%s requested a video update, passing it to %s\n", ast_channel_name(winner), ast_channel_name(caller));
                                                break;
                                        case AST_CONTROL_SRCUPDATE:
                                                break;
                                        case AST_CONTROL_SRCUPDATE:
-                                               ast_verb(3, "%s requested a source update, passing it to %s\n", winner->name, caller->name);
+                                               ast_verb(3, "%s requested a source update, passing it to %s\n", ast_channel_name(winner), ast_channel_name(caller));
                                                break;
                                        case AST_CONTROL_PROCEEDING:
                                                break;
                                        case AST_CONTROL_PROCEEDING:
-                                               ast_verb(3, "%s is proceeding passing it to %s\n", winner->name,caller->name);
+                                               ast_verb(3, "%s is proceeding passing it to %s\n", ast_channel_name(winner),ast_channel_name(caller));
                                                break;
                                        case AST_CONTROL_HOLD:
                                                break;
                                        case AST_CONTROL_HOLD:
-                                               ast_verb(3, "Call on %s placed on hold\n", winner->name);
+                                               ast_verb(3, "Call on %s placed on hold\n", ast_channel_name(winner));
                                                break;
                                        case AST_CONTROL_UNHOLD:
                                                break;
                                        case AST_CONTROL_UNHOLD:
-                                               ast_verb(3, "Call on %s left from hold\n", winner->name);
+                                               ast_verb(3, "Call on %s left from hold\n", ast_channel_name(winner));
                                                break;
                                        case AST_CONTROL_OFFHOOK:
                                        case AST_CONTROL_FLASH:
                                                /* Ignore going off hook and flash */
                                                break;
                                        case -1:
                                                break;
                                        case AST_CONTROL_OFFHOOK:
                                        case AST_CONTROL_FLASH:
                                                /* Ignore going off hook and flash */
                                                break;
                                        case -1:
-                                               ast_verb(3, "%s stopped sounds\n", winner->name);
+                                               ast_verb(3, "%s stopped sounds\n", ast_channel_name(winner));
                                                break;
                                        default:
                                                ast_debug(1, "Dunno what to do with control type %d\n", f->subclass.integer);
                                                break;
                                        default:
                                                ast_debug(1, "Dunno what to do with control type %d\n", f->subclass.integer);
@@ -1206,7 +1206,7 @@ static int app_exec(struct ast_channel *chan, const char *data)
                /* Make sure channels are compatible */
                res = ast_channel_make_compatible(caller, outbound);
                if (res < 0) {
                /* Make sure channels are compatible */
                res = ast_channel_make_compatible(caller, outbound);
                if (res < 0) {
-                       ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", caller->name, outbound->name);
+                       ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", ast_channel_name(caller), ast_channel_name(outbound));
                        ast_hangup(outbound);
                        goto outrun;
                }
                        ast_hangup(outbound);
                        goto outrun;
                }
index 7f59976..30b5d78 100644 (file)
@@ -87,7 +87,7 @@ static int cpeid_exec(struct ast_channel *chan, const char *idata)
                res = ast_adsi_get_cpeid(chan, cpeid, 0);
                if (res > 0) {
                        gotcpeid = 1;
                res = ast_adsi_get_cpeid(chan, cpeid, 0);
                if (res > 0) {
                        gotcpeid = 1;
-                       ast_verb(3, "Got CPEID of '%02x:%02x:%02x:%02x' on '%s'\n", cpeid[0], cpeid[1], cpeid[2], cpeid[3], chan->name);
+                       ast_verb(3, "Got CPEID of '%02x:%02x:%02x:%02x' on '%s'\n", cpeid[0], cpeid[1], cpeid[2], cpeid[3], ast_channel_name(chan));
                }
                if (res > -1) {
                        strcpy(data[1], "Measuring CPE...");
                }
                if (res > -1) {
                        strcpy(data[1], "Measuring CPE...");
@@ -95,7 +95,7 @@ static int cpeid_exec(struct ast_channel *chan, const char *idata)
                        cpeid_setstatus(chan, data, 0);
                        res = ast_adsi_get_cpeinfo(chan, &width, &height, &buttons, 0);
                        if (res > -1) {
                        cpeid_setstatus(chan, data, 0);
                        res = ast_adsi_get_cpeinfo(chan, &width, &height, &buttons, 0);
                        if (res > -1) {
-                               ast_verb(3, "CPE has %d lines, %d columns, and %d buttons on '%s'\n", height, width, buttons, chan->name);
+                               ast_verb(3, "CPE has %d lines, %d columns, and %d buttons on '%s'\n", height, width, buttons, ast_channel_name(chan));
                                gotgeometry = 1;
                        }
                }
                                gotgeometry = 1;
                        }
                }
index 893a5de..46024ff 100644 (file)
@@ -396,7 +396,7 @@ static int init_jack_data(struct ast_channel *chan, struct jack_data *jack_data)
                client_name = jack_data->client_name;
        } else {
                ast_channel_lock(chan);
                client_name = jack_data->client_name;
        } else {
                ast_channel_lock(chan);
-               client_name = ast_strdupa(chan->name);
+               client_name = ast_strdupa(ast_channel_name(chan));
                ast_channel_unlock(chan);
        }
 
                ast_channel_unlock(chan);
        }
 
@@ -833,7 +833,7 @@ static int jack_hook_callback(struct ast_audiohook *audiohook, struct ast_channe
        ast_channel_lock(chan);
 
        if (!(datastore = ast_channel_datastore_find(chan, &jack_hook_ds_info, NULL))) {
        ast_channel_lock(chan);
 
        if (!(datastore = ast_channel_datastore_find(chan, &jack_hook_ds_info, NULL))) {
-               ast_log(LOG_ERROR, "JACK_HOOK datastore not found for '%s'\n", chan->name);
+               ast_log(LOG_ERROR, "JACK_HOOK datastore not found for '%s'\n", ast_channel_name(chan));
                ast_channel_unlock(chan);
                return -1;
        }
                ast_channel_unlock(chan);
                return -1;
        }
@@ -863,7 +863,7 @@ static int enable_jack_hook(struct ast_channel *chan, char *data)
        ast_channel_lock(chan);
 
        if ((datastore = ast_channel_datastore_find(chan, &jack_hook_ds_info, NULL))) {
        ast_channel_lock(chan);
 
        if ((datastore = ast_channel_datastore_find(chan, &jack_hook_ds_info, NULL))) {
-               ast_log(LOG_ERROR, "JACK_HOOK already enabled for '%s'\n", chan->name);
+               ast_log(LOG_ERROR, "JACK_HOOK already enabled for '%s'\n", ast_channel_name(chan));
                goto return_error;
        }
 
                goto return_error;
        }
 
index 8a31dc2..86017e6 100644 (file)
@@ -426,8 +426,8 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive
                                res = 0;
                                goto out;
                        default:
                                res = 0;
                                goto out;
                        default:
-                               ast_debug(2, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
-                               ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
+                               ast_debug(2, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, ast_channel_name(chan), macro);
+                               ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, ast_channel_name(chan), macro);
                                goto out;
                        }
                }
                                goto out;
                        }
                }
@@ -494,7 +494,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive
                }
 
                if (gosub_level == 0 && strcasecmp(chan->context, fullmacro)) {
                }
 
                if (gosub_level == 0 && strcasecmp(chan->context, fullmacro)) {
-                       ast_verb(2, "Channel '%s' jumping out of macro '%s'\n", chan->name, macro);
+                       ast_verb(2, "Channel '%s' jumping out of macro '%s'\n", ast_channel_name(chan), macro);
                        break;
                }
 
                        break;
                }
 
index 956f95c..2b3f5c4 100644 (file)
@@ -1511,7 +1511,7 @@ static char *meetme_show_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
                                        user->user_no,
                                        S_COR(user->chan->caller.id.number.valid, user->chan->caller.id.number.str, "<unknown>"),
                                        S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, "<no name>"),
                                        user->user_no,
                                        S_COR(user->chan->caller.id.number.valid, user->chan->caller.id.number.str, "<unknown>"),
                                        S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, "<no name>"),
-                                       user->chan->name,
+                                       ast_channel_name(user->chan),
                                        ast_test_flag64(&user->userflags, CONFFLAG_ADMIN) ? "(Admin)" : "",
                                        ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "(Listen only)" : "",
                                        user->adminflags & ADMINFLAG_MUTED ? "(Admin Muted)" : user->adminflags & ADMINFLAG_SELFMUTED ? "(Muted)" : "",
                                        ast_test_flag64(&user->userflags, CONFFLAG_ADMIN) ? "(Admin)" : "",
                                        ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "(Listen only)" : "",
                                        user->adminflags & ADMINFLAG_MUTED ? "(Admin Muted)" : user->adminflags & ADMINFLAG_SELFMUTED ? "(Muted)" : "",
@@ -1522,7 +1522,7 @@ static char *meetme_show_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
                                        user->user_no,
                                        S_COR(user->chan->caller.id.number.valid, user->chan->caller.id.number.str, ""),
                                        S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, ""),
                                        user->user_no,
                                        S_COR(user->chan->caller.id.number.valid, user->chan->caller.id.number.str, ""),
                                        S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, ""),
-                                       user->chan->name,
+                                       ast_channel_name(user->chan),
                                        ast_test_flag64(&user->userflags, CONFFLAG_ADMIN) ? "1" : "",
                                        ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "1" : "",
                                        user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED) ? "1" : "",
                                        ast_test_flag64(&user->userflags, CONFFLAG_ADMIN) ? "1" : "",
                                        ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "1" : "",
                                        user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED) ? "1" : "",
@@ -1922,7 +1922,7 @@ static void conf_queue_dtmf(const struct ast_conference *conf,
                        continue;
                }
                if (ast_write(user->chan, f) < 0)
                        continue;
                }
                if (ast_write(user->chan, f) < 0)
-                       ast_log(LOG_WARNING, "Error writing frame to channel %s\n", user->chan->name);
+                       ast_log(LOG_WARNING, "Error writing frame to channel %s\n", ast_channel_name(user->chan));
                ao2_ref(user, -1);
        }
        ao2_iterator_destroy(&user_iter);
                ao2_ref(user, -1);
        }
        ao2_iterator_destroy(&user_iter);
@@ -2185,7 +2185,7 @@ static void send_talking_event(struct ast_channel *chan, struct ast_conference *
              "Meetme: %s\r\n"
              "Usernum: %d\r\n"
              "Status: %s\r\n",
              "Meetme: %s\r\n"
              "Usernum: %d\r\n"
              "Status: %s\r\n",
-             chan->name, chan->uniqueid, conf->confno, user->user_no, talking ? "on" : "off");
+             ast_channel_name(chan), chan->uniqueid, conf->confno, user->user_no, talking ? "on" : "off");
 }
 
 static void set_user_talking(struct ast_channel *chan, struct ast_conference *conf, struct ast_conf_user *user, int talking, int monitor)
 }
 
 static void set_user_talking(struct ast_channel *chan, struct ast_conference *conf, struct ast_conf_user *user, int talking, int monitor)
@@ -2663,12 +2663,12 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
        }
 
        if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) {
        }
 
        if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) {
-               ast_log(LOG_WARNING, "Unable to set '%s' to write linear mode\n", chan->name);
+               ast_log(LOG_WARNING, "Unable to set '%s' to write linear mode\n", ast_channel_name(chan));
                goto outrun;
        }
 
        if (ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) {
                goto outrun;
        }
 
        if (ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) {
-               ast_log(LOG_WARNING, "Unable to set '%s' to read linear mode\n", chan->name);
+               ast_log(LOG_WARNING, "Unable to set '%s' to read linear mode\n", ast_channel_name(chan));
                goto outrun;
        }
 
                goto outrun;
        }
 
@@ -2775,7 +2775,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                close(fd);
                goto outrun;
        }
                close(fd);
                goto outrun;
        }
-       ast_debug(1, "Placed channel %s in DAHDI conf %d\n", chan->name, conf->dahdiconf);
+       ast_debug(1, "Placed channel %s in DAHDI conf %d\n", ast_channel_name(chan), conf->dahdiconf);
 
        if (!sent_event) {
                ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeJoin",
 
        if (!sent_event) {
                ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeJoin",
@@ -2787,7 +2787,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                        "CallerIDname: %s\r\n"
                        "ConnectedLineNum: %s\r\n"
                        "ConnectedLineName: %s\r\n",
                        "CallerIDname: %s\r\n"
                        "ConnectedLineNum: %s\r\n"
                        "ConnectedLineName: %s\r\n",
-                       chan->name, chan->uniqueid, conf->confno,
+                       ast_channel_name(chan), chan->uniqueid, conf->confno,
                        user->user_no,
                        S_COR(user->chan->caller.id.number.valid, user->chan->caller.id.number.str, "<unknown>"),
                        S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, "<unknown>"),
                        user->user_no,
                        S_COR(user->chan->caller.id.number.valid, user->chan->caller.id.number.str, "<unknown>"),
                        S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, "<unknown>"),
@@ -3150,7 +3150,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                                "Meetme: %s\r\n"
                                                "Usernum: %i\r\n"
                                                "Status: on\r\n",
                                                "Meetme: %s\r\n"
                                                "Usernum: %i\r\n"
                                                "Status: on\r\n",
-                                               chan->name, chan->uniqueid, conf->confno, user->user_no);
+                                               ast_channel_name(chan), chan->uniqueid, conf->confno, user->user_no);
                        }
 
                        /* If I should be un-muted but am not talker, un-mute me */
                        }
 
                        /* If I should be un-muted but am not talker, un-mute me */
@@ -3168,7 +3168,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                                "Meetme: %s\r\n"
                                                "Usernum: %i\r\n"
                                                "Status: off\r\n",
                                                "Meetme: %s\r\n"
                                                "Usernum: %i\r\n"
                                                "Status: off\r\n",
-                                               chan->name, chan->uniqueid, conf->confno, user->user_no);
+                                               ast_channel_name(chan), chan->uniqueid, conf->confno, user->user_no);
                        }
                        
                        if ((user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) && 
                        }
                        
                        if ((user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) && 
@@ -3181,7 +3181,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                                              "Meetme: %s\r\n"
                                                              "Usernum: %i\r\n"
                                                              "Status: on\r\n",
                                                              "Meetme: %s\r\n"
                                                              "Usernum: %i\r\n"
                                                              "Status: on\r\n",
-                                                             chan->name, chan->uniqueid, conf->confno, user->user_no);
+                                                             ast_channel_name(chan), chan->uniqueid, conf->confno, user->user_no);
                        }
 
                        
                        }
 
                        
@@ -3194,7 +3194,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                                              "Meetme: %s\r\n"
                                                              "Usernum: %i\r\n"
                                                              "Status: off\r\n",
                                                              "Meetme: %s\r\n"
                                                              "Usernum: %i\r\n"
                                                              "Status: off\r\n",
-                                                            chan->name, chan->uniqueid, conf->confno, user->user_no);
+                                                            ast_channel_name(chan), chan->uniqueid, conf->confno, user->user_no);
                        }
 
                        /* If user have been hung up, exit the conference */
                        }
 
                        /* If user have been hung up, exit the conference */
@@ -3505,7 +3505,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                                                ao2_callback(conf->usercontainer, OBJ_NODATA, user_max_cmp, &max_no);
                                                                menu_active = 0;
                                                                usr = ao2_find(conf->usercontainer, &max_no, 0);
                                                                ao2_callback(conf->usercontainer, OBJ_NODATA, user_max_cmp, &max_no);
                                                                menu_active = 0;
                                                                usr = ao2_find(conf->usercontainer, &max_no, 0);
-                                                               if ((usr->chan->name == chan->name) || ast_test_flag64(&usr->userflags, CONFFLAG_ADMIN)) {
+                                                               if ((ast_channel_name(usr->chan) == ast_channel_name(chan)) || ast_test_flag64(&usr->userflags, CONFFLAG_ADMIN)) {
                                                                        if (!ast_streamfile(chan, "conf-errormenu", chan->language)) {
                                                                                ast_waitstream(chan, "");
                                                                        }
                                                                        if (!ast_streamfile(chan, "conf-errormenu", chan->language)) {
                                                                                ast_waitstream(chan, "");
                                                                        }
@@ -3693,12 +3693,12 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                        default:
                                                ast_debug(1,
                                                        "Got ignored control frame on channel %s, f->frametype=%d,f->subclass=%d\n",
                                        default:
                                                ast_debug(1,
                                                        "Got ignored control frame on channel %s, f->frametype=%d,f->subclass=%d\n",
-                                                       chan->name, f->frametype, f->subclass.integer);
+                                                       ast_channel_name(chan), f->frametype, f->subclass.integer);
                                        }
                                } else {
                                        ast_debug(1,
                                                "Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d\n",
                                        }
                                } else {
                                        ast_debug(1,
                                                "Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d\n",
-                                               chan->name, f->frametype, f->subclass.integer);
+                                               ast_channel_name(chan), f->frametype, f->subclass.integer);
                                }
                                ast_frfree(f);
                        } else if (outfd > -1) {
                                }
                                ast_frfree(f);
                        } else if (outfd > -1) {
@@ -3756,7 +3756,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                                                */
                                                                for (cur = conf->transframe[idx]; cur; cur = AST_LIST_NEXT(cur, frame_list)) {
                                                                        if (ast_write(chan, cur)) {
                                                                */
                                                                for (cur = conf->transframe[idx]; cur; cur = AST_LIST_NEXT(cur, frame_list)) {
                                                                        if (ast_write(chan, cur)) {
-                                                                               ast_log(LOG_WARNING, "Unable to write frame to channel %s\n", chan->name);
+                                                                               ast_log(LOG_WARNING, "Unable to write frame to channel %s\n", ast_channel_name(chan));
                                                                                break;
                                                                        }
                                                                }
                                                                                break;
                                                                        }
                                                                }
@@ -3780,7 +3780,7 @@ bailoutandtrynormal:
                                                        ast_frame_adjust_volume(&fr, user->listen.actual);
                                                }
                                                if (can_write(chan, confflags) && ast_write(chan, &fr) < 0) {
                                                        ast_frame_adjust_volume(&fr, user->listen.actual);
                                                }
                                                if (can_write(chan, confflags) && ast_write(chan, &fr) < 0) {
-                                                       ast_log(LOG_WARNING, "Unable to write frame to channel %s\n", chan->name);
+                                                       ast_log(LOG_WARNING, "Unable to write frame to channel %s\n", ast_channel_name(chan));
                                                }
                                                if (musiconhold && mohtempstopped && confsilence > MEETME_DELAYDETECTENDTALK) {
                                                        mohtempstopped = 0;
                                                }
                                                if (musiconhold && mohtempstopped && confsilence > MEETME_DELAYDETECTENDTALK) {
                                                        mohtempstopped = 0;
@@ -3861,7 +3861,7 @@ bailoutandtrynormal:
                                "ConnectedLineNum: %s\r\n"
                                "ConnectedLineName: %s\r\n"
                                "Duration: %ld\r\n",
                                "ConnectedLineNum: %s\r\n"
                                "ConnectedLineName: %s\r\n"
                                "Duration: %ld\r\n",
-                               chan->name, chan->uniqueid, conf->confno,
+                               ast_channel_name(chan), chan->uniqueid, conf->confno,
                                user->user_no,
                                S_COR(user->chan->caller.id.number.valid, user->chan->caller.id.number.str, "<unknown>"),
                                S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, "<unknown>"),
                                user->user_no,
                                S_COR(user->chan->caller.id.number.valid, user->chan->caller.id.number.str, "<unknown>"),
                                S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, "<unknown>"),
@@ -4629,7 +4629,7 @@ static int user_chan_cb(void *obj, void *args, int flags)
        struct ast_conf_user *user = obj;
        const char *channel = args;
 
        struct ast_conf_user *user = obj;
        const char *channel = args;
 
-       if (!strcmp(user->chan->name, channel)) {
+       if (!strcmp(ast_channel_name(user->chan), channel)) {
                return (CMP_MATCH | CMP_STOP);
        }
 
                return (CMP_MATCH | CMP_STOP);
        }
 
@@ -4894,7 +4894,7 @@ static int meetmemute(struct mansession *s, const struct message *m, int mute)
 
        AST_LIST_UNLOCK(&confs);
 
 
        AST_LIST_UNLOCK(&confs);
 
-       ast_log(LOG_NOTICE, "Requested to %smute conf %s user %d userchan %s uniqueid %s\n", mute ? "" : "un", conf->confno, user->user_no, user->chan->name, user->chan->uniqueid);
+       ast_log(LOG_NOTICE, "Requested to %smute conf %s user %d userchan %s uniqueid %s\n", mute ? "" : "un", conf->confno, user->user_no, ast_channel_name(user->chan), user->chan->uniqueid);
 
        ao2_ref(user, -1);
        astman_send_ack(s, m, mute ? "User muted" : "User unmuted");
 
        ao2_ref(user, -1);
        astman_send_ack(s, m, mute ? "User muted" : "User unmuted");
@@ -4965,7 +4965,7 @@ static int action_meetmelist(struct mansession *s, const struct message *m)
                                S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, "<no name>"),
                                S_COR(user->chan->connected.id.number.valid, user->chan->connected.id.number.str, "<unknown>"),
                                S_COR(user->chan->connected.id.name.valid, user->chan->connected.id.name.str, "<no name>"),
                                S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, "<no name>"),
                                S_COR(user->chan->connected.id.number.valid, user->chan->connected.id.number.str, "<unknown>"),
                                S_COR(user->chan->connected.id.name.valid, user->chan->connected.id.name.str, "<no name>"),
-                               user->chan->name,
+                               ast_channel_name(user->chan),
                                ast_test_flag64(&user->userflags, CONFFLAG_ADMIN) ? "Yes" : "No",
                                ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "Listen only" : ast_test_flag64(&user->userflags, CONFFLAG_TALKER) ? "Talk only" : "Talk and listen",
                                ast_test_flag64(&user->userflags, CONFFLAG_MARKEDUSER) ? "Yes" : "No",
                                ast_test_flag64(&user->userflags, CONFFLAG_ADMIN) ? "Yes" : "No",
                                ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "Listen only" : ast_test_flag64(&user->userflags, CONFFLAG_TALKER) ? "Talk only" : "Talk and listen",
                                ast_test_flag64(&user->userflags, CONFFLAG_MARKEDUSER) ? "Yes" : "No",
index dc37e7e..412ac1e 100644 (file)
@@ -109,7 +109,7 @@ static int milliwatt_generate(struct ast_channel *chan, void *data, int len, int
        }
 
        if (ast_write(chan,&wf) < 0) {
        }
 
        if (ast_write(chan,&wf) < 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;
        }
 
                return -1;
        }
 
@@ -132,7 +132,7 @@ static int old_milliwatt_exec(struct ast_channel *chan)
        }
 
        if (ast_activate_generator(chan,&milliwattgen,"milliwatt") < 0) {
        }
 
        if (ast_activate_generator(chan,&milliwattgen,"milliwatt") < 0) {
-               ast_log(LOG_WARNING,"Failed to activate generator on '%s'\n",chan->name);
+               ast_log(LOG_WARNING,"Failed to activate generator on '%s'\n",ast_channel_name(chan));
                return -1;
        }
 
                return -1;
        }
 
index edffd4d..9348b3a 100644 (file)
@@ -1946,7 +1946,7 @@ static int leave_voicemail(struct ast_channel *chan, char *username, struct leav
                        chan->macrocontext, 
                        chan->exten,
                        chan->priority,
                        chan->macrocontext, 
                        chan->exten,
                        chan->priority,
-                       chan->name,
+                       ast_channel_name(chan),
                        callerid,
                        date, 
                        timebuf,
                        callerid,
                        date, 
                        timebuf,
index 82ee8c7..b7d40f3 100644 (file)
@@ -610,7 +610,7 @@ static void launch_monitor_thread(struct ast_channel *chan, const char *filename
                return;
        }
 
                return;
        }
 
-       mixmonitor->name = ast_strdup(chan->name);
+       mixmonitor->name = ast_strdup(ast_channel_name(chan));
 
        if (!ast_strlen_zero(postprocess2)) {
                mixmonitor->post_process = ast_strdup(postprocess2);
 
        if (!ast_strlen_zero(postprocess2)) {
                mixmonitor->post_process = ast_strdup(postprocess2);
@@ -637,7 +637,7 @@ static void launch_monitor_thread(struct ast_channel *chan, const char *filename
 
        if (startmon(chan, &mixmonitor->audiohook)) {
                ast_log(LOG_WARNING, "Unable to add '%s' spy to channel '%s'\n",
 
        if (startmon(chan, &mixmonitor->audiohook)) {
                ast_log(LOG_WARNING, "Unable to add '%s' spy to channel '%s'\n",
-                       mixmonitor_spy_type, chan->name);
+                       mixmonitor_spy_type, ast_channel_name(chan));
                ast_audiohook_destroy(&mixmonitor->audiohook);
                mixmonitor_free(mixmonitor);
                return;
                ast_audiohook_destroy(&mixmonitor->audiohook);
                mixmonitor_free(mixmonitor);
                return;
index cf21014..1389c79 100644 (file)
@@ -171,7 +171,7 @@ static int page_exec(struct ast_channel *chan, const char *data)
 
        AST_STANDARD_APP_ARGS(args, parse);
 
 
        AST_STANDARD_APP_ARGS(args, parse);
 
-       ast_copy_string(originator, chan->name, sizeof(originator));
+       ast_copy_string(originator, ast_channel_name(chan), sizeof(originator));
        if ((tmp = strchr(originator, '-'))) {
                *tmp = '\0';
        }
        if ((tmp = strchr(originator, '-'))) {
                *tmp = '\0';
        }
index c899bd2..f245d59 100644 (file)
@@ -182,10 +182,10 @@ static int parkandannounce_exec(struct ast_channel *chan, const char *data)
        ast_party_id_free(&caller_id);
        if (dchan) {
                if (dchan->_state == AST_STATE_UP) {
        ast_party_id_free(&caller_id);
        if (dchan) {
                if (dchan->_state == AST_STATE_UP) {
-                       ast_verb(4, "Channel %s was answered.\n", dchan->name);
+                       ast_verb(4, "Channel %s was answered.\n", ast_channel_name(dchan));
                } else {
                } else {
-                       ast_verb(4, "Channel %s was never answered.\n", dchan->name);
-                       ast_log(LOG_WARNING, "PARK: Channel %s was never answered for the announce.\n", dchan->name);
+                       ast_verb(4, "Channel %s was never answered.\n", ast_channel_name(dchan));
+                       ast_log(LOG_WARNING, "PARK: Channel %s was never answered for the announce.\n", ast_channel_name(dchan));
                        ast_hangup(dchan);
                        res = -1;
                        goto parkcleanup;
                        ast_hangup(dchan);
                        res = -1;
                        goto parkcleanup;
@@ -218,7 +218,7 @@ static int parkandannounce_exec(struct ast_channel *chan, const char *data)
                        if (!dres) {
                                dres = ast_waitstream(dchan, "");
                        } else {
                        if (!dres) {
                                dres = ast_waitstream(dchan, "");
                        } else {
-                               ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", tmp[i], dchan->name);
+                               ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", tmp[i], ast_channel_name(dchan));
                        }
                }
        }
                        }
                }
        }
index ea4d90b..6db5377 100644 (file)
@@ -477,7 +477,7 @@ static int playback_exec(struct ast_channel *chan, const char *data)
                                res = ast_waitstream(chan, ""); 
                                ast_stopstream(chan);
                        } else {
                                res = ast_waitstream(chan, ""); 
                                ast_stopstream(chan);
                        } else {
-                               ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char *)data);
+                               ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", ast_channel_name(chan), (char *)data);
                                res = 0;
                                mres = 1;
                        }
                                res = 0;
                                mres = 1;
                        }
index de88dca..ec9ad39 100644 (file)
@@ -2595,13 +2595,13 @@ static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *
                        "Position: %d\r\n"
                        "Count: %d\r\n"
                        "Uniqueid: %s\r\n",
                        "Position: %d\r\n"
                        "Count: %d\r\n"
                        "Uniqueid: %s\r\n",
-                       qe->chan->name,
+                       ast_channel_name(qe->chan),
                        S_COR(qe->chan->caller.id.number.valid, qe->chan->caller.id.number.str, "unknown"),/* XXX somewhere else it is <unknown> */
                        S_COR(qe->chan->caller.id.name.valid, qe->chan->caller.id.name.str, "unknown"),
                        S_COR(qe->chan->connected.id.number.valid, qe->chan->connected.id.number.str, "unknown"),/* XXX somewhere else it is <unknown> */
                        S_COR(qe->chan->connected.id.name.valid, qe->chan->connected.id.name.str, "unknown"),
                        q->name, qe->pos, q->count, qe->chan->uniqueid );
                        S_COR(qe->chan->caller.id.number.valid, qe->chan->caller.id.number.str, "unknown"),/* XXX somewhere else it is <unknown> */
                        S_COR(qe->chan->caller.id.name.valid, qe->chan->caller.id.name.str, "unknown"),
                        S_COR(qe->chan->connected.id.number.valid, qe->chan->connected.id.number.str, "unknown"),/* XXX somewhere else it is <unknown> */
                        S_COR(qe->chan->connected.id.name.valid, qe->chan->connected.id.name.str, "unknown"),
                        q->name, qe->pos, q->count, qe->chan->uniqueid );
-               ast_debug(1, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, qe->chan->name, qe->pos );
+               ast_debug(1, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, ast_channel_name(qe->chan), qe->pos );
        }
        ao2_unlock(q);
        queue_t_unref(q, "Done with realtime queue");
        }
        ao2_unlock(q);
        queue_t_unref(q, "Done with realtime queue");
@@ -2790,7 +2790,7 @@ static int say_position(struct queue_ent *qe, int ringing)
 posout:
        if (qe->parent->announceposition) {
                ast_verb(3, "Told %s in %s their queue position (which was %d)\n",
 posout:
        if (qe->parent->announceposition) {
                ast_verb(3, "Told %s in %s their queue position (which was %d)\n",
-                       qe->chan->name, qe->parent->name, qe->pos);
+                       ast_channel_name(qe->chan), qe->parent->name, qe->pos);
        }
        if (say_thanks) {
                res = play_file(qe->chan, qe->parent->sound_thanks);
        }
        if (say_thanks) {
                res = play_file(qe->chan, qe->parent->sound_thanks);
@@ -2856,8 +2856,8 @@ static void leave_queue(struct queue_ent *qe)
                        /* Take us out of the queue */
                        ast_manager_event(qe->chan, EVENT_FLAG_CALL, "Leave",
                                "Channel: %s\r\nQueue: %s\r\nCount: %d\r\nPosition: %d\r\nUniqueid: %s\r\n",
                        /* Take us out of the queue */
                        ast_manager_event(qe->chan, EVENT_FLAG_CALL, "Leave",
                                "Channel: %s\r\nQueue: %s\r\nCount: %d\r\nPosition: %d\r\nUniqueid: %s\r\n",
-                               qe->chan->name, q->name,  q->count, qe->pos, qe->chan->uniqueid);
-                       ast_debug(1, "Queue '%s' Leave, Channel '%s'\n", q->name, qe->chan->name );
+                               ast_channel_name(qe->chan), q->name,  q->count, qe->pos, qe->chan->uniqueid);
+                       ast_debug(1, "Queue '%s' Leave, Channel '%s'\n", q->name, ast_channel_name(qe->chan));
                        /* Take us out of the queue */
                        if (prev)
                                prev->next = current->next;
                        /* Take us out of the queue */
                        if (prev)
                                prev->next = current->next;
@@ -3219,7 +3219,7 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies
        if (ast_cdr_isset_unanswered()) {
                /* they want to see the unanswered dial attempts! */
                /* set up the CDR fields on all the CDRs to give sensical information */
        if (ast_cdr_isset_unanswered()) {
                /* they want to see the unanswered dial attempts! */
                /* set up the CDR fields on all the CDRs to give sensical information */
-               ast_cdr_setdestchan(tmp->chan->cdr, tmp->chan->name);
+               ast_cdr_setdestchan(tmp->chan->cdr, ast_channel_name(tmp->chan));
                strcpy(tmp->chan->cdr->clid, qe->chan->cdr->clid);
                strcpy(tmp->chan->cdr->channel, qe->chan->cdr->channel);
                strcpy(tmp->chan->cdr->src, qe->chan->cdr->src);
                strcpy(tmp->chan->cdr->clid, qe->chan->cdr->clid);
                strcpy(tmp->chan->cdr->channel, qe->chan->cdr->channel);
                strcpy(tmp->chan->cdr->src, qe->chan->cdr->src);
@@ -3264,7 +3264,7 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies
                        "Priority: %d\r\n"
                        "Uniqueid: %s\r\n"
                        "%s",
                        "Priority: %d\r\n"
                        "Uniqueid: %s\r\n"
                        "%s",
-                       qe->parent->name, tmp->interface, tmp->member->membername, qe->chan->name, tmp->chan->name,
+                       qe->parent->name, tmp->interface, tmp->member->membername, ast_channel_name(qe->chan), ast_channel_name(tmp->chan),
                        S_COR(qe->chan->caller.id.number.valid, qe->chan->caller.id.number.str, "unknown"),
                        S_COR(qe->chan->caller.id.name.valid, qe->chan->caller.id.name.str, "unknown"),
                        S_COR(qe->chan->connected.id.number.valid, qe->chan->connected.id.number.str, "unknown"),
                        S_COR(qe->chan->caller.id.number.valid, qe->chan->caller.id.number.str, "unknown"),
                        S_COR(qe->chan->caller.id.name.valid, qe->chan->caller.id.name.str, "unknown"),
                        S_COR(qe->chan->connected.id.number.valid, qe->chan->connected.id.number.str, "unknown"),
@@ -3489,7 +3489,7 @@ static void rna(int rnatime, struct queue_ent *qe, char *interface, char *member
                                                "%s",
                                                qe->parent->name,
                                                qe->chan->uniqueid,
                                                "%s",
                                                qe->parent->name,
                                                qe->chan->uniqueid,
-                                               qe->chan->name,
+                                               ast_channel_name(qe->chan),
                                                interface,
                                                membername,
                                                rnatime,
                                                interface,
                                                membername,
                                                rnatime,
@@ -3574,7 +3574,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
        ast_party_connected_line_init(&connected_caller);
 
        ast_channel_lock(qe->chan);
        ast_party_connected_line_init(&connected_caller);
 
        ast_channel_lock(qe->chan);
-       inchan_name = ast_strdupa(qe->chan->name);
+       inchan_name = ast_strdupa(ast_channel_name(qe->chan));
        ast_channel_unlock(qe->chan);
 
        starttime = (long) time(NULL);
        ast_channel_unlock(qe->chan);
 
        starttime = (long) time(NULL);
@@ -3638,7 +3638,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
                        char ochan_name[AST_CHANNEL_NAME];
                        if (o->chan) {
                                ast_channel_lock(o->chan);
                        char ochan_name[AST_CHANNEL_NAME];
                        if (o->chan) {
                                ast_channel_lock(o->chan);
-                               ast_copy_string(ochan_name, o->chan->name, sizeof(ochan_name));
+                               ast_copy_string(ochan_name, ast_channel_name(o->chan), sizeof(ochan_name));
                                ast_channel_unlock(o->chan);
                        }
                        if (o->stillgoing && (o->chan) &&  (o->chan->_state == AST_STATE_UP)) {
                                ast_channel_unlock(o->chan);
                        }
                        if (o->stillgoing && (o->chan) &&  (o->chan->_state == AST_STATE_UP)) {
@@ -3990,10 +3990,10 @@ static int is_our_turn(struct queue_ent *qe)
         * from the front of the queue are valid when autofill is disabled)
         */
        if (ch && idx < avl && (qe->parent->autofill || qe->pos == 1)) {
         * from the front of the queue are valid when autofill is disabled)
         */
        if (ch && idx < avl && (qe->parent->autofill || qe->pos == 1)) {
-               ast_debug(1, "It's our turn (%s).\n", qe->chan->name);
+               ast_debug(1, "It's our turn (%s).\n", ast_channel_name(qe->chan));
                res = 1;
        } else {
                res = 1;
        } else {
-               ast_debug(1, "It's not our turn (%s).\n", qe->chan->name);
+               ast_debug(1, "It's not our turn (%s).\n", ast_channel_name(qe->chan));
                res = 0;
        }
 
                res = 0;
        }
 
@@ -4024,7 +4024,7 @@ static void update_qe_rule(struct queue_ent *qe)
        pbx_builtin_setvar_helper(qe->chan, "QUEUE_MIN_PENALTY", min_penalty_str);
        qe->max_penalty = max_penalty;
        qe->min_penalty = min_penalty;
        pbx_builtin_setvar_helper(qe->chan, "QUEUE_MIN_PENALTY", min_penalty_str);
        qe->max_penalty = max_penalty;
        qe->min_penalty = min_penalty;
-       ast_debug(3, "Setting max penalty to %d and min penalty to %d for caller %s since %d seconds have elapsed\n", qe->max_penalty, qe->min_penalty, qe->chan->name, qe->pr->time);
+       ast_debug(3, "Setting max penalty to %d and min penalty to %d for caller %s since %d seconds have elapsed\n", qe->max_penalty, qe->min_penalty, ast_channel_name(qe->chan), qe->pr->time);
        qe->pr = AST_LIST_NEXT(qe->pr, list);
 }
 
        qe->pr = AST_LIST_NEXT(qe->pr, list);
 }
 
@@ -4269,7 +4269,7 @@ static void send_agent_complete(const struct queue_ent *qe, const char *queuenam
                "TalkTime: %ld\r\n"
                "Reason: %s\r\n"
                "%s",
                "TalkTime: %ld\r\n"
                "Reason: %s\r\n"
                "%s",
-               queuename, qe->chan->uniqueid, peer->name, member->interface, member->membername,
+               queuename, qe->chan->uniqueid, ast_channel_name(peer), member->interface, member->membername,
                (long)(callstart - qe->start), (long)(time(NULL) - callstart), reason,
                qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, vars_len) : "");
 }
                (long)(callstart - qe->start), (long)(time(NULL) - callstart), reason,
                qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, vars_len) : "");
 }
@@ -4547,7 +4547,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
 
        ao2_lock(qe->parent);
        ast_debug(1, "%s is trying to call a queue member.\n",
 
        ao2_lock(qe->parent);
        ast_debug(1, "%s is trying to call a queue member.\n",
-                                                       qe->chan->name);
+                                                       ast_channel_name(qe->chan));
        ast_copy_string(queuename, qe->parent->name, sizeof(queuename));
        if (!ast_strlen_zero(qe->announce))
                announce = qe->announce;
        ast_copy_string(queuename, qe->parent->name, sizeof(queuename));
        if (!ast_strlen_zero(qe->announce))
                announce = qe->announce;
@@ -4708,7 +4708,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                        res = digit;
                }
                if (res == -1)
                        res = digit;
                }
                if (res == -1)
-                       ast_debug(1, "%s: Nobody answered.\n", qe->chan->name);
+                       ast_debug(1, "%s: Nobody answered.\n", ast_channel_name(qe->chan));
                if (ast_cdr_isset_unanswered()) {
                        /* channel contains the name of one of the outgoing channels
                           in its CDR; zero out this CDR to avoid a dual-posting */
                if (ast_cdr_isset_unanswered()) {
                        /* channel contains the name of one of the outgoing channels
                           in its CDR; zero out this CDR to avoid a dual-posting */
@@ -4775,7 +4775,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                        res2 |= ast_autoservice_stop(qe->chan);
                        if (ast_check_hangup(peer)) {
                                /* Agent must have hung up */
                        res2 |= ast_autoservice_stop(qe->chan);
                        if (ast_check_hangup(peer)) {
                                /* Agent must have hung up */
-                               ast_log(LOG_WARNING, "Agent on %s hungup on the customer.\n", peer->name);
+                               ast_log(LOG_WARNING, "Agent on %s hungup on the customer.\n", ast_channel_name(peer));
                                ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "AGENTDUMP", "%s", "");
                                if (qe->parent->eventwhencalled)
                                        manager_event(EVENT_FLAG_AGENT, "AgentDump",
                                ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "AGENTDUMP", "%s", "");
                                if (qe->parent->eventwhencalled)
                                        manager_event(EVENT_FLAG_AGENT, "AgentDump",
@@ -4785,14 +4785,14 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                                                        "Member: %s\r\n"
                                                        "MemberName: %s\r\n"
                                                        "%s",
                                                        "Member: %s\r\n"
                                                        "MemberName: %s\r\n"
                                                        "%s",
-                                                       queuename, qe->chan->uniqueid, peer->name, member->interface, member->membername,
+                                                       queuename, qe->chan->uniqueid, ast_channel_name(peer), member->interface, member->membername,
                                                        qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
                                ast_hangup(peer);
                                ao2_ref(member, -1);
                                goto out;
                        } else if (res2) {
                                /* Caller must have hung up just before being connected*/
                                                        qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
                                ast_hangup(peer);
                                ao2_ref(member, -1);
                                goto out;
                        } else if (res2) {
                                /* Caller must have hung up just before being connected*/
-                               ast_log(LOG_NOTICE, "Caller was about to talk to agent on %s but the caller hungup.\n", peer->name);
+                               ast_log(LOG_NOTICE, "Caller was about to talk to agent on %s but the caller hungup.\n", ast_channel_name(peer));
                                ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "ABANDON", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
                                record_abandoned(qe);
                                ast_hangup(peer);
                                ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "ABANDON", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
                                record_abandoned(qe);
                                ast_hangup(peer);
@@ -4807,13 +4807,13 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                        ast_moh_stop(qe->chan);
                /* If appropriate, log that we have a destination channel */
                if (qe->chan->cdr) {
                        ast_moh_stop(qe->chan);
                /* If appropriate, log that we have a destination channel */
                if (qe->chan->cdr) {
-                       ast_cdr_setdestchan(qe->chan->cdr, peer->name);
+                       ast_cdr_setdestchan(qe->chan->cdr, ast_channel_name(peer));
                }
                /* Make sure channels are compatible */
                res = ast_channel_make_compatible(qe->chan, peer);
                if (res < 0) {
                        ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "SYSCOMPAT", "%s", "");
                }
                /* Make sure channels are compatible */
                res = ast_channel_make_compatible(qe->chan, peer);
                if (res < 0) {
                        ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "SYSCOMPAT", "%s", "");
-                       ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", qe->chan->name, peer->name);
+                       ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", ast_channel_name(qe->chan), ast_channel_name(peer));
                        record_abandoned(qe);
                        ast_cdr_failed(qe->chan->cdr);
                        ast_hangup(peer);
                        record_abandoned(qe);
                        ast_cdr_failed(qe->chan->cdr);
                        ast_hangup(peer);
@@ -5140,7 +5140,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                                        "BridgedChannel: %s\r\n"
                                        "Ringtime: %ld\r\n"
                                        "%s",
                                        "BridgedChannel: %s\r\n"
                                        "Ringtime: %ld\r\n"
                                        "%s",
-                                       queuename, qe->chan->uniqueid, peer->name, member->interface, member->membername,
+                                       queuename, qe->chan->uniqueid, ast_channel_name(peer), member->interface, member->membername,
                                        (long) time(NULL) - qe->start, peer->uniqueid, (long)(orig - to > 0 ? (orig - to) / 1000 : 0),
                                        qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
                ast_copy_string(oldcontext, qe->chan->context, sizeof(oldcontext));
                                        (long) time(NULL) - qe->start, peer->uniqueid, (long)(orig - to > 0 ? (orig - to) / 1000 : 0),
                                        qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
                ast_copy_string(oldcontext, qe->chan->context, sizeof(oldcontext));
@@ -5799,7 +5799,7 @@ static int rqm_exec(struct ast_channel *chan, const char *data)
        AST_STANDARD_APP_ARGS(args, parse);
 
        if (ast_strlen_zero(args.interface)) {
        AST_STANDARD_APP_ARGS(args, parse);
 
        if (ast_strlen_zero(args.interface)) {
-               args.interface = ast_strdupa(chan->name);
+               args.interface = ast_strdupa(ast_channel_name(chan));
                temppos = strrchr(args.interface, '-');
                if (temppos)
                        *temppos = '\0';
                temppos = strrchr(args.interface, '-');
                if (temppos)
                        *temppos = '\0';
@@ -5871,7 +5871,7 @@ static int aqm_exec(struct ast_channel *chan, const char *data)
        AST_STANDARD_APP_ARGS(args, parse);
 
        if (ast_strlen_zero(args.interface)) {
        AST_STANDARD_APP_ARGS(args, parse);
 
        if (ast_strlen_zero(args.interface)) {
-               args.interface = ast_strdupa(chan->name);
+               args.interface = ast_strdupa(ast_channel_name(chan));
                temppos = strrchr(args.interface, '-');
                if (temppos)
                        *temppos = '\0';
                temppos = strrchr(args.interface, '-');
                if (temppos)
                        *temppos = '\0';
@@ -6042,10 +6042,10 @@ static int queue_exec(struct ast_channel *chan, const char *data)
        user_priority = pbx_builtin_getvar_helper(chan, "QUEUE_PRIO");
        if (user_priority) {
                if (sscanf(user_priority, "%30d", &prio) == 1) {
        user_priority = pbx_builtin_getvar_helper(chan, "QUEUE_PRIO");
        if (user_priority) {
                if (sscanf(user_priority, "%30d", &prio) == 1) {
-                       ast_debug(1, "%s: Got priority %d from ${QUEUE_PRIO}.\n", chan->name, prio);
+                       ast_debug(1, "%s: Got priority %d from ${QUEUE_PRIO}.\n", ast_channel_name(chan), prio);
                } else {
                        ast_log(LOG_WARNING, "${QUEUE_PRIO}: Invalid value (%s), channel %s.\n",
                } else {
                        ast_log(LOG_WARNING, "${QUEUE_PRIO}: Invalid value (%s), channel %s.\n",
-                               user_priority, chan->name);
+                               user_priority, ast_channel_name(chan));
                        prio = 0;
                }
        } else {
                        prio = 0;
                }
        } else {
@@ -6057,10 +6057,10 @@ static int queue_exec(struct ast_channel *chan, const char *data)
 
        if ((max_penalty_str = pbx_builtin_getvar_helper(chan, "QUEUE_MAX_PENALTY"))) {
                if (sscanf(max_penalty_str, "%30d", &max_penalty) == 1) {
 
        if ((max_penalty_str = pbx_builtin_getvar_helper(chan, "QUEUE_MAX_PENALTY"))) {
                if (sscanf(max_penalty_str, "%30d", &max_penalty) == 1) {
-                       ast_debug(1, "%s: Got max penalty %d from ${QUEUE_MAX_PENALTY}.\n", chan->name, max_penalty);
+                       ast_debug(1, "%s: Got max penalty %d from ${QUEUE_MAX_PENALTY}.\n", ast_channel_name(chan), max_penalty);
                } else {
                        ast_log(LOG_WARNING, "${QUEUE_MAX_PENALTY}: Invalid value (%s), channel %s.\n",
                } else {
                        ast_log(LOG_WARNING, "${QUEUE_MAX_PENALTY}: Invalid value (%s), channel %s.\n",
-                               max_penalty_str, chan->name);
+                               max_penalty_str, ast_channel_name(chan));
                        max_penalty = 0;
                }
        } else {
                        max_penalty = 0;
                }
        } else {
@@ -6069,10 +6069,10 @@ static int queue_exec(struct ast_channel *chan, const char *data)
 
        if ((min_penalty_str = pbx_builtin_getvar_helper(chan, "QUEUE_MIN_PENALTY"))) {
                if (sscanf(min_penalty_str, "%30d", &min_penalty) == 1) {
 
        if ((min_penalty_str = pbx_builtin_getvar_helper(chan, "QUEUE_MIN_PENALTY"))) {
                if (sscanf(min_penalty_str, "%30d", &min_penalty) == 1) {
-                       ast_debug(1, "%s: Got min penalty %d from ${QUEUE_MIN_PENALTY}.\n", chan->name, min_penalty);
+                       ast_debug(1, "%s: Got min penalty %d from ${QUEUE_MIN_PENALTY}.\n", ast_channel_name(chan), min_penalty);
                } else {
                        ast_log(LOG_WARNING, "${QUEUE_MIN_PENALTY}: Invalid value (%s), channel %s.\n",
                } else {
                        ast_log(LOG_WARNING, "${QUEUE_MIN_PENALTY}: Invalid value (%s), channel %s.\n",
-                               min_penalty_str, chan->name);
+                               min_penalty_str, ast_channel_name(chan));
                        min_penalty = 0;
                }
        } else {
                        min_penalty = 0;
                }
        } else {
@@ -6228,7 +6228,7 @@ check_turns:
                 * of the queue, go and check for our turn again.
                 */
                if (!is_our_turn(&qe)) {
                 * of the queue, go and check for our turn again.
                 */
                if (!is_our_turn(&qe)) {
-                       ast_debug(1, "Darn priorities, going back in queue (%s)!\n", qe.chan->name);
+                       ast_debug(1, "Darn priorities, going back in queue (%s)!\n", ast_channel_name(qe.chan));
                        goto check_turns;
                }
        }
                        goto check_turns;
                }
        }
@@ -7322,7 +7322,7 @@ static char *__queues_show(struct mansession *s, int fd, int argc, const char *
                        do_print(s, fd, "   Callers: ");
                        for (qe = q->head; qe; qe = qe->next) {
                                ast_str_set(&out, 0, "      %d. %s (wait: %ld:%2.2ld, prio: %d)",
                        do_print(s, fd, "   Callers: ");
                        for (qe = q->head; qe; qe = qe->next) {
                                ast_str_set(&out, 0, "      %d. %s (wait: %ld:%2.2ld, prio: %d)",
-                                       pos++, qe->chan->name, (long) (now - qe->start) / 60,
+                                       pos++, ast_channel_name(qe->chan), (long) (now - qe->start) / 60,
                                        (long) (now - qe->start) % 60, qe->prio);
                                do_print(s, fd, ast_str_buffer(out));
                        }
                                        (long) (now - qe->start) % 60, qe->prio);
                                do_print(s, fd, ast_str_buffer(out));
                        }
@@ -7593,7 +7593,7 @@ static int manager_queues_status(struct mansession *s, const struct message *m)
                                        "Wait: %ld\r\n"
                                        "%s"
                                        "\r\n",
                                        "Wait: %ld\r\n"
                                        "%s"
                                        "\r\n",
-                                       q->name, pos++, qe->chan->name, qe->chan->uniqueid,
+                                       q->name, pos++, ast_channel_name(qe->chan), qe->chan->uniqueid,
                                        S_COR(qe->chan->caller.id.number.valid, qe->chan->caller.id.number.str, "unknown"),
                                        S_COR(qe->chan->caller.id.name.valid, qe->chan->caller.id.name.str, "unknown"),
                                        S_COR(qe->chan->connected.id.number.valid, qe->chan->connected.id.number.str, "unknown"),
                                        S_COR(qe->chan->caller.id.number.valid, qe->chan->caller.id.number.str, "unknown"),
                                        S_COR(qe->chan->caller.id.name.valid, qe->chan->caller.id.name.str, "unknown"),
                                        S_COR(qe->chan->connected.id.number.valid, qe->chan->connected.id.number.str, "unknown"),
index 4792119..6e8531d 100644 (file)
@@ -246,7 +246,7 @@ static int readexten_exec(struct ast_channel *chan, const char *data)
                        pbx_builtin_setvar_helper(chan, arglist.variable, exten);
                        status = "OK";
                } else {
                        pbx_builtin_setvar_helper(chan, arglist.variable, exten);
                        status = "OK";
                } else {
-                       ast_debug(3, "User dialed invalid extension '%s' in context '%s' on %s\n", exten, arglist.context, chan->name);
+                       ast_debug(3, "User dialed invalid extension '%s' in context '%s' on %s\n", exten, arglist.context, ast_channel_name(chan));
                        pbx_builtin_setvar_helper(chan, arglist.variable, "i");
                        pbx_builtin_setvar_helper(chan, "INVALID_EXTEN", exten);
                        status = "INVALID";
                        pbx_builtin_setvar_helper(chan, arglist.variable, "i");
                        pbx_builtin_setvar_helper(chan, "INVALID_EXTEN", exten);
                        status = "INVALID";
index 6098ca7..18101e4 100644 (file)
@@ -272,7 +272,7 @@ static int record_exec(struct ast_channel *chan, const char *data)
        }
 
        if (res) {
        }
 
        if (res) {
-               ast_log(LOG_WARNING, "Could not answer channel '%s'\n", chan->name);
+               ast_log(LOG_WARNING, "Could not answer channel '%s'\n", ast_channel_name(chan));
                pbx_builtin_setvar_helper(chan, "RECORD_STATUS", "ERROR");
                goto out;
        }
                pbx_builtin_setvar_helper(chan, "RECORD_STATUS", "ERROR");
                goto out;
        }
@@ -283,7 +283,7 @@ static int record_exec(struct ast_channel *chan, const char *data)
                if (!res) {
                        res = ast_waitstream(chan, "");
                } else {
                if (!res) {
                        res = ast_waitstream(chan, "");
                } else {
-                       ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", chan->name);
+                       ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(chan));
                }
                ast_stopstream(chan);
        }
                }
                ast_stopstream(chan);
        }
@@ -416,7 +416,7 @@ out:
        if ((silence > 0) && rfmt.id) {
                res = ast_set_read_format(chan, &rfmt);
                if (res)
        if ((silence > 0) && rfmt.id) {
                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));
                if (sildet)
                        ast_dsp_free(sildet);
        }
                if (sildet)
                        ast_dsp_free(sildet);
        }
index 6722040..3a8ef4a 100644 (file)
@@ -1647,7 +1647,7 @@ static const char* dtmf_tones[] = {
                                ast_playtones_start(myrpt->txchannel, 0, dtmf_tones[15], 0);
                        else {
                                /* not handled */
                                ast_playtones_start(myrpt->txchannel, 0, dtmf_tones[15], 0);
                        else {
                                /* not handled */
-                               ast_debug(1, "Unable to generate DTMF tone '%c' for '%s'\n", digit, myrpt->txchannel->name);
+                               ast_debug(1, "Unable to generate DTMF tone '%c' for '%s'\n", digit, ast_channel_name(myrpt->txchannel));
                        }
                        rpt_mutex_lock(&myrpt->lock);
                }
                        }
                        rpt_mutex_lock(&myrpt->lock);
                }
@@ -3708,7 +3708,7 @@ int       res;
        if (!res) 
                res = ast_waitstream(mychannel, "");
        else
        if (!res) 
                res = ast_waitstream(mychannel, "");
        else
-                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
        ast_stopstream(mychannel);
        return res;
 }
        ast_stopstream(mychannel);
        return res;
 }
@@ -3721,7 +3721,7 @@ int       res;
        if (!res) 
                res = ast_waitstream(mychannel, "");
        else
        if (!res) 
                res = ast_waitstream(mychannel, "");
        else
-                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
        ast_stopstream(mychannel);
        return res;
 }
        ast_stopstream(mychannel);
        return res;
 }
@@ -3733,7 +3733,7 @@ static int saynum(struct ast_channel *mychannel, int num)
        if(!res)
                res = ast_waitstream(mychannel, "");
        else
        if(!res)
                res = ast_waitstream(mychannel, "");
        else
-               ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+               ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
        ast_stopstream(mychannel);
        return res;
 }
        ast_stopstream(mychannel);
        return res;
 }
@@ -4229,7 +4229,7 @@ struct ast_format_cap *cap = NULL;
 
                        res = telem_lookup(myrpt,mychannel, myrpt->name, (!hastx) ? "remotemon" : "remotetx");
                        if(res)
 
                        res = telem_lookup(myrpt,mychannel, myrpt->name, (!hastx) ? "remotemon" : "remotetx");
                        if(res)
-                               ast_log(LOG_WARNING, "telem_lookup:remotexx failed on %s\n", mychannel->name);
+                               ast_log(LOG_WARNING, "telem_lookup:remotexx failed on %s\n", ast_channel_name(mychannel));
                        
                
                        /* if in remote cmd mode, indicate it */
                        
                
                        /* if in remote cmd mode, indicate it */
@@ -4238,7 +4238,7 @@ struct ast_format_cap *cap = NULL;
                                ast_safe_sleep(mychannel,200);
                                res = telem_lookup(myrpt,mychannel, myrpt->name, "cmdmode");
                                if(res)
                                ast_safe_sleep(mychannel,200);
                                res = telem_lookup(myrpt,mychannel, myrpt->name, "cmdmode");
                                if(res)
-                                       ast_log(LOG_WARNING, "telem_lookup:cmdmode failed on %s\n", mychannel->name);
+                                       ast_log(LOG_WARNING, "telem_lookup:cmdmode failed on %s\n", ast_channel_name(mychannel));
                                ast_stopstream(mychannel);
                        }
                }
                                ast_stopstream(mychannel);
                        }
                }
@@ -4252,7 +4252,7 @@ struct ast_format_cap *cap = NULL;
                        else
                                res = -1;
                        if(res)
                        else
                                res = -1;
                        if(res)
-                               ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", mychannel->name);               
+                               ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", ast_channel_name(mychannel));           
                }       
                if (hasremote && (!myrpt->cmdnode[0]))
                {
                }       
                if (hasremote && (!myrpt->cmdnode[0]))
                {
@@ -4287,7 +4287,7 @@ struct ast_format_cap *cap = NULL;
                                        res = -1;
                
                                if(res)
                                        res = -1;
                
                                if(res)
-                                       ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", mychannel->name);               
+                                       ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", ast_channel_name(mychannel));           
                        }       
                }
 #if    defined(_MDC_DECODE_H_) && defined(MDC_SAY_WHEN_DOING_CT)
                        }       
                }
 #if    defined(_MDC_DECODE_H_) && defined(MDC_SAY_WHEN_DOING_CT)
@@ -4383,7 +4383,7 @@ struct ast_format_cap *cap = NULL;
                        else
                                res = -1;
                        if(res)
                        else
                                res = -1;
                        if(res)
-                               ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", mychannel->name);               
+                               ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", ast_channel_name(mychannel));           
                }       
                imdone = 1;
                break;
                }       
                imdone = 1;
                break;
@@ -4446,13 +4446,13 @@ struct ast_format_cap *cap = NULL;
                if (!res) 
                        res = ast_waitstream(mychannel, "");
                else
                if (!res) 
                        res = ast_waitstream(mychannel, "");
                else
-                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
                ast_stopstream(mychannel);
                res = ast_streamfile(mychannel, "digits/2", mychannel->language);
                if (!res) 
                        res = ast_waitstream(mychannel, "");
                else
                ast_stopstream(mychannel);
                res = ast_streamfile(mychannel, "digits/2", mychannel->language);
                if (!res) 
                        res = ast_waitstream(mychannel, "");
                else
-                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
                ast_stopstream(mychannel);
                res = saynode(myrpt,mychannel,myrpt->name);
                imdone = 1;
                ast_stopstream(mychannel);
                res = saynode(myrpt,mychannel,myrpt->name);
                imdone = 1;
@@ -4826,7 +4826,7 @@ struct ast_format_cap *cap = NULL;
                        l1 = ast_malloc(sizeof(struct rpt_link));
                        if (!l1)
                        {
                        l1 = ast_malloc(sizeof(struct rpt_link));
                        if (!l1)
                        {
-                               ast_log(LOG_WARNING, "Cannot alloc memory on %s\n", mychannel->name);
+                               ast_log(LOG_WARNING, "Cannot alloc memory on %s\n", ast_channel_name(mychannel));
                                remque((struct qelem *)mytele);
                                myrpt->active_telem = NULL;
                                rpt_mutex_unlock(&myrpt->lock);
                                remque((struct qelem *)mytele);
                                myrpt->active_telem = NULL;
                                rpt_mutex_unlock(&myrpt->lock);
@@ -4851,7 +4851,7 @@ struct ast_format_cap *cap = NULL;
                        if (!res) 
                                res = ast_waitstream(mychannel, "");
                        else
                        if (!res) 
                                res = ast_waitstream(mychannel, "");
                        else
-                                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
                        ast_stopstream(mychannel);
                }
                l = linkbase.next;
                        ast_stopstream(mychannel);
                }
                l = linkbase.next;
@@ -4868,7 +4868,7 @@ struct ast_format_cap *cap = NULL;
                        if (!res) 
                                res = ast_waitstream(mychannel, "");
                        else
                        if (!res) 
                                res = ast_waitstream(mychannel, "");
                        else
-                               ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                               ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
                        ast_stopstream(mychannel);
                        l = l->next;
                }                       
                        ast_stopstream(mychannel);
                        l = l->next;
                }                       
@@ -4878,7 +4878,7 @@ struct ast_format_cap *cap = NULL;
                        if (!res) 
                                res = ast_waitstream(mychannel, "");
                        else
                        if (!res) 
                                res = ast_waitstream(mychannel, "");
                        else
-                                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
                        ast_stopstream(mychannel);
                }
                /* destroy our local link queue */
                        ast_stopstream(mychannel);
                }
                /* destroy our local link queue */
@@ -4912,7 +4912,7 @@ struct ast_format_cap *cap = NULL;
                        if (!res) 
                                res = ast_waitstream(mychannel, "");
                        else
                        if (!res) 
                                res = ast_waitstream(mychannel, "");
                        else
-                                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
                        ast_stopstream(mychannel);
                }
                /* go thru all the nodes in list */
                        ast_stopstream(mychannel);
                }
                /* go thru all the nodes in list */
@@ -4936,7 +4936,7 @@ struct ast_format_cap *cap = NULL;
                        if (!res) 
                                res = ast_waitstream(mychannel, "");
                        else
                        if (!res) 
                                res = ast_waitstream(mychannel, "");
                        else
-                               ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                               ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
                        ast_stopstream(mychannel);
                }                       
                if (!hastx)
                        ast_stopstream(mychannel);
                }                       
                if (!hastx)
@@ -4945,7 +4945,7 @@ struct ast_format_cap *cap = NULL;
                        if (!res) 
                                res = ast_waitstream(mychannel, "");
                        else
                        if (!res) 
                                res = ast_waitstream(mychannel, "");
                        else
-                                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
                        ast_stopstream(mychannel);
                }
                imdone = 1;
                        ast_stopstream(mychannel);
                }
                imdone = 1;
@@ -4980,7 +4980,7 @@ struct ast_format_cap *cap = NULL;
                if (!res) 
                        res = ast_waitstream(mychannel, "");
                else
                if (!res) 
                        res = ast_waitstream(mychannel, "");
                else
-                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
                ast_stopstream(mychannel);
                imdone = 1;
                break;
                ast_stopstream(mychannel);
                imdone = 1;
                break;
@@ -5000,7 +5000,7 @@ struct ast_format_cap *cap = NULL;
                if (!res) 
                        res = ast_waitstream(mychannel, "");
                else
                if (!res) 
                        res = ast_waitstream(mychannel, "");
                else
-                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
                ast_stopstream(mychannel);
                sprintf(mystr,PARROTFILE,myrpt->name,(unsigned int)mytele->parrot);
                strcat(mystr,".wav");
                ast_stopstream(mychannel);
                sprintf(mystr,PARROTFILE,myrpt->name,(unsigned int)mytele->parrot);
                strcat(mystr,".wav");
@@ -5023,7 +5023,7 @@ struct ast_format_cap *cap = NULL;
                if (!res) 
                        res = ast_waitstream(mychannel, "");
                else
                if (!res) 
                        res = ast_waitstream(mychannel, "");
                else
-                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
                ast_stopstream(mychannel);
                if(!res) /* Say number of seconds */
                        ast_say_number(mychannel, myrpt->p.remotetimeout - 
                ast_stopstream(mychannel);
                if(!res) /* Say number of seconds */
                        ast_say_number(mychannel, myrpt->p.remotetimeout - 
@@ -5043,7 +5043,7 @@ struct ast_format_cap *cap = NULL;
                if (!res) 
                        res = ast_waitstream(mychannel, "");
                else
                if (!res) 
                        res = ast_waitstream(mychannel, "");
                else
-                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
                ast_stopstream(mychannel);
                if(!res) /* Say number of seconds */
                        ast_say_number(mychannel, myrpt->p.remoteinacttimeout - 
                ast_stopstream(mychannel);
                if(!res) /* Say number of seconds */
                        ast_say_number(mychannel, myrpt->p.remoteinacttimeout - 
@@ -5115,7 +5115,7 @@ struct ast_format_cap *cap = NULL;
                        ast_stopstream(mychannel);
                }       
                else
                        ast_stopstream(mychannel);
                }       
                else
-                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
                imdone = 1;
                break;
            case ARB_ALPHA:
                imdone = 1;
                break;
            case ARB_ALPHA:
@@ -5154,7 +5154,7 @@ struct ast_format_cap *cap = NULL;
                                        if(!dres) {
                                                dres = ast_waitstream(mychannel, "");
                                        } else {
                                        if(!dres) {
                                                dres = ast_waitstream(mychannel, "");
                                        } else {
-                                               ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", tmp[idx], mychannel->name);
+                                               ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", tmp[idx], ast_channel_name(mychannel));
                                                dres = 0;
                                        }
                                }
                                                dres = 0;
                                        }
                                }
@@ -5186,7 +5186,7 @@ struct ast_format_cap *cap = NULL;
                if (!res) 
                        res = ast_waitstream(mychannel, "");
                else {
                if (!res) 
                        res = ast_waitstream(mychannel, "");
                else {
-                       ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
+                       ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
                        res = 0;
                }
        }
                        res = 0;
                }
        }
@@ -5829,7 +5829,7 @@ static int connect_link(struct rpt *myrpt, char* node, int mode, int perma)
                l->chan->data = "(Remote Rx)";
                if (debug > 3)
                        ast_log(LOG_NOTICE, "rpt (remote) initiating call to %s/%s on %s\n",
                l->chan->data = "(Remote Rx)";
                if (debug > 3)
                        ast_log(LOG_NOTICE, "rpt (remote) initiating call to %s/%s on %s\n",
-               deststr, tele, l->chan->name);
+               deststr, tele, ast_channel_name(l->chan));
                l->chan->caller.id.number.valid = 1;
                ast_free(l->chan->caller.id.number.str);
                l->chan->caller.id.number.str = ast_strdup(myrpt->name);
                l->chan->caller.id.number.valid = 1;
                ast_free(l->chan->caller.id.number.str);
                l->chan->caller.id.number.str = ast_strdup(myrpt->name);
@@ -5838,7 +5838,7 @@ static int connect_link(struct rpt *myrpt, char* node, int mode, int perma)
        else {
                if(debug > 3) 
                        ast_log(LOG_NOTICE, "Unable to place call to %s/%s on %s\n",
        else {
                if(debug > 3) 
                        ast_log(LOG_NOTICE, "Unable to place call to %s/%s on %s\n",
-               deststr,tele,l->chan->name);
+               deststr,tele,ast_channel_name(l->chan));
                if (myrpt->p.archivedir)
                {
                        char str[100];
                if (myrpt->p.archivedir)
                {
                        char str[100];
@@ -7427,7 +7427,7 @@ struct dahdi_radio_param r;
        memcpy(&r.data,data,5);
        if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&r) == -1)
        {
        memcpy(&r.data,data,5);
        if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&r) == -1)
        {
-               ast_log(LOG_WARNING,"Cannot send RBI command for channel %s\n",myrpt->dahdirxchannel->name);
+               ast_log(LOG_WARNING,"Cannot send RBI command for channel %s\n",ast_channel_name(myrpt->dahdirxchannel));
                return;
        }
 }
                return;
        }
 }
@@ -10411,7 +10411,7 @@ static int attempt_reconnect(struct rpt *myrpt, struct rpt_link *l)
                l->chan->appl = "Apprpt";
                l->chan->data = "(Remote Rx)";
                ast_verb(3, "rpt (attempt_reconnect) initiating call to %s/%s on %s\n",
                l->chan->appl = "Apprpt";
                l->chan->data = "(Remote Rx)";
                ast_verb(3, "rpt (attempt_reconnect) initiating call to %s/%s on %s\n",
-                       deststr, tele, l->chan->name);
+                       deststr, tele, ast_channel_name(l->chan));
                l->chan->caller.id.number.valid = 1;
                ast_free(l->chan->caller.id.number.str);
                l->chan->caller.id.number.str = ast_strdup(myrpt->name);
                l->chan->caller.id.number.valid = 1;
                ast_free(l->chan->caller.id.number.str);
                l->chan->caller.id.number.str = ast_strdup(myrpt->name);
@@ -10421,7 +10421,7 @@ static int attempt_reconnect(struct rpt *myrpt, struct rpt_link *l)
        else 
        {
                ast_verb(3, "Unable to place call to %s/%s on %s\n",
        else 
        {
                ast_verb(3, "Unable to place call to %s/%s on %s\n",
-                       deststr,tele,l->chan->name);
+                       deststr,tele,ast_channel_name(l->chan));
                return -1;
        }
        rpt_mutex_lock(&myrpt->lock);
                return -1;
        }
        rpt_mutex_lock(&myrpt->lock);
@@ -13335,12 +13335,12 @@ static int rpt_exec(struct ast_channel *chan, const char *data)
        {
 #ifdef ALLOW_LOCAL_CHANNELS
                /* Check to insure the connection is IAX2 or Local*/
        {
 #ifdef ALLOW_LOCAL_CHANNELS
                /* Check to insure the connection is IAX2 or Local*/
-               if ( (strncmp(chan->name,"IAX2",4)) && (strncmp(chan->name,"Local",5)) ) {
+               if ( (strncmp(ast_channel_name(chan),"IAX2",4)) && (strncmp(ast_channel_name(chan),"Local",5)) ) {
                    ast_log(LOG_WARNING, "We only accept links via IAX2 or Local!!\n");
                    return -1;
                }
 #else
                    ast_log(LOG_WARNING, "We only accept links via IAX2 or Local!!\n");
                    return -1;
                }
 #else
-               if (strncmp(chan->name,"IAX2",4))
+               if (strncmp(ast_channel_name(chan),"IAX2",4))
                {
                        ast_log(LOG_WARNING, "We only accept links via IAX2!!\n");
                        return -1;
                {
                        ast_log(LOG_WARNING, "We only accept links via IAX2!!\n");
                        return -1;
@@ -13485,7 +13485,7 @@ static int rpt_exec(struct ast_channel *chan, const char *data)
                memset(hisip,0,sizeof(hisip));
 #ifdef ALLOW_LOCAL_CHANNELS
         /* set IP address if this is a local connection*/
                memset(hisip,0,sizeof(hisip));
 #ifdef ALLOW_LOCAL_CHANNELS
         /* set IP address if this is a local connection*/
-        if (strncmp(chan->name,"Local",5)==0) {
+        if (strncmp(ast_channel_name(chan),"Local",5)==0) {
             strcpy(hisip,"127.0.0.1");
         } else {
                        pbx_substitute_variables_helper(chan,"${IAXPEER(CURRENTCHANNEL)}",hisip,sizeof(hisip) - 1);
             strcpy(hisip,"127.0.0.1");
         } else {
                        pbx_substitute_variables_helper(chan,"${IAXPEER(CURRENTCHANNEL)}",hisip,sizeof(hisip) - 1);
@@ -13827,7 +13827,7 @@ static int rpt_exec(struct ast_channel *chan, const char *data)
                myrpt->rxchannel->appl = "Apprpt";
                myrpt->rxchannel->data = "(Link Rx)";
                ast_verb(3, "rpt (Rx) initiating call to %s/%s on %s\n",
                myrpt->rxchannel->appl = "Apprpt";
                myrpt->rxchannel->data = "(Link Rx)";
                ast_verb(3, "rpt (Rx) initiating call to %s/%s on %s\n",
-                       myrpt->rxchanname,tele,myrpt->rxchannel->name);
+                       myrpt->rxchanname,tele,ast_channel_name(myrpt->rxchannel));
                rpt_mutex_unlock(&myrpt->lock);
                ast_call(myrpt->rxchannel,tele,999);
                rpt_mutex_lock(&myrpt->lock);
                rpt_mutex_unlock(&myrpt->lock);
                ast_call(myrpt->rxchannel,tele,999);
                rpt_mutex_lock(&myrpt->lock);
@@ -13869,7 +13869,7 @@ static int rpt_exec(struct ast_channel *chan, const char *data)
                        myrpt->txchannel->appl = "Apprpt";
                        myrpt->txchannel->data = "(Link Tx)";
                        ast_verb(3, "rpt (Tx) initiating call to %s/%s on %s\n",
                        myrpt->txchannel->appl = "Apprpt";
                        myrpt->txchannel->data = "(Link Tx)";
                        ast_verb(3, "rpt (Tx) initiating call to %s/%s on %s\n",
-                               myrpt->txchanname,tele,myrpt->txchannel->name);
+                               myrpt->txchanname,tele,ast_channel_name(myrpt->txchannel));
                        rpt_mutex_unlock(&myrpt->lock);
                        ast_call(myrpt->txchannel,tele,999);
                        rpt_mutex_lock(&myrpt->lock);
                        rpt_mutex_unlock(&myrpt->lock);
                        ast_call(myrpt->txchannel,tele,999);
                        rpt_mutex_lock(&myrpt->lock);
@@ -14058,7 +14058,7 @@ static int rpt_exec(struct ast_channel *chan, const char *data)
                time(&myt);
                strftime(mydate,sizeof(mydate) - 1,"%Y%m%d%H%M%S",
                        localtime(&myt));
                time(&myt);
                strftime(mydate,sizeof(mydate) - 1,"%Y%m%d%H%M%S",
                        localtime(&myt));
-               sprintf(mycmd,"mixmonitor start %s %s/%s/%s.wav49 a",chan->name,
+               sprintf(mycmd,"mixmonitor start %s %s/%s/%s.wav49 a",ast_channel_name(chan),
                        myrpt->p.archivedir,myrpt->name,mydate);
                if (myrpt->p.monminblocks)
                {
                        myrpt->p.archivedir,myrpt->name,mydate);
                if (myrpt->p.monminblocks)
                {
@@ -14596,7 +14596,7 @@ static int rpt_exec(struct ast_channel *chan, const char *data)
        }
        /* wait for telem to be done */
        while(myrpt->tele.next != &myrpt->tele) usleep(100000);
        }
        /* wait for telem to be done */
        while(myrpt->tele.next != &myrpt->tele) usleep(100000);
-       sprintf(tmp,"mixmonitor stop %s",chan->name);
+       sprintf(tmp,"mixmonitor stop %s",ast_channel_name(chan));
        ast_cli_command(nullfd,tmp);
        close(nullfd);
        rpt_mutex_lock(&myrpt->lock);
        ast_cli_command(nullfd,tmp);
        close(nullfd);
        rpt_mutex_lock(&myrpt->lock);
index e3f8c52..68770da 100644 (file)
@@ -1658,7 +1658,7 @@ static int sms_generate(struct ast_channel *chan, void *data, int len, int sampl
                }
        }
        if (ast_write(chan, &f) < 0) {
                }
        }
        if (ast_write(chan, &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;
        }
        return 0;
                return -1;
        }
        return 0;
@@ -2015,7 +2015,7 @@ static int sms_exec(struct ast_channel *chan, const char *data)
        }
 
        if ( (res = ast_activate_generator(chan, &smsgen, &h)) < 0) {
        }
 
        if ( (res = ast_activate_generator(chan, &smsgen, &h)) < 0) {
-               ast_log(LOG_ERROR, "Failed to activate generator on '%s'\n", chan->name);
+               ast_log(LOG_ERROR, "Failed to activate generator on '%s'\n", ast_channel_name(chan));
                goto done;
        }
 
                goto done;
        }
 
index cdfd7c1..2a4befa 100644 (file)
@@ -104,7 +104,7 @@ static int softhangup_exec(struct ast_channel *chan, const char *data)
 
        while ((c = ast_channel_iterator_next(iter))) {
                ast_channel_lock(c);
 
        while ((c = ast_channel_iterator_next(iter))) {
                ast_channel_lock(c);
-               ast_copy_string(name, c->name, sizeof(name));
+               ast_copy_string(name, ast_channel_name(c), sizeof(name));
                if (ast_test_flag(&flags, OPTION_ALL)) {
                        /* CAPI is set up like CAPI[foo/bar]/clcnt */ 
                        if (!strcmp(c->tech->type, "CAPI")) {
                if (ast_test_flag(&flags, OPTION_ALL)) {
                        /* CAPI is set up like CAPI[foo/bar]/clcnt */ 
                        if (!strcmp(c->tech->type, "CAPI")) {
@@ -119,7 +119,7 @@ static int softhangup_exec(struct ast_channel *chan, const char *data)
                                *cut = 0;
                }
                if (!strcasecmp(name, args.channel)) {
                                *cut = 0;
                }
                if (!strcasecmp(name, args.channel)) {
-                       ast_log(LOG_WARNING, "Soft hanging %s up.\n", c->name);
+                       ast_log(LOG_WARNING, "Soft hanging %s up.\n", ast_channel_name(c));
                        ast_softhangup(c, AST_SOFTHANGUP_EXPLICIT);
                        if (!ast_test_flag(&flags, OPTION_ALL)) {
        &nb