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)) {
-               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;
        }
 
-       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) {
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_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;
@@ -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"
-                               "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");
 
@@ -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 "
-                                                               "reserved\n", ast->name);
+                                                               "reserved\n", ast_channel_name(ast));
                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_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);
                }
@@ -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",
-                               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);
@@ -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_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) {
 
@@ -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 ? "en" : "dis", ast->name);
+                                                        *cp ? "en" : "dis", ast_channel_name(ast));
 
                        res = 0;
                        break;
@@ -1428,7 +1428,7 @@ static int ooh323_queryoption(struct ast_channel *ast, int option, void *data, i
        }
 
        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);
 
@@ -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"
-                               "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);
 
@@ -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, "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;
@@ -4179,7 +4179,7 @@ static int ooh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance
        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;
@@ -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_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) {
@@ -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->frametype, f->subclass.integer, f->datalen, ast->name);
+                               f->frametype, f->subclass.integer, f->datalen, ast_channel_name(ast));
                }
                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)))) {
-                               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)) {
-                                       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) {
@@ -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)))) {
-                                       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)) {
-                                               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;
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");
-               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;
        }
@@ -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");
-               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;
        }
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)) {
-                               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;
@@ -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)) {
-                       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;
                }
@@ -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_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)) {
-               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;
        }
 
index 35c5005..0e03010 100644 (file)
@@ -192,7 +192,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
        );
 
        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));
@@ -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 ) {
-               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;
@@ -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())) {
-               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;
@@ -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))) {
-                       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;
@@ -285,7 +285,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
 
                        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);
@@ -305,11 +305,11 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
                                
                                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){
-                                               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;
@@ -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",
-                                               chan->name, silenceDuration, initialSilence);
+                                               ast_channel_name(chan), 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",
-                                               chan->name, silenceDuration, afterGreetingSilence);
+                                               ast_channel_name(chan), 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++;
-                                       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){
-                                       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_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);
@@ -363,7 +363,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
                                }
 
                                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);
@@ -373,13 +373,13 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
 
                                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)
-                                               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;
                                }
@@ -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. */
-               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);
        }
@@ -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))
-               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);
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))) {
-                                       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);
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;
 
-       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);
@@ -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);
-       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 */
@@ -534,7 +534,7 @@ static int channel_spy(struct ast_channel *chan, struct ast_autochan *spyee_auto
        }
 
        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);
@@ -685,7 +685,7 @@ static int channel_spy(struct ast_channel *chan, struct ast_autochan *spyee_auto
                        (*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;
@@ -747,7 +747,7 @@ redo:
                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;
@@ -925,7 +925,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
 
                                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';
@@ -943,7 +943,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
                        }
 
                        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, "-");
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",
-               chan->name,
+               ast_channel_name(chan),
                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",
-               chan->name,
+               ast_channel_name(chan),
                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_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);
@@ -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",
-             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)
@@ -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);
-               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) :
@@ -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",
-                       bridge_channel->chan->name,
+                       ast_channel_name(bridge_channel->chan),
                        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) {
-               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) {
-               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);
        }
@@ -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, "%-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);
@@ -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) {
-               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;
-               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;;
        }
@@ -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>"),
-                       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");
        }
@@ -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) {
-               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;
@@ -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) {
-               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;
                }
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) {
-               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) {
-               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);
@@ -192,7 +192,7 @@ dahdiretry:
                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;
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) {
-               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;
        }
 
@@ -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) {
-                                       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;
                                }
@@ -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_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", 
-                                        chan->name, WTERMSIG(status));
+                                        ast_channel_name(chan), WTERMSIG(status));
                        } 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;
@@ -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) {
-                               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;
                }
@@ -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... */
-               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) {
-                       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. */
-                       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);
                }
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",
-               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>"),
@@ -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",
-               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_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)) {
-               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 {
@@ -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);
-                       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",
@@ -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) {
-                                       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)) {
@@ -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) {
-                                               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)) {
@@ -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:
-                                       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;
@@ -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:
-                                       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;
@@ -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) {
-                                               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);
@@ -1272,7 +1272,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                        }
                                        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);
@@ -1289,19 +1289,19 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                        }
                                        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_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_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;
-                                               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);
@@ -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)) {
-                                               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) {
-                                               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);
                                                }
@@ -1336,18 +1336,18 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                        }
                                        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:
-                                       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_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:
@@ -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)) {
-                                               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;
                                        }
@@ -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",
-                                                       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:
@@ -1722,7 +1722,7 @@ static int setup_privacy_args(struct privacy_args *pa,
        } 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? */
@@ -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)
-                       ast_cdr_setdestchan(chan->cdr, tc->name);
+                       ast_cdr_setdestchan(chan->cdr, ast_channel_name(tc));
 
                /* 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) {
-                       ast_cdr_setdestchan(chan->cdr, peer->name);
+                       ast_cdr_setdestchan(chan->cdr, ast_channel_name(peer));
                        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"); 
@@ -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) {
-                               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;
@@ -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. */
-                               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 */
                }
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);
-       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;
        }
@@ -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)) {
-                       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);
@@ -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) {
-               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);
@@ -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);
-       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;
@@ -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, "&"))) {
-               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) {
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",
-                               ((k&1) ? "extension" : "password"),chan->name);
+                               ((k&1) ? "extension" : "password"),ast_channel_name(chan));
                        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) {
-                                                       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;
                                                }
@@ -294,12 +294,12 @@ static int disa_exec(struct ast_channel *chan, const char *data)
                                        }
                                        /* 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 */
-                                       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 */
@@ -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;
-                                       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 {
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",
-               c->name,
+               ast_channel_name(c),
                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,
-               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,
@@ -191,7 +191,7 @@ static int dumpchan_exec(struct ast_channel *chan, const char *data)
                        "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;
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 */
-#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 */
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",
-               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, ""),
@@ -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_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;
                }
        }
@@ -408,11 +408,11 @@ static int transmit_audio(fax_session *s)
                        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) {
-                                       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) {
@@ -421,7 +421,7 @@ static int transmit_audio(fax_session *s)
                                                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;
                                        }
                                }
@@ -435,14 +435,14 @@ static int transmit_audio(fax_session *s)
 
                                        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:
-                                               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:
-                                               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);
@@ -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)
-                       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)
-                       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;
@@ -735,11 +735,11 @@ disable_t38:
                        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) {
-                                       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) {
@@ -748,7 +748,7 @@ disable_t38:
                                                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;
                                        }
                                }
@@ -762,13 +762,13 @@ disable_t38:
 
                                        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:
-                                               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:
-                                               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);
@@ -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) {
-                       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;
                }
        }
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")) {
-               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;
        }
        
@@ -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);
-                               ast_verb(3, "Flashed channel %s\n", chan->name);
+                               ast_verb(3, "Flashed channel %s\n", ast_channel_name(chan));
                        } 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
-                       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
-               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;
 }
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:
-                                               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;
                                                }
@@ -692,7 +692,7 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
                                                }
                                                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;
@@ -720,38 +720,38 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
                                                }
                                                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:
-                                               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:
-                                               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:
-                                               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:
-                                               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:
-                                               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:
-                                               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:
-                                               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:
-                                               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:
-                                               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);
@@ -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) {
-                       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;
                }
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;
-                       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...");
@@ -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) {
-                               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;
                        }
                }
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 = ast_strdupa(chan->name);
+               client_name = ast_strdupa(ast_channel_name(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_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;
        }
@@ -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_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;
        }
 
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:
-                               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;
                        }
                }
@@ -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)) {
-                       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;
                }
 
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->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)" : "",
@@ -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->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" : "",
@@ -1922,7 +1922,7 @@ static void conf_queue_dtmf(const struct ast_conference *conf,
                        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);
@@ -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",
-             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)
@@ -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) {
-               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) {
-               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;
        }
 
@@ -2775,7 +2775,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                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",
@@ -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",
-                       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>"),
@@ -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",
-                                               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 */
@@ -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",
-                                               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)) && 
@@ -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",
-                                                             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",
-                                                            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 */
@@ -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);
-                                                               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, "");
                                                                        }
@@ -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",
-                                                       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",
-                                               chan->name, f->frametype, f->subclass.integer);
+                                               ast_channel_name(chan), f->frametype, f->subclass.integer);
                                }
                                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)) {
-                                                                               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;
                                                                        }
                                                                }
@@ -3780,7 +3780,7 @@ bailoutandtrynormal:
                                                        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;
@@ -3861,7 +3861,7 @@ bailoutandtrynormal:
                                "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>"),
@@ -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;
 
-       if (!strcmp(user->chan->name, channel)) {
+       if (!strcmp(ast_channel_name(user->chan), channel)) {
                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_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");
@@ -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>"),
-                               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",
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) {
-               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;
        }
 
@@ -132,7 +132,7 @@ static int old_milliwatt_exec(struct ast_channel *chan)
        }
 
        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;
        }
 
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->name,
+                       ast_channel_name(chan),
                        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;
        }
 
-       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);
@@ -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",
-                       mixmonitor_spy_type, chan->name);
+                       mixmonitor_spy_type, ast_channel_name(chan));
                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_copy_string(originator, chan->name, sizeof(originator));
+       ast_copy_string(originator, ast_channel_name(chan), sizeof(originator));
        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_verb(4, "Channel %s was answered.\n", dchan->name);
+                       ast_verb(4, "Channel %s was answered.\n", ast_channel_name(dchan));
                } 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;
@@ -218,7 +218,7 @@ static int parkandannounce_exec(struct ast_channel *chan, const char *data)
                        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 {
-                               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;
                        }
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",
-                       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 );
-               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");
@@ -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",
-                       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);
@@ -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",
-                               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;
@@ -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 */
-               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);
@@ -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",
-                       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"),
@@ -3489,7 +3489,7 @@ static void rna(int rnatime, struct queue_ent *qe, char *interface, char *member
                                                "%s",
                                                qe->parent->name,
                                                qe->chan->uniqueid,
-                                               qe->chan->name,
+                                               ast_channel_name(qe->chan),
                                                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);
-       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);
@@ -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);
-                               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)) {
@@ -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)) {
-               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 {
-               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;
        }
 
@@ -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;
-       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);
 }
 
@@ -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",
-               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) : "");
 }
@@ -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",
-                                                       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;
@@ -4708,7 +4708,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                        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 */
@@ -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 */
-                               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",
@@ -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",
-                                                       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*/
-                               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);
@@ -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_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", "");
-                       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);
@@ -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",
-                                       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));
@@ -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)) {
-               args.interface = ast_strdupa(chan->name);
+               args.interface = ast_strdupa(ast_channel_name(chan));
                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)) {
-               args.interface = ast_strdupa(chan->name);
+               args.interface = ast_strdupa(ast_channel_name(chan));
                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) {
-                       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",
-                               user_priority, chan->name);
+                               user_priority, ast_channel_name(chan));
                        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) {
-                       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",
-                               max_penalty_str, chan->name);
+                               max_penalty_str, ast_channel_name(chan));
                        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) {
-                       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",
-                               min_penalty_str, chan->name);
+                               min_penalty_str, ast_channel_name(chan));
                        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)) {
-                       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;
                }
        }
@@ -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)",
-                                       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));
                        }
@@ -7593,7 +7593,7 @@ static int manager_queues_status(struct mansession *s, const struct message *m)
                                        "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"),
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 {
-                       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";
index 6098ca7..18101e4 100644 (file)
@@ -272,7 +272,7 @@ static int record_exec(struct ast_channel *chan, const char *data)
        }
 
        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;
        }
@@ -283,7 +283,7 @@ static int record_exec(struct ast_channel *chan, const char *data)
                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);
        }
@@ -416,7 +416,7 @@ out:
        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);
        }
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_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);
                }
@@ -3708,7 +3708,7 @@ int       res;
        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;
 }
@@ -3721,7 +3721,7 @@ int       res;
        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;
 }
@@ -3733,7 +3733,7 @@ static int saynum(struct ast_channel *mychannel, int num)
        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;
 }
@@ -4229,7 +4229,7 @@ struct ast_format_cap *cap = NULL;
 
                        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 */
@@ -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_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);
                        }
                }
@@ -4252,7 +4252,7 @@ struct ast_format_cap *cap = NULL;
                        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]))
                {
@@ -4287,7 +4287,7 @@ struct ast_format_cap *cap = NULL;
                                        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)
@@ -4383,7 +4383,7 @@ struct ast_format_cap *cap = NULL;
                        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;
@@ -4446,13 +4446,13 @@ struct ast_format_cap *cap = NULL;
                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_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;
@@ -4826,7 +4826,7 @@ struct ast_format_cap *cap = NULL;
                        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);
@@ -4851,7 +4851,7 @@ struct ast_format_cap *cap = NULL;
                        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;
@@ -4868,7 +4868,7 @@ struct ast_format_cap *cap = NULL;
                        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;
                }                       
@@ -4878,7 +4878,7 @@ struct ast_format_cap *cap = NULL;
                        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 */
@@ -4912,7 +4912,7 @@ struct ast_format_cap *cap = NULL;
                        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 */
@@ -4936,7 +4936,7 @@ struct ast_format_cap *cap = NULL;
                        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)
@@ -4945,7 +4945,7 @@ struct ast_format_cap *cap = NULL;
                        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;
@@ -4980,7 +4980,7 @@ struct ast_format_cap *cap = NULL;
                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;
@@ -5000,7 +5000,7 @@ struct ast_format_cap *cap = NULL;
                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");
@@ -5023,7 +5023,7 @@ struct ast_format_cap *cap = NULL;
                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 - 
@@ -5043,7 +5043,7 @@ struct ast_format_cap *cap = NULL;
                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 - 
@@ -5115,7 +5115,7 @@ struct ast_format_cap *cap = NULL;
                        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:
@@ -5154,7 +5154,7 @@ struct ast_format_cap *cap = NULL;
                                        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;
                                        }
                                }
@@ -5186,7 +5186,7 @@ struct ast_format_cap *cap = NULL;
                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;
                }
        }
@@ -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",
-               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);
@@ -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",
-               deststr,tele,l->chan->name);
+               deststr,tele,ast_channel_name(l->chan));
                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)
        {
-               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;
        }
 }
@@ -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",
-                       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);
@@ -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",
-                       deststr,tele,l->chan->name);
+                       deststr,tele,ast_channel_name(l->chan));
                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*/
-               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
-               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;
@@ -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*/
-        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);
@@ -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->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);
@@ -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->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);
@@ -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));
-               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)
                {
@@ -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);
-       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);
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) {
-               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;
@@ -2015,7 +2015,7 @@ static int sms_exec(struct ast_channel *chan, const char *data)
        }
 
        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;
        }
 
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);
-               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")) {
@@ -119,7 +119,7 @@ static int softhangup_exec(struct ast_channel *chan, const char *data)
                                *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)) {
                                ast_channel_unlock(c);
index c5f0b6a..83de481 100644 (file)
@@ -231,7 +231,7 @@ static int frame_set_var(struct ast_channel *chan, struct gosub_stack_frame *fra
                "Variable: LOCAL(%s)\r\n"
                "Value: %s\r\n"
                "Uniqueid: %s\r\n",
-               chan->name, var, value, chan->uniqueid);
+               ast_channel_name(chan), var, value, chan->uniqueid);
        return 0;
 }
 
@@ -358,7 +358,7 @@ static int gosub_exec(struct ast_channel *chan, const char *data)
        }
 
        if (!stack_store) {
-               ast_debug(1, "Channel %s has no datastore, so we're allocating one.\n", chan->name);
+               ast_debug(1, "Channel %s has no datastore, so we're allocating one.\n", ast_channel_name(chan));
                stack_store = ast_datastore_alloc(&stack_info, NULL);
                if (!stack_store) {
                        ast_log(LOG_ERROR, "Unable to allocate new datastore.  Gosub will fail.\n");
index 9eb8002..a177227 100644 (file)
@@ -145,7 +145,7 @@ static int background_detect_exec(struct ast_channel *chan, const char *data)
                }
                ast_stopstream(chan);
                if (ast_streamfile(chan, tmp, chan->language)) {
-                       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);
                        break;
                }
                detection_start = ast_tvnow();
@@ -160,7 +160,7 @@ static int background_detect_exec(struct ast_channel *chan, const char *data)
                        }
                        res = ast_waitfor(chan, res);
                        if (res < 0) {
-                               ast_log(LOG_WARNING, "Waitfor failed on %s\n", chan->name);
+                               ast_log(LOG_WARNING, "Waitfor failed on %s\n", ast_channel_name(chan));
                                break;
                        } else if (res > 0) {
                                fr = ast_read(chan);
@@ -169,7 +169,7 @@ static int background_detect_exec(struct ast_channel *chan, const char *data)
                                         * frames and the time has not expired */
                                        if (ast_tvdiff_ms(ast_tvnow(), detection_start) >= analysistime) {
                                                continue_analysis = 0;
-                                               ast_verb(3, "BackgroundDetect: Talk analysis time complete on %s.\n", chan->name);
+                                               ast_verb(3, "BackgroundDetect: Talk analysis time complete on %s.\n", ast_channel_name(chan));
                                        }
                                }
                                
@@ -235,7 +235,7 @@ static int background_detect_exec(struct ast_channel *chan, const char *data)
        if (res > -1) {
                if (origrformat.id && ast_set_read_format(chan, &origrformat)) {
                        ast_log(LOG_WARNING, "Failed to restore read format for %s to %s\n", 
-                               chan->name, ast_getformatname(&origrformat));
+                               ast_channel_name(chan), ast_getformatname(&origrformat));
                }
        }
        if (dsp) {
index 32b6fc0..9e11866 100644 (file)
@@ -199,7 +199,7 @@ static int testclient_exec(struct ast_channel *chan, const char *data)
                snprintf(fn, sizeof(fn), "%s/testresults/%s-client.txt", ast_config_AST_LOG_DIR, testid);
                if ((f = fopen(fn, "w+"))) {
                        setlinebuf(f);
-                       fprintf(f, "CLIENTCHAN:    %s\n", chan->name);
+                       fprintf(f, "CLIENTCHAN:    %s\n", ast_channel_name(chan));
                        fprintf(f, "CLIENTTEST ID: %s\n", testid);
                        fprintf(f, "ANSWER:        PASS\n");
                        res = 0;
@@ -317,7 +317,7 @@ static int testclient_exec(struct ast_channel *chan, const char *data)
                } else
                        res = -1;
        } else {
-               ast_log(LOG_NOTICE, "Did not read a test ID on '%s'\n", chan->name);
+               ast_log(LOG_NOTICE, "Did not read a test ID on '%s'\n", ast_channel_name(chan));
                res = -1;
        }
        return res;
@@ -361,7 +361,7 @@ static int testserver_exec(struct ast_channel *chan, const char *data)
                snprintf(fn, sizeof(fn), "%s/testresults/%s-server.txt", ast_config_AST_LOG_DIR, testid);
                if ((f = fopen(fn, "w+"))) {
                        setlinebuf(f);
-                       fprintf(f, "SERVERCHAN:    %s\n", chan->name);
+                       fprintf(f, "SERVERCHAN:    %s\n", ast_channel_name(chan));
                        fprintf(f, "SERVERTEST ID: %s\n", testid);
                        fprintf(f, "ANSWER:        PASS\n");
                        ast_debug(1, "Processing Test ID '%s'\n", testid);
@@ -467,7 +467,7 @@ static int testserver_exec(struct ast_channel *chan, const char *data)
                } else
                        res = -1;
        } else {
-               ast_log(LOG_NOTICE, "Did not read a test ID on '%s'\n", chan->name);
+               ast_log(LOG_NOTICE, "Did not read a test ID on '%s'\n", ast_channel_name(chan));
                res = -1;
        }
        return res;
index 8be69e5..062e103 100644 (file)
@@ -4757,7 +4757,7 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
                /* flag added for Urgent */
                fprintf(p, "X-Asterisk-VM-Flag: %s" ENDL, flag);
                fprintf(p, "X-Asterisk-VM-Priority: %d" ENDL, chan->priority);
-               fprintf(p, "X-Asterisk-VM-Caller-channel: %s" ENDL, chan->name);
+               fprintf(p, "X-Asterisk-VM-Caller-channel: %s" ENDL, ast_channel_name(chan));
                fprintf(p, "X-Asterisk-VM-Caller-ID-Num: %s" ENDL, enc_cidnum);
                fprintf(p, "X-Asterisk-VM-Caller-ID-Name: %s" ENDL, enc_cidname);
                fprintf(p, "X-Asterisk-VM-Duration: %d" ENDL, duration);
@@ -6024,7 +6024,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
                                "macrocontext", chan->macrocontext,
                                "exten", chan->exten,
                                "priority", priority,
-                               "callerchan", chan->name,
+                               "callerchan", ast_channel_name(chan),
                                "callerid", callerid,
                                "origdate", date,
                                "origtime", origtime,
@@ -6064,7 +6064,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
                                S_COR(chan->redirecting.from.number.valid,
                                        chan->redirecting.from.number.str, "unknown"),
                                chan->priority,
-                               chan->name,
+                               ast_channel_name(chan),
                                callerid,
                                date, (long) time(NULL),
                                category ? category : "");
index a920e11..3d3aa75 100644 (file)
@@ -200,7 +200,7 @@ static int do_waiting(struct ast_channel *chan, int timereqd, time_t waitstart,
 
 
        if (rfmt.id && ast_set_read_format(chan, &rfmt)) {
-               ast_log(LOG_WARNING, "Unable to restore format %s to channel '%s'\n", ast_getformatname(&rfmt), chan->name);
+               ast_log(LOG_WARNING, "Unable to restore format %s to channel '%s'\n", ast_getformatname(&rfmt), ast_channel_name(chan));
        }
        ast_dsp_free(sildet);
        return res;
index e004dfd..9ca6aa4 100644 (file)
@@ -318,7 +318,7 @@ static int multiplexed_bridge_join(struct ast_bridge *bridge, struct ast_bridge_
        struct ast_channel *c0 = AST_LIST_FIRST(&bridge->channels)->chan, *c1 = AST_LIST_LAST(&bridge->channels)->chan;
        struct multiplexed_thread *multiplexed_thread = bridge->bridge_pvt;
 
-       ast_debug(1, "Adding channel '%s' to multiplexed thread '%p' for monitoring\n", bridge_channel->chan->name, multiplexed_thread);
+       ast_debug(1, "Adding channel '%s' to multiplexed thread '%p' for monitoring\n", ast_channel_name(bridge_channel->chan), multiplexed_thread);
 
        multiplexed_add_or_remove(multiplexed_thread, bridge_channel->chan, 1);
 
@@ -341,7 +341,7 @@ static int multiplexed_bridge_leave(struct ast_bridge *bridge, struct ast_bridge
 {
        struct multiplexed_thread *multiplexed_thread = bridge->bridge_pvt;
 
-       ast_debug(1, "Removing channel '%s' from multiplexed thread '%p'\n", bridge_channel->chan->name, multiplexed_thread);
+       ast_debug(1, "Removing channel '%s' from multiplexed thread '%p'\n", ast_channel_name(bridge_channel->chan), multiplexed_thread);
 
        multiplexed_add_or_remove(multiplexed_thread, bridge_channel->chan, 0);
 
@@ -353,7 +353,7 @@ static void multiplexed_bridge_suspend(struct ast_bridge *bridge, struct ast_bri
 {
        struct multiplexed_thread *multiplexed_thread = bridge->bridge_pvt;
 
-       ast_debug(1, "Suspending channel '%s' from multiplexed thread '%p'\n", bridge_channel->chan->name, multiplexed_thread);
+       ast_debug(1, "Suspending channel '%s' from multiplexed thread '%p'\n", ast_channel_name(bridge_channel->chan), multiplexed_thread);
 
        multiplexed_add_or_remove(multiplexed_thread, bridge_channel->chan, 0);
 
@@ -365,7 +365,7 @@ static void multiplexed_bridge_unsuspend(struct ast_bridge *bridge, struct ast_b
 {
        struct multiplexed_thread *multiplexed_thread = bridge->bridge_pvt;
 
-       ast_debug(1, "Unsuspending channel '%s' from multiplexed thread '%p'\n", bridge_channel->chan->name, multiplexed_thread);
+       ast_debug(1, "Unsuspending channel '%s' from multiplexed thread '%p'\n", ast_channel_name(bridge_channel->chan), multiplexed_thread);
 
        multiplexed_add_or_remove(multiplexed_thread, bridge_channel->chan, 1);
 
index 13f080e..75aceac 100644 (file)
@@ -606,7 +606,7 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
                case AST_FRAME_CONTROL:
                        if (f->subclass.integer == AST_CONTROL_ANSWER) {
                                if (p->ackcall) {
-                                       ast_verb(3, "%s answered, waiting for '%c' to acknowledge\n", p->chan->name, p->acceptdtmf);
+                                       ast_verb(3, "%s answered, waiting for '%c' to acknowledge\n", ast_channel_name(p->chan), p->acceptdtmf);
                                        /* Don't pass answer along */
                                        ast_frfree(f);
                                        f = &ast_null_frame;
@@ -628,7 +628,7 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
                        break;
                case AST_FRAME_DTMF_END:
                        if (!p->acknowledged && (f->subclass.integer == p->acceptdtmf)) {
-                               ast_verb(3, "%s acknowledged\n", p->chan->name);
+                               ast_verb(3, "%s acknowledged\n", ast_channel_name(p->chan));
                                p->acknowledged = 1;
                                ast_frfree(f);
                                f = &answer_frame;
@@ -656,7 +656,7 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
                if (strcasecmp(p->chan->tech->type, "Local")) {
                        p->chan->_bridge = ast;
                        if (p->chan)
-                               ast_debug(1, "Bridge on '%s' being set to '%s' (3)\n", p->chan->name, p->chan->_bridge->name);
+                               ast_debug(1, "Bridge on '%s' being set to '%s' (3)\n", ast_channel_name(p->chan), ast_channel_name(p->chan->_bridge));
                }
        }
        ast_mutex_unlock(&p->lock);
@@ -703,7 +703,7 @@ static int agent_write(struct ast_channel *ast, struct ast_frame *f)
                } else {
                        ast_debug(1, "Dropping one incompatible %s frame on '%s' to '%s'\n", 
                                f->frametype == AST_FRAME_VOICE ? "audio" : "video",
-                               ast->name, p->chan->name);
+                               ast_channel_name(ast), ast_channel_name(p->chan));
                        res = 0;
                }
        }
@@ -794,7 +794,7 @@ static int agent_call(struct ast_channel *ast, char *dest, int timeout)
                ast_mutex_unlock(&p->lock);
                return res;
        }
-       ast_verb(3, "agent_call, call to agent '%s' call on '%s'\n", p->agent, p->chan->name);
+       ast_verb(3, "agent_call, call to agent '%s' call on '%s'\n", p->agent, ast_channel_name(p->chan));
        ast_debug(3, "Playing beep, lang '%s'\n", p->chan->language);
        
        chan = p->chan;
@@ -878,7 +878,7 @@ int agent_set_base_channel(struct ast_channel *chan, struct ast_channel *base)
        }
        p = chan->tech_pvt;
        if (!p) {
-               ast_log(LOG_ERROR, "whoa, channel %s is missing his tech_pvt structure!!.\n", chan->name);
+               ast_log(LOG_ERROR, "whoa, channel %s is missing his tech_pvt structure!!.\n", ast_channel_name(chan));
                return -1;
        }
        p->chan = base;
@@ -1035,7 +1035,7 @@ static struct ast_channel *agent_bridgedchannel(struct ast_channel *chan, struct
                        ret = p->chan;
        }
 
-       ast_debug(1, "Asked for bridged channel on '%s'/'%s', returning '%s'\n", chan->name, bridge->name, ret ? ret->name : "<none>");
+       ast_debug(1, "Asked for bridged channel on '%s'/'%s', returning '%s'\n", ast_channel_name(chan), ast_channel_name(bridge), ret ? ast_channel_name(ret) : "<none>");
        return ret;
 }
 
@@ -1268,7 +1268,7 @@ static int check_availability(struct agent_pvt *newlyavailable, int needlock)
                }
                ast_mutex_lock(&p->lock);
                if (!p->abouttograb && p->pending && ((p->group && (newlyavailable->group & p->group)) || !strcmp(p->agent, newlyavailable->agent))) {
-                       ast_debug(1, "Call '%s' looks like a winner for agent '%s'\n", p->owner->name, newlyavailable->agent);
+                       ast_debug(1, "Call '%s' looks like a winner for agent '%s'\n", ast_channel_name(p->owner), newlyavailable->agent);
                        /* We found a pending call, time to merge */
                        chan = agent_new(newlyavailable, AST_STATE_DOWN, p->owner ? p->owner->linkedid : NULL);
                        parent = p->owner;
@@ -1330,7 +1330,7 @@ static int check_beep(struct agent_pvt *newlyavailable, int needlock)
                }
                ast_mutex_lock(&p->lock);
                if (!p->abouttograb && p->pending && ((p->group && (newlyavailable->group & p->group)) || !strcmp(p->agent, newlyavailable->agent))) {
-                       ast_debug(1, "Call '%s' looks like a would-be winner for agent '%s'\n", p->owner->name, newlyavailable->agent);
+                       ast_debug(1, "Call '%s' looks like a would-be winner for agent '%s'\n", ast_channel_name(p->owner), newlyavailable->agent);
                        ast_mutex_unlock(&p->lock);
                        break;
                }
@@ -1528,13 +1528,13 @@ static int action_agents(struct mansession *s, const struct message *m)
                status = "AGENT_UNKNOWN";
 
                if (p->chan) {
-                       loginChan = ast_strdupa(p->chan->name);
+                       loginChan = ast_strdupa(ast_channel_name(p->chan));
                        if (p->owner && p->owner->_bridge) {
                                talkingto = S_COR(p->chan->caller.id.number.valid,
                                        p->chan->caller.id.number.str, "n/a");
                                ast_channel_lock(p->owner);
                                if ((bridge = ast_bridged_channel(p->owner))) {
-                                       talkingtoChan = ast_strdupa(bridge->name);
+                                       talkingtoChan = ast_strdupa(ast_channel_name(bridge));
                                } else {
                                        talkingtoChan = "n/a";
                                }
@@ -1739,9 +1739,9 @@ static char *agents_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
                        else
                                username[0] = '\0';
                        if (p->chan) {
-                               snprintf(location, sizeof(location), "logged in on %s", p->chan->name);
+                               snprintf(location, sizeof(location), "logged in on %s", ast_channel_name(p->chan));
                                if (p->owner && ast_bridged_channel(p->owner))
-                                       snprintf(talkingto, sizeof(talkingto), " talking to %s", ast_bridged_channel(p->owner)->name);
+                                       snprintf(talkingto, sizeof(talkingto), " talking to %s", ast_channel_name(ast_bridged_channel(p->owner)));
                                 else 
                                        strcpy(talkingto, " is idle");
                                online_agents++;
@@ -1803,9 +1803,9 @@ static char *agents_show_online(struct ast_cli_entry *e, int cmd, struct ast_cli
                else
                        username[0] = '\0';
                if (p->chan) {
-                       snprintf(location, sizeof(location), "logged in on %s", p->chan->name);
+                       snprintf(location, sizeof(location), "logged in on %s", ast_channel_name(p->chan));
                        if (p->owner && ast_bridged_channel(p->owner)) 
-                               snprintf(talkingto, sizeof(talkingto), " talking to %s", ast_bridged_channel(p->owner)->name);
+                               snprintf(talkingto, sizeof(talkingto), " talking to %s", ast_channel_name(ast_bridged_channel(p->owner)));
                        else 
                                strcpy(talkingto, " is idle");
                        agent_status = 1;
@@ -1887,7 +1887,7 @@ static int login_exec(struct ast_channel *chan, const char *data)
                if (max_login_tries < 0)
                        max_login_tries = 0;
                tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTMAXLOGINTRIES");
-               ast_verb(3, "Saw variable AGENTMAXLOGINTRIES=%s, setting max_login_tries to: %d on Channel '%s'.\n",tmpoptions,max_login_tries,chan->name);
+               ast_verb(3, "Saw variable AGENTMAXLOGINTRIES=%s, setting max_login_tries to: %d on Channel '%s'.\n",tmpoptions,max_login_tries,ast_channel_name(chan));
        }
        if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "AGENTUPDATECDR"))) {
                if (ast_true(pbx_builtin_getvar_helper(chan, "AGENTUPDATECDR")))
@@ -1895,12 +1895,12 @@ static int login_exec(struct ast_channel *chan, const char *data)
                else
                        update_cdr = 0;
                tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTUPDATECDR");
-               ast_verb(3, "Saw variable AGENTUPDATECDR=%s, setting update_cdr to: %d on Channel '%s'.\n",tmpoptions,update_cdr,chan->name);
+               ast_verb(3, "Saw variable AGENTUPDATECDR=%s, setting update_cdr to: %d on Channel '%s'.\n",tmpoptions,update_cdr,ast_channel_name(chan));
        }
        if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "AGENTGOODBYE"))) {
                strcpy(agent_goodbye, pbx_builtin_getvar_helper(chan, "AGENTGOODBYE"));
                tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTGOODBYE");
-               ast_verb(3, "Saw variable AGENTGOODBYE=%s, setting agent_goodbye to: %s on Channel '%s'.\n",tmpoptions,agent_goodbye,chan->name);
+               ast_verb(3, "Saw variable AGENTGOODBYE=%s, setting agent_goodbye to: %s on Channel '%s'.\n",tmpoptions,agent_goodbye,ast_channel_name(chan));
        }
        ast_channel_unlock(chan);
        /* End Channel Specific Login Overrides */
@@ -2043,10 +2043,10 @@ static int login_exec(struct ast_channel *chan, const char *data)
                                                              "Agent: %s\r\n"
                                                              "Channel: %s\r\n"
                                                              "Uniqueid: %s\r\n",
-                                                             p->agent, chan->name, chan->uniqueid);
+                                                             p->agent, ast_channel_name(chan), chan->uniqueid);
                                                if (update_cdr && chan->cdr)
                                                        snprintf(chan->cdr->channel, sizeof(chan->cdr->channel), "Agent/%s", p->agent);
-                                               ast_queue_log("NONE", chan->uniqueid, agent, "AGENTLOGIN", "%s", chan->name);
+                                               ast_queue_log("NONE", chan->uniqueid, agent, "AGENTLOGIN", "%s", ast_channel_name(chan));
                                                ast_verb(2, "Agent '%s' logged in (format %s/%s)\n", p->agent,
                                                                    ast_getformatname(&chan->readformat), ast_getformatname(&chan->writeformat));
                                                /* Login this channel and wait for it to go away */
@@ -2136,7 +2136,7 @@ static int login_exec(struct ast_channel *chan, const char *data)
                                                              "Logintime: %ld\r\n"
                                                              "Uniqueid: %s\r\n",
                                                              p->agent, logintime, chan->uniqueid);
-                                               ast_queue_log("NONE", chan->uniqueid, agent, "AGENTLOGOFF", "%s|%ld", chan->name, logintime);
+                                               ast_queue_log("NONE", chan->uniqueid, agent, "AGENTLOGOFF", "%s|%ld", ast_channel_name(chan), logintime);
                                                ast_verb(2, "Agent '%s' logged out\n", p->agent);
                                                /* If there is no owner, go ahead and kill it now */
                                                ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
@@ -2345,7 +2345,7 @@ static int function_agent(struct ast_channel *chan, const char *cmd, char *data,
        else if (!strcasecmp(args.item, "channel")) {
                if (agent->chan) {
                        ast_channel_lock(agent->chan);
-                       ast_copy_string(buf, agent->chan->name, len);
+                       ast_copy_string(buf, ast_channel_name(agent->chan), len);
                        ast_channel_unlock(agent->chan);
                        tmp = strrchr(buf, '-');
                        if (tmp)
@@ -2354,7 +2354,7 @@ static int function_agent(struct ast_channel *chan, const char *cmd, char *data,
        } else if (!strcasecmp(args.item, "fullchannel")) {
                if (agent->chan) {
                        ast_channel_lock(agent->chan);
-                       ast_copy_string(buf, agent->chan->name, len);
+                       ast_copy_string(buf, ast_channel_name(agent->chan), len);
                        ast_channel_unlock(agent->chan);
                } 
        } else if (!strcasecmp(args.item, "exten")) {
index bd9aea5..8f38090 100644 (file)
@@ -554,7 +554,7 @@ static int alsa_indicate(struct ast_channel *chan, int cond, const void *data, s
                ast_moh_stop(chan);
                break;
        default:
-               ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, chan->name);
+               ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, ast_channel_name(chan));
                res = -1;
        }
 
@@ -588,7 +588,7 @@ static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state, const ch
        ast_jb_configure(tmp, &global_jbconf);
        if (state != AST_STATE_DOWN) {
                if (ast_pbx_start(tmp)) {
-                       ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
+                       ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ast_channel_name(tmp));
                        ast_hangup(tmp);
                        tmp = NULL;
                }
index 7a40f9b..7e23010 100644 (file)
@@ -621,7 +621,7 @@ static int console_indicate(struct ast_channel *chan, int cond, const void *data
                break;
        default:
                ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", 
-                       cond, chan->name);
+                       cond, ast_channel_name(chan));
                /* The core will play inband indications for us if appropriate */
                res = -1;
        }
index ce5b28b..da167d6 100644 (file)
@@ -2060,7 +2060,7 @@ static void my_handle_dtmf(void *pvt, struct ast_channel *ast, enum analog_sub a
 
        ast_debug(1, "%s DTMF digit: 0x%02X '%c' on %s\n",
                f->frametype == AST_FRAME_DTMF_BEGIN ? "Begin" : "End",
-               f->subclass.integer, f->subclass.integer, ast->name);
+               f->subclass.integer, f->subclass.integer, ast_channel_name(ast));
 
        if (f->subclass.integer == 'f') {
                if (f->frametype == AST_FRAME_DTMF_END) {
@@ -2076,7 +2076,7 @@ static void my_handle_dtmf(void *pvt, struct ast_channel *ast, enum analog_sub a
                                        int res;
 
                                        if ((res = ioctl(p->subs[idx].dfd, DAHDI_SET_BUFINFO, &bi)) < 0) {
-                                               ast_log(LOG_WARNING, "Channel '%s' unable to set buffer policy, reason: %s\n", ast->name, strerror(errno));
+                                               ast_log(LOG_WARNING, "Channel '%s' unable to set buffer policy, reason: %s\n", ast_channel_name(ast), strerror(errno));
                                        } else {
                                                p->bufferoverrideinuse = 1;
                                        }
@@ -2085,7 +2085,7 @@ static void my_handle_dtmf(void *pvt, struct ast_channel *ast, enum analog_sub a
                                if (p->dsp) {
                                        p->dsp_features &= ~DSP_FEATURE_FAX_DETECT;
                                        ast_dsp_set_features(p->dsp, p->dsp_features);
-                                       ast_debug(1, "Disabling FAX tone detection on %s after tone received\n", ast->name);
+                                       ast_debug(1, "Disabling FAX tone detection on %s after tone received\n", ast_channel_name(ast));
                                }
                                if (strcmp(ast->exten, "fax")) {
                                        const char *target_context = S_OR(ast->macrocontext, ast->context);
@@ -2100,11 +2100,11 @@ static void my_handle_dtmf(void *pvt, struct ast_channel *ast, enum analog_sub a
                                                S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) {
                                                ast_channel_lock(ast);
                                                ast_mutex_lock(&p->lock);
-                                               ast_verb(3, "Redirecting %s to fax extension\n", ast->name);
+                                               ast_verb(3, "Redirecting %s to fax extension\n", ast_channel_name(ast));
                                                /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */
                                                pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast->exten);
                                                if (ast_async_goto(ast, target_context, "fax", 1))
-                                                       ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast->name, target_context);
+                                                       ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(ast), target_context);
                                        } else {
                                                ast_channel_lock(ast);
                                                ast_mutex_lock(&p->lock);
@@ -2172,7 +2172,7 @@ static void dahdi_ami_channel_event(struct dahdi_pvt *p, struct ast_channel *cha
                "Uniqueid: %s\r\n"
                "DAHDISpan: %d\r\n"
                "DAHDIChannel: %s\r\n",
-               chan->name,
+               ast_channel_name(chan),
                chan->uniqueid,
                p->span,
                ch_name);
@@ -2254,11 +2254,11 @@ static void my_set_cadence(void *pvt, int *cidrings, struct ast_channel *ast)
        /* Choose proper cadence */
        if ((p->distinctivering > 0) && (p->distinctivering <= num_cadence)) {
                if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCADENCE, &cadences[p->distinctivering - 1]))
-                       ast_log(LOG_WARNING, "Unable to set distinctive ring cadence %d on '%s': %s\n", p->distinctivering, ast->name, strerror(errno));
+                       ast_log(LOG_WARNING, "Unable to set distinctive ring cadence %d on '%s': %s\n", p->distinctivering, ast_channel_name(ast), strerror(errno));
                *cidrings = cidrings[p->distinctivering - 1];
        } else {
                if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCADENCE, NULL))
-                       ast_log(LOG_WARNING, "Unable to reset default ring on '%s': %s\n", ast->name, strerror(errno));
+                       ast_log(LOG_WARNING, "Unable to reset default ring on '%s': %s\n", ast_channel_name(ast), strerror(errno));
                *cidrings = p->sendcalleridafter;
        }
 }
@@ -2989,7 +2989,7 @@ static int my_dial_digits(void *pvt, enum analog_sub sub, struct analog_dialoper
 
        res = ioctl(p->subs[index].dfd, DAHDI_DIAL, &ddop);
        if (res == -1) {
-               ast_debug(1, "DAHDI_DIAL ioctl failed on %s: %s\n", p->owner->name, strerror(errno));
+               ast_debug(1, "DAHDI_DIAL ioctl failed on %s: %s\n", ast_channel_name(p->owner), strerror(errno));
        }
 
        return res;
@@ -3715,7 +3715,7 @@ static int _dahdi_get_index(struct ast_channel *ast, struct dahdi_pvt *p, int nu
                if (!nullok)
                        ast_log(LOG_WARNING,
                                "Unable to get index for '%s' on channel %d (%s(), line %lu)\n",
-                               ast ? ast->name : "", p->channel, fname, line);
+                               ast ? ast_channel_name(ast) : "", p->channel, fname, line);
        }
        return res;
 }
@@ -3824,12 +3824,12 @@ static openr2_calling_party_category_t dahdi_r2_get_channel_category(struct ast_
        struct dahdi_pvt *p = c->tech_pvt;
        if (ast_strlen_zero(catstr)) {
                ast_debug(1, "No MFC/R2 category specified for chan %s, using default %s\n",
-                               c->name, openr2_proto_get_category_string(p->mfcr2_category));
+                               ast_channel_name(c), openr2_proto_get_category_string(p->mfcr2_category));
                return p->mfcr2_category;
        }
        if ((cat = openr2_proto_get_category(catstr)) == OR2_CALLING_PARTY_CATEGORY_UNKNOWN) {
                ast_log(LOG_WARNING, "Invalid category specified '%s' for chan %s, using default %s\n",
-                               catstr, c->name, openr2_proto_get_category_string(p->mfcr2_category));
+                               catstr, ast_channel_name(c), openr2_proto_get_category_string(p->mfcr2_category));
                return p->mfcr2_category;
        }
        ast_debug(1, "Using category %s\n", catstr);
@@ -5367,7 +5367,7 @@ static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout)
                return 0;
        }
        if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) {
-               ast_log(LOG_WARNING, "dahdi_call called on %s, neither down nor reserved\n", ast->name);
+               ast_log(LOG_WARNING, "dahdi_call called on %s, neither down nor reserved\n", ast_channel_name(ast));
                ast_mutex_unlock(&p->lock);
                return -1;
        }
@@ -5937,7 +5937,7 @@ static int dahdi_send_callrerouting_facility_exec(struct ast_channel *chan, cons
                break;
        default:
                ast_debug(1, "callrerouting attempted on non-ISDN channel %s\n",
-                       chan->name);
+                       ast_channel_name(chan));
                return -1;
        }
 
@@ -6009,13 +6009,13 @@ static int dahdi_accept_r2_call_exec(struct ast_channel *chan, const char *data)
        ast_mutex_lock(&p->lock);
        if (!p->mfcr2 || !p->mfcr2call) {
                ast_mutex_unlock(&p->lock);
-               ast_debug(1, "Channel %s does not seems to be an R2 active channel!\n", chan->name);
+               ast_debug(1, "Channel %s does not seems to be an R2 active channel!\n", ast_channel_name(chan));
                return -1;
        }
 
        if (p->mfcr2_call_accepted) {
                ast_mutex_unlock(&p->lock);
-               ast_debug(1, "MFC/R2 call already accepted on channel %s!\n", chan->name);
+               ast_debug(1, "MFC/R2 call already accepted on channel %s!\n", ast_channel_name(chan));
                return 0;
        }
        accept_mode = ast_true(args.charge) ? OR2_CALL_WITH_CHARGE : OR2_CALL_NO_CHARGE;
@@ -6037,7 +6037,7 @@ static int dahdi_accept_r2_call_exec(struct ast_channel *chan, const char *data)
                }
                res = ast_waitfor(chan, timeout);
                if (res < 0) {
-                       ast_debug(1, "ast_waitfor failed on channel %s, going out ...\n", chan->name);
+                       ast_debug(1, "ast_waitfor failed on channel %s, going out ...\n", ast_channel_name(chan));
                        res = -1;
                        break;
                }
@@ -6046,12 +6046,12 @@ static int dahdi_accept_r2_call_exec(struct ast_channel *chan, const char *data)
                }
                f = ast_read(chan);
                if (!f) {
-                       ast_debug(1, "No frame read on channel %s, going out ...\n", chan->name);
+                       ast_debug(1, "No frame read on channel %s, going out ...\n", ast_channel_name(chan));
                        res = -1;
                        break;
                }
                if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_HANGUP) {
-                       ast_debug(1, "Got HANGUP frame on channel %s, going out ...\n", chan->name);
+                       ast_debug(1, "Got HANGUP frame on channel %s, going out ...\n", ast_channel_name(chan));
                        ast_frfree(f);
                        res = -1;
                        break;
@@ -6123,7 +6123,7 @@ static int revert_fax_buffers(struct dahdi_pvt *p, struct ast_channel *ast)
                int bpres;
 
                if ((bpres = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SET_BUFINFO, &bi)) < 0) {
-                       ast_log(LOG_WARNING, "Channel '%s' unable to revert buffer policy: %s\n", ast->name, strerror(errno));
+                       ast_log(LOG_WARNING, "Channel '%s' unable to revert buffer policy: %s\n", ast_channel_name(ast), strerror(errno));
                }
                p->bufferoverrideinuse = 0;
                return bpres;
@@ -6141,7 +6141,7 @@ static int dahdi_hangup(struct ast_channel *ast)
        struct dahdi_pvt *p = ast->tech_pvt;
        struct dahdi_params par;
 
-       ast_debug(1, "dahdi_hangup(%s)\n", ast->name);
+       ast_debug(1, "dahdi_hangup(%s)\n", ast_channel_name(ast));
        if (!ast->tech_pvt) {
                ast_log(LOG_WARNING, "Asked to hangup channel not connected\n");
                return 0;
@@ -6465,7 +6465,7 @@ static int dahdi_hangup(struct ast_channel *ast)
                        break;
                }
                if (res < 0) {
-                       ast_log(LOG_WARNING, "Unable to hangup line %s\n", ast->name);
+                       ast_log(LOG_WARNING, "Unable to hangup line %s\n", ast_channel_name(ast));
                }
                switch (p->sig) {
                case SIG_FXOGS:
@@ -6538,7 +6538,7 @@ hangup_out:
        p->cidspill = NULL;
 
        ast_mutex_unlock(&p->lock);
-       ast_verb(3, "Hungup '%s'\n", ast->name);
+       ast_verb(3, "Hungup '%s'\n", ast_channel_name(ast));
 
        ast_mutex_lock(&iflock);
        if (p->restartpending) {
@@ -6664,12 +6664,12 @@ static int dahdi_queryoption(struct ast_channel *chan, int option, void *data, i
        case AST_OPTION_DIGIT_DETECT:
                cp = (char *) data;
                *cp = p->ignoredtmf ? 0 : 1;
-               ast_debug(1, "Reporting digit detection %sabled on %s\n", *cp ? "en" : "dis", chan->name);
+               ast_debug(1, "Reporting digit detection %sabled on %s\n", *cp ? "en" : "dis", ast_channel_name(chan));
                break;
        case AST_OPTION_FAX_DETECT:
                cp = (char *) data;
                *cp = (p->dsp_features & DSP_FEATURE_FAX_DETECT) ? 0 : 1;
-               ast_debug(1, "Reporting fax tone detection %sabled on %s\n", *cp ? "en" : "dis", chan->name);
+               ast_debug(1, "Reporting fax tone detection %sabled on %s\n", *cp ? "en" : "dis", ast_channel_name(chan));
                break;
        case AST_OPTION_CC_AGENT_TYPE:
 #if defined(HAVE_PRI)
@@ -6714,7 +6714,7 @@ static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int
                        ast_log(LOG_WARNING, "No index in TXGAIN?\n");
                        return -1;
                }
-               ast_debug(1, "Setting actual tx gain on %s to %f\n", chan->name, p->txgain + (float) *scp);
+               ast_debug(1, "Setting actual tx gain on %s to %f\n", ast_channel_name(chan), p->txgain + (float) *scp);
                return set_actual_txgain(p->subs[idx].dfd, p->txgain + (float) *scp, p->txdrc, p->law);
        case AST_OPTION_RXGAIN:
                scp = (signed char *) data;
@@ -6723,7 +6723,7 @@ static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int
                        ast_log(LOG_WARNING, "No index in RXGAIN?\n");
                        return -1;
                }
-               ast_debug(1, "Setting actual rx gain on %s to %f\n", chan->name, p->rxgain + (float) *scp);
+               ast_debug(1, "Setting actual rx gain on %s to %f\n", ast_channel_name(chan), p->rxgain + (float) *scp);
                return set_actual_rxgain(p->subs[idx].dfd, p->rxgain + (float) *scp, p->rxdrc, p->law);
        case AST_OPTION_TONE_VERIFY:
                if (!p->dsp)
@@ -6731,15 +6731,15 @@ static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int
                cp = (char *) data;
                switch (*cp) {
                case 1:
-                       ast_debug(1, "Set option TONE VERIFY, mode: MUTECONF(1) on %s\n",chan->name);
+                       ast_debug(1, "Set option TONE VERIFY, mode: MUTECONF(1) on %s\n",ast_channel_name(chan));
                        ast_dsp_set_digitmode(p->dsp, DSP_DIGITMODE_MUTECONF | p->dtmfrelax);  /* set mute mode if desired */
                        break;
                case 2:
-                       ast_debug(1, "Set option TONE VERIFY, mode: MUTECONF/MAX(2) on %s\n",chan->name);
+                       ast_debug(1, "Set option TONE VERIFY, mode: MUTECONF/MAX(2) on %s\n",ast_channel_name(chan));
                        ast_dsp_set_digitmode(p->dsp, DSP_DIGITMODE_MUTECONF | DSP_DIGITMODE_MUTEMAX | p->dtmfrelax);  /* set mute mode if desired */
                        break;
                default:
-                       ast_debug(1, "Set option TONE VERIFY, mode: OFF(0) on %s\n",chan->name);
+                       ast_debug(1, "Set option TONE VERIFY, mode: OFF(0) on %s\n",ast_channel_name(chan));
                        ast_dsp_set_digitmode(p->dsp, DSP_DIGITMODE_DTMF | p->dtmfrelax);  /* set mute mode if desired */
                        break;
                }
@@ -6749,14 +6749,14 @@ static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int
                cp = (char *) data;
                p->mate = 0;
                if (!*cp) { /* turn it off */
-                       ast_debug(1, "Set option TDD MODE, value: OFF(0) on %s\n",chan->name);
+                       ast_debug(1, "Set option TDD MODE, value: OFF(0) on %s\n",ast_channel_name(chan));
                        if (p->tdd)
                                tdd_free(p->tdd);
                        p->tdd = 0;
                        break;
                }
                ast_debug(1, "Set option TDD MODE, value: %s(%d) on %s\n",
-                       (*cp == 2) ? "MATE" : "ON", (int) *cp, chan->name);
+                       (*cp == 2) ? "MATE" : "ON", (int) *cp, ast_channel_name(chan));
                dahdi_disable_ec(p);
                /* otherwise, turn it on */
                if (!p->didtdd) { /* if havent done it yet */
@@ -6823,7 +6823,7 @@ static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int
                        break;
                cp = (char *) data;
                ast_debug(1, "Set option RELAX DTMF, value: %s(%d) on %s\n",
-                       *cp ? "ON" : "OFF", (int) *cp, chan->name);
+                       *cp ? "ON" : "OFF", (int) *cp, ast_channel_name(chan));
                ast_dsp_set_digitmode(p->dsp, ((*cp) ? DSP_DIGITMODE_RELAXDTMF : DSP_DIGITMODE_DTMF) | p->dtmfrelax);
                break;
        case AST_OPTION_AUDIO_MODE:  /* Set AUDIO mode (or not) */
@@ -6837,11 +6837,11 @@ static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int
 
                cp = (char *) data;
                if (!*cp) {
-                       ast_debug(1, "Set option AUDIO MODE, value: OFF(0) on %s\n", chan->name);
+                       ast_debug(1, "Set option AUDIO MODE, value: OFF(0) on %s\n", ast_channel_name(chan));
                        x = 0;
                        dahdi_disable_ec(p);
                } else {
-                       ast_debug(1, "Set option AUDIO MODE, value: ON(1) on %s\n", chan->name);
+                       ast_debug(1, "Set option AUDIO MODE, value: ON(1) on %s\n", ast_channel_name(chan));
                        x = 1;
                }
                if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &x) == -1)
@@ -6868,21 +6868,21 @@ static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int
                        p->oprmode = -oprmode->mode;
                }
                ast_debug(1, "Set Operator Services mode, value: %d on %s/%s\n",
-                       oprmode->mode, chan->name,oprmode->peer->name);
+                       oprmode->mode, ast_channel_name(chan),ast_channel_name(oprmode->peer));
                break;
        case AST_OPTION_ECHOCAN:
                cp = (char *) data;
                if (*cp) {
-                       ast_debug(1, "Enabling echo cancellation on %s\n", chan->name);
+                       ast_debug(1, "Enabling echo cancellation on %s\n", ast_channel_name(chan));
                        dahdi_enable_ec(p);
                } else {
-                       ast_debug(1, "Disabling echo cancellation on %s\n", chan->name);
+                       ast_debug(1, "Disabling echo cancellation on %s\n", ast_channel_name(chan));
                        dahdi_disable_ec(p);
                }
                break;
        case AST_OPTION_DIGIT_DETECT:
                cp = (char *) data;
-               ast_debug(1, "%sabling digit detection on %s\n", *cp ? "En" : "Dis", chan->name);
+               ast_debug(1, "%sabling digit detection on %s\n", *cp ? "En" : "Dis", ast_channel_name(chan));
                if (*cp) {
                        enable_dtmf_detect(p);
                } else {
@@ -6892,7 +6892,7 @@ static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int
        case AST_OPTION_FAX_DETECT:
                cp = (char *) data;
                if (p->dsp) {
-                       ast_debug(1, "%sabling fax tone detection on %s\n", *cp ? "En" : "Dis", chan->name);
+                       ast_debug(1, "%sabling fax tone detection on %s\n", *cp ? "En" : "Dis", ast_channel_name(chan));
                        if (*cp) {
                                p->dsp_features |= DSP_FEATURE_FAX_DETECT;
                        } else {
@@ -7372,12 +7372,12 @@ static enum ast_bridge_result dahdi_bridge(struct ast_channel *c0, struct ast_ch
                        (p1->subs[SUB_REAL].owner->_state == AST_STATE_RINGING)) {
                        ast_debug(1,
                                "Playing ringback on %d/%d(%s) since %d/%d(%s) is in a ringing three-way\n",
-                               p0->channel, oi0, c0->name, p1->channel, oi1, c1->name);
+                               p0->channel, oi0, ast_channel_name(c0), p1->channel, oi1, ast_channel_name(c1));
                        tone_zone_play_tone(p0->subs[oi0].dfd, DAHDI_TONE_RINGTONE);
                        os1 = p1->subs[SUB_REAL].owner->_state;
                } else {
                        ast_debug(1, "Stopping tones on %d/%d(%s) talking to %d/%d(%s)\n",
-                               p0->channel, oi0, c0->name, p1->channel, oi1, c1->name);
+                               p0->channel, oi0, ast_channel_name(c0), p1->channel, oi1, ast_channel_name(c1));
                        tone_zone_play_tone(p0->subs[oi0].dfd, -1);
                }
                if ((oi0 == SUB_THREEWAY) &&
@@ -7387,12 +7387,12 @@ static enum ast_bridge_result dahdi_bridge(struct ast_channel *c0, struct ast_ch
                        (p0->subs[SUB_REAL].owner->_state == AST_STATE_RINGING)) {
                        ast_debug(1,
                                "Playing ringback on %d/%d(%s) since %d/%d(%s) is in a ringing three-way\n",
-                               p1->channel, oi1, c1->name, p0->channel, oi0, c0->name);
+                               p1->channel, oi1, ast_channel_name(c1), p0->channel, oi0, ast_channel_name(c0));
                        tone_zone_play_tone(p1->subs[oi1].dfd, DAHDI_TONE_RINGTONE);
                        os0 = p0->subs[SUB_REAL].owner->_state;
                } else {
                        ast_debug(1, "Stopping tones on %d/%d(%s) talking to %d/%d(%s)\n",
-                               p1->channel, oi1, c1->name, p0->channel, oi0, c0->name);
+                               p1->channel, oi1, ast_channel_name(c1), p0->channel, oi0, ast_channel_name(c0));
                        tone_zone_play_tone(p1->subs[oi1].dfd, -1);
                }
                if ((oi0 == SUB_REAL) && (oi1 == SUB_REAL)) {
@@ -7425,7 +7425,7 @@ static enum ast_bridge_result dahdi_bridge(struct ast_channel *c0, struct ast_ch
                return AST_BRIDGE_FAILED;
        }
 
-       ast_verb(3, "Native bridging %s and %s\n", c0->name, c1->name);
+       ast_verb(3, "Native bridging %s and %s\n", ast_channel_name(c0), ast_channel_name(c1));
 
        if (!(flags & AST_BRIDGE_DTMF_CHANNEL_0) && (oi0 == SUB_REAL))
                disable_dtmf_detect(op0);
@@ -7541,7 +7541,7 @@ static enum ast_bridge_result dahdi_bridge(struct ast_channel *c0, struct ast_ch
                        break;
                default:
                        ast_debug(1, "Chan '%s' is discarding frame of frametype:%d\n",
-                               who->name, f->frametype);
+                               ast_channel_name(who), f->frametype);
                        break;
                }
                ast_frfree(f);
@@ -7575,7 +7575,7 @@ static int dahdi_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
 
        ast_mutex_lock(&p->lock);
 
-       ast_debug(1, "New owner for channel %d is %s\n", p->channel, newchan->name);
+       ast_debug(1, "New owner for channel %d is %s\n", p->channel, ast_channel_name(newchan));
        if (p->owner == oldchan) {
                p->owner = newchan;
        }
@@ -7658,7 +7658,7 @@ static int attempt_transfer(struct dahdi_pvt *p)
                }
                 if (ast_channel_masquerade(p->subs[SUB_THREEWAY].owner, ast_bridged_channel(p->subs[SUB_REAL].owner))) {
                        ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n",
-                                       ast_bridged_channel(p->subs[SUB_REAL].owner)->name, p->subs[SUB_THREEWAY].owner->name);
+                                       ast_channel_name(ast_bridged_channel(p->subs[SUB_REAL].owner)), ast_channel_name(p->subs[SUB_THREEWAY].owner));
                        return -1;
                }
                /* Orphan the channel after releasing the lock */
@@ -7674,7 +7674,7 @@ static int attempt_transfer(struct dahdi_pvt *p)
                }
                if (ast_channel_masquerade(p->subs[SUB_REAL].owner, ast_bridged_channel(p->subs[SUB_THREEWAY].owner))) {
                        ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n",
-                                       ast_bridged_channel(p->subs[SUB_THREEWAY].owner)->name, p->subs[SUB_REAL].owner->name);
+                                       ast_channel_name(ast_bridged_channel(p->subs[SUB_THREEWAY].owner)), ast_channel_name(p->subs[SUB_REAL].owner));
                        return -1;
                }
                /* Three-way is now the REAL */
@@ -7685,7 +7685,7 @@ static int attempt_transfer(struct dahdi_pvt *p)
                return 1;
        } else {
                ast_debug(1, "Neither %s nor %s are in a bridge, nothing to transfer\n",
-                       p->subs[SUB_REAL].owner->name, p->subs[SUB_THREEWAY].owner->name);
+                       ast_channel_name(p->subs[SUB_REAL].owner), ast_channel_name(p->subs[SUB_THREEWAY].owner));
                p->subs[SUB_THREEWAY].owner->_softhangup |= AST_SOFTHANGUP_DEV;
                return -1;
        }
@@ -7752,11 +7752,11 @@ static void dahdi_handle_dtmf(struct ast_channel *ast, int idx, struct ast_frame
 
        ast_debug(1, "%s DTMF digit: 0x%02X '%c' on %s\n",
                f->frametype == AST_FRAME_DTMF_BEGIN ? "Begin" : "End",
-               f->subclass.integer, f->subclass.integer, ast->name);
+               f->subclass.integer, f->subclass.integer, ast_channel_name(ast));
 
        if (p->confirmanswer) {
                if (f->frametype == AST_FRAME_DTMF_END) {
-                       ast_debug(1, "Confirm answer on %s!\n", ast->name);
+                       ast_debug(1, "Confirm answer on %s!\n", ast_channel_name(ast));
                        /* Upon receiving a DTMF digit, consider this an answer confirmation instead
                           of a DTMF digit */
                        p->subs[idx].f.frametype = AST_FRAME_CONTROL;
@@ -7795,7 +7795,7 @@ static void dahdi_handle_dtmf(struct ast_channel *ast, int idx, struct ast_frame
                                        int res;
 
                                        if ((res = ioctl(p->subs[idx].dfd, DAHDI_SET_BUFINFO, &bi)) < 0) {
-                                               ast_log(LOG_WARNING, "Channel '%s' unable to set buffer policy, reason: %s\n", ast->name, strerror(errno));
+                                               ast_log(LOG_WARNING, "Channel '%s' unable to set buffer policy, reason: %s\n", ast_channel_name(ast), strerror(errno));
                                        } else {
                                                p->bufferoverrideinuse = 1;
                                        }
@@ -7804,7 +7804,7 @@ static void dahdi_handle_dtmf(struct ast_channel *ast, int idx, struct ast_frame
                                if (p->dsp) {
                                        p->dsp_features &= ~DSP_FEATURE_FAX_DETECT;
                                        ast_dsp_set_features(p->dsp, p->dsp_features);
-                                       ast_debug(1, "Disabling FAX tone detection on %s after tone received\n", ast->name);
+                                       ast_debug(1, "Disabling FAX tone detection on %s after tone received\n", ast_channel_name(ast));
                                }
                                if (strcmp(ast->exten, "fax")) {
                                        const char *target_context = S_OR(ast->macrocontext, ast->context);
@@ -7819,11 +7819,11 @@ static void dahdi_handle_dtmf(struct ast_channel *ast, int idx, struct ast_frame
                                                S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) {
                                                ast_channel_lock(ast);
                                                ast_mutex_lock(&p->lock);
-                                               ast_verb(3, "Redirecting %s to fax extension\n", ast->name);
+                                               ast_verb(3, "Redirecting %s to fax extension\n", ast_channel_name(ast));
                                                /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */
                                                pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast->exten);
                                                if (ast_async_goto(ast, target_context, "fax", 1))
-                                                       ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast->name, target_context);
+                                                       ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(ast), target_context);
                                        } else {
                                                ast_channel_lock(ast);
                                                ast_mutex_lock(&p->lock);
@@ -7985,7 +7985,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
                if (p->inalarm) break;
                if ((p->radio || (p->oprmode < 0))) break;
                if (ioctl(p->subs[idx].dfd,DAHDI_DIALING,&x) == -1) {
-                       ast_debug(1, "DAHDI_DIALING ioctl failed on %s: %s\n",ast->name, strerror(errno));
+                       ast_debug(1, "DAHDI_DIALING ioctl failed on %s: %s\n",ast_channel_name(ast), strerror(errno));
                        return NULL;
                }
                if (!x) { /* if not still dialing in driver */
@@ -8441,7 +8441,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
                                swap_subs(p, SUB_REAL, SUB_CALLWAIT);
                                tone_zone_play_tone(p->subs[SUB_REAL].dfd, -1);
                                p->owner = p->subs[SUB_REAL].owner;
-                               ast_debug(1, "Making %s the new owner\n", p->owner->name);
+                               ast_debug(1, "Making %s the new owner\n", ast_channel_name(p->owner));
                                if (p->owner->_state == AST_STATE_RINGING) {
                                        ast_setstate(p->owner, AST_STATE_UP);
                                        p->subs[SUB_REAL].needanswer = 1;
@@ -8546,7 +8546,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
                                                p->owner = p->subs[SUB_REAL].owner;
                                        }
                                        /* Drop the last call and stop the conference */
-                                       ast_verb(3, "Dropping three-way call on %s\n", p->subs[SUB_THREEWAY].owner->name);
+                                       ast_verb(3, "Dropping three-way call on %s\n", ast_channel_name(p->subs[SUB_THREEWAY].owner));
                                        p->subs[SUB_THREEWAY].owner->_softhangup |= AST_SOFTHANGUP_DEV;
                                        p->subs[SUB_REAL].inthreeway = 0;
                                        p->subs[SUB_THREEWAY].inthreeway = 0;
@@ -8557,8 +8557,8 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
                                                int otherindex = SUB_THREEWAY;
 
                                                ast_verb(3, "Building conference call with %s and %s\n",
-                                                       p->subs[SUB_THREEWAY].owner->name,
-                                                       p->subs[SUB_REAL].owner->name);
+                                                       ast_channel_name(p->subs[SUB_THREEWAY].owner),
+                                                       ast_channel_name(p->subs[SUB_REAL].owner));
                                                /* Put them in the threeway, and flip */
                                                p->subs[SUB_THREEWAY].inthreeway = 1;
                                                p->subs[SUB_REAL].inthreeway = 1;
@@ -8571,7 +8571,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
                                                p->subs[otherindex].needunhold = 1;
                                                p->owner = p->subs[SUB_REAL].owner;
                                        } else {
-                                               ast_verb(3, "Dumping incomplete call on on %s\n", p->subs[SUB_THREEWAY].owner->name);
+                                               ast_verb(3, "Dumping incomplete call on on %s\n", ast_channel_name(p->subs[SUB_THREEWAY].owner));
                                                swap_subs(p, SUB_THREEWAY, SUB_REAL);
                                                p->subs[SUB_THREEWAY].owner->_softhangup |= AST_SOFTHANGUP_DEV;
                                                p->owner = p->subs[SUB_REAL].owner;
@@ -8777,7 +8777,7 @@ static struct ast_frame *__dahdi_exception(struct ast_channel *ast)
                case DAHDI_EVENT_ONHOOK:
                        dahdi_disable_ec(p);
                        if (p->owner) {
-                               ast_verb(3, "Channel %s still has call, ringing phone\n", p->owner->name);
+                               ast_verb(3, "Channel %s still has call, ringing phone\n", ast_channel_name(p->owner));
                                dahdi_ring_phone(p);
                                p->callwaitingrepeat = 0;
                                p->cidcwexpire = 0;
@@ -8802,7 +8802,7 @@ static struct ast_frame *__dahdi_exception(struct ast_channel *ast)
                case DAHDI_EVENT_WINKFLASH:
                        p->flashtime = ast_tvnow();
                        if (p->owner) {
-                               ast_verb(3, "Channel %d flashed to other channel %s\n", p->channel, p->owner->name);
+                               ast_verb(3, "Channel %d flashed to other channel %s\n", p->channel, ast_channel_name(p->owner));
                                if (p->owner->_state != AST_STATE_UP) {
                                        /* Answer if necessary */
                                        usedindex = dahdi_get_index(p->owner, p, 0);
@@ -8831,7 +8831,7 @@ static struct ast_frame *__dahdi_exception(struct ast_channel *ast)
                ast_debug(1, "Exception on %d, channel %d\n", ast->fds[0],p->channel);
        /* If it's not us, return NULL immediately */
        if (ast != p->owner) {
-               ast_log(LOG_WARNING, "We're %s, not %s\n", ast->name, p->owner->name);
+               ast_log(LOG_WARNING, "We're %s, not %s\n", ast_channel_name(ast), ast_channel_name(p->owner));
                f = &p->subs[idx].f;
                return f;
        }
@@ -8839,7 +8839,7 @@ static struct ast_frame *__dahdi_exception(struct ast_channel *ast)
 
        /* tell the cdr this zap device hung up */
        if (f == NULL) {
-               ast_set_hangupsource(ast, ast->name, 0);
+               ast_set_hangupsource(ast, ast_channel_name(ast), 0);
        }
 
        return f;
@@ -9019,7 +9019,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
                p->subs[idx].f.frametype = AST_FRAME_CONTROL;
                p->subs[idx].f.subclass.integer = AST_CONTROL_HOLD;
                ast_mutex_unlock(&p->lock);
-               ast_debug(1, "Sending hold on '%s'\n", ast->name);
+               ast_debug(1, "Sending hold on '%s'\n", ast_channel_name(ast));
                return &p->subs[idx].f;
        }
 
@@ -9029,7 +9029,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
                p->subs[idx].f.frametype = AST_FRAME_CONTROL;
                p->subs[idx].f.subclass.integer = AST_CONTROL_UNHOLD;
                ast_mutex_unlock(&p->lock);
-               ast_debug(1, "Sending unhold on '%s'\n", ast->name);
+               ast_debug(1, "Sending unhold on '%s'\n", ast_channel_name(ast));
                return &p->subs[idx].f;
        }
 
@@ -9210,7 +9210,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
                                        /* Don't accept in-band DTMF when in overlap dial mode */
                                        ast_debug(1, "Absorbing inband %s DTMF digit: 0x%02X '%c' on %s\n",
                                                f->frametype == AST_FRAME_DTMF_BEGIN ? "begin" : "end",
-                                               f->subclass.integer, f->subclass.integer, ast->name);
+                                               f->subclass.integer, f->subclass.integer, ast_channel_name(ast));
 
                                        f->frametype = AST_FRAME_NULL;
                                        f->subclass.integer = 0;
@@ -9313,7 +9313,7 @@ static int dahdi_write(struct ast_channel *ast, struct ast_frame *frame)
        int idx;
        idx = dahdi_get_index(ast, p, 0);
        if (idx < 0) {
-               ast_log(LOG_WARNING, "%s doesn't really exist?\n", ast->name);
+               ast_log(LOG_WARNING, "%s doesn't really exist?\n", ast_channel_name(ast));
                return -1;
        }
 
@@ -9330,16 +9330,16 @@ static int dahdi_write(struct ast_channel *ast, struct ast_frame *frame)
                return -1;
        }
        if (p->dialing) {
-               ast_debug(1, "Dropping frame since I'm still dialing on %s...\n",ast->name);
+               ast_debug(1, "Dropping frame since I'm still dialing on %s...\n",ast_channel_name(ast));
                return 0;
        }
        if (!p->owner) {
-               ast_debug(1, "Dropping frame since there is no active owner on %s...\n",ast->name);
+               ast_debug(1, "Dropping frame since there is no active owner on %s...\n",ast_channel_name(ast));
                return 0;
        }
        if (p->cidspill) {
                ast_debug(1, "Dropping frame since I've still got a callerid spill on %s...\n",
-                       ast->name);
+                       ast_channel_name(ast));
                return 0;
        }
        /* Return if it's not valid data */
@@ -9379,7 +9379,7 @@ static int dahdi_indicate(struct ast_channel *chan, int condition, const void *d
        int func = DAHDI_FLASH;
 
        ast_mutex_lock(&p->lock);
-       ast_debug(1, "Requested indication %d on channel %s\n", condition, chan->name);
+       ast_debug(1, "Requested indication %d on channel %s\n", condition, ast_channel_name(chan));
        switch (p->sig) {
 #if defined(HAVE_PRI)
        case SIG_PRI_LIB_HANDLE_CASES:
@@ -9422,17 +9422,17 @@ static int dahdi_indicate(struct ast_channel *chan, int condition, const void *d
                        }
                        break;
                case AST_CONTROL_INCOMPLETE:
-                       ast_debug(1, "Received AST_CONTROL_INCOMPLETE on %s\n", chan->name);
+                       ast_debug(1, "Received AST_CONTROL_INCOMPLETE on %s\n", ast_channel_name(chan));
                        /* act as a progress or proceeding, allowing the caller to enter additional numbers */
                        res = 0;
                        break;
                case AST_CONTROL_PROCEEDING:
-                       ast_debug(1, "Received AST_CONTROL_PROCEEDING on %s\n", chan->name);
+                       ast_debug(1, "Received AST_CONTROL_PROCEEDING on %s\n", ast_channel_name(chan));
                        /* don't continue in ast_indicate */
                        res = 0;
                        break;
                case AST_CONTROL_PROGRESS:
-                       ast_debug(1, "Received AST_CONTROL_PROGRESS on %s\n", chan->name);
+                       ast_debug(1, "Received AST_CONTROL_PROGRESS on %s\n", ast_channel_name(chan));
                        /* don't continue in ast_indicate */
                        res = 0;
                        break;
@@ -9472,7 +9472,7 @@ static int dahdi_indicate(struct ast_channel *chan, int condition, const void *d
                                p->dop.dialstr[0] = '\0';
                                if ((ioctl(p->subs[SUB_REAL].dfd,DAHDI_HOOK,&func) == -1) && (errno != EINPROGRESS)) {
                                        ast_log(LOG_WARNING, "Unable to flash external trunk on channel %s: %s\n",
-                                               chan->name, strerror(errno));
+                                               ast_channel_name(chan), strerror(errno));
                                } else
                                        res = 0;
                        } else
@@ -9530,7 +9530,7 @@ static struct ast_str *create_channel_name(struct dahdi_pvt *i)
                        ast_str_set(&chan_name, 0, "%d-%d", i->channel, y);
                        for (x = 0; x < 3; ++x) {
                                if (i->subs[x].owner && !strcasecmp(ast_str_buffer(chan_name),
-                                       i->subs[x].owner->name + 6)) {
+                                       ast_channel_name(i->subs[x].owner) + 6)) {
                                        break;
                                }
                        }
@@ -9637,7 +9637,7 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb
        }
        if (features) {
                if (i->dsp) {
-                       ast_debug(1, "Already have a dsp on %s?\n", tmp->name);
+                       ast_debug(1, "Already have a dsp on %s?\n", ast_channel_name(tmp));
                } else {
                        if (i->channel != CHAN_PSEUDO)
                                i->dsp = ast_dsp_new();
@@ -9732,7 +9732,7 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb
        ast_jb_configure(tmp, &global_jbconf);
 
        /* Set initial device state */
-       ast_copy_string(device_name, tmp->name, sizeof(device_name));
+       ast_copy_string(device_name, ast_channel_name(tmp), sizeof(device_name));
        dashptr = strrchr(device_name, '-');
        if (dashptr) {
                *dashptr = '\0';
@@ -9752,7 +9752,7 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb
                }
 #endif
                if (ast_pbx_start(tmp)) {
-                       ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
+                       ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ast_channel_name(tmp));
                        ast_hangup(tmp);
                        return NULL;
                }
@@ -9892,11 +9892,11 @@ static void *analog_ss_thread(void *data)
           even get started here, abort safely
        */
        if (!p) {
-               ast_log(LOG_WARNING, "Channel became a zombie before simple switch could be started (%s)\n", chan->name);
+               ast_log(LOG_WARNING, "Channel became a zombie before simple switch could be started (%s)\n", ast_channel_name(chan));
                ast_hangup(chan);
                goto quit;
        }
-       ast_verb(3, "Starting simple switch on '%s'\n", chan->name);
+       ast_verb(3, "Starting simple switch on '%s'\n", ast_channel_name(chan));
        idx = dahdi_get_index(chan, p, 1);
        if (idx < 0) {
                ast_log(LOG_WARNING, "Huh?\n");
@@ -10256,13 +10256,13 @@ static void *analog_ss_thread(void *data)
                                ast_hangup(chan);
                                goto quit;
                        } else if (p->callwaiting && !strcmp(exten, "*70")) {
-                               ast_verb(3, "Disabling call waiting on %s\n", chan->name);
+                               ast_verb(3, "Disabling call waiting on %s\n", ast_channel_name(chan));
                                /* Disable call waiting if enabled */
                                p->callwaiting = 0;
                                res = tone_zone_play_tone(p->subs[idx].dfd, DAHDI_TONE_DIALRECALL);
                                if (res) {
                                        ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n",
-                                               chan->name, strerror(errno));
+                                               ast_channel_name(chan), strerror(errno));
                                }
                                len = 0;
                                ioctl(p->subs[idx].dfd,DAHDI_CONFDIAG,&len);
@@ -10298,7 +10298,7 @@ static void *analog_ss_thread(void *data)
                                }
 
                        } else if (!p->hidecallerid && !strcmp(exten, "*67")) {
-                               ast_verb(3, "Disabling Caller*ID on %s\n", chan->name);
+                               ast_verb(3, "Disabling Caller*ID on %s\n", ast_channel_name(chan));
                                /* Disable Caller*ID if enabled */
                                p->hidecallerid = 1;
                                ast_party_number_free(&chan->caller.id.number);
@@ -10308,7 +10308,7 @@ static void *analog_ss_thread(void *data)
                                res = tone_zone_play_tone(p->subs[idx].dfd, DAHDI_TONE_DIALRECALL);
                                if (res) {
                                        ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n",
-                                               chan->name, strerror(errno));
+                                               ast_channel_name(chan), strerror(errno));
                                }
                                len = 0;
                                memset(exten, 0, sizeof(exten));
@@ -10349,17 +10349,17 @@ static void *analog_ss_thread(void *data)
                                        and we're parking the first call. */
                                ast_masq_park_call_exten(ast_bridged_channel(p->subs[SUB_THREEWAY].owner),
                                        chan, exten, chan->context, 0, NULL);
-                               ast_verb(3, "Parking call to '%s'\n", chan->name);
+                               ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan));
                                break;
                        } else if (p->hidecallerid && !strcmp(exten, "*82")) {
-                               ast_verb(3, "Enabling Caller*ID on %s\n", chan->name);
+                               ast_verb(3, "Enabling Caller*ID on %s\n", ast_channel_name(chan));
                                /* Enable Caller*ID if enabled */
                                p->hidecallerid = 0;
                                ast_set_callerid(chan, p->cid_num, p->cid_name, NULL);
                                res = tone_zone_play_tone(p->subs[idx].dfd, DAHDI_TONE_DIALRECALL);
                                if (res) {
                                        ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n",
-                                               chan->name, strerror(errno));
+                                               ast_channel_name(chan), strerror(errno));
                                }
                                len = 0;
                                memset(exten, 0, sizeof(exten));
@@ -10381,7 +10381,7 @@ static void *analog_ss_thread(void *data)
                                        /* flash hookswitch */
                                        if ((ioctl(pbridge->subs[SUB_REAL].dfd,DAHDI_HOOK,&func) == -1) && (errno != EINPROGRESS)) {
                                                ast_log(LOG_WARNING, "Unable to flash external trunk on channel %s: %s\n",
-                                                       nbridge->name, strerror(errno));
+                                                       ast_channel_name(nbridge), strerror(errno));
                                        }
                                        swap_subs(p, SUB_REAL, SUB_THREEWAY);
                                        unalloc_sub(p, SUB_THREEWAY);
@@ -10429,7 +10429,7 @@ static void *analog_ss_thread(void *data)
                                else if (smdi_msg->type == 'N')
                                        pbx_builtin_setvar_helper(chan, "_SMDI_VM_TYPE", "u");
 
-                               ast_debug(1, "Received SMDI message on %s\n", chan->name);
+                               ast_debug(1, "Received SMDI message on %s\n", ast_channel_name(chan));
                        } else {
                                ast_log(LOG_WARNING, "SMDI enabled but no SMDI message present\n");
                        }
@@ -10447,7 +10447,7 @@ static void *analog_ss_thread(void *data)
                        if (p->cid_signalling == CID_SIG_DTMF) {
                                int k = 0;
                                cs = NULL;
-                               ast_debug(1, "Receiving DTMF cid on channel %s\n", chan->name);
+                               ast_debug(1, "Receiving DTMF cid on channel %s\n", ast_channel_name(chan));
                                dahdi_setlinear(p->subs[idx].dfd, 0);
                                /*
                                 * We are the only party interested in the Rx stream since
@@ -10559,7 +10559,7 @@ static void *analog_ss_thread(void *data)
                                                                 */
                                                                ast_log(LOG_WARNING,
                                                                        "Failed to decode CallerID on channel '%s'\n",
-                                                                       chan->name);
+                                                                       ast_channel_name(chan));
                                                                break;
                                                        } else if (res)
                                                                break;
@@ -10702,7 +10702,7 @@ static void *analog_ss_thread(void *data)
                                        "state, but I have nothing to do. "
                                        "Terminating simple switch, should be "
                                        "restarted by the actual ring.\n",
-                                       chan->name);
+                                       ast_channel_name(chan));
                                ast_hangup(chan);
                                goto quit;
                        }
@@ -10832,7 +10832,7 @@ static void *analog_ss_thread(void *data)
                                                                 */
                                                                ast_log(LOG_WARNING,
                                                                        "Failed to decode CallerID on channel '%s'\n",
-                                                                       chan->name);
+                                                                       ast_channel_name(chan));
                                                                break;
                                                        } else if (res)
                                                                break;
@@ -10939,7 +10939,7 @@ static void *analog_ss_thread(void *data)
                                        restore_gains(p);
 #endif
                                        if (res < 0) {
-                                               ast_log(LOG_WARNING, "CallerID returned with error on channel '%s'\n", chan->name);
+                                               ast_log(LOG_WARNING, "CallerID returned with error on channel '%s'\n", ast_channel_name(chan));
                                        }
                                } else
                                        ast_log(LOG_WARNING, "Unable to get caller ID space\n");
@@ -15017,7 +15017,7 @@ retry:
                                goto retry;
                        }
                        if (option_debug > 2)
-                               ast_verbose("Softhanging up on %s\n", p->owner->name);
+                               ast_verbose("Softhanging up on %s\n", ast_channel_name(p->owner));
                        ast_softhangup_nolock(p->owner, AST_SOFTHANGUP_EXPLICIT);
                        p->restartpending = 1;
                        num_restart_pending++;
@@ -15312,10 +15312,10 @@ static char *dahdi_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli
                        ast_cli(a->fd, "InAlarm: %d\n", tmp->inalarm);
                        ast_cli(a->fd, "Signalling Type: %s\n", sig2str(tmp->sig));
                        ast_cli(a->fd, "Radio: %d\n", tmp->radio);
-                       ast_cli(a->fd, "Owner: %s\n", tmp->owner ? tmp->owner->name : "<None>");
-                       ast_cli(a->fd, "Real: %s%s%s\n", tmp->subs[SUB_REAL].owner ? tmp->subs[SUB_REAL].owner->name : "<None>", tmp->subs[SUB_REAL].inthreeway ? " (Confed)" : "", tmp->subs[SUB_REAL].linear ? " (Linear)" : "");
-                       ast_cli(a->fd, "Callwait: %s%s%s\n", tmp->subs[SUB_CALLWAIT].owner ? tmp->subs[SUB_CALLWAIT].owner->name : "<None>", tmp->subs[SUB_CALLWAIT].inthreeway ? " (Confed)" : "", tmp->subs[SUB_CALLWAIT].linear ? " (Linear)" : "");
-                       ast_cli(a->fd, "Threeway: %s%s%s\n", tmp->subs[SUB_THREEWAY].owner ? tmp->subs[SUB_THREEWAY].owner->name : "<None>", tmp->subs[SUB_THREEWAY].inthreeway ? " (Confed)" : "", tmp->subs[SUB_THREEWAY].linear ? " (Linear)" : "");
+                       ast_cli(a->fd, "Owner: %s\n", tmp->owner ? ast_channel_name(tmp->owner) : "<None>");
+                       ast_cli(a->fd, "Real: %s%s%s\n", tmp->subs[SUB_REAL].owner ? ast_channel_name(tmp->subs[SUB_REAL].owner) : "<None>", tmp->subs[SUB_REAL].inthreeway ? " (Confed)" : "", tmp->subs[SUB_REAL].linear ? " (Linear)" : "");
+                       ast_cli(a->fd, "Callwait: %s%s%s\n", tmp->subs[SUB_CALLWAIT].owner ? ast_channel_name(tmp->subs[SUB_CALLWAIT].owner) : "<None>", tmp->subs[SUB_CALLWAIT].inthreeway ? " (Confed)" : "", tmp->subs[SUB_CALLWAIT].linear ? " (Linear)" : "");
+                       ast_cli(a->fd, "Threeway: %s%s%s\n", tmp->subs[SUB_THREEWAY].owner ? ast_channel_name(tmp->subs[SUB_THREEWAY].owner) : "<None>", tmp->subs[SUB_THREEWAY].inthreeway ? " (Confed)" : "", tmp->subs[SUB_THREEWAY].linear ? " (Linear)" : "");
                        ast_cli(a->fd, "Confno: %d\n", tmp->confno);
                        ast_cli(a->fd, "Propagated Conference: %d\n", tmp->propconfno);
                        ast_cli(a->fd, "Real in conference: %d\n", tmp->inconference);
@@ -15825,7 +15825,7 @@ static int dahdi_fake_event(struct dahdi_pvt *p, int mode)
                        p->fake_event = DAHDI_EVENT_ONHOOK;
                        break;
                default:
-                       ast_log(LOG_WARNING, "I don't know how to handle transfer event with this: %d on channel %s\n",mode, p->owner->name);
+                       ast_log(LOG_WARNING, "I don't know how to handle transfer event with this: %d on channel %s\n",mode, ast_channel_name(p->owner));
                }
        }
        return 0;
@@ -16028,7 +16028,7 @@ static int action_dahdishowchannels(struct mansession *s, const struct message *
                                        "%s"
                                        "\r\n",
                                        tmp->channel,
-                                       tmp->owner->name,
+                                       ast_channel_name(tmp->owner),
                                        tmp->owner->uniqueid,
                                        tmp->owner->accountcode,
                                        sig2str(tmp->sig),
index 855c89b..21b80e2 100644 (file)
@@ -537,7 +537,7 @@ static int gtalk_answer(struct ast_channel *ast)
        ast_mutex_lock(&p->lock);
        gtalk_invite(p, p->them, p->us,p->sid, 0);
        manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate", "Channel: %s\r\nChanneltype: %s\r\nGtalk-SID: %s\r\n",
-               ast->name, "GTALK", p->sid);
+               ast_channel_name(ast), "GTALK", p->sid);
        ast_mutex_unlock(&p->lock);
        return res;
 }
@@ -1202,14 +1202,14 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i,
        if (i->rtp)
                ast_jb_configure(tmp, &global_jbconf);
        if (state != AST_STATE_DOWN && ast_pbx_start(tmp)) {
-               ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
+               ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ast_channel_name(tmp));
                tmp->hangupcause = AST_CAUSE_SWITCH_CONGESTION;
                ast_hangup(tmp);
                tmp = NULL;
        } else {
                manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate",
                        "Channel: %s\r\nChanneltype: %s\r\nGtalk-SID: %s\r\n",
-                       i->owner ? i->owner->name : "", "Gtalk", i->sid);
+                       i->owner ? ast_channel_name(i->owner) : "", "Gtalk", i->sid);
        }
        return tmp;
 }
@@ -1857,7 +1857,7 @@ static int gtalk_call(struct ast_channel *ast, char *dest, int timeout)
        struct gtalk_pvt *p = ast->tech_pvt;
 
        if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) {
-               ast_log(LOG_WARNING, "gtalk_call called on %s, neither down nor reserved\n", ast->name);
+               ast_log(LOG_WARNING, "gtalk_call called on %s, neither down nor reserved\n", ast_channel_name(ast));
                return -1;
        }
 
@@ -1989,7 +1989,7 @@ static char *gtalk_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cl
                        }
                        if (chan)
                                ast_cli(a->fd, FORMAT,
-                                       chan->name,
+                                       ast_channel_name(chan),
                                        jid,
                                        resource,
                                        ast_getformatname(&chan->readformat),
index 5f28720..7999bc4 100644 (file)
@@ -344,14 +344,14 @@ static void __oh323_update_info(struct ast_channel *c, struct oh323_pvt *pvt)
        h323_format chan_nativeformats_bits = ast_format_cap_to_old_bitfield(c->nativeformats);
        if (chan_nativeformats_bits != pvt->nativeformats) {
                if (h323debug)
-                       ast_debug(1, "Preparing %s for new native format\n", c->name);
+                       ast_debug(1, "Preparing %s for new native format\n", ast_channel_name(c));
                ast_format_cap_from_old_bitfield(c->nativeformats, pvt->nativeformats);
                ast_set_read_format(c, &c->readformat);
                ast_set_write_format(c, &c->writeformat);
        }
        if (pvt->needhangup) {
                if (h323debug)
-                       ast_debug(1, "Process pending hangup for %s\n", c->name);
+                       ast_debug(1, "Process pending hangup for %s\n", ast_channel_name(c));
                c->_softhangup |= AST_SOFTHANGUP_DEV;
                c->hangupcause = pvt->hangupcause;
                ast_queue_hangup_with_cause(c, pvt->hangupcause);
@@ -471,7 +471,7 @@ static void __oh323_destroy(struct oh323_pvt *pvt)
        if (pvt->owner) {
                ast_channel_lock(pvt->owner);
                if (h323debug)
-                       ast_debug(1, "Detaching from %s\n", pvt->owner->name);
+                       ast_debug(1, "Detaching from %s\n", ast_channel_name(pvt->owner));
                pvt->owner->tech_pvt = NULL;
                ast_channel_unlock(pvt->owner);
        }
@@ -499,7 +499,7 @@ static void __oh323_destroy(struct oh323_pvt *pvt)
 static void oh323_destroy(struct oh323_pvt *pvt)
 {
        if (h323debug) {
-               ast_debug(1, "Destroying channel %s\n", (pvt->owner ? pvt->owner->name : "<unknown>"));
+               ast_debug(1, "Destroying channel %s\n", (pvt->owner ? ast_channel_name(pvt->owner) : "<unknown>"));
        }
        ast_mutex_lock(&iflock);
        ast_mutex_lock(&pvt->lock);
@@ -522,14 +522,14 @@ static int oh323_digit_begin(struct ast_channel *c, char digit)
                 /*|| ((pvt->options.dtmfmode & H323_DTMF_CISCO) && pvt->dtmf_pt[1]))*/)) {
                /* out-of-band DTMF */
                if (h323debug) {
-                       ast_log(LOG_DTMF, "Begin sending out-of-band digit %c on %s\n", digit, c->name);
+                       ast_log(LOG_DTMF, "Begin sending out-of-band digit %c on %s\n", digit, ast_channel_name(c));
                }
                ast_rtp_instance_dtmf_begin(pvt->rtp, digit);
                ast_mutex_unlock(&pvt->lock);
        } else if (pvt->txDtmfDigit != digit) {
                /* in-band DTMF */
                if (h323debug) {
-                       ast_log(LOG_DTMF, "Begin sending inband digit %c on %s\n", digit, c->name);
+                       ast_log(LOG_DTMF, "Begin sending inband digit %c on %s\n", digit, ast_channel_name(c));
                }
                pvt->txDtmfDigit = digit;
                token = pvt->cd.call