diff options
103 files changed, 1712 insertions, 1630 deletions
diff --git a/addons/chan_mobile.c b/addons/chan_mobile.c index 743f81168..defbe19a3 100644 --- a/addons/chan_mobile.c +++ b/addons/chan_mobile.c @@ -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) { diff --git a/addons/chan_ooh323.c b/addons/chan_ooh323.c index 2e04bc5c5..c1a69bcf6 100644 --- a/addons/chan_ooh323.c +++ b/addons/chan_ooh323.c @@ -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; diff --git a/apps/app_adsiprog.c b/apps/app_adsiprog.c index 430d8258d..518a02113 100644 --- a/apps/app_adsiprog.c +++ b/apps/app_adsiprog.c @@ -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; } diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c index 1a4f9220f..20171e023 100644 --- a/apps/app_alarmreceiver.c +++ b/apps/app_alarmreceiver.c @@ -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; } diff --git a/apps/app_amd.c b/apps/app_amd.c index 35c5005f7..0e0301007 100644 --- a/apps/app_amd.c +++ b/apps/app_amd.c @@ -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); diff --git a/apps/app_chanisavail.c b/apps/app_chanisavail.c index 86ce34177..37ba214ca 100644 --- a/apps/app_chanisavail.c +++ b/apps/app_chanisavail.c @@ -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); diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 278098c10..af816f320 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -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, "-"); diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index d5609b741..8683c95f8 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -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; } diff --git a/apps/app_dahdibarge.c b/apps/app_dahdibarge.c index bb0120cbc..5384c6814 100644 --- a/apps/app_dahdibarge.c +++ b/apps/app_dahdibarge.c @@ -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; diff --git a/apps/app_dahdiras.c b/apps/app_dahdiras.c index fbaf98450..dcf0cafb3 100644 --- a/apps/app_dahdiras.c +++ b/apps/app_dahdiras.c @@ -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); } diff --git a/apps/app_dial.c b/apps/app_dial.c index 24bff278a..2c7f50a9e 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -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 */ } diff --git a/apps/app_directed_pickup.c b/apps/app_directed_pickup.c index b01ec4c69..4fda8320e 100644 --- a/apps/app_directed_pickup.c +++ b/apps/app_directed_pickup.c @@ -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) { diff --git a/apps/app_disa.c b/apps/app_disa.c index 3ca080009..ce175bc20 100644 --- a/apps/app_disa.c +++ b/apps/app_disa.c @@ -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 { diff --git a/apps/app_dumpchan.c b/apps/app_dumpchan.c index 0a9fa6888..9b0096f0a 100644 --- a/apps/app_dumpchan.c +++ b/apps/app_dumpchan.c @@ -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; diff --git a/apps/app_externalivr.c b/apps/app_externalivr.c index 4eb99c1bb..d8ff60ab0 100644 --- a/apps/app_externalivr.c +++ b/apps/app_externalivr.c @@ -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 */ diff --git a/apps/app_fax.c b/apps/app_fax.c index 5285ba833..e4cf44f62 100644 --- a/apps/app_fax.c +++ b/apps/app_fax.c @@ -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; } } diff --git a/apps/app_flash.c b/apps/app_flash.c index 3273b5b0a..283953b39 100644 --- a/apps/app_flash.c +++ b/apps/app_flash.c @@ -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; } diff --git a/apps/app_followme.c b/apps/app_followme.c index 6d46a1fd5..d3e8f4778 100644 --- a/apps/app_followme.c +++ b/apps/app_followme.c @@ -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; } diff --git a/apps/app_getcpeid.c b/apps/app_getcpeid.c index 7f59976eb..30b5d78a4 100644 --- a/apps/app_getcpeid.c +++ b/apps/app_getcpeid.c @@ -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; } } diff --git a/apps/app_jack.c b/apps/app_jack.c index 893a5dec0..46024ff39 100644 --- a/apps/app_jack.c +++ b/apps/app_jack.c @@ -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; } diff --git a/apps/app_macro.c b/apps/app_macro.c index 8a31dc221..86017e6ed 100644 --- a/apps/app_macro.c +++ b/apps/app_macro.c @@ -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; } diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 956f95c52..2b3f5c43f 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -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", diff --git a/apps/app_milliwatt.c b/apps/app_milliwatt.c index dc37e7e89..412ac1ef4 100644 --- a/apps/app_milliwatt.c +++ b/apps/app_milliwatt.c @@ -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; } diff --git a/apps/app_minivm.c b/apps/app_minivm.c index edffd4d3f..9348b3a84 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -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, diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c index 82ee8c7ad..b7d40f3f7 100644 --- a/apps/app_mixmonitor.c +++ b/apps/app_mixmonitor.c @@ -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; diff --git a/apps/app_page.c b/apps/app_page.c index cf2101446..1389c792c 100644 --- a/apps/app_page.c +++ b/apps/app_page.c @@ -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'; } diff --git a/apps/app_parkandannounce.c b/apps/app_parkandannounce.c index c899bd220..f245d5929 100644 --- a/apps/app_parkandannounce.c +++ b/apps/app_parkandannounce.c @@ -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)); } } } diff --git a/apps/app_playback.c b/apps/app_playback.c index ea4d90b19..6db5377ea 100644 --- a/apps/app_playback.c +++ b/apps/app_playback.c @@ -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; } diff --git a/apps/app_queue.c b/apps/app_queue.c index de88dcaba..ec9ad3966 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -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"), diff --git a/apps/app_readexten.c b/apps/app_readexten.c index 479211911..6e8531d16 100644 --- a/apps/app_readexten.c +++ b/apps/app_readexten.c @@ -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"; diff --git a/apps/app_record.c b/apps/app_record.c index 6098ca729..18101e460 100644 --- a/apps/app_record.c +++ b/apps/app_record.c @@ -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); } diff --git a/apps/app_rpt.c b/apps/app_rpt.c index 6722040e5..3a8ef4ad8 100644 --- a/apps/app_rpt.c +++ b/apps/app_rpt.c @@ -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); diff --git a/apps/app_sms.c b/apps/app_sms.c index e3f8c5260..68770da30 100644 --- a/apps/app_sms.c +++ b/apps/app_sms.c @@ -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; } diff --git a/apps/app_softhangup.c b/apps/app_softhangup.c index cdfd7c147..2a4befa9e 100644 --- a/apps/app_softhangup.c +++ b/apps/app_softhangup.c @@ -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); diff --git a/apps/app_stack.c b/apps/app_stack.c index c5f0b6aff..83de48187 100644 --- a/apps/app_stack.c +++ b/apps/app_stack.c @@ -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"); diff --git a/apps/app_talkdetect.c b/apps/app_talkdetect.c index 9eb800287..a177227be 100644 --- a/apps/app_talkdetect.c +++ b/apps/app_talkdetect.c @@ -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) { diff --git a/apps/app_test.c b/apps/app_test.c index 32b6fc02b..9e118669e 100644 --- a/apps/app_test.c +++ b/apps/app_test.c @@ -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; diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 8be69e5a6..062e103d0 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -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 : ""); diff --git a/apps/app_waitforsilence.c b/apps/app_waitforsilence.c index a920e11a8..3d3aa75df 100644 --- a/apps/app_waitforsilence.c +++ b/apps/app_waitforsilence.c @@ -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; diff --git a/bridges/bridge_multiplexed.c b/bridges/bridge_multiplexed.c index e004dfd40..9ca6aa45b 100644 --- a/bridges/bridge_multiplexed.c +++ b/bridges/bridge_multiplexed.c @@ -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); diff --git a/channels/chan_agent.c b/channels/chan_agent.c index 13f080ebb..75aceacc7 100644 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -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")) { diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c index bd9aea599..8f380909a 100644 --- a/channels/chan_alsa.c +++ b/channels/chan_alsa.c @@ -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; } diff --git a/channels/chan_console.c b/channels/chan_console.c index 7a40f9be6..7e2301073 100644 --- a/channels/chan_console.c +++ b/channels/chan_console.c @@ -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; } diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index ce5b28bf2..da167d64e 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -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), diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c index 855c89ba2..21b80e254 100644 --- a/channels/chan_gtalk.c +++ b/channels/chan_gtalk.c @@ -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), diff --git a/channels/chan_h323.c b/channels/chan_h323.c index 5f2872086..7999bc40a 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -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_token ? ast_strdup(pvt->cd.call_token) : NULL; @@ -561,14 +561,14 @@ static int oh323_digit_end(struct ast_channel *c, char digit, unsigned int durat if (pvt->rtp && (pvt->options.dtmfmode & H323_DTMF_RFC2833) && ((pvt->dtmf_pt[0] > 0) || (pvt->dtmf_pt[0] > 0))) { /* out-of-band DTMF */ if (h323debug) { - ast_log(LOG_DTMF, "End sending out-of-band digit %c on %s, duration %d\n", digit, c->name, duration); + ast_log(LOG_DTMF, "End sending out-of-band digit %c on %s, duration %d\n", digit, ast_channel_name(c), duration); } ast_rtp_instance_dtmf_end(pvt->rtp, digit); ast_mutex_unlock(&pvt->lock); } else { /* in-band DTMF */ if (h323debug) { - ast_log(LOG_DTMF, "End sending inband digit %c on %s, duration %d\n", digit, c->name, duration); + ast_log(LOG_DTMF, "End sending inband digit %c on %s, duration %d\n", digit, ast_channel_name(c), duration); } pvt->txDtmfDigit = ' '; token = pvt->cd.call_token ? ast_strdup(pvt->cd.call_token) : NULL; @@ -595,10 +595,10 @@ static int oh323_call(struct ast_channel *c, char *dest, int timeout) char called_addr[1024]; if (h323debug) { - ast_debug(1, "Calling to %s on %s\n", dest, c->name); + ast_debug(1, "Calling to %s on %s\n", dest, ast_channel_name(c)); } if ((c->_state != AST_STATE_DOWN) && (c->_state != AST_STATE_RESERVED)) { - ast_log(LOG_WARNING, "Line is already in use (%s)\n", c->name); + ast_log(LOG_WARNING, "Line is already in use (%s)\n", ast_channel_name(c)); return -1; } ast_mutex_lock(&pvt->lock); @@ -660,7 +660,7 @@ static int oh323_call(struct ast_channel *c, char *dest, int timeout) ast_mutex_unlock(&pvt->lock); res = h323_make_call(called_addr, &(pvt->cd), &pvt->options); if (res) { - ast_log(LOG_NOTICE, "h323_make_call failed(%s)\n", c->name); + ast_log(LOG_NOTICE, "h323_make_call failed(%s)\n", ast_channel_name(c)); return -1; } oh323_update_info(c); @@ -674,7 +674,7 @@ static int oh323_answer(struct ast_channel *c) char *token; if (h323debug) - ast_debug(1, "Answering on %s\n", c->name); + ast_debug(1, "Answering on %s\n", ast_channel_name(c)); ast_mutex_lock(&pvt->lock); token = pvt->cd.call_token ? ast_strdup(pvt->cd.call_token) : NULL; @@ -698,7 +698,7 @@ static int oh323_hangup(struct ast_channel *c) if (h323debug) - ast_debug(1, "Hanging up and scheduling destroy of call %s\n", c->name); + ast_debug(1, "Hanging up and scheduling destroy of call %s\n", ast_channel_name(c)); if (!c->tech_pvt) { ast_log(LOG_WARNING, "Asked to hangup channel not connected\n"); @@ -831,7 +831,7 @@ static struct ast_frame *oh323_read(struct ast_channel *c) fr = &ast_null_frame; break; default: - ast_log(LOG_ERROR, "Unable to handle fd %d on channel %s\n", c->fdno, c->name); + ast_log(LOG_ERROR, "Unable to handle fd %d on channel %s\n", c->fdno, ast_channel_name(c)); fr = &ast_null_frame; break; } @@ -886,7 +886,7 @@ static int oh323_indicate(struct ast_channel *c, int condition, const void *data ast_mutex_unlock(&pvt->lock); if (h323debug) - ast_debug(1, "OH323: Indicating %d on %s (%s)\n", condition, token, c->name); + ast_debug(1, "OH323: Indicating %d on %s (%s)\n", condition, token, ast_channel_name(c)); switch(condition) { case AST_CONTROL_RINGING: @@ -1127,7 +1127,7 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c ch->transfercapability = pvt->cd.transfer_capability; 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_hangup(ch); ch = NULL; } diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 34d6536f9..c799955a0 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -1323,7 +1323,7 @@ static void iax2_ami_channelupdate(struct chan_iax2_pvt *pvt) { manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate", "Channel: %s\r\nChanneltype: IAX2\r\nIAX2-callno-local: %d\r\nIAX2-callno-remote: %d\r\nIAX2-peer: %s\r\n", - pvt->owner ? pvt->owner->name : "", + pvt->owner ? ast_channel_name(pvt->owner) : "", pvt->callno, pvt->peercallno, pvt->peer ? pvt->peer : ""); } @@ -3560,7 +3560,7 @@ static void __attempt_transmit(const void *data) iax2_destroy(callno); } else { if (iaxs[callno]->owner) - ast_log(LOG_WARNING, "Max retries exceeded to host %s on %s (type = %d, subclass = %u, ts=%d, seqno=%d)\n", ast_inet_ntoa(iaxs[f->callno]->addr.sin_addr),iaxs[f->callno]->owner->name , f->af.frametype, f->af.subclass.integer, f->ts, f->oseqno); + ast_log(LOG_WARNING, "Max retries exceeded to host %s on %s (type = %d, subclass = %u, ts=%d, seqno=%d)\n", ast_inet_ntoa(iaxs[f->callno]->addr.sin_addr),ast_channel_name(iaxs[f->callno]->owner), f->af.frametype, f->af.subclass.integer, f->ts, f->oseqno); iaxs[callno]->error = ETIMEDOUT; if (iaxs[callno]->owner) { struct ast_frame fr = { AST_FRAME_CONTROL, { AST_CONTROL_HANGUP }, .data.uint32 = AST_CAUSE_DESTINATION_OUT_OF_ORDER }; @@ -5092,7 +5092,7 @@ static int iax2_call(struct ast_channel *c, char *dest, int timeout) iax2_format iax2_tmpfmt; if ((c->_state != AST_STATE_DOWN) && (c->_state != AST_STATE_RESERVED)) { - ast_log(LOG_WARNING, "Channel is already in use (%s)?\n", c->name); + ast_log(LOG_WARNING, "Channel is already in use (%s)?\n", ast_channel_name(c)); return -1; } @@ -5292,7 +5292,7 @@ static int iax2_hangup(struct ast_channel *c) memset(&ied, 0, sizeof(ied)); ast_mutex_lock(&iaxsl[callno]); if (callno && iaxs[callno]) { - ast_debug(1, "We're hanging up %s now...\n", c->name); + ast_debug(1, "We're hanging up %s now...\n", ast_channel_name(c)); alreadygone = ast_test_flag64(iaxs[callno], IAX_ALREADYGONE); /* Send the hangup unless we have had a transmission error or are already gone */ iax_ie_append_byte(&ied, IAX_IE_CAUSECODE, (unsigned char)c->hangupcause); @@ -5309,7 +5309,7 @@ static int iax2_hangup(struct ast_channel *c) iax2_predestroy(callno); /* If we were already gone to begin with, destroy us now */ if (iaxs[callno] && alreadygone) { - ast_debug(1, "Really destroying %s now...\n", c->name); + ast_debug(1, "Really destroying %s now...\n", ast_channel_name(c)); iax2_destroy(callno); } else if (iaxs[callno]) { if (ast_sched_add(sched, 10000, scheduled_destroy, CALLNO_TO_PTR(callno)) < 0) { @@ -5325,7 +5325,7 @@ static int iax2_hangup(struct ast_channel *c) c->tech_pvt = NULL; } ast_mutex_unlock(&iaxsl[callno]); - ast_verb(3, "Hungup '%s'\n", c->name); + ast_verb(3, "Hungup '%s'\n", ast_channel_name(c)); return 0; } @@ -5752,7 +5752,7 @@ static int iax2_transfer(struct ast_channel *c, const char *dest) iax_ie_append_str(&ied, IAX_IE_CALLED_NUMBER, tmp); if (context) iax_ie_append_str(&ied, IAX_IE_CALLED_CONTEXT, context); - ast_debug(1, "Transferring '%s' to '%s'\n", c->name, dest); + ast_debug(1, "Transferring '%s' to '%s'\n", ast_channel_name(c), dest); ast_queue_control_data(c, AST_CONTROL_TRANSFER, &message, sizeof(message)); return send_command_locked(callno, AST_FRAME_IAX, IAX_COMMAND_TRANSFER, 0, ied.buf, ied.pos, -1); } @@ -5902,7 +5902,7 @@ static struct ast_channel *ast_iax2_new(int callno, int state, iax2_format capab 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); i->owner = NULL; return NULL; @@ -7275,7 +7275,7 @@ static char *handle_cli_iax2_show_channels(struct ast_cli_entry *e, int cmd, str iax_frame_subclass2str(iaxs[x]->last_iax_message & ~MARK_IAX_SUBCLASS_TX, last_message, sizeof(last_message)); lag = iaxs[x]->remote_rr.delay; ast_cli(a->fd, FORMAT, - iaxs[x]->owner ? iaxs[x]->owner->name : "(None)", + iaxs[x]->owner ? ast_channel_name(iaxs[x]->owner) : "(None)", ast_inet_ntoa(iaxs[x]->addr.sin_addr), S_OR(iaxs[x]->username, "(None)"), iaxs[x]->callno, iaxs[x]->peercallno, @@ -7333,7 +7333,7 @@ static int ast_cli_netstats(struct mansession *s, int fd, int limit_fmt) } if (s) astman_append(s, limit_fmt ? ACN_FORMAT1 : ACN_FORMAT2, - iaxs[x]->owner ? iaxs[x]->owner->name : "(None)", + iaxs[x]->owner ? ast_channel_name(iaxs[x]->owner) : "(None)", iaxs[x]->pingtime, localjitter, localdelay, @@ -7355,7 +7355,7 @@ static int ast_cli_netstats(struct mansession *s, int fd, int limit_fmt) last_message); else ast_cli(fd, limit_fmt ? ACN_FORMAT1 : ACN_FORMAT2, - iaxs[x]->owner ? iaxs[x]->owner->name : "(None)", + iaxs[x]->owner ? ast_channel_name(iaxs[x]->owner) : "(None)", iaxs[x]->pingtime, localjitter, localdelay, @@ -9366,7 +9366,7 @@ static void *iax_park_thread(void *stuff) d = stuff; ast_debug(4, "IAX Park: Transferer channel %s, Transferee %s\n", - d->chan2->name, d->chan1->name); + ast_channel_name(d->chan2), ast_channel_name(d->chan1)); res = ast_park_call_exten(d->chan1, d->chan2, d->park_exten, d->park_context, 0, &ext); if (res) { @@ -9390,8 +9390,8 @@ static int iax_park(struct ast_channel *chan1, struct ast_channel *chan2, const struct ast_channel *chan1m, *chan2m;/* Chan2m: The transferer, chan1m: The transferee */ pthread_t th; - chan1m = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan2->accountcode, chan1->exten, chan1->context, chan1->linkedid, chan1->amaflags, "Parking/%s", chan1->name); - chan2m = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan2->accountcode, chan2->exten, chan2->context, chan2->linkedid, chan2->amaflags, "IAXPeer/%s", chan2->name); + chan1m = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan2->accountcode, chan1->exten, chan1->context, chan1->linkedid, chan1->amaflags, "Parking/%s", ast_channel_name(chan1)); + chan2m = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan2->accountcode, chan2->exten, chan2->context, chan2->linkedid, chan2->amaflags, "IAXPeer/%s", ast_channel_name(chan2)); d = ast_calloc(1, sizeof(*d)); if (!chan1m || !chan2m || !d) { if (chan1m) { @@ -9550,7 +9550,7 @@ static void log_jitterstats(unsigned short callno) jb_info jbinfo; ast_mutex_lock(&iaxsl[callno]); - if (iaxs[callno] && iaxs[callno]->owner && iaxs[callno]->owner->name) { + if (iaxs[callno] && iaxs[callno]->owner && ast_channel_name(iaxs[callno]->owner)) { if(ast_test_flag64(iaxs[callno], IAX_USEJITTERBUF)) { jb_getinfo(iaxs[callno]->jb, &jbinfo); localjitter = jbinfo.jitter; @@ -9562,7 +9562,7 @@ static void log_jitterstats(unsigned short callno) localpackets = jbinfo.frames_in; } ast_debug(3, "JB STATS:%s ping=%d ljitterms=%d ljbdelayms=%d ltotlost=%d lrecentlosspct=%d ldropped=%d looo=%d lrecvd=%d rjitterms=%d rjbdelayms=%d rtotlost=%d rrecentlosspct=%d rdropped=%d rooo=%d rrecvd=%d\n", - iaxs[callno]->owner->name, + ast_channel_name(iaxs[callno]->owner), iaxs[callno]->pingtime, localjitter, localdelay, @@ -9579,7 +9579,7 @@ static void log_jitterstats(unsigned short callno) iaxs[callno]->remote_rr.ooo, iaxs[callno]->remote_rr.packets); manager_event(EVENT_FLAG_REPORTING, "JitterBufStats", "Owner: %s\r\nPing: %d\r\nLocalJitter: %d\r\nLocalJBDelay: %d\r\nLocalTotalLost: %d\r\nLocalLossPercent: %d\r\nLocalDropped: %d\r\nLocalooo: %d\r\nLocalReceived: %d\r\nRemoteJitter: %d\r\nRemoteJBDelay: %d\r\nRemoteTotalLost: %d\r\nRemoteLossPercent: %d\r\nRemoteDropped: %d\r\nRemoteooo: %d\r\nRemoteReceived: %d\r\n", - iaxs[callno]->owner->name, + ast_channel_name(iaxs[callno]->owner), iaxs[callno]->pingtime, localjitter, localdelay, @@ -9946,7 +9946,7 @@ static void set_hangup_source_and_cause(int callno, unsigned char causecode) if (causecode) { iaxs[callno]->owner->hangupcause = causecode; } - ast_set_hangupsource(iaxs[callno]->owner, iaxs[callno]->owner->name, 0); + ast_set_hangupsource(iaxs[callno]->owner, ast_channel_name(iaxs[callno]->owner), 0); ast_channel_unlock(iaxs[callno]->owner); } } @@ -10495,7 +10495,7 @@ static int socket_process(struct iax2_thread *thread) "Status: On\r\n" "Channel: %s\r\n" "Uniqueid: %s\r\n", - iaxs[fr->callno]->owner->name, + ast_channel_name(iaxs[fr->callno]->owner), iaxs[fr->callno]->owner->uniqueid); } @@ -10532,7 +10532,7 @@ static int socket_process(struct iax2_thread *thread) "Status: Off\r\n" "Channel: %s\r\n" "Uniqueid: %s\r\n", - iaxs[fr->callno]->owner->name, + ast_channel_name(iaxs[fr->callno]->owner), iaxs[fr->callno]->owner->uniqueid); } @@ -10858,24 +10858,24 @@ static int socket_process(struct iax2_thread *thread) ast_mutex_unlock(&iaxsl[fr->callno]); /* Set BLINDTRANSFER channel variables */ - pbx_builtin_setvar_helper(owner, "BLINDTRANSFER", bridged_chan->name); - pbx_builtin_setvar_helper(bridged_chan, "BLINDTRANSFER", owner->name); + pbx_builtin_setvar_helper(owner, "BLINDTRANSFER", ast_channel_name(bridged_chan)); + pbx_builtin_setvar_helper(bridged_chan, "BLINDTRANSFER", ast_channel_name(owner)); /* DO NOT hold any locks while calling ast_parking_ext_valid() */ if (ast_parking_ext_valid(ies.called_number, owner, context)) { - ast_debug(1, "Parking call '%s'\n", bridged_chan->name); + ast_debug(1, "Parking call '%s'\n", ast_channel_name(bridged_chan)); if (iax_park(bridged_chan, owner, ies.called_number, context)) { ast_log(LOG_WARNING, "Failed to park call '%s'\n", - bridged_chan->name); + ast_channel_name(bridged_chan)); } } else { if (ast_async_goto(bridged_chan, context, ies.called_number, 1)) { ast_log(LOG_WARNING, "Async goto of '%s' to '%s@%s' failed\n", - bridged_chan->name, ies.called_number, context); + ast_channel_name(bridged_chan), ies.called_number, context); } else { ast_debug(1, "Async goto of '%s' to '%s@%s' started\n", - bridged_chan->name, ies.called_number, context); + ast_channel_name(bridged_chan), ies.called_number, context); } } ast_channel_unref(owner); @@ -11040,7 +11040,7 @@ static int socket_process(struct iax2_thread *thread) break; case IAX_COMMAND_AUTHREQ: if (ast_test_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED | IAX_STATE_TBD)) { - ast_log(LOG_WARNING, "Call on %s is already up, can't start on it\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>"); + ast_log(LOG_WARNING, "Call on %s is already up, can't start on it\n", iaxs[fr->callno]->owner ? ast_channel_name(iaxs[fr->callno]->owner) : "<Unknown>"); break; } if (authenticate_reply(iaxs[fr->callno], &iaxs[fr->callno]->addr, &ies, iaxs[fr->callno]->secret, iaxs[fr->callno]->outkey)) { @@ -11059,7 +11059,7 @@ static int socket_process(struct iax2_thread *thread) send_command_immediate(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr->ts, NULL, 0,fr->iseqno); /* Ignore once we've started */ if (ast_test_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED | IAX_STATE_TBD)) { - ast_log(LOG_WARNING, "Call on %s is already up, can't start on it\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>"); + ast_log(LOG_WARNING, "Call on %s is already up, can't start on it\n", iaxs[fr->callno]->owner ? ast_channel_name(iaxs[fr->callno]->owner) : "<Unknown>"); break; } if (authenticate_verify(iaxs[fr->callno], &ies)) { @@ -11417,7 +11417,7 @@ immediatedial: break; case IAX_COMMAND_TXREJ: iaxs[fr->callno]->transferring = 0; - ast_verb(3, "Channel '%s' unable to transfer\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>"); + ast_verb(3, "Channel '%s' unable to transfer\n", iaxs[fr->callno]->owner ? ast_channel_name(iaxs[fr->callno]->owner) : "<Unknown>"); memset(&iaxs[fr->callno]->transfer, 0, sizeof(iaxs[fr->callno]->transfer)); if (iaxs[fr->callno]->bridgecallno) { if (iaxs[iaxs[fr->callno]->bridgecallno]->transferring) { @@ -11433,14 +11433,14 @@ immediatedial: iaxs[fr->callno]->transferring = TRANSFER_MREADY; else iaxs[fr->callno]->transferring = TRANSFER_READY; - ast_verb(3, "Channel '%s' ready to transfer\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>"); + ast_verb(3, "Channel '%s' ready to transfer\n", iaxs[fr->callno]->owner ? ast_channel_name(iaxs[fr->callno]->owner) : "<Unknown>"); if (iaxs[fr->callno]->bridgecallno) { if ((iaxs[iaxs[fr->callno]->bridgecallno]->transferring == TRANSFER_READY) || (iaxs[iaxs[fr->callno]->bridgecallno]->transferring == TRANSFER_MREADY)) { /* They're both ready, now release them. */ if (iaxs[fr->callno]->transferring == TRANSFER_MREADY) { - ast_verb(3, "Attempting media bridge of %s and %s\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>", - iaxs[iaxs[fr->callno]->bridgecallno]->owner ? iaxs[iaxs[fr->callno]->bridgecallno]->owner->name : "<Unknown>"); + ast_verb(3, "Attempting media bridge of %s and %s\n", iaxs[fr->callno]->owner ? ast_channel_name(iaxs[fr->callno]->owner) : "<Unknown>", + iaxs[iaxs[fr->callno]->bridgecallno]->owner ? ast_channel_name(iaxs[iaxs[fr->callno]->bridgecallno]->owner) : "<Unknown>"); iaxs[iaxs[fr->callno]->bridgecallno]->transferring = TRANSFER_MEDIA; iaxs[fr->callno]->transferring = TRANSFER_MEDIA; @@ -11452,8 +11452,8 @@ immediatedial: send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXMEDIA, 0, ied0.buf, ied0.pos, -1); send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXMEDIA, 0, ied1.buf, ied1.pos, -1); } else { - ast_verb(3, "Releasing %s and %s\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>", - iaxs[iaxs[fr->callno]->bridgecallno]->owner ? iaxs[iaxs[fr->callno]->bridgecallno]->owner->name : "<Unknown>"); + ast_verb(3, "Releasing %s and %s\n", iaxs[fr->callno]->owner ? ast_channel_name(iaxs[fr->callno]->owner) : "<Unknown>", + iaxs[iaxs[fr->callno]->bridgecallno]->owner ? ast_channel_name(iaxs[iaxs[fr->callno]->bridgecallno]->owner) : "<Unknown>"); iaxs[iaxs[fr->callno]->bridgecallno]->transferring = TRANSFER_RELEASED; iaxs[fr->callno]->transferring = TRANSFER_RELEASED; @@ -12238,7 +12238,7 @@ static struct ast_channel *iax2_request(const char *type, struct ast_format_cap char tmp[256]; char tmp2[256]; ast_log(LOG_WARNING, "Unable to create translator path for %s to %s on %s\n", - ast_getformatname_multiple(tmp, sizeof(tmp), c->nativeformats), ast_getformatname_multiple(tmp2, sizeof(tmp2), cap), c->name); + ast_getformatname_multiple(tmp, sizeof(tmp), c->nativeformats), ast_getformatname_multiple(tmp2, sizeof(tmp2), cap), ast_channel_name(c)); ast_hangup(c); return NULL; } diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c index 233ec7e2e..aad52e3cc 100644 --- a/channels/chan_jingle.c +++ b/channels/chan_jingle.c @@ -916,7 +916,7 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt * 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; @@ -1503,7 +1503,7 @@ static int jingle_call(struct ast_channel *ast, char *dest, int timeout) struct jingle_pvt *p = ast->tech_pvt; if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) { - ast_log(LOG_WARNING, "jingle_call called on %s, neither down nor reserved\n", ast->name); + ast_log(LOG_WARNING, "jingle_call called on %s, neither down nor reserved\n", ast_channel_name(ast)); return -1; } @@ -1632,7 +1632,7 @@ static char *jingle_show_channels(struct ast_cli_entry *e, int cmd, struct ast_c } if (chan) ast_cli(a->fd, FORMAT, - chan->name, + ast_channel_name(chan), jid, resource, ast_getformatname(&chan->readformat), diff --git a/channels/chan_local.c b/channels/chan_local.c index 25ac5ae11..69e6841e9 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -326,7 +326,7 @@ static struct ast_channel *local_bridgedchannel(struct ast_channel *chan, struct if (!p) { ast_debug(1, "Asked for bridged channel on '%s'/'%s', returning <none>\n", - chan->name, bridge->name); + ast_channel_name(chan), ast_channel_name(bridge)); return NULL; } @@ -607,7 +607,7 @@ static int local_write(struct ast_channel *ast, struct ast_frame *f) if (!ast_test_flag(p, LOCAL_ALREADY_MASQED)) { res = local_queue_frame(p, isoutbound, f, ast, 1); } else { - ast_debug(1, "Not posting to queue since already masked on '%s'\n", ast->name); + ast_debug(1, "Not posting to queue since already masked on '%s'\n", ast_channel_name(ast)); res = 0; } ao2_unlock(p); @@ -917,7 +917,7 @@ static int local_call(struct ast_channel *ast, char *dest, int timeout) "Context: %s\r\n" "Exten: %s\r\n" "LocalOptimization: %s\r\n", - p->owner->name, p->chan->name, p->owner->uniqueid, p->chan->uniqueid, + ast_channel_name(p->owner), ast_channel_name(p->chan), p->owner->uniqueid, p->chan->uniqueid, p->context, p->exten, ast_test_flag(p, LOCAL_NO_OPTIMIZATION) ? "Yes" : "No"); @@ -1234,7 +1234,7 @@ static char *locals_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args * it = ao2_iterator_init(locals, 0); while ((p = ao2_iterator_next(&it))) { ao2_lock(p); - ast_cli(a->fd, "%s -- %s@%s\n", p->owner ? p->owner->name : "<unowned>", p->exten, p->context); + ast_cli(a->fd, "%s -- %s@%s\n", p->owner ? ast_channel_name(p->owner) : "<unowned>", p->exten, p->context); ao2_unlock(p); ao2_ref(p, -1); } diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 9df36eb7a..8c3ddd0ce 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -842,7 +842,7 @@ static int mgcp_call(struct ast_channel *ast, char *dest, int timeout) struct varshead *headp; struct ast_var_t *current; - ast_debug(3, "MGCP mgcp_call(%s)\n", ast->name); + ast_debug(3, "MGCP mgcp_call(%s)\n", ast_channel_name(ast)); sub = ast->tech_pvt; p = sub->parent; headp = &ast->varshead; @@ -877,7 +877,7 @@ static int mgcp_call(struct ast_channel *ast, char *dest, int timeout) } if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) { - ast_log(LOG_WARNING, "mgcp_call called on %s, neither down nor reserved\n", ast->name); + ast_log(LOG_WARNING, "mgcp_call called on %s, neither down nor reserved\n", ast_channel_name(ast)); ast_mutex_unlock(&sub->lock); return -1; } @@ -923,7 +923,7 @@ static int mgcp_hangup(struct ast_channel *ast) struct mgcp_endpoint *p = sub->parent; struct ast_channel *bridged; - ast_debug(1, "mgcp_hangup(%s)\n", ast->name); + ast_debug(1, "mgcp_hangup(%s)\n", ast_channel_name(ast)); if (!ast->tech_pvt) { ast_debug(1, "Asked to hangup channel not connected\n"); return 0; @@ -933,7 +933,7 @@ static int mgcp_hangup(struct ast_channel *ast) return 0; } ast_mutex_lock(&sub->lock); - ast_debug(3, "MGCP mgcp_hangup(%s) on %s@%s\n", ast->name, p->name, p->parent->name); + ast_debug(3, "MGCP mgcp_hangup(%s) on %s@%s\n", ast_channel_name(ast), p->name, p->parent->name); if ((p->dtmfmode & MGCP_DTMF_INBAND) && p->dsp) { /* check whether other channel is active. */ @@ -1017,16 +1017,16 @@ static int mgcp_hangup(struct ast_channel *ast) if ((p->hookstate == MGCP_ONHOOK) && (!sub->next->rtp)) { p->hidecallerid = 0; if (p->hascallwaiting && !p->callwaiting) { - ast_verb(3, "Enabling call waiting on %s\n", ast->name); + ast_verb(3, "Enabling call waiting on %s\n", ast_channel_name(ast)); p->callwaiting = -1; } if (has_voicemail(p)) { ast_debug(3, "MGCP mgcp_hangup(%s) on %s@%s set vmwi(+)\n", - ast->name, p->name, p->parent->name); + ast_channel_name(ast), p->name, p->parent->name); transmit_notify_request(sub, "L/vmwi(+)"); } else { ast_debug(3, "MGCP mgcp_hangup(%s) on %s@%s set vmwi(-)\n", - ast->name, p->name, p->parent->name); + ast_channel_name(ast), p->name, p->parent->name); transmit_notify_request(sub, "L/vmwi(-)"); } } @@ -1186,10 +1186,10 @@ static int mgcp_answer(struct ast_channel *ast) transmit_modify_request(sub); } ast_verb(3, "MGCP mgcp_answer(%s) on %s@%s-%d\n", - ast->name, p->name, p->parent->name, sub->id); + ast_channel_name(ast), p->name, p->parent->name, sub->id); if (ast->_state != AST_STATE_UP) { ast_setstate(ast, AST_STATE_UP); - ast_debug(1, "mgcp_answer(%s)\n", ast->name); + ast_debug(1, "mgcp_answer(%s)\n", ast_channel_name(ast)); transmit_notify_request(sub, ""); transmit_modify_request(sub); } @@ -1284,7 +1284,7 @@ static int mgcp_fixup(struct ast_channel *oldchan, struct ast_channel *newchan) struct mgcp_subchannel *sub = newchan->tech_pvt; ast_mutex_lock(&sub->lock); - ast_log(LOG_NOTICE, "mgcp_fixup(%s, %s)\n", oldchan->name, newchan->name); + ast_log(LOG_NOTICE, "mgcp_fixup(%s, %s)\n", ast_channel_name(oldchan), ast_channel_name(newchan)); if (sub->owner != oldchan) { ast_mutex_unlock(&sub->lock); ast_log(LOG_WARNING, "old channel wasn't %p but was %p\n", oldchan, sub->owner); @@ -1441,7 +1441,7 @@ static int mgcp_indicate(struct ast_channel *ast, int ind, const void *data, siz int res = 0; ast_debug(3, "MGCP asked to indicate %d '%s' condition on channel %s\n", - ind, control2str(ind), ast->name); + ind, control2str(ind), ast_channel_name(ast)); ast_mutex_lock(&sub->lock); switch(ind) { case AST_CONTROL_RINGING: @@ -1560,13 +1560,13 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state, cons } 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; } } ast_verb(3, "MGCP mgcp_new(%s) created in state: %s\n", - tmp->name, ast_state2str(state)); + ast_channel_name(tmp), ast_state2str(state)); } else { ast_log(LOG_WARNING, "Unable to allocate channel structure\n"); } @@ -3004,7 +3004,7 @@ static void *mgcp_ss(void *data) /* Record this as the forwarding extension */ ast_copy_string(p->call_forward, p->dtmf_buf, sizeof(p->call_forward)); ast_verb(3, "Setting call forward to '%s' on channel %s\n", - p->call_forward, chan->name); + p->call_forward, ast_channel_name(chan)); /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/ transmit_notify_request(sub, "L/sl"); if (res) @@ -3057,7 +3057,7 @@ static void *mgcp_ss(void *data) memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf)); return NULL; } else if (p->hascallwaiting && p->callwaiting && !strcmp(p->dtmf_buf, "*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[index].zfd, DAHDI_TONE_DIALRECALL);*/ @@ -3079,7 +3079,7 @@ static void *mgcp_ss(void *data) ast_hangup(chan); return NULL; } else if (!p->hidecallerid && !strcmp(p->dtmf_buf, "*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_set_callerid(chan, "", "", NULL); @@ -3099,7 +3099,7 @@ static void *mgcp_ss(void *data) break; } else if (!strcmp(p->dtmf_buf, "*78")) { /* Do not disturb */ - ast_verb(3, "Enabled DND on channel %s\n", chan->name); + ast_verb(3, "Enabled DND on channel %s\n", ast_channel_name(chan)); /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/ transmit_notify_request(sub, "L/sl"); p->dnd = 1; @@ -3108,7 +3108,7 @@ static void *mgcp_ss(void *data) len = 0; } else if (!strcmp(p->dtmf_buf, "*79")) { /* Do not disturb */ - ast_verb(3, "Disabled DND on channel %s\n", chan->name); + ast_verb(3, "Disabled DND on channel %s\n", ast_channel_name(chan)); /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/ transmit_notify_request(sub, "L/sl"); p->dnd = 0; @@ -3122,7 +3122,7 @@ static void *mgcp_ss(void *data) memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf)); len = 0; } else if (p->cancallforward && !strcmp(p->dtmf_buf, "*73")) { - ast_verb(3, "Cancelling call forwarding on channel %s\n", chan->name); + ast_verb(3, "Cancelling call forwarding on channel %s\n", ast_channel_name(chan)); /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/ transmit_notify_request(sub, "L/sl"); memset(p->call_forward, 0, sizeof(p->call_forward)); @@ -3135,7 +3135,7 @@ static void *mgcp_ss(void *data) and we're parking the first call. */ ast_masq_park_call_exten(ast_bridged_channel(sub->next->owner), chan, p->dtmf_buf, 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 (!ast_strlen_zero(p->lastcallerid) && !strcmp(p->dtmf_buf, "*60")) { ast_verb(3, "Blacklisting number %s\n", p->lastcallerid); @@ -3147,7 +3147,7 @@ static void *mgcp_ss(void *data) len = 0; } } else if (p->hidecallerid && !strcmp(p->dtmf_buf, "*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); @@ -3234,7 +3234,7 @@ static int attempt_transfer(struct mgcp_endpoint *p) } if (ast_channel_masquerade(p->sub->next->owner, ast_bridged_channel(p->sub->owner))) { ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n", - ast_bridged_channel(p->sub->owner)->name, p->sub->next->owner->name); + ast_channel_name(ast_bridged_channel(p->sub->owner)), ast_channel_name(p->sub->next->owner)); return -1; } /* Orphan the channel */ @@ -3246,7 +3246,7 @@ static int attempt_transfer(struct mgcp_endpoint *p) ast_queue_control(p->sub->next->owner, AST_CONTROL_UNHOLD); if (ast_channel_masquerade(p->sub->owner, ast_bridged_channel(p->sub->next->owner))) { ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n", - ast_bridged_channel(p->sub->next->owner)->name, p->sub->owner->name); + ast_channel_name(ast_bridged_channel(p->sub->next->owner)), ast_channel_name(p->sub->owner)); return -1; } /*swap_subs(p, SUB_THREEWAY, SUB_REAL);*/ @@ -3257,7 +3257,7 @@ static int attempt_transfer(struct mgcp_endpoint *p) return 1; } else { ast_debug(1, "Neither %s nor %s are in a bridge, nothing to transfer\n", - p->sub->owner->name, p->sub->next->owner->name); + ast_channel_name(p->sub->owner), ast_channel_name(p->sub->next->owner)); p->sub->next->owner->_softhangup |= AST_SOFTHANGUP_DEV; if (p->sub->next->owner) { p->sub->next->alreadygone = 1; diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c index 30b104452..a9614344a 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -762,7 +762,7 @@ static struct chan_list *get_chan_by_ast_name(const char *name) ast_mutex_lock(&cl_te_lock); for (tmp = cl_te; tmp; tmp = tmp->next) { - if (tmp->ast && strcmp(tmp->ast->name, name) == 0) { + if (tmp->ast && strcmp(ast_channel_name(tmp->ast), name) == 0) { chan_list_ref(tmp, "Found chan_list by ast name"); ast_mutex_unlock(&cl_te_lock); return tmp; @@ -3682,7 +3682,7 @@ static void send_digit_to_chan(struct chan_list *cl, char digit) ast_playtones_start(chan, 0, dtmf_tones[15], 0); } else { /* not handled */ - ast_debug(1, "Unable to handle DTMF tone '%c' for '%s'\n", digit, chan->name); + ast_debug(1, "Unable to handle DTMF tone '%c' for '%s'\n", digit, ast_channel_name(chan)); } } @@ -4178,7 +4178,7 @@ static void print_bc_info(int fd, struct chan_list *help, struct misdn_bchannel #endif " --> notone : rx %d tx:%d\n" " --> bc_hold: %d\n", - help->ast->name, + ast_channel_name(help->ast), help->l3id, help->addr, bc->addr, @@ -4296,7 +4296,7 @@ static char *handle_cli_misdn_show_channel(struct ast_cli_entry *e, int cmd, str struct ast_channel *ast = help->ast; if (bc && ast) { - if (!strcasecmp(ast->name, a->argv[3])) { + if (!strcasecmp(ast_channel_name(ast), a->argv[3])) { print_bc_info(a->fd, help, bc); break; } @@ -6507,7 +6507,7 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout) } if (((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) || !dest) { - ast_log(LOG_WARNING, " --> ! misdn_call called on %s, neither down nor reserved (or dest==NULL)\n", ast->name); + ast_log(LOG_WARNING, " --> ! misdn_call called on %s, neither down nor reserved (or dest==NULL)\n", ast_channel_name(ast)); ast->hangupcause = AST_CAUSE_NORMAL_TEMPORARY_FAILURE; ast_setstate(ast, AST_STATE_DOWN); return -1; @@ -6515,7 +6515,7 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout) ch = MISDN_ASTERISK_TECH_PVT(ast); if (!ch) { - ast_log(LOG_WARNING, " --> ! misdn_call called on %s, chan_list *ch==NULL\n", ast->name); + ast_log(LOG_WARNING, " --> ! misdn_call called on %s, chan_list *ch==NULL\n", ast_channel_name(ast)); ast->hangupcause = AST_CAUSE_NORMAL_TEMPORARY_FAILURE; ast_setstate(ast, AST_STATE_DOWN); return -1; @@ -6523,7 +6523,7 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout) newbc = ch->bc; if (!newbc) { - ast_log(LOG_WARNING, " --> ! misdn_call called on %s, newbc==NULL\n", ast->name); + ast_log(LOG_WARNING, " --> ! misdn_call called on %s, newbc==NULL\n", ast_channel_name(ast)); ast->hangupcause = AST_CAUSE_NORMAL_TEMPORARY_FAILURE; ast_setstate(ast, AST_STATE_DOWN); return -1; @@ -6545,7 +6545,7 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout) cc_record = misdn_cc_find_by_id(ch->record_id); if (!cc_record) { AST_LIST_UNLOCK(&misdn_cc_records_db); - ast_log(LOG_WARNING, " --> ! misdn_call called on %s, cc_record==NULL\n", ast->name); + ast_log(LOG_WARNING, " --> ! misdn_call called on %s, cc_record==NULL\n", ast_channel_name(ast)); ast->hangupcause = AST_CAUSE_NORMAL_TEMPORARY_FAILURE; ast_setstate(ast, AST_STATE_DOWN); return -1; @@ -6572,7 +6572,7 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout) ast_copy_string(ast->exten, newbc->dialed.number, sizeof(ast->exten)); chan_misdn_log(1, port, "* Call completion to: %s\n", newbc->dialed.number); - chan_misdn_log(2, port, " --> * tech:%s context:%s\n", ast->name, ast->context); + chan_misdn_log(2, port, " --> * tech:%s context:%s\n", ast_channel_name(ast), ast->context); } else #endif /* defined(AST_MISDN_ENHANCEMENTS) */ { @@ -6591,7 +6591,7 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout) } chan_misdn_log(1, port, "* CALL: %s\n", dest); - chan_misdn_log(2, port, " --> * dialed:%s tech:%s context:%s\n", args.ext, ast->name, ast->context); + chan_misdn_log(2, port, " --> * dialed:%s tech:%s context:%s\n", args.ext, ast_channel_name(ast), ast->context); ast_copy_string(ast->exten, args.ext, sizeof(ast->exten)); ast_copy_string(newbc->dialed.number, args.ext, sizeof(newbc->dialed.number)); @@ -6915,16 +6915,16 @@ static int misdn_indication(struct ast_channel *ast, int cond, const void *data, if (!p->bc) { if (p->hold.state == MISDN_HOLD_IDLE) { chan_misdn_log(1, 0, "* IND : Indication [%d] ignored on %s\n", cond, - ast->name); + ast_channel_name(ast)); ast_log(LOG_WARNING, "Private Pointer but no bc ?\n"); } else { chan_misdn_log(1, 0, "* IND : Indication [%d] ignored on hold %s\n", - cond, ast->name); + cond, ast_channel_name(ast)); } return -1; } - chan_misdn_log(5, p->bc->port, "* IND : Indication [%d] on %s\n\n", cond, ast->name); + chan_misdn_log(5, p->bc->port, "* IND : Indication [%d] on %s\n\n", cond, ast_channel_name(ast)); switch (cond) { case AST_CONTROL_BUSY: @@ -7052,7 +7052,7 @@ static int misdn_hangup(struct ast_channel *ast) return -1; } - ast_debug(1, "misdn_hangup(%s)\n", ast->name); + ast_debug(1, "misdn_hangup(%s)\n", ast_channel_name(ast)); /* Take the ast_channel's tech_pvt reference. */ ast_mutex_lock(&release_lock); @@ -7076,7 +7076,7 @@ static int misdn_hangup(struct ast_channel *ast) bc = misdn_lib_find_held_bc(p->hold.port, p->l3id); if (!bc) { chan_misdn_log(4, p->hold.port, - "misdn_hangup: Could not find held bc for (%s)\n", ast->name); + "misdn_hangup: Could not find held bc for (%s)\n", ast_channel_name(ast)); release_chan_early(p); ast_mutex_unlock(&release_lock); chan_list_unref(p, "Release ast_channel reference"); @@ -7234,7 +7234,7 @@ static int misdn_hangup(struct ast_channel *ast) } p->state = MISDN_CLEANING; - chan_misdn_log(3, bc->port, " --> Channel: %s hungup new state:%s\n", ast->name, + chan_misdn_log(3, bc->port, " --> Channel: %s hungup new state:%s\n", ast_channel_name(ast), misdn_get_ch_state(p)); ast_mutex_unlock(&release_lock); @@ -7265,7 +7265,7 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame if (!tmp->faxhandled) { struct ast_channel *ast = tmp->ast; tmp->faxhandled++; - chan_misdn_log(0, tmp->bc->port, "Fax detected, preparing %s for fax transfer.\n", ast->name); + chan_misdn_log(0, tmp->bc->port, "Fax detected, preparing %s for fax transfer.\n", ast_channel_name(ast)); tmp->bc->rxgain = 0; isdn_lib_update_rxgain(tmp->bc); tmp->bc->txgain = 0; @@ -7286,11 +7286,11 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame context = ast_strlen_zero(context_tmp) ? (ast_strlen_zero(ast->macrocontext) ? ast->context : ast->macrocontext) : context_tmp; if (ast_exists_extension(ast, context, "fax", 1, S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) { - ast_verb(3, "Redirecting %s to fax extension (context:%s)\n", ast->name, context); + ast_verb(3, "Redirecting %s to fax extension (context:%s)\n", ast_channel_name(ast), context); /* 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, context, "fax", 1)) { - ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast->name, context); + ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(ast), context); } } else { ast_log(LOG_NOTICE, "Fax detected but no fax extension, context:%s exten:%s\n", context, ast->exten); @@ -7300,7 +7300,7 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame } break; case 2: - ast_verb(3, "Not redirecting %s to fax extension, nojump is set.\n", ast->name); + ast_verb(3, "Not redirecting %s to fax extension, nojump is set.\n", ast_channel_name(ast)); break; default: break; @@ -7554,7 +7554,7 @@ static enum ast_bridge_result misdn_bridge(struct ast_channel *c0, misdn_lib_bridge(ch1->bc, ch2->bc); } - 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)); chan_misdn_log(1, ch1->bc->port, "* Making Native Bridge between \"%s\" <%s> and \"%s\" <%s>\n", ch1->bc->caller.name, @@ -8100,10 +8100,10 @@ static void update_name(struct ast_channel *tmp, int port, int c) } snprintf(newname, sizeof(newname), "%s/%d-", misdn_type, chan_offset + c); - if (strncmp(tmp->name, newname, strlen(newname))) { + if (strncmp(ast_channel_name(tmp), newname, strlen(newname))) { snprintf(newname, sizeof(newname), "%s/%d-u%d", misdn_type, chan_offset + c, glob_channel++); ast_change_name(tmp, newname); - chan_misdn_log(3, port, " --> updating channel name to [%s]\n", tmp->name); + chan_misdn_log(3, port, " --> updating channel name to [%s]\n", ast_channel_name(tmp)); } } @@ -8578,7 +8578,7 @@ static int misdn_attempt_transfer(struct chan_list *active_ch, struct chan_list target = active_ch->ast; chan_misdn_log(1, held_ch->hold.port, "TRANSFERRING %s to %s\n", - held_ch->ast->name, target->name); + ast_channel_name(held_ch->ast), ast_channel_name(target)); ast_party_connected_line_init(&target_colp); ast_party_connected_line_copy(&target_colp, &target->connected); @@ -8929,10 +8929,10 @@ static void misdn_cc_pbx_notify(long record_id, const struct misdn_cc_notify *no chan->dialed.number.str = ast_strdup(notify->exten); if (ast_pbx_start(chan)) { - ast_log(LOG_WARNING, "Unable to start pbx channel %s!\n", chan->name); + ast_log(LOG_WARNING, "Unable to start pbx channel %s!\n", ast_channel_name(chan)); ast_channel_release(chan); } else { - ast_verb(1, "Started pbx for call completion notify channel %s\n", chan->name); + ast_verb(1, "Started pbx for call completion notify channel %s\n", ast_channel_name(chan)); } } #endif /* defined(AST_MISDN_ENHANCEMENTS) */ @@ -11587,7 +11587,7 @@ static int misdn_command_cc_deactivate(struct ast_channel *chan, struct misdn_co AST_LIST_UNLOCK(&misdn_cc_records_db); if (error_str) { ast_verb(1, "%s(%s) diagnostic '%s' on channel %s\n", - misdn_command_name, subcommand->name, error_str, chan->name); + misdn_command_name, subcommand->name, error_str, ast_channel_name(chan)); pbx_builtin_setvar_helper(chan, MISDN_ERROR_MSG, error_str); } @@ -11907,7 +11907,7 @@ static int misdn_command_cc_request(struct ast_channel *chan, struct misdn_comma AST_LIST_UNLOCK(&misdn_cc_records_db); if (error_str) { ast_verb(1, "%s(%s) diagnostic '%s' on channel %s\n", - misdn_command_name, subcommand->name, error_str, chan->name); + misdn_command_name, subcommand->name, error_str, ast_channel_name(chan)); pbx_builtin_setvar_helper(chan, MISDN_ERROR_MSG, error_str); pbx_builtin_setvar_helper(chan, MISDN_CC_STATUS, "ERROR"); } else { diff --git a/channels/chan_nbs.c b/channels/chan_nbs.c index 3ff97dde7..d9885c14e 100644 --- a/channels/chan_nbs.c +++ b/channels/chan_nbs.c @@ -90,16 +90,16 @@ static int nbs_call(struct ast_channel *ast, char *dest, int timeout) p = ast->tech_pvt; if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) { - ast_log(LOG_WARNING, "nbs_call called on %s, neither down nor reserved\n", ast->name); + ast_log(LOG_WARNING, "nbs_call called on %s, neither down nor reserved\n", ast_channel_name(ast)); return -1; } /* When we call, it just works, really, there's no destination... Just ring the phone and wait for someone to answer */ - ast_debug(1, "Calling %s on %s\n", dest, ast->name); + ast_debug(1, "Calling %s on %s\n", dest, ast_channel_name(ast)); /* If we can't connect, return congestion */ if (nbs_connect(p->nbs)) { - ast_log(LOG_WARNING, "NBS Connection failed on %s\n", ast->name); + ast_log(LOG_WARNING, "NBS Connection failed on %s\n", ast_channel_name(ast)); ast_queue_control(ast, AST_CONTROL_CONGESTION); } else { ast_setstate(ast, AST_STATE_RINGING); @@ -165,7 +165,7 @@ static int nbs_hangup(struct ast_channel *ast) { struct nbs_pvt *p; p = ast->tech_pvt; - ast_debug(1, "nbs_hangup(%s)\n", ast->name); + ast_debug(1, "nbs_hangup(%s)\n", ast_channel_name(ast)); if (!ast->tech_pvt) { ast_log(LOG_WARNING, "Asked to hangup channel not connected\n"); return 0; @@ -191,7 +191,7 @@ static struct ast_frame *nbs_xread(struct ast_channel *ast) p->fr.delivery.tv_sec = 0; p->fr.delivery.tv_usec = 0; - ast_debug(1, "Returning null frame on %s\n", ast->name); + ast_debug(1, "Returning null frame on %s\n", ast_channel_name(ast)); return &p->fr; } @@ -241,7 +241,7 @@ static struct ast_channel *nbs_new(struct nbs_pvt *i, int state, const char *lin i->u = ast_module_user_add(tmp); 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); } } diff --git a/channels/chan_oss.c b/channels/chan_oss.c index 17894ab6f..f74a3ae36 100644 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -775,7 +775,7 @@ static int oss_indicate(struct ast_channel *c, int cond, const void *data, size_ ast_moh_stop(c); break; default: - ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, c->name); + ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, ast_channel_name(c)); return -1; } @@ -824,7 +824,7 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o, char *ext, char *ctx, ast_jb_configure(c, &global_jbconf); if (state != AST_STATE_DOWN) { if (ast_pbx_start(c)) { - ast_log(LOG_WARNING, "Unable to start PBX on %s\n", c->name); + ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ast_channel_name(c)); ast_hangup(c); o->owner = c = NULL; } @@ -1198,7 +1198,7 @@ static char *console_transfer(struct ast_cli_entry *e, int cmd, struct ast_cli_a S_COR(b->caller.id.number.valid, b->caller.id.number.str, NULL))) { ast_cli(a->fd, "No such extension exists\n"); } else { - ast_cli(a->fd, "Whee, transferring %s to %s@%s.\n", b->name, ext, ctx); + ast_cli(a->fd, "Whee, transferring %s to %s@%s.\n", ast_channel_name(b), ext, ctx); if (ast_async_goto(b, ctx, ext, 1)) ast_cli(a->fd, "Failed to transfer :(\n"); } diff --git a/channels/chan_phone.c b/channels/chan_phone.c index 6acb7a184..1281f149a 100644 --- a/channels/chan_phone.c +++ b/channels/chan_phone.c @@ -204,7 +204,7 @@ static int phone_indicate(struct ast_channel *chan, int condition, const void *d { struct phone_pvt *p = chan->tech_pvt; int res=-1; - 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(condition) { case AST_CONTROL_FLASH: ioctl(p->fd, IXJCTL_PSTN_SET_STATE, PSTN_ON_HOOK); @@ -223,7 +223,7 @@ static int phone_indicate(struct ast_channel *chan, int condition, const void *d res = 0; break; default: - ast_log(LOG_WARNING, "Condition %d is not supported on channel %s\n", condition, chan->name); + ast_log(LOG_WARNING, "Condition %d is not supported on channel %s\n", condition, ast_channel_name(chan)); } return res; } @@ -315,10 +315,10 @@ static int phone_call(struct ast_channel *ast, char *dest, int timeout) p = ast->tech_pvt; if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) { - ast_log(LOG_WARNING, "phone_call called on %s, neither down nor reserved\n", ast->name); + ast_log(LOG_WARNING, "phone_call called on %s, neither down nor reserved\n", ast_channel_name(ast)); return -1; } - ast_debug(1, "Ringing %s on %s (%d)\n", dest, ast->name, ast->fds[0]); + ast_debug(1, "Ringing %s on %s (%d)\n", dest, ast_channel_name(ast), ast->fds[0]); start = IXJ_PHONE_RING_START(cid); if (start == -1) @@ -343,7 +343,7 @@ static int phone_hangup(struct ast_channel *ast) { struct phone_pvt *p; p = ast->tech_pvt; - ast_debug(1, "phone_hangup(%s)\n", ast->name); + ast_debug(1, "phone_hangup(%s)\n", ast_channel_name(ast)); if (!ast->tech_pvt) { ast_log(LOG_WARNING, "Asked to hangup channel not connected\n"); return 0; @@ -362,7 +362,7 @@ static int phone_hangup(struct ast_channel *ast) /* If it's an FXO, hang them up */ if (p->mode == MODE_FXO) { if (ioctl(p->fd, PHONE_PSTN_SET_STATE, PSTN_ON_HOOK)) - ast_debug(1, "ioctl(PHONE_PSTN_SET_STATE) failed on %s (%s)\n",ast->name, strerror(errno)); + ast_debug(1, "ioctl(PHONE_PSTN_SET_STATE) failed on %s (%s)\n",ast_channel_name(ast), strerror(errno)); } /* If they're off hook, give a busy signal */ @@ -379,7 +379,7 @@ static int phone_hangup(struct ast_channel *ast) memset(p->ext, 0, sizeof(p->ext)); ((struct phone_pvt *)(ast->tech_pvt))->owner = NULL; ast_module_unref(ast_module_info->self); - ast_verb(3, "Hungup '%s'\n", ast->name); + ast_verb(3, "Hungup '%s'\n", ast_channel_name(ast)); ast->tech_pvt = NULL; ast_setstate(ast, AST_STATE_DOWN); restart_monitor(); @@ -460,12 +460,12 @@ static int phone_answer(struct ast_channel *ast) /* In case it's a LineJack, take it off hook */ if (p->mode == MODE_FXO) { if (ioctl(p->fd, PHONE_PSTN_SET_STATE, PSTN_OFF_HOOK)) - ast_debug(1, "ioctl(PHONE_PSTN_SET_STATE) failed on %s (%s)\n", ast->name, strerror(errno)); + ast_debug(1, "ioctl(PHONE_PSTN_SET_STATE) failed on %s (%s)\n", ast_channel_name(ast), strerror(errno)); else ast_debug(1, "Took linejack off hook\n"); } phone_setup(ast); - ast_debug(1, "phone_answer(%s)\n", ast->name); + ast_debug(1, "phone_answer(%s)\n", ast_channel_name(ast)); ast->rings = 0; ast_setstate(ast, AST_STATE_UP); return 0; @@ -897,7 +897,7 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *cntx, i->cpt = 1; } 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); } } diff --git a/channels/chan_sip.c b/channels/chan_sip.c index f4ed077ec..43c942032 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -2966,7 +2966,7 @@ void dialog_unlink_all(struct sip_pvt *dialog) /* Unlink us from the owner (channel) if we have one */ owner = sip_pvt_lock_full(dialog); if (owner) { - ast_debug(1, "Detaching from channel %s\n", owner->name); + ast_debug(1, "Detaching from channel %s\n", ast_channel_name(owner)); owner->tech_pvt = dialog_unref(owner->tech_pvt, "resetting channel dialog ptr in unlink_all"); ast_channel_unlock(owner); ast_channel_unref(owner); @@ -4290,7 +4290,7 @@ static int sip_setoption(struct ast_channel *chan, int option, void *data, int d (ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_AUTO)) { char *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_dsp_detect(p); } else { @@ -4359,7 +4359,7 @@ static int sip_queryoption(struct ast_channel *chan, int option, void *data, int case AST_OPTION_DIGIT_DETECT: cp = (char *) data; *cp = p->dsp ? 1 : 0; - 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_SECURE_SIGNALING: *((unsigned int *) data) = p->req_secure_signaling; @@ -4464,7 +4464,7 @@ static int sip_sendtext(struct ast_channel *ast, const char *text) return(0); } if (debug) - ast_verbose("Sending text %s on %s\n", text, ast->name); + ast_verbose("Sending text %s on %s\n", text, ast_channel_name(ast)); transmit_message_with_text(dialog, text, 0, 0); return 0; } @@ -5099,7 +5099,7 @@ static void change_t38_state(struct sip_pvt *p, int state) return; p->t38.state = state; - ast_debug(2, "T38 state changed to %d on channel %s\n", p->t38.state, chan ? chan->name : "<none>"); + ast_debug(2, "T38 state changed to %d on channel %s\n", p->t38.state, chan ? ast_channel_name(chan) : "<none>"); /* If no channel was provided we can't send off a control frame */ if (!chan) @@ -5111,13 +5111,13 @@ static void change_t38_state(struct sip_pvt *p, int state) parameters = p->t38.their_parms; parameters.max_ifp = ast_udptl_get_far_max_ifp(p->udptl); parameters.request_response = AST_T38_REQUEST_NEGOTIATE; - ast_udptl_set_tag(p->udptl, "%s", chan->name); + ast_udptl_set_tag(p->udptl, "%s", ast_channel_name(chan)); break; case T38_ENABLED: parameters = p->t38.their_parms; parameters.max_ifp = ast_udptl_get_far_max_ifp(p->udptl); parameters.request_response = AST_T38_NEGOTIATED; - ast_udptl_set_tag(p->udptl, "%s", chan->name); + ast_udptl_set_tag(p->udptl, "%s", ast_channel_name(chan)); break; case T38_REJECTED: case T38_DISABLED: @@ -5533,7 +5533,7 @@ static int sip_call(struct ast_channel *ast, char *dest, int timeout) char uri[SIPBUFSIZE] = ""; if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) { - ast_log(LOG_WARNING, "sip_call called on %s, neither down nor reserved\n", ast->name); + ast_log(LOG_WARNING, "sip_call called on %s, neither down nor reserved\n", ast_channel_name(ast)); return -1; } @@ -5751,7 +5751,7 @@ void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist) if (p->owner) { if (lockowner) ast_channel_lock(p->owner); - ast_debug(1, "Detaching from %s\n", p->owner->name); + ast_debug(1, "Detaching from %s\n", ast_channel_name(p->owner)); p->owner->tech_pvt = NULL; /* Make sure that the channel knows its backend is going away */ p->owner->_softhangup |= AST_SOFTHANGUP_DEV; @@ -6267,11 +6267,11 @@ static int sip_hangup(struct ast_channel *ast) if (ast_test_flag(ast, AST_FLAG_ZOMBIE)) { if (p->refer) - ast_debug(1, "SIP Transfer: Hanging up Zombie channel %s after transfer ... Call-ID: %s\n", ast->name, p->callid); + ast_debug(1, "SIP Transfer: Hanging up Zombie channel %s after transfer ... Call-ID: %s\n", ast_channel_name(ast), p->callid); else ast_debug(1, "Hanging up zombie call. Be scared.\n"); } else - ast_debug(1, "Hangup call %s, SIP callid %s\n", ast->name, p->callid); + ast_debug(1, "Hangup call %s, SIP callid %s\n", ast_channel_name(ast), p->callid); sip_pvt_lock(p); if (ast_test_flag(&p->flags[0], SIP_INC_COUNT) || ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD)) { @@ -6474,7 +6474,7 @@ static int sip_answer(struct ast_channel *ast) try_suggested_sip_codec(p); ast_setstate(ast, AST_STATE_UP); - ast_debug(1, "SIP answering channel: %s\n", ast->name); + ast_debug(1, "SIP answering channel: %s\n", ast_channel_name(ast)); ast_rtp_instance_update_source(p->rtp); res = transmit_response_with_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL, FALSE, TRUE); ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED); @@ -6604,16 +6604,16 @@ static int sip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan) if (!newchan || !newchan->tech_pvt) { if (!newchan) - ast_log(LOG_WARNING, "No new channel! Fixup of %s failed.\n", oldchan->name); + ast_log(LOG_WARNING, "No new channel! Fixup of %s failed.\n", ast_channel_name(oldchan)); else - ast_log(LOG_WARNING, "No SIP tech_pvt! Fixup of %s failed.\n", oldchan->name); + ast_log(LOG_WARNING, "No SIP tech_pvt! Fixup of %s failed.\n", ast_channel_name(oldchan)); return -1; } p = newchan->tech_pvt; sip_pvt_lock(p); - append_history(p, "Masq", "Old channel: %s\n", oldchan->name); - append_history(p, "Masq (cont)", "...new owner: %s\n", newchan->name); + append_history(p, "Masq", "Old channel: %s\n", ast_channel_name(oldchan)); + append_history(p, "Masq (cont)", "...new owner: %s\n", ast_channel_name(newchan)); if (p->owner != oldchan) ast_log(LOG_WARNING, "old channel wasn't %p but was %p\n", oldchan, p->owner); else { @@ -6627,7 +6627,7 @@ static int sip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan) sip_set_rtp_peer(newchan, NULL, NULL, 0, 0, 0); ret = 0; } - ast_debug(3, "SIP Fixup: New owner for dialogue %s: %s (Old parent: %s)\n", p->callid, p->owner->name, oldchan->name); + ast_debug(3, "SIP Fixup: New owner for dialogue %s: %s (Old parent: %s)\n", p->callid, ast_channel_name(p->owner), ast_channel_name(oldchan)); sip_pvt_unlock(p); return ret; @@ -6927,7 +6927,7 @@ static int sip_indicate(struct ast_channel *ast, int condition, const void *data * just says they are waiting to get AOC-E before completely tearing * the call down. Since SIP does not support this at the moment go * ahead and terminate the call here to avoid an unnecessary timeout. */ - ast_debug(1, "AOC-E termination request received on %s. This is not yet supported on sip. Continue with hangup \n", p->owner->name); + ast_debug(1, "AOC-E termination request received on %s. This is not yet supported on sip. Continue with hangup \n", ast_channel_name(p->owner)); ast_softhangup_nolock(p->owner, AST_SOFTHANGUP_DEV); } break; @@ -7174,14 +7174,14 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit } if (i->do_history) { - append_history(i, "NewChan", "Channel %s - from %s", tmp->name, i->callid); + append_history(i, "NewChan", "Channel %s - from %s", ast_channel_name(tmp), i->callid); } /* Inform manager user about new channel and their SIP call ID */ if (sip_cfg.callevents) { manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate", "Channel: %s\r\nUniqueid: %s\r\nChanneltype: %s\r\nSIPcallid: %s\r\nSIPfullcontact: %s\r\n", - tmp->name, tmp->uniqueid, "SIP", i->callid, i->fullcontact); + ast_channel_name(tmp), tmp->uniqueid, "SIP", i->callid, i->fullcontact); } return tmp; @@ -7413,7 +7413,7 @@ static struct ast_frame *sip_rtp_read(struct ast_channel *ast, struct sip_pvt *p if (f && !ast_format_cap_iscompatible(p->owner->nativeformats, &f->subclass.format)) { if (!ast_format_cap_iscompatible(p->jointcaps, &f->subclass.format)) { ast_debug(1, "Bogus frame of format '%s' received from '%s'!\n", - ast_getformatname(&f->subclass.format), p->owner->name); + ast_getformatname(&f->subclass.format), ast_channel_name(p->owner)); return &ast_null_frame; } ast_debug(1, "Oooh, format changed to %s\n", @@ -7428,7 +7428,7 @@ static struct ast_frame *sip_rtp_read(struct ast_channel *ast, struct sip_pvt *p f = ast_dsp_process(p->owner, p->dsp, f); if (f && f->frametype == AST_FRAME_DTMF) { if (f->subclass.integer == 'f') { - ast_debug(1, "Fax CNG detected on %s\n", ast->name); + ast_debug(1, "Fax CNG detected on %s\n", ast_channel_name(ast)); *faxdetect = 1; /* If we only needed this DSP for fax detection purposes we can just drop it now */ if (ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_INBAND) { @@ -7472,10 +7472,10 @@ static struct ast_frame *sip_read(struct ast_channel *ast) S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) { ast_channel_lock(ast); sip_pvt_lock(p); - ast_verb(2, "Redirecting '%s' to fax extension due to CNG detection\n", ast->name); + ast_verb(2, "Redirecting '%s' to fax extension due to CNG detection\n", ast_channel_name(ast)); pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast->exten); if (ast_async_goto(ast, target_context, "fax", 1)) { - ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", ast->name, target_context); + ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(ast), target_context); } fr = &ast_null_frame; } else { @@ -8764,7 +8764,7 @@ static void change_hold_state(struct sip_pvt *dialog, struct sip_request *req, i "Channel: %s\r\n" "Uniqueid: %s\r\n", holdstate ? "On" : "Off", - dialog->owner->name, + ast_channel_name(dialog->owner), dialog->owner->uniqueid); append_history(dialog, holdstate ? "Hold" : "Unhold", "%s", req->data->str); if (!holdstate) { /* Put off remote hold */ @@ -9427,10 +9427,10 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action ast_channel_unlock(p->owner); if (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 peer T.38 re-INVITE\n", p->owner->name); + ast_verb(2, "Redirecting '%s' to fax extension due to peer T.38 re-INVITE\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); } } else { ast_log(LOG_NOTICE, "T.38 re-INVITE detected but no fax extension\n"); @@ -12471,7 +12471,7 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init, if (sdp) { memset(p->offered_media, 0, sizeof(p->offered_media)); if (p->udptl && p->t38.state == T38_LOCAL_REINVITE) { - ast_debug(1, "T38 is in state %d on channel %s\n", p->t38.state, p->owner ? p->owner->name : "<none>"); + ast_debug(1, "T38 is in state %d on channel %s\n", p->t38.state, p->owner ? ast_channel_name(p->owner) : "<none>"); add_sdp(&req, p, FALSE, FALSE, TRUE); } else if (p->rtp) { try_suggested_sip_codec(p); @@ -13132,7 +13132,7 @@ static void update_connectedline(struct sip_pvt *p, const void *data, size_t dat send_response(p, &resp, XMIT_UNRELIABLE, 0); ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT); } else { - ast_debug(1, "Unable able to send update to '%s' in state '%s'\n", p->owner->name, ast_state2str(p->owner->_state)); + ast_debug(1, "Unable able to send update to '%s' in state '%s'\n", ast_channel_name(p->owner), ast_state2str(p->owner->_state)); } } } @@ -18871,7 +18871,7 @@ static char *sip_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_a } ast_cli(a->fd, " Curr. trans. direction: %s\n", ast_test_flag(&cur->flags[0], SIP_OUTGOING) ? "Outgoing" : "Incoming"); ast_cli(a->fd, " Call-ID: %s\n", cur->callid); - ast_cli(a->fd, " Owner channel ID: %s\n", cur->owner ? cur->owner->name : "<none>"); + ast_cli(a->fd, " Owner channel ID: %s\n", cur->owner ? ast_channel_name(cur->owner) : "<none>"); ast_cli(a->fd, " Our Codec Capability: %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->caps)); ast_cli(a->fd, " Non-Codec Capability (DTMF): %d\n", cur->noncodeccapability); ast_cli(a->fd, " Their Codec Capability: %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->peercaps)); @@ -20591,7 +20591,7 @@ static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest if (sip_cfg.callevents) { manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate", "Channel: %s\r\nChanneltype: %s\r\nUniqueid: %s\r\nSIPcallid: %s\r\nSIPfullcontact: %s\r\nPeername: %s\r\n", - p->owner->name, "SIP", p->owner->uniqueid, p->callid, p->fullcontact, p->peername); + ast_channel_name(p->owner), "SIP", p->owner->uniqueid, p->callid, p->fullcontact, p->peername); } } else { /* RE-invite */ if (p->t38.state == T38_DISABLED || p->t38.state == T38_REJECTED) { @@ -20678,7 +20678,7 @@ static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest xmitres = transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE); ast_log(LOG_WARNING, "Received response: \"Forbidden\" from '%s'\n", sip_get_header(&p->initreq, "From")); if (!req->ignore && p->owner) { - ast_set_hangupsource(p->owner, p->owner->name, 0); + ast_set_hangupsource(p->owner, ast_channel_name(p->owner), 0); ast_queue_control(p->owner, AST_CONTROL_CONGESTION); } pvt_set_needdestroy(p, "received 403 response"); @@ -20688,7 +20688,7 @@ static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest case 404: /* Not found */ xmitres = transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE); if (p->owner && !req->ignore) { - ast_set_hangupsource(p->owner, p->owner->name, 0); + ast_set_hangupsource(p->owner, ast_channel_name(p->owner), 0); ast_queue_control(p->owner, AST_CONTROL_CONGESTION); } sip_alreadygone(p); @@ -20809,7 +20809,7 @@ static void handle_response_notify(struct sip_pvt *p, int resp, const char *rest /* They got the notify, this is the end */ if (p->owner) { if (!p->refer) { - ast_log(LOG_WARNING, "Notify answer on an owned channel? - %s\n", p->owner->name); + ast_log(LOG_WARNING, "Notify answer on an owned channel? - %s\n", ast_channel_name(p->owner)); ast_queue_hangup_with_cause(p->owner, AST_CAUSE_NORMAL_UNSPECIFIED); } else { ast_debug(4, "Got OK on REFER Notify message\n"); @@ -21727,7 +21727,7 @@ static void handle_response(struct sip_pvt *p, int resp, const char *rest, struc } } } else - ast_log(LOG_NOTICE, "Don't know how to handle a %d %s response from %s\n", resp, rest, p->owner ? p->owner->name : ast_sockaddr_stringify(&p->sa)); + ast_log(LOG_NOTICE, "Don't know how to handle a %d %s response from %s\n", resp, rest, p->owner ? ast_channel_name(p->owner) : ast_sockaddr_stringify(&p->sa)); } } else { /* Responses to OUTGOING SIP requests on INCOMING calls @@ -21851,7 +21851,7 @@ static void *sip_park_thread(void *stuff) transferee = d->chan1; transferer = d->chan2; - ast_debug(4, "SIP Park: Transferer channel %s, Transferee %s\n", transferer->name, transferee->name); + ast_debug(4, "SIP Park: Transferer channel %s, Transferee %s\n", ast_channel_name(transferer), ast_channel_name(transferee)); res = ast_park_call_exten(transferee, transferer, d->park_exten, d->park_context, 0, &ext); @@ -21894,8 +21894,8 @@ static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct struct ast_channel *transferee, *transferer; pthread_t th; - transferee = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan1->accountcode, chan1->exten, chan1->context, chan1->linkedid, chan1->amaflags, "Parking/%s", chan1->name); - transferer = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan2->accountcode, chan2->exten, chan2->context, chan2->linkedid, chan2->amaflags, "SIPPeer/%s", chan2->name); + transferee = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan1->accountcode, chan1->exten, chan1->context, chan1->linkedid, chan1->amaflags, "Parking/%s", ast_channel_name(chan1)); + transferer = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, chan2->accountcode, chan2->exten, chan2->context, chan2->linkedid, chan2->amaflags, "SIPPeer/%s", ast_channel_name(chan2)); d = ast_calloc(1, sizeof(*d)); if (!transferee || !transferer || !d) { if (transferee) { @@ -22010,11 +22010,11 @@ static int sip_pickup(struct ast_channel *chan) ast_channel_ref(chan); if (ast_pthread_create_detached_background(&threadid, NULL, sip_pickup_thread, chan)) { - ast_debug(1, "Unable to start Group pickup thread on channel %s\n", chan->name); + ast_debug(1, "Unable to start Group pickup thread on channel %s\n", ast_channel_name(chan)); ast_channel_unref(chan); return -1; } - ast_debug(1, "Started Group pickup thread on channel %s\n", chan->name); + ast_debug(1, "Started Group pickup thread on channel %s\n", ast_channel_name(chan)); return 0; } @@ -22047,19 +22047,19 @@ static int attempt_transfer(struct sip_dual *transferer, struct sip_dual *target all channels to the transferer */ ast_debug(4, "Sip transfer:--------------------\n"); if (transferer->chan1) - ast_debug(4, "-- Transferer to PBX channel: %s State %s\n", transferer->chan1->name, ast_state2str(transferer->chan1->_state)); + ast_debug(4, "-- Transferer to PBX channel: %s State %s\n", ast_channel_name(transferer->chan1), ast_state2str(transferer->chan1->_state)); else ast_debug(4, "-- No transferer first channel - odd??? \n"); if (target->chan1) - ast_debug(4, "-- Transferer to PBX second channel (target): %s State %s\n", target->chan1->name, ast_state2str(target->chan1->_state)); + ast_debug(4, "-- Transferer to PBX second channel (target): %s State %s\n", ast_channel_name(target->chan1), ast_state2str(target->chan1->_state)); else ast_debug(4, "-- No target first channel ---\n"); if (transferer->chan2) - ast_debug(4, "-- Bridged call to transferee: %s State %s\n", transferer->chan2->name, ast_state2str(transferer->chan2->_state)); + ast_debug(4, "-- Bridged call to transferee: %s State %s\n", ast_channel_name(transferer->chan2), ast_state2str(transferer->chan2->_state)); else ast_debug(4, "-- No bridged call to transferee\n"); if (target->chan2) - ast_debug(4, "-- Bridged call to transfer target: %s State %s\n", target->chan2 ? target->chan2->name : "<none>", target->chan2 ? ast_state2str(target->chan2->_state) : "(none)"); + ast_debug(4, "-- Bridged call to transfer target: %s State %s\n", target->chan2 ? ast_channel_name(target->chan2) : "<none>", target->chan2 ? ast_state2str(target->chan2->_state) : "(none)"); else ast_debug(4, "-- No target second channel ---\n"); ast_debug(4, "-- END Sip transfer:--------------------\n"); @@ -22084,9 +22084,9 @@ static int attempt_transfer(struct sip_dual *transferer, struct sip_dual *target if (peerd) ast_quiet_chan(peerd); - ast_debug(4, "SIP transfer: trying to masquerade %s into %s\n", peerc->name, peerb->name); + ast_debug(4, "SIP transfer: trying to masquerade %s into %s\n", ast_channel_name(peerc), ast_channel_name(peerb)); if (ast_channel_masquerade(peerb, peerc)) { - ast_log(LOG_WARNING, "Failed to masquerade %s into %s\n", peerb->name, peerc->name); + ast_log(LOG_WARNING, "Failed to masquerade %s into %s\n", ast_channel_name(peerb), ast_channel_name(peerc)); res = -1; } else ast_debug(4, "SIP transfer: Succeeded to masquerade channels.\n"); @@ -22458,7 +22458,7 @@ static int handle_invite_replaces(struct sip_pvt *p, struct sip_request *req, in if (!(targetcall = ast_bridged_channel(replacecall))) { /* We have no bridge */ if (!earlyreplace) { - ast_debug(2, " Attended transfer attempted to replace call with no bridge (maybe ringing). Channel %s!\n", replacecall->name); + ast_debug(2, " Attended transfer attempted to replace call with no bridge (maybe ringing). Channel %s!\n", ast_channel_name(replacecall)); oneleggedreplace = 1; } } @@ -22466,9 +22466,9 @@ static int handle_invite_replaces(struct sip_pvt *p, struct sip_request *req, in ast_debug(4, "SIP transfer: Target channel is in ringing state\n"); if (targetcall) - ast_debug(4, "SIP transfer: Invite Replace incoming channel should bridge to channel %s while hanging up channel %s\n", targetcall->name, replacecall->name); + ast_debug(4, "SIP transfer: Invite Replace incoming channel should bridge to channel %s while hanging up channel %s\n", ast_channel_name(targetcall), ast_channel_name(replacecall)); else - ast_debug(4, "SIP transfer: Invite Replace incoming channel should replace and hang up channel %s (one call leg)\n", replacecall->name); + ast_debug(4, "SIP transfer: Invite Replace incoming channel should replace and hang up channel %s (one call leg)\n", ast_channel_name(replacecall)); if (req->ignore) { ast_log(LOG_NOTICE, "Ignoring this INVITE with replaces in a stupid way.\n"); @@ -22521,7 +22521,7 @@ static int handle_invite_replaces(struct sip_pvt *p, struct sip_request *req, in /* Stop music on hold and other generators */ ast_quiet_chan(replacecall); ast_quiet_chan(targetcall); - ast_debug(4, "Invite/Replaces: preparing to masquerade %s into %s\n", c->name, replacecall->name); + ast_debug(4, "Invite/Replaces: preparing to masquerade %s into %s\n", ast_channel_name(c), ast_channel_name(replacecall)); /* Make sure that the masq does not free our PVT for the old call */ if (! earlyreplace && ! oneleggedreplace ) @@ -22531,7 +22531,7 @@ static int handle_invite_replaces(struct sip_pvt *p, struct sip_request *req, in if(ast_channel_masquerade(replacecall, c)) ast_log(LOG_ERROR, "Failed to masquerade C into Replacecall\n"); else - ast_debug(4, "Invite/Replaces: Going to masquerade %s into %s\n", c->name, replacecall->name); + ast_debug(4, "Invite/Replaces: Going to masquerade %s into %s\n", ast_channel_name(c), ast_channel_name(replacecall)); /* C should now be in place of replacecall. all channel locks and pvt locks should be removed * before issuing the masq. Since we are unlocking both the pvt (p) and its owner channel (c) @@ -23406,7 +23406,7 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int switch(c_state) { case AST_STATE_DOWN: - ast_debug(2, "%s: New call is still down.... Trying... \n", c->name); + ast_debug(2, "%s: New call is still down.... Trying... \n", ast_channel_name(c)); transmit_provisional_response(p, "100 Trying", req, 0); p->invitestate = INV_PROCEEDING; ast_setstate(c, AST_STATE_RING); @@ -23444,7 +23444,7 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int } } else { /* Pickup call in call group */ if (sip_pickup(c)) { - ast_log(LOG_WARNING, "Failed to start Group pickup by %s\n", c->name); + ast_log(LOG_WARNING, "Failed to start Group pickup by %s\n", ast_channel_name(c)); transmit_response_reliable(p, "480 Temporarily Unavailable", req); sip_alreadygone(p); c->hangupcause = AST_CAUSE_FAILURE; @@ -23470,7 +23470,7 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int p->invitestate = INV_PROCEEDING; break; case AST_STATE_UP: - ast_debug(2, "%s: This call is UP.... \n", c->name); + ast_debug(2, "%s: This call is UP.... \n", ast_channel_name(c)); transmit_response(p, "100 Trying", req); @@ -23607,9 +23607,9 @@ static int local_attended_transfer(struct sip_pvt *transferer, struct sip_dual * /* Transfer */ if (sipdebug) { if (current->chan2) /* We have two bridges */ - ast_debug(4, "SIP attended transfer: trying to bridge %s and %s\n", target.chan1->name, current->chan2->name); + ast_debug(4, "SIP attended transfer: trying to bridge %s and %s\n", ast_channel_name(target.chan1), ast_channel_name(current->chan2)); else /* One bridge, propably transfer of IVR/voicemail etc */ - ast_debug(4, "SIP attended transfer: trying to make %s take over (masq) %s\n", target.chan1->name, current->chan1->name); + ast_debug(4, "SIP attended transfer: trying to make %s take over (masq) %s\n", ast_channel_name(target.chan1), ast_channel_name(current->chan1)); } ast_set_flag(&transferer->flags[0], SIP_DEFER_BYE_ON_TRANSFER); /* Delay hangup */ @@ -23627,10 +23627,10 @@ static int local_attended_transfer(struct sip_pvt *transferer, struct sip_dual * "SIP-Callid: %s\r\n" "TargetChannel: %s\r\n" "TargetUniqueid: %s\r\n", - transferer->owner->name, + ast_channel_name(transferer->owner), transferer->owner->uniqueid, transferer->callid, - target.chan1->name, + ast_channel_name(target.chan1), target.chan1->uniqueid); ast_party_connected_line_init(&connected_to_transferee); ast_party_connected_line_init(&connected_to_target); @@ -23957,8 +23957,8 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int if (sipdebug) { ast_debug(3, "SIP %s transfer: Transferer channel %s, transferee channel %s\n", p->refer->attendedtransfer ? "attended" : "blind", - current.chan1->name, - current.chan2 ? current.chan2->name : "<none>"); + ast_channel_name(current.chan1), + current.chan2 ? ast_channel_name(current.chan2) : "<none>"); } if (!current.chan2 && !p->refer->attendedtransfer) { @@ -23977,7 +23977,7 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int if (current.chan2) { if (sipdebug) { - ast_debug(4, "Got SIP transfer, applying to bridged peer '%s'\n", current.chan2->name); + ast_debug(4, "Got SIP transfer, applying to bridged peer '%s'\n", ast_channel_name(current.chan2)); } ast_queue_control(current.chan1, AST_CONTROL_UNHOLD); } @@ -24033,15 +24033,15 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int "TargetUniqueid: %s\r\n" "TransferExten: %s\r\n" "Transfer2Parking: Yes\r\n", - current.chan1->name, + ast_channel_name(current.chan1), current.chan1->uniqueid, callid, - current.chan2->name, + ast_channel_name(current.chan2), current.chan2->uniqueid, refer_to); if (sipdebug) { - ast_debug(4, "SIP transfer to parking: trying to park %s. Parked by %s\n", current.chan2->name, current.chan1->name); + ast_debug(4, "SIP transfer to parking: trying to park %s. Parked by %s\n", ast_channel_name(current.chan2), ast_channel_name(current.chan1)); } /* DO NOT hold any locks while calling sip_park */ @@ -24058,12 +24058,12 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int * Locks should not be held while calling pbx_builtin_setvar_helper. This function * locks the channel being passed into it.*/ if (current.chan1 && current.chan2) { - ast_debug(3, "chan1->name: %s\n", current.chan1->name); - pbx_builtin_setvar_helper(current.chan1, "BLINDTRANSFER", current.chan2->name); + ast_debug(3, "chan1->name: %s\n", ast_channel_name(current.chan1)); + pbx_builtin_setvar_helper(current.chan1, "BLINDTRANSFER", ast_channel_name(current.chan2)); } if (current.chan2) { - pbx_builtin_setvar_helper(current.chan2, "BLINDTRANSFER", current.chan1->name); + pbx_builtin_setvar_helper(current.chan2, "BLINDTRANSFER", ast_channel_name(current.chan1)); pbx_builtin_setvar_helper(current.chan2, "SIPDOMAIN", refer_to_domain); pbx_builtin_setvar_helper(current.chan2, "SIPTRANSFER", "yes"); /* One for the new channel */ @@ -24140,10 +24140,10 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int "TargetUniqueid: %s\r\n" "TransferExten: %s\r\n" "TransferContext: %s\r\n", - current.chan1->name, + ast_channel_name(current.chan1), current.chan1->uniqueid, callid, - current.chan2->name, + ast_channel_name(current.chan2), current.chan2->uniqueid, refer_to, refer_to_context); @@ -24222,7 +24222,7 @@ static int handle_request_cancel(struct sip_pvt *p, struct sip_request *req) stop_media_flows(p); /* Immediately stop RTP, VRTP and UDPTL as applicable */ if (p->owner) { - ast_set_hangupsource(p->owner, p->owner->name, 0); + ast_set_hangupsource(p->owner, ast_channel_name(p->owner), 0); ast_queue_hangup(p->owner); } else @@ -24380,7 +24380,7 @@ static int handle_request_bye(struct sip_pvt *p, struct sip_request *req) ast_queue_hangup_with_cause(p->owner, AST_CAUSE_PROTOCOL_ERROR); } } else if (p->owner) { - ast_set_hangupsource(p->owner, p->owner->name, 0); + ast_set_hangupsource(p->owner, ast_channel_name(p->owner), 0); ast_queue_hangup(p->owner); sip_scheddestroy_final(p, DEFAULT_TRANS_TIMEOUT); ast_debug(3, "Received bye, issuing owner hangup\n"); @@ -25648,7 +25648,7 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct as if (global_store_sip_cause && p->owner) { struct ast_channel *owner = p->owner; - snprintf(causevar, sizeof(causevar), "MASTER_CHANNEL(HASH(SIP_CAUSE,%s))", owner->name); + snprintf(causevar, sizeof(causevar), "MASTER_CHANNEL(HASH(SIP_CAUSE,%s))", ast_channel_name(owner)); snprintf(causeval, sizeof(causeval), "SIP %s", REQ_OFFSET_TO_STR(req, rlPart2)); ast_channel_ref(owner); @@ -26358,7 +26358,7 @@ static int check_rtp_timeout(struct sip_pvt *dialog, time_t t) return 0; } ast_log(LOG_NOTICE, "Disconnecting call '%s' for lack of RTP activity in %ld seconds\n", - dialog->owner->name, (long) (t - dialog->lastrtprx)); + ast_channel_name(dialog->owner), (long) (t - dialog->lastrtprx)); /* Issue a softhangup */ ast_softhangup_nolock(dialog->owner, AST_SOFTHANGUP_DEV); ast_channel_unlock(dialog->owner); @@ -27242,7 +27242,7 @@ static struct ast_channel *sip_request_call(const char *type, struct ast_format_ if (sip_cfg.callevents) manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate", "Channel: %s\r\nChanneltype: %s\r\nSIPcallid: %s\r\nSIPfullcontact: %s\r\nPeername: %s\r\n", - p->owner? p->owner->name : "", "SIP", p->callid, p->fullcontact, p->peername); + p->owner? ast_channel_name(p->owner) : "", "SIP", p->callid, p->fullcontact, p->peername); sip_pvt_unlock(p); if (!tmpc) { dialog_unlink_all(p); @@ -29732,7 +29732,7 @@ static int sip_set_udptl_peer(struct ast_channel *chan, struct ast_udptl *udptl) sip_pvt_lock(p); if (p->owner != chan) { /* I suppose it could be argued that if this happens it is a bug. */ - ast_debug(1, "The private is not owned by channel %s anymore.\n", chan->name); + ast_debug(1, "The private is not owned by channel %s anymore.\n", ast_channel_name(chan)); sip_pvt_unlock(p); ast_channel_unlock(chan); return 0; @@ -29874,7 +29874,7 @@ static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *i sip_pvt_lock(p); if (p->owner != chan) { /* I suppose it could be argued that if this happens it is a bug. */ - ast_debug(1, "The private is not owned by channel %s anymore.\n", chan->name); + ast_debug(1, "The private is not owned by channel %s anymore.\n", ast_channel_name(chan)); sip_pvt_unlock(p); ast_channel_unlock(chan); return 0; diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index 896f38ebf..05ee648ba 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -3234,7 +3234,7 @@ static enum ast_rtp_glue_result skinny_get_rtp_peer(struct ast_channel *c, struc enum ast_rtp_glue_result res = AST_RTP_GLUE_RESULT_REMOTE; if (skinnydebug) - ast_verb(1, "skinny_get_rtp_peer() Channel = %s\n", c->name); + ast_verb(1, "skinny_get_rtp_peer() Channel = %s\n", ast_channel_name(c)); if (!(sub = c->tech_pvt)) @@ -3863,8 +3863,8 @@ static char *_skinny_show_lines(int fd, int *total, struct mansession *s, const AST_LIST_TRAVERSE(&l->sub, sub, list) { ast_cli(fd, " %s> %s to %s\n", (sub == l->activesub?"Active ":"Inactive"), - sub->owner->name, - (ast_bridged_channel(sub->owner)?ast_bridged_channel(sub->owner)->name:"") + ast_channel_name(sub->owner), + (ast_bridged_channel(sub->owner)?ast_channel_name(ast_bridged_channel(sub->owner)):"") ); } } @@ -4293,7 +4293,7 @@ static void *skinny_ss(void *data) /* Record this as the forwarding extension */ set_callforwards(l, sub->exten, l->getforward); ast_verb(3, "Setting call forward (%d) to '%s' on channel %s\n", - l->cfwdtype, sub->exten, c->name); + l->cfwdtype, sub->exten, ast_channel_name(c)); transmit_start_tone(d, SKINNY_DIALTONE, l->instance, sub->callid); transmit_lamp_indication(d, STIMULUS_FORWARDALL, 1, SKINNY_LAMP_ON); transmit_displaynotify(d, "CFwd enabled", 10); @@ -4377,12 +4377,12 @@ static int skinny_call(struct ast_channel *ast, char *dest, int timeout) } if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) { - ast_log(LOG_WARNING, "skinny_call called on %s, neither down nor reserved\n", ast->name); + ast_log(LOG_WARNING, "skinny_call called on %s, neither down nor reserved\n", ast_channel_name(ast)); return -1; } if (skinnydebug) - ast_verb(3, "skinny_call(%s)\n", ast->name); + ast_verb(3, "skinny_call(%s)\n", ast_channel_name(ast)); if (l->dnd) { ast_queue_control(ast, AST_CONTROL_BUSY); @@ -4467,7 +4467,7 @@ static int skinny_answer(struct ast_channel *ast) if (sub->blindxfer) { if (skinnydebug) ast_debug(1, "skinny_answer(%s) on %s@%s-%d with BlindXFER, transferring\n", - ast->name, l->name, d->name, sub->callid); + ast_channel_name(ast), l->name, d->name, sub->callid); ast_setstate(ast, AST_STATE_UP); skinny_transfer(sub); return 0; @@ -4476,7 +4476,7 @@ static int skinny_answer(struct ast_channel *ast) sub->cxmode = SKINNY_CX_SENDRECV; if (skinnydebug) - ast_verb(1, "skinny_answer(%s) on %s@%s-%d\n", ast->name, l->name, d->name, sub->callid); + ast_verb(1, "skinny_answer(%s) on %s@%s-%d\n", ast_channel_name(ast), l->name, d->name, sub->callid); setsubstate(sub, SUBSTATE_CONNECTED); @@ -4576,7 +4576,7 @@ static int skinny_write(struct ast_channel *ast, struct ast_frame *frame) static int skinny_fixup(struct ast_channel *oldchan, struct ast_channel *newchan) { struct skinny_subchannel *sub = newchan->tech_pvt; - ast_log(LOG_NOTICE, "skinny_fixup(%s, %s)\n", oldchan->name, newchan->name); + ast_log(LOG_NOTICE, "skinny_fixup(%s, %s)\n", ast_channel_name(oldchan), ast_channel_name(newchan)); if (sub->owner != oldchan) { ast_log(LOG_WARNING, "old channel wasn't %p but was %p\n", oldchan, sub->owner); return -1; @@ -4716,9 +4716,9 @@ static int skinny_transfer(struct skinny_subchannel *sub) if (skinnydebug) { ast_debug(1, "Transferee channels (local/remote): %s and %s\n", - xferee->owner->name, ast_bridged_channel(xferee->owner)?ast_bridged_channel(xferee->owner)->name:""); + ast_channel_name(xferee->owner), ast_bridged_channel(xferee->owner)?ast_channel_name(ast_bridged_channel(xferee->owner)):""); ast_debug(1, "Transferor channels (local/remote): %s and %s\n", - xferor->owner->name, ast_bridged_channel(xferor->owner)?ast_bridged_channel(xferor->owner)->name:""); + ast_channel_name(xferor->owner), ast_bridged_channel(xferor->owner)?ast_channel_name(ast_bridged_channel(xferor->owner)):""); } if (ast_bridged_channel(xferor->owner)) { if (ast_bridged_channel(xferee->owner)) { @@ -4733,10 +4733,10 @@ static int skinny_transfer(struct skinny_subchannel *sub) } if (skinnydebug) ast_debug(1, "Transfer Masquerading %s to %s\n", - xferee->owner->name, ast_bridged_channel(xferor->owner)?ast_bridged_channel(xferor->owner)->name:""); + ast_channel_name(xferee->owner), ast_bridged_channel(xferor->owner)?ast_channel_name(ast_bridged_channel(xferor->owner)):""); if (ast_channel_masquerade(xferee->owner, ast_bridged_channel(xferor->owner))) { ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n", - ast_bridged_channel(xferor->owner)->name, xferee->owner->name); + ast_channel_name(ast_bridged_channel(xferor->owner)), ast_channel_name(xferee->owner)); return -1; } } else if (ast_bridged_channel(xferee->owner)) { @@ -4750,16 +4750,16 @@ static int skinny_transfer(struct skinny_subchannel *sub) } if (skinnydebug) ast_debug(1, "Transfer Masquerading %s to %s\n", - xferor->owner->name, ast_bridged_channel(xferee->owner)?ast_bridged_channel(xferee->owner)->name:""); + ast_channel_name(xferor->owner), ast_bridged_channel(xferee->owner)?ast_channel_name(ast_bridged_channel(xferee->owner)):""); if (ast_channel_masquerade(xferor->owner, ast_bridged_channel(xferee->owner))) { ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n", - ast_bridged_channel(xferee->owner)->name, xferor->owner->name); + ast_channel_name(ast_bridged_channel(xferee->owner)), ast_channel_name(xferor->owner)); return -1; } return 0; } else { ast_debug(1, "Neither %s nor %s are in a bridge, nothing to transfer\n", - xferor->owner->name, xferee->owner->name); + ast_channel_name(xferor->owner), ast_channel_name(xferee->owner)); } } return 0; @@ -4773,17 +4773,17 @@ static int skinny_indicate(struct ast_channel *ast, int ind, const void *data, s struct skinnysession *s = d->session; if (!s) { - ast_log(LOG_NOTICE, "Asked to indicate '%s' condition on channel %s, but session does not exist.\n", control2str(ind), ast->name); + ast_log(LOG_NOTICE, "Asked to indicate '%s' condition on channel %s, but session does not exist.\n", control2str(ind), ast_channel_name(ast)); return -1; } if (skinnydebug) - ast_verb(3, "Asked to indicate '%s' condition on channel %s\n", control2str(ind), ast->name); + ast_verb(3, "Asked to indicate '%s' condition on channel %s\n", control2str(ind), ast_channel_name(ast)); switch(ind) { case AST_CONTROL_RINGING: if (sub->blindxfer) { if (skinnydebug) - ast_debug(1, "Channel %s set up for Blind Xfer, so Xfer rather than ring device\n", ast->name); + ast_debug(1, "Channel %s set up for Blind Xfer, so Xfer rather than ring device\n", ast_channel_name(ast)); skinny_transfer(sub); break; } @@ -4951,7 +4951,7 @@ static struct ast_channel *skinny_new(struct skinny_line *l, struct skinny_subli 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; } @@ -5895,7 +5895,7 @@ static int handle_stimulus_message(struct skinny_req *req, struct skinnysession setsubstate(sub, SUBSTATE_CONNECTED); } else { if (sub && sub->owner) { - ast_debug(1, "Current subchannel [%s] already has owner\n", sub->owner->name); + ast_debug(1, "Current subchannel [%s] already has owner\n", ast_channel_name(sub->owner)); } else { c = skinny_new(l, NULL, AST_STATE_DOWN, NULL, SKINNY_OUTGOING); if (c) { @@ -5970,7 +5970,7 @@ static int handle_offhook_message(struct skinny_req *req, struct skinnysession * transmit_definetimedate(d); if (sub && sub->owner) { - ast_debug(1, "Current sub [%s] already has owner\n", sub->owner->name); + ast_debug(1, "Current sub [%s] already has owner\n", ast_channel_name(sub->owner)); } else { c = skinny_new(l, NULL, AST_STATE_DOWN, NULL, SKINNY_OUTGOING); if (c) { diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c index ac4d559a9..45267724e 100644 --- a/channels/chan_unistim.c +++ b/channels/chan_unistim.c @@ -1972,8 +1972,8 @@ static int attempt_transfer(struct unistim_subchannel *p1, struct unistim_subcha peerc->cdr = NULL; if (ast_channel_masquerade(peerb, peerc)) { - ast_log(LOG_WARNING, "Failed to masquerade %s into %s\n", peerb->name, - peerc->name); + ast_log(LOG_WARNING, "Failed to masquerade %s into %s\n", ast_channel_name(peerb), + ast_channel_name(peerc)); res = -1; } return res; @@ -2507,10 +2507,10 @@ static void HandleCallOutgoing(struct unistimsession *s) } if (unistimdebug) ast_verb(0, "Started three way call on channel %p (%s) subchan %d\n", - p->subs[SUB_THREEWAY]->owner, p->subs[SUB_THREEWAY]->owner->name, + p->subs[SUB_THREEWAY]->owner, ast_channel_name(p->subs[SUB_THREEWAY]->owner), p->subs[SUB_THREEWAY]->subtype); } else - ast_debug(1, "Current sub [%s] already has owner\n", sub->owner->name); + ast_debug(1, "Current sub [%s] already has owner\n", ast_channel_name(sub->owner)); } return; } @@ -3759,12 +3759,12 @@ static int unistim_call(struct ast_channel *ast, char *dest, int timeout) sub = ast->tech_pvt; if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) { ast_log(LOG_WARNING, "unistim_call called on %s, neither down nor reserved\n", - ast->name); + ast_channel_name(ast)); return -1; } if (unistimdebug) - ast_verb(3, "unistim_call(%s)\n", ast->name); + ast_verb(3, "unistim_call(%s)\n", ast_channel_name(ast)); session->state = STATE_RINGING; Sendicon(TEXT_LINE0, FAV_ICON_NONE, session); @@ -3839,7 +3839,7 @@ static int unistim_hangup(struct ast_channel *ast) } l = sub->parent; if (unistimdebug) - ast_verb(0, "unistim_hangup(%s) on %s@%s\n", ast->name, l->name, l->parent->name); + ast_verb(0, "unistim_hangup(%s) on %s@%s\n", ast_channel_name(ast), l->name, l->parent->name); if ((l->subs[SUB_THREEWAY]) && (sub->subtype == SUB_REAL)) { if (unistimdebug) @@ -3938,7 +3938,7 @@ static int unistim_answer(struct ast_channel *ast) if ((!sub->rtp) && (!l->subs[SUB_THREEWAY])) start_rtp(sub); if (unistimdebug) - ast_verb(0, "unistim_answer(%s) on %s@%s-%d\n", ast->name, l->name, + ast_verb(0, "unistim_answer(%s) on %s@%s-%d\n", ast_channel_name(ast), l->name, l->parent->name, sub->subtype); send_text(TEXT_LINE2, TEXT_NORMAL, l->parent->session, "is now on-line"); if (l->subs[SUB_THREEWAY]) @@ -4115,11 +4115,11 @@ static int unistim_fixup(struct ast_channel *oldchan, struct ast_channel *newcha ast_mutex_lock(&p->lock); ast_debug(1, "New owner for channel USTM/%s@%s-%d is %s\n", l->name, - l->parent->name, p->subtype, newchan->name); + l->parent->name, p->subtype, ast_channel_name(newchan)); if (p->owner != oldchan) { ast_log(LOG_WARNING, "old channel wasn't %s (%p) but was %s (%p)\n", - oldchan->name, oldchan, p->owner->name, p->owner); + ast_channel_name(oldchan), oldchan, ast_channel_name(p->owner), p->owner); return -1; } @@ -4188,7 +4188,7 @@ static int unistim_indicate(struct ast_channel *ast, int ind, const void *data, if (unistimdebug) { ast_verb(3, "Asked to indicate '%s' condition on channel %s\n", - control2str(ind), ast->name); + control2str(ind), ast_channel_name(ast)); } s = channel_to_session(ast); @@ -4621,7 +4621,7 @@ static struct ast_channel *unistim_new(struct unistim_subchannel *sub, int state if (unistimdebug) ast_verb(0, "Starting pbx in unistim_new\n"); 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; } diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c index a6cc03a66..541a325f3 100644 --- a/channels/chan_usbradio.c +++ b/channels/chan_usbradio.c @@ -1845,13 +1845,13 @@ static struct ast_frame *usbradio_read(struct ast_channel *c) if(!o->pmrChan->txPttIn) { o->pmrChan->txPttIn=1; - if(o->debuglevel) ast_log(LOG_NOTICE,"txPttIn = %i, chan %s\n",o->pmrChan->txPttIn,o->owner->name); + if(o->debuglevel) ast_log(LOG_NOTICE,"txPttIn = %i, chan %s\n",o->pmrChan->txPttIn,ast_channel_name(o->owner)); } } else if(o->pmrChan->txPttIn) { o->pmrChan->txPttIn=0; - if(o->debuglevel) ast_log(LOG_NOTICE,"txPttIn = %i, chan %s\n",o->pmrChan->txPttIn,o->owner->name); + if(o->debuglevel) ast_log(LOG_NOTICE,"txPttIn = %i, chan %s\n",o->pmrChan->txPttIn,ast_channel_name(o->owner)); } oldpttout = o->pmrChan->txPttOut; @@ -1862,7 +1862,7 @@ static struct ast_frame *usbradio_read(struct ast_channel *c) if (oldpttout != o->pmrChan->txPttOut) { - if(o->debuglevel) ast_log(LOG_NOTICE,"txPttOut = %i, chan %s\n",o->pmrChan->txPttOut,o->owner->name); + if(o->debuglevel) ast_log(LOG_NOTICE,"txPttOut = %i, chan %s\n",o->pmrChan->txPttOut,ast_channel_name(o->owner)); kickptt(o); } @@ -1960,13 +1960,13 @@ static struct ast_frame *usbradio_read(struct ast_channel *c) if(cd!=o->rxcarrierdetect) { o->rxcarrierdetect=cd; - if(o->debuglevel) ast_log(LOG_NOTICE,"rxcarrierdetect = %i, chan %s\n",cd,o->owner->name); + if(o->debuglevel) ast_log(LOG_NOTICE,"rxcarrierdetect = %i, chan %s\n",cd,ast_channel_name(o->owner)); // printf("rxcarrierdetect = %i, chan %s\n",res,o->owner->name); } if(o->pmrChan->b.ctcssRxEnable && o->pmrChan->rxCtcss->decode!=o->rxctcssdecode) { - if(o->debuglevel)ast_log(LOG_NOTICE,"rxctcssdecode = %i, chan %s\n",o->pmrChan->rxCtcss->decode,o->owner->name); + if(o->debuglevel)ast_log(LOG_NOTICE,"rxctcssdecode = %i, chan %s\n",o->pmrChan->rxCtcss->decode,ast_channel_name(o->owner)); // printf("rxctcssdecode = %i, chan %s\n",o->pmrChan->rxCtcss->decode,o->owner->name); o->rxctcssdecode=o->pmrChan->rxCtcss->decode; strcpy(o->rxctcssfreq, o->pmrChan->rxctcssfreq); @@ -2004,7 +2004,7 @@ static struct ast_frame *usbradio_read(struct ast_channel *c) if(o->pmrChan->decDcs->decode!=o->rxdcsdecode) { - if(o->debuglevel)ast_log(LOG_NOTICE,"rxdcsdecode = %s, chan %s\n",o->pmrChan->rxctcssfreq,o->owner->name); + if(o->debuglevel)ast_log(LOG_NOTICE,"rxdcsdecode = %s, chan %s\n",o->pmrChan->rxctcssfreq,ast_channel_name(o->owner)); // printf("rxctcssdecode = %i, chan %s\n",o->pmrChan->rxCtcss->decode,o->owner->name); o->rxdcsdecode=o->pmrChan->decDcs->decode; strcpy(o->rxctcssfreq, o->pmrChan->rxctcssfreq); @@ -2012,7 +2012,7 @@ static struct ast_frame *usbradio_read(struct ast_channel *c) if(o->pmrChan->rptnum && (o->pmrChan->pLsdCtl->cs[o->pmrChan->rptnum].b.rxkeyed != o->rxlsddecode)) { - if(o->debuglevel)ast_log(LOG_NOTICE,"rxLSDecode = %s, chan %s\n",o->pmrChan->rxctcssfreq,o->owner->name); + if(o->debuglevel)ast_log(LOG_NOTICE,"rxLSDecode = %s, chan %s\n",o->pmrChan->rxctcssfreq,ast_channel_name(o->owner)); o->rxlsddecode=o->pmrChan->pLsdCtl->cs[o->pmrChan->rptnum].b.rxkeyed; strcpy(o->rxctcssfreq, o->pmrChan->rxctcssfreq); } @@ -2027,13 +2027,13 @@ static struct ast_frame *usbradio_read(struct ast_channel *c) if ( cd && sd ) { //if(!o->rxkeyed)o->pmrChan->dd.b.doitnow=1; - if(!o->rxkeyed && o->debuglevel)ast_log(LOG_NOTICE,"o->rxkeyed = 1, chan %s\n", o->owner->name); + if(!o->rxkeyed && o->debuglevel)ast_log(LOG_NOTICE,"o->rxkeyed = 1, chan %s\n", ast_channel_name(o->owner)); o->rxkeyed = 1; } else { //if(o->rxkeyed)o->pmrChan->dd.b.doitnow=1; - if(o->rxkeyed && o->debuglevel)ast_log(LOG_NOTICE,"o->rxkeyed = 0, chan %s\n",o->owner->name); + if(o->rxkeyed && o->debuglevel)ast_log(LOG_NOTICE,"o->rxkeyed = 0, chan %s\n",ast_channel_name(o->owner)); o->rxkeyed = 0; } @@ -2159,7 +2159,7 @@ static int usbradio_indicate(struct ast_channel *c, int cond, const void *data, if(o->debuglevel)ast_verbose(" << AST_CONTROL_RADIO_UNKEY Radio Transmit Off. >> \n"); break; default: - ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, c->name); + ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, ast_channel_name(c)); return -1; } @@ -2205,7 +2205,7 @@ static struct ast_channel *usbradio_new(struct chan_usbradio_pvt *o, char *ext, ast_jb_configure(c, &global_jbconf); if (state != AST_STATE_DOWN) { if (ast_pbx_start(c)) { - ast_log(LOG_WARNING, "Unable to start PBX on %s\n", c->name); + ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ast_channel_name(c)); ast_hangup(c); o->owner = c = NULL; /* XXX what about the channel itself ? */ diff --git a/channels/chan_vpb.cc b/channels/chan_vpb.cc index 894c6045f..71e7febee 100644 --- a/channels/chan_vpb.cc +++ b/channels/chan_vpb.cc @@ -467,7 +467,7 @@ static enum ast_bridge_result ast_vpb_bridge(struct ast_channel *c0, struct ast_ ast_mutex_unlock(&bridge_lock); if (i == max_bridges) { - ast_log(LOG_WARNING, "%s: vpb_bridge: Failed to bridge %s and %s!\n", p0->dev, c0->name, c1->name); + ast_log(LOG_WARNING, "%s: vpb_bridge: Failed to bridge %s and %s!\n", p0->dev, ast_channel_name(c0), ast_channel_name(c1)); ast_mutex_unlock(&p0->lock); ast_mutex_unlock(&p1->lock); return AST_BRIDGE_FAILED_NOWARN; @@ -481,14 +481,14 @@ static enum ast_bridge_result ast_vpb_bridge(struct ast_channel *c0, struct ast_ p1->bridge = &bridges[i]; ast_mutex_unlock(&p1->lock); - ast_verb(2, "%s: vpb_bridge: Bridging call entered with [%s, %s]\n", p0->dev, c0->name, c1->name); + ast_verb(2, "%s: vpb_bridge: Bridging call entered with [%s, %s]\n", p0->dev, ast_channel_name(c0), ast_channel_name(c1)); } - 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)); #ifdef HALF_DUPLEX_BRIDGE - ast_debug(2, "%s: vpb_bridge: Starting half-duplex bridge [%s, %s]\n", p0->dev, c0->name, c1->name); + ast_debug(2, "%s: vpb_bridge: Starting half-duplex bridge [%s, %s]\n", p0->dev, ast_channel_name(c0), ast_channel_name(c1)); int dir = 0; @@ -520,7 +520,7 @@ static enum ast_bridge_result ast_vpb_bridge(struct ast_channel *c0, struct ast_ vpb_play_buf_finish(p0->handle); vpb_play_buf_finish(p1->handle); - ast_debug(2, "%s: vpb_bridge: Finished half-duplex bridge [%s, %s]\n", p0->dev, c0->name, c1->name); + ast_debug(2, "%s: vpb_bridge: Finished half-duplex bridge [%s, %s]\n", p0->dev, ast_channel_name(c0), ast_channel_name(c1)); res = VPB_OK; @@ -602,7 +602,7 @@ static enum ast_bridge_result ast_vpb_bridge(struct ast_channel *c0, struct ast_ p1->bridge = NULL; - ast_verb(2, "Bridging call done with [%s, %s] => %d\n", c0->name, c1->name, res); + ast_verb(2, "Bridging call done with [%s, %s] => %d\n", ast_channel_name(c0), ast_channel_name(c1), res); /* ast_mutex_unlock(&p0->lock); @@ -901,11 +901,11 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e) if (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(3, "Redirecting %s to fax extension\n", p->owner->name); + ast_verb(3, "Redirecting %s to fax extension\n", ast_channel_name(p->owner)); /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */ pbx_builtin_setvar_helper(p->owner, "FAXEXTEN", p->owner->exten); if (ast_async_goto(p->owner, target_context, "fax", 1)) { - ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", p->owner->name, target_context); + ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(p->owner), target_context); } } else { ast_log(LOG_NOTICE, "Fax detected, but no fax extension\n"); @@ -1062,7 +1062,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e) } ast_verb(4, "%s: handle_owned: Prepared frame type[%d]subclass[%d], bridge=%p owner=[%s]\n", - p->dev, f.frametype, f.subclass.integer, (void *)p->bridge, p->owner->name); + p->dev, f.frametype, f.subclass.integer, (void *)p->bridge, ast_channel_name(p->owner)); /* Trylock used here to avoid deadlock that can occur if we * happen to be in here handling an event when hangup is called @@ -1072,7 +1072,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e) if (ast_channel_trylock(p->owner) == 0) { ast_queue_frame(p->owner, &f); ast_channel_unlock(p->owner); - ast_verb(4, "%s: handled_owned: Queued Frame to [%s]\n", p->dev, p->owner->name); + ast_verb(4, "%s: handled_owned: Queued Frame to [%s]\n", p->dev, ast_channel_name(p->owner)); } else { ast_verbose("%s: handled_owned: Missed event %d/%d \n", p->dev, f.frametype, f.subclass.integer); @@ -1731,7 +1731,7 @@ static int vpb_fixup(struct ast_channel *oldchan, struct ast_channel *newchan) ast_verb(4, "%s: LOCKING count[%d] owner[%d] \n", p->dev, p->lock.__m_count,p->lock.__m_owner); */ ast_mutex_lock(&p->lock); - ast_debug(1, "New owner for channel %s is %s\n", p->dev, newchan->name); + ast_debug(1, "New owner for channel %s is %s\n", p->dev, ast_channel_name(newchan)); if (p->owner == oldchan) { p->owner = newchan; @@ -1814,7 +1814,7 @@ static int vpb_call(struct ast_channel *ast, char *dest, int timeout) } if (ast->_state != AST_STATE_DOWN && ast->_state != AST_STATE_RESERVED) { - ast_log(LOG_WARNING, "vpb_call on %s neither down nor reserved!\n", ast->name); + ast_log(LOG_WARNING, "vpb_call on %s neither down nor reserved!\n", ast_channel_name(ast)); ast_mutex_unlock(&p->lock); return -1; } @@ -1840,15 +1840,15 @@ static int vpb_call(struct ast_channel *ast, char *dest, int timeout) memcpy(&call.tone_map, DialToneMap, sizeof(DialToneMap)); vpb_set_call(p->handle, &call); - ast_verb(2, "%s: Calling %s on %s \n",p->dev, dialstring, ast->name); + ast_verb(2, "%s: Calling %s on %s \n",p->dev, dialstring, ast_channel_name(ast)); ast_verb(2, "%s: Dial parms for %s %d/%dms/%dms/%dms/%dms\n", p->dev, - ast->name, call.dialtones, call.dialtone_timeout, + ast_channel_name(ast), call.dialtones, call.dialtone_timeout, call.ringback_timeout, call.inter_ringback_timeout, call.answer_timeout); for (j = 0; !call.tone_map[j].terminate; j++) { ast_verb(2, "%s: Dial parms for %s tone %d->%d\n", p->dev, - ast->name, call.tone_map[j].tone_id, call.tone_map[j].call_id); + ast_channel_name(ast), call.tone_map[j].tone_id, call.tone_map[j].call_id); } ast_verb(4, "%s: Disabling Loop Drop detection\n", p->dev); @@ -1868,13 +1868,13 @@ static int vpb_call(struct ast_channel *ast, char *dest, int timeout) #endif if (res != VPB_OK) { - ast_debug(1, "Call on %s to %s failed: %d\n", ast->name, s, res); + ast_debug(1, "Call on %s to %s failed: %d\n", ast_channel_name(ast), s, res); res = -1; } else res = 0; } - ast_verb(3, "%s: VPB Calling %s [t=%d] on %s returned %d\n", p->dev , s, timeout, ast->name, res); + ast_verb(3, "%s: VPB Calling %s [t=%d] on %s returned %d\n", p->dev , s, timeout, ast_channel_name(ast), res); if (res == 0) { ast_setstate(ast, AST_STATE_RINGING); ast_queue_control(ast, AST_CONTROL_RINGING); @@ -1900,10 +1900,10 @@ static int vpb_hangup(struct ast_channel *ast) ast_verb(4, "%s: LOCKING pthread_self(%d)\n", p->dev,pthread_self()); ast_mutex_lock(&p->lock); */ - ast_verb(2, "%s: Hangup requested\n", ast->name); + ast_verb(2, "%s: Hangup requested\n", ast_channel_name(ast)); if (!ast->tech || !ast->tech_pvt) { - ast_log(LOG_WARNING, "%s: channel not connected?\n", ast->name); + ast_log(LOG_WARNING, "%s: channel not connected?\n", ast_channel_name(ast)); ast_mutex_unlock(&p->lock); /* Free up ast dsp if we have one */ if (use_ast_dtmfdet && p->vad) { @@ -1919,19 +1919,19 @@ static int vpb_hangup(struct ast_channel *ast) p->stopreads = 1; if (p->readthread) { pthread_join(p->readthread, NULL); - ast_verb(4, "%s: stopped record thread \n", ast->name); + ast_verb(4, "%s: stopped record thread \n", ast_channel_name(ast)); } /* Stop play */ if (p->lastoutput != -1) { - ast_verb(2, "%s: Ending play mode \n", ast->name); + ast_verb(2, "%s: Ending play mode \n", ast_channel_name(ast)); vpb_play_terminate(p->handle); ast_mutex_lock(&p->play_lock); vpb_play_buf_finish(p->handle); ast_mutex_unlock(&p->play_lock); } - ast_verb(4, "%s: Setting state down\n", ast->name); + ast_verb(4, "%s: Setting state down\n", ast_channel_name(ast)); ast_setstate(ast, AST_STATE_DOWN); @@ -1967,7 +1967,7 @@ static int vpb_hangup(struct ast_channel *ast) } while (VPB_OK == vpb_get_event_ch_async(p->handle, &je)) { vpb_translate_event(&je, str); - ast_verb(4, "%s: Flushing event [%d]=>%s\n", ast->name, je.type, str); + ast_verb(4, "%s: Flushing event [%d]=>%s\n", ast_channel_name(ast), je.type, str); } p->readthread = 0; @@ -1986,7 +1986,7 @@ static int vpb_hangup(struct ast_channel *ast) p->vad = NULL; } - ast_verb(2, "%s: Hangup complete\n", ast->name); + ast_verb(2, "%s: Hangup complete\n", ast_channel_name(ast)); restart_monitor(); ast_mutex_unlock(&p->lock); @@ -2026,7 +2026,7 @@ static int vpb_answer(struct ast_channel *ast) ast_setstate(ast, AST_STATE_UP); ast_verb(2, "%s: Answered call on %s [%s]\n", p->dev, - ast->name, (p->mode == MODE_FXO) ? "FXO" : "FXS"); + ast_channel_name(ast), (p->mode == MODE_FXO) ? "FXO" : "FXS"); ast->rings = 0; if (!p->readthread) { @@ -2136,11 +2136,11 @@ static int vpb_write(struct ast_channel *ast, struct ast_frame *frame) ast_verb(6, "%s: vpb_write: Writing to channel\n", p->dev); if (frame->frametype != AST_FRAME_VOICE) { - ast_verb(4, "%s: vpb_write: Don't know how to handle from type %d\n", ast->name, frame->frametype); + ast_verb(4, "%s: vpb_write: Don't know how to handle from type %d\n", ast_channel_name(ast), frame->frametype); /* ast_mutex_unlock(&p->lock); */ return 0; } else if (ast->_state != AST_STATE_UP) { - ast_verb(4, "%s: vpb_write: Attempt to Write frame type[%d]subclass[%s] on not up chan(state[%d])\n", ast->name, frame->frametype, ast_getformatname(&frame->subclass.format), ast->_state); + ast_verb(4, "%s: vpb_write: Attempt to Write frame type[%d]subclass[%s] on not up chan(state[%d])\n", ast_channel_name(ast), frame->frametype, ast_getformatname(&frame->subclass.format), ast->_state); p->lastoutput = -1; /* ast_mutex_unlock(&p->lock); */ return 0; @@ -2150,7 +2150,7 @@ static int vpb_write(struct ast_channel *ast, struct ast_frame *frame) fmt = ast2vpbformat(&frame->subclass.format); if (fmt < 0) { - ast_log(LOG_WARNING, "%s: vpb_write: Cannot handle frames of %s format!\n", ast->name, ast_getformatname(&frame->subclass.format)); + ast_log(LOG_WARNING, "%s: vpb_write: Cannot handle frames of %s format!\n", ast_channel_name(ast), ast_getformatname(&frame->subclass.format)); return -1; } @@ -2258,7 +2258,7 @@ static void *do_chanreads(void *pvt) } else { ast_verb(5, "%s: chanreads: No native bridge.\n", p->dev); if (p->owner->_bridge) { - ast_verb(5, "%s: chanreads: Got Asterisk bridge with [%s].\n", p->dev, p->owner->_bridge->name); + ast_verb(5, "%s: chanreads: Got Asterisk bridge with [%s].\n", p->dev, ast_channel_name(p->owner->_bridge)); bridgerec = 1; } else { bridgerec = 0; @@ -2495,7 +2495,7 @@ static struct ast_channel *vpb_new(struct vpb_pvt *me, enum ast_channel_state st vpb_answer(tmp); } 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); } } @@ -2552,7 +2552,7 @@ static struct ast_channel *vpb_request(const char *type, struct ast_format_cap * ast_mutex_unlock(&iflock); - ast_verb(2, " %s requested, got: [%s]\n", name, tmp ? tmp->name : "None"); + ast_verb(2, " %s requested, got: [%s]\n", name, tmp ? ast_channel_name(tmp) : "None"); ast_free(name); diff --git a/channels/console_video.c b/channels/console_video.c index c26ac983f..25e095f68 100644 --- a/channels/console_video.c +++ b/channels/console_video.c @@ -991,7 +991,7 @@ static void *video_thread(void *arg) for (p = f; p; p = AST_LIST_NEXT(p, frame_list)) { if (write(fd, &blah, l) != l) ast_log(LOG_WARNING, "Unable to write to alert pipe on %s, frametype/subclass %d/%d: %s!\n", - chan->name, f->frametype, f->subclass, strerror(errno)); + ast_channel_name(chan), f->frametype, f->subclass, strerror(errno)); } } ast_channel_unlock(chan); diff --git a/channels/sig_analog.c b/channels/sig_analog.c index edfd0da9e..7a7b34555 100644 --- a/channels/sig_analog.c +++ b/channels/sig_analog.c @@ -397,7 +397,7 @@ static int _analog_get_index(struct ast_channel *ast, struct analog_pvt *p, int 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; @@ -700,7 +700,7 @@ static int analog_attempt_transfer(struct analog_pvt *p, int inthreeway) * applications together. Why would we want to? */ if (bridge_3way) { - ast_verb(3, "TRANSFERRING %s to %s\n", owner_3way->name, owner_real->name); + ast_verb(3, "TRANSFERRING %s to %s\n", ast_channel_name(owner_3way), ast_channel_name(owner_real)); ast_cel_report_event(owner_3way, (owner_real->_state == AST_STATE_RINGING || owner_3way->_state == AST_STATE_RINGING) @@ -714,7 +714,7 @@ static int analog_attempt_transfer(struct analog_pvt *p, int inthreeway) if (ast_channel_transfer_masquerade(owner_real, &owner_real->connected, 0, bridge_3way, &owner_3way->connected, !inthreeway)) { ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n", - bridge_3way->name, owner_real->name); + ast_channel_name(bridge_3way), ast_channel_name(owner_real)); return -1; } @@ -726,7 +726,7 @@ static int analog_attempt_transfer(struct analog_pvt *p, int inthreeway) return 1; } else if (bridge_real) { /* Try transferring the other way. */ - ast_verb(3, "TRANSFERRING %s to %s\n", owner_real->name, owner_3way->name); + ast_verb(3, "TRANSFERRING %s to %s\n", ast_channel_name(owner_real), ast_channel_name(owner_3way)); ast_cel_report_event(owner_3way, (owner_real->_state == AST_STATE_RINGING || owner_3way->_state == AST_STATE_RINGING) @@ -740,7 +740,7 @@ static int analog_attempt_transfer(struct analog_pvt *p, int inthreeway) if (ast_channel_transfer_masquerade(owner_3way, &owner_3way->connected, !inthreeway, bridge_real, &owner_real->connected, 0)) { ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n", - bridge_real->name, owner_3way->name); + ast_channel_name(bridge_real), ast_channel_name(owner_3way)); return -1; } @@ -750,7 +750,7 @@ static int analog_attempt_transfer(struct analog_pvt *p, int inthreeway) return 0; } else { ast_debug(1, "Neither %s nor %s are in a bridge, nothing to transfer\n", - owner_real->name, owner_3way->name); + ast_channel_name(owner_real), ast_channel_name(owner_3way)); return -1; } } @@ -1021,7 +1021,7 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, char *rdest, int } if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) { - ast_log(LOG_WARNING, "analog_call called on %s, neither down nor reserved\n", ast->name); + ast_log(LOG_WARNING, "analog_call called on %s, neither down nor reserved\n", ast_channel_name(ast)); return -1; } @@ -1085,7 +1085,7 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, char *rdest, int } /* Make ring-back */ if (analog_play_tone(p, ANALOG_SUB_CALLWAIT, ANALOG_TONE_RINGTONE)) { - ast_log(LOG_WARNING, "Unable to generate call-wait ring-back on channel %s\n", ast->name); + ast_log(LOG_WARNING, "Unable to generate call-wait ring-back on channel %s\n", ast_channel_name(ast)); } } @@ -1436,7 +1436,7 @@ int analog_hangup(struct analog_pvt *p, struct ast_channel *ast) /* Perform low level hangup if no owner left */ res = analog_on_hook(p); 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 ANALOG_SIG_FXOGS: @@ -1480,7 +1480,7 @@ int analog_hangup(struct analog_pvt *p, struct ast_channel *ast) analog_stop_callwait(p); - ast_verb(3, "Hanging up on '%s'\n", ast->name); + ast_verb(3, "Hanging up on '%s'\n", ast_channel_name(ast)); return 0; } @@ -1522,7 +1522,7 @@ int analog_answer(struct analog_pvt *p, struct ast_channel *ast) case ANALOG_SIG_FXOGS: case ANALOG_SIG_FXOKS: /* Pick up the line */ - ast_debug(1, "Took %s off hook\n", ast->name); + ast_debug(1, "Took %s off hook\n", ast_channel_name(ast)); if (p->hanguponpolarityswitch) { gettimeofday(&p->polaritydelaytv, NULL); } @@ -1594,11 +1594,11 @@ void analog_handle_dtmf(struct analog_pvt *p, struct ast_channel *ast, enum anal 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 (analog_check_confirmanswer(p)) { 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; @@ -1771,12 +1771,12 @@ static void *__analog_ss_thread(void *data) even get started here, abort safely */ if (!chan->tech_pvt) { - 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 = analog_get_index(chan, p, 0); if (idx < 0) { ast_hangup(chan); @@ -2174,13 +2174,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 */ analog_set_callwaiting(p, 0); res = analog_play_tone(p, idx, ANALOG_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)); @@ -2215,7 +2215,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); @@ -2225,7 +2225,7 @@ static void *__analog_ss_thread(void *data) res = analog_play_tone(p, idx, ANALOG_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)); @@ -2273,7 +2273,7 @@ static void *__analog_ss_thread(void *data) ast_masq_park_call_exten( ast_bridged_channel(p->subs[ANALOG_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 (!ast_strlen_zero(p->lastcid_num) && !strcmp(exten, "*60")) { ast_verb(3, "Blacklisting number %s\n", p->lastcid_num); @@ -2284,14 +2284,14 @@ static void *__analog_ss_thread(void *data) len = 0; } } 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 = analog_play_tone(p, idx, ANALOG_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)); @@ -2312,7 +2312,7 @@ static void *__analog_ss_thread(void *data) /* flash hookswitch */ if ((analog_flash(p) == -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)); } analog_swap_subs(p, ANALOG_SUB_REAL, ANALOG_SUB_THREEWAY); analog_unalloc_sub(p, ANALOG_SUB_THREEWAY); @@ -2363,7 +2363,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"); } @@ -2384,7 +2384,7 @@ static void *__analog_ss_thread(void *data) int k = 0; int oldlinearity; 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)); oldlinearity = analog_set_linear_mode(p, idx, 0); @@ -2516,7 +2516,7 @@ static void *__analog_ss_thread(void *data) } 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"); @@ -2526,7 +2526,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; } @@ -2589,7 +2589,7 @@ static void *__analog_ss_thread(void *data) } 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"); @@ -3137,7 +3137,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_ analog_swap_subs(p, ANALOG_SUB_REAL, ANALOG_SUB_CALLWAIT); analog_play_tone(p, ANALOG_SUB_REAL, -1); analog_set_new_owner(p, p->subs[ANALOG_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->subs[ANALOG_SUB_REAL].owner->_state == AST_STATE_RINGING) { ast_setstate(p->subs[ANALOG_SUB_REAL].owner, AST_STATE_UP); ast_queue_control(p->subs[ANALOG_SUB_REAL].owner, AST_CONTROL_ANSWER); @@ -3267,7 +3267,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_ analog_set_new_owner(p, p->subs[ANALOG_SUB_REAL].owner); } /* Drop the last call and stop the conference */ - ast_verb(3, "Dropping three-way call on %s\n", p->subs[ANALOG_SUB_THREEWAY].owner->name); + ast_verb(3, "Dropping three-way call on %s\n", ast_channel_name(p->subs[ANALOG_SUB_THREEWAY].owner)); ast_softhangup_nolock(p->subs[ANALOG_SUB_THREEWAY].owner, AST_SOFTHANGUP_DEV); analog_set_inthreeway(p, ANALOG_SUB_REAL, 0); analog_set_inthreeway(p, ANALOG_SUB_THREEWAY, 0); @@ -3276,8 +3276,8 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_ if (((ast->pbx) || (ast->_state == AST_STATE_UP)) && (p->transfertobusy || (ast->_state != AST_STATE_BUSY))) { ast_verb(3, "Building conference call with %s and %s\n", - p->subs[ANALOG_SUB_THREEWAY].owner->name, - p->subs[ANALOG_SUB_REAL].owner->name); + ast_channel_name(p->subs[ANALOG_SUB_THREEWAY].owner), + ast_channel_name(p->subs[ANALOG_SUB_REAL].owner)); /* Put them in the threeway, and flip */ analog_set_inthreeway(p, ANALOG_SUB_THREEWAY, 1); analog_set_inthreeway(p, ANALOG_SUB_REAL, 1); @@ -3290,7 +3290,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_ } analog_set_new_owner(p, p->subs[ANALOG_SUB_REAL].owner); } else { - ast_verb(3, "Dumping incomplete call on %s\n", p->subs[ANALOG_SUB_THREEWAY].owner->name); + ast_verb(3, "Dumping incomplete call on %s\n", ast_channel_name(p->subs[ANALOG_SUB_THREEWAY].owner)); analog_swap_subs(p, ANALOG_SUB_THREEWAY, ANALOG_SUB_REAL); orig_3way_sub = ANALOG_SUB_REAL; ast_softhangup_nolock(p->subs[ANALOG_SUB_THREEWAY].owner, AST_SOFTHANGUP_DEV); @@ -3537,7 +3537,7 @@ struct ast_frame *analog_exception(struct analog_pvt *p, struct ast_channel *ast * Possible deadlock because we do not have the real-call lock. */ ast_log(LOG_WARNING, "Event %s on %s is not restored owner %s\n", - analog_event2str(res), ast->name, p->owner->name); + analog_event2str(res), ast_channel_name(ast), ast_channel_name(p->owner)); } if (p->owner && ast_bridged_channel(p->owner)) { ast_queue_control(p->owner, AST_CONTROL_UNHOLD); @@ -3547,7 +3547,7 @@ struct ast_frame *analog_exception(struct analog_pvt *p, struct ast_channel *ast case ANALOG_EVENT_ONHOOK: analog_set_echocanceller(p, 0); 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)); analog_ring(p); analog_stop_callwait(p); } else { @@ -3572,7 +3572,7 @@ struct ast_frame *analog_exception(struct analog_pvt *p, struct ast_channel *ast case ANALOG_EVENT_WINKFLASH: gettimeofday(&p->flashtime, NULL); 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 */ ast_queue_control(p->owner, AST_CONTROL_ANSWER); @@ -3598,7 +3598,7 @@ struct ast_frame *analog_exception(struct analog_pvt *p, 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; } @@ -3908,7 +3908,7 @@ int analog_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, void { struct analog_pvt *new_pvt = newp; int x; - ast_debug(1, "New owner for channel %d is %s\n", new_pvt->channel, newchan->name); + ast_debug(1, "New owner for channel %d is %s\n", new_pvt->channel, ast_channel_name(newchan)); if (new_pvt->owner == oldchan) { analog_set_new_owner(new_pvt, newchan); } diff --git a/channels/sig_pri.c b/channels/sig_pri.c index e0e40725c..3c0f908ac 100644 --- a/channels/sig_pri.c +++ b/channels/sig_pri.c @@ -1395,12 +1395,12 @@ static int pri_fixup_principle(struct sig_pri_span *pri, int principle, q931_cal sig_pri_lock_private(new_chan); ast_verb(3, "Moving call (%s) from channel %d to %d.\n", - old_chan->owner ? old_chan->owner->name : "", + old_chan->owner ? ast_channel_name(old_chan->owner) : "", old_chan->channel, new_chan->channel); if (!sig_pri_is_chan_available(new_chan)) { ast_log(LOG_WARNING, "Can't move call (%s) from channel %d to %d. It is already in use.\n", - old_chan->owner ? old_chan->owner->name : "", + old_chan->owner ? ast_channel_name(old_chan->owner) : "", old_chan->channel, new_chan->channel); sig_pri_unlock_private(new_chan); if (old_chan->owner) { @@ -1802,10 +1802,10 @@ static void *do_idle_thread(void *v_pvt) /* Wait up to 30 seconds for an answer */ int newms, ms = 30000; - ast_verb(3, "Initiating idle call on channel %s\n", chan->name); + ast_verb(3, "Initiating idle call on channel %s\n", ast_channel_name(chan)); snprintf(ex, sizeof(ex), "%d/%s", pvt->channel, pvt->pri->idledial); if (ast_call(chan, ex, 0)) { - ast_log(LOG_WARNING, "Idle dial failed on '%s' to '%s'\n", chan->name, ex); + ast_log(LOG_WARNING, "Idle dial failed on '%s' to '%s'\n", ast_channel_name(chan), ex); ast_hangup(chan); return NULL; } @@ -1822,15 +1822,15 @@ static void *do_idle_thread(void *v_pvt) ast_copy_string(chan->exten, pvt->pri->idleext, sizeof(chan->exten)); ast_copy_string(chan->context, pvt->pri->idlecontext, sizeof(chan->context)); chan->priority = 1; - ast_verb(4, "Idle channel '%s' answered, sending to %s@%s\n", chan->name, chan->exten, chan->context); + ast_verb(4, "Idle channel '%s' answered, sending to %s@%s\n", ast_channel_name(chan), chan->exten, chan->context); ast_pbx_run(chan); /* It's already hungup, return immediately */ return NULL; case AST_CONTROL_BUSY: - ast_verb(4, "Idle channel '%s' busy, waiting...\n", chan->name); + ast_verb(4, "Idle channel '%s' busy, waiting...\n", ast_channel_name(chan)); break; case AST_CONTROL_CONGESTION: - ast_verb(4, "Idle channel '%s' congested, waiting...\n", chan->name); + ast_verb(4, "Idle channel '%s' congested, waiting...\n", ast_channel_name(chan)); break; }; } @@ -1861,12 +1861,12 @@ static void *pri_ss_thread(void *data) * even get started here, abort safely. */ if (!chan->tech_pvt) { - 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); return NULL; } - ast_verb(3, "Starting simple switch on '%s'\n", chan->name); + ast_verb(3, "Starting simple switch on '%s'\n", ast_channel_name(chan)); sig_pri_dsp_reset_and_flush_digits(p); @@ -2216,7 +2216,7 @@ static void sig_pri_mcid_event(struct sig_pri_span *pri, const struct pri_subcmd */ ast_queue_control(owner, AST_CONTROL_MCID); - ast_str_append(&msg, 0, "Channel: %s\r\n", owner->name); + ast_str_append(&msg, 0, "Channel: %s\r\n", ast_channel_name(owner)); ast_str_append(&msg, 0, "UniqueID: %s\r\n", owner->uniqueid); sig_pri_event_party_id(&msg, "CallerID", &owner->connected.id); @@ -2405,7 +2405,7 @@ static int sig_pri_attempt_transfer(struct sig_pri_span *pri, q931_call *call_1_ return -1; } - ast_verb(3, "TRANSFERRING %s to %s\n", call_1->ast->name, call_2->ast->name); + ast_verb(3, "TRANSFERRING %s to %s\n", ast_channel_name(call_1->ast), ast_channel_name(call_2->ast)); /* * Setup transfer masquerade. @@ -3769,7 +3769,7 @@ static void sig_pri_send_aoce_termination_request(struct sig_pri_span *pri, int pvt->waiting_for_aoce = 1; ast_channel_setwhentohangup_tv(pvt->owner, whentohangup); - ast_debug(1, "Delaying hangup on %s for aoc-e msg\n", pvt->owner->name); + ast_debug(1, "Delaying hangup on %s for aoc-e msg\n", ast_channel_name(pvt->owner)); cleanup_termination_request: ast_channel_unlock(pvt->owner); @@ -4175,14 +4175,14 @@ static void sig_pri_handle_subcmds(struct sig_pri_span *pri, int chanpos, int ev if (!call_rsp) { ast_log(LOG_WARNING, "Span %d: %s tried CallRerouting/CallDeflection to '%s' without call!\n", - pri->span, owner->name, subcmd->u.rerouting.deflection.to.number.str); + pri->span, ast_channel_name(owner), subcmd->u.rerouting.deflection.to.number.str); ast_channel_unlock(owner); break; } if (ast_strlen_zero(subcmd->u.rerouting.deflection.to.number.str)) { ast_log(LOG_WARNING, "Span %d: %s tried CallRerouting/CallDeflection to empty number!\n", - pri->span, owner->name); + pri->span, ast_channel_name(owner)); pri_rerouting_rsp(pri->pri, call_rsp, subcmd->u.rerouting.invoke_id, PRI_REROUTING_RSP_INVALID_NUMBER); ast_channel_unlock(owner); @@ -4190,7 +4190,7 @@ static void sig_pri_handle_subcmds(struct sig_pri_span *pri, int chanpos, int ev } ast_verb(3, "Span %d: %s is CallRerouting/CallDeflection to '%s'.\n", - pri->span, owner->name, subcmd->u.rerouting.deflection.to.number.str); + pri->span, ast_channel_name(owner), subcmd->u.rerouting.deflection.to.number.str); /* * Send back positive ACK to CallRerouting/CallDeflection. @@ -5042,7 +5042,7 @@ static void sig_pri_moh_fsm_event(struct ast_channel *chan, struct sig_pri_chan const char *chan_name; if (chan) { - chan_name = ast_strdupa(chan->name); + chan_name = ast_strdupa(ast_channel_name(chan)); } else { chan_name = "Unknown"; } @@ -5080,7 +5080,7 @@ static void sig_pri_ami_hold_event(struct ast_channel *chan, int is_held) "Channel: %s\r\n" "Uniqueid: %s\r\n", is_held ? "On" : "Off", - chan->name, + ast_channel_name(chan), chan->uniqueid); } #endif /* defined(HAVE_PRI_CALL_HOLD) */ @@ -5515,7 +5515,7 @@ static void *pri_dchannel(void *vpri) if (idle) { pri->pvts[nextidle]->isidlecall = 1; if (ast_pthread_create_background(&p, NULL, do_idle_thread, pri->pvts[nextidle])) { - ast_log(LOG_WARNING, "Unable to start new thread for idle channel '%s'\n", idle->name); + ast_log(LOG_WARNING, "Unable to start new thread for idle channel '%s'\n", ast_channel_name(idle)); ast_mutex_unlock(&pri->lock); ast_hangup(idle); ast_mutex_lock(&pri->lock); @@ -7405,7 +7405,7 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, char *rdest, i } if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) { - ast_log(LOG_WARNING, "sig_pri_call called on %s, neither down nor reserved\n", ast->name); + ast_log(LOG_WARNING, "sig_pri_call called on %s, neither down nor reserved\n", ast_channel_name(ast)); return -1; } @@ -7846,7 +7846,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi } 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)); if (p->call_level < SIG_PRI_CALL_LEVEL_PROCEEDING && !p->outgoing) { p->call_level = SIG_PRI_CALL_LEVEL_PROCEEDING; if (p->pri && p->pri->pri) { @@ -7863,7 +7863,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi 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)); sig_pri_set_digital(p, 0); /* Digital-only calls isn't allowing any inband progress messages */ if (!p->progress && p->call_level < SIG_PRI_CALL_LEVEL_ALERTING && !p->outgoing && !p->no_b_channel) { @@ -7960,7 +7960,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi res = sig_pri_play_tone(p, -1); break; case AST_CONTROL_CONNECTED_LINE: - ast_debug(1, "Received AST_CONTROL_CONNECTED_LINE on %s\n", chan->name); + ast_debug(1, "Received AST_CONTROL_CONNECTED_LINE on %s\n", ast_channel_name(chan)); if (p->pri) { struct pri_party_connected_line connected; int dialplan; @@ -8009,7 +8009,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi } break; case AST_CONTROL_REDIRECTING: - ast_debug(1, "Received AST_CONTROL_REDIRECTING on %s\n", chan->name); + ast_debug(1, "Received AST_CONTROL_REDIRECTING on %s\n", ast_channel_name(chan)); if (p->pri) { pri_grab(p, p->pri); sig_pri_redirecting_update(p, chan); @@ -8021,7 +8021,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi { struct ast_aoc_decoded *decoded = ast_aoc_decode((struct ast_aoc_encoded *) data, datalen, chan); - ast_debug(1, "Received AST_CONTROL_AOC on %s\n", chan->name); + ast_debug(1, "Received AST_CONTROL_AOC on %s\n", ast_channel_name(chan)); if (decoded && p->pri) { pri_grab(p, p->pri); switch (ast_aoc_get_msg_type(decoded)) { @@ -8047,7 +8047,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi p->waiting_for_aoce = 0; ast_debug(1, "Received final AOC-E msg, continue with hangup on %s\n", - chan->name); + ast_channel_name(chan)); ast_softhangup_nolock(chan, AST_SOFTHANGUP_DEV); } break; @@ -8776,7 +8776,7 @@ void sig_pri_cli_show_channels(int fd, struct sig_pri_span *pri) sig_pri_is_chan_available(pvt) ? "Yes" : "No", sig_pri_call_level2str(pvt->call_level), pvt->call ? "Yes" : "No", - pvt->owner ? pvt->owner->name : ""); + pvt->owner ? ast_channel_name(pvt->owner) : ""); if (pvt->owner) { ast_channel_unlock(pvt->owner); diff --git a/channels/sig_ss7.c b/channels/sig_ss7.c index 616d6002a..a94188071 100644 --- a/channels/sig_ss7.c +++ b/channels/sig_ss7.c @@ -624,7 +624,7 @@ static void ss7_start_call(struct sig_ss7_chan *p, struct sig_ss7_linkset *links ast_channel_unlock(c); if (ast_pbx_start(c)) { - ast_log(LOG_WARNING, "Unable to start PBX on %s (CIC %d)\n", c->name, p->cic); + ast_log(LOG_WARNING, "Unable to start PBX on %s (CIC %d)\n", ast_channel_name(c), p->cic); ast_hangup(c); } else { ast_verb(3, "Accepting call to '%s' on CIC %d\n", p->exten, p->cic); @@ -1679,7 +1679,7 @@ int sig_ss7_indicate(struct sig_ss7_chan *p, struct ast_channel *chan, int condi } 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)); ss7_grab(p, p->ss7); /* This IF sends the FAR for an answered ALEG call */ if (chan->_state == AST_STATE_UP && (p->rlt != 1)){ @@ -1697,7 +1697,7 @@ int sig_ss7_indicate(struct sig_ss7_chan *p, struct ast_channel *chan, int condi 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)); ss7_grab(p, p->ss7); if (!p->progress && p->call_level < SIG_SS7_CALL_LEVEL_ALERTING && !p->outgoing) { p->progress = 1;/* No need to send inband-information progress again. */ @@ -1812,7 +1812,7 @@ void sig_ss7_cli_show_channels(int fd, struct sig_ss7_linkset *linkset) pvt->remotelyblocked ? "Yes" : "No", sig_ss7_call_level2str(pvt->call_level), pvt->ss7call ? "Yes" : "No", - pvt->owner ? pvt->owner->name : ""); + pvt->owner ? ast_channel_name(pvt->owner) : ""); if (pvt->owner) { ast_channel_unlock(pvt->owner); diff --git a/funcs/func_audiohookinherit.c b/funcs/func_audiohookinherit.c index 59faa9019..073c5c46f 100644 --- a/funcs/func_audiohookinherit.c +++ b/funcs/func_audiohookinherit.c @@ -123,12 +123,12 @@ static void audiohook_inheritance_fixup(void *data, struct ast_channel *old_chan struct inheritable_audiohook *audiohook = NULL; struct audiohook_inheritance_datastore *datastore = data; - ast_debug(2, "inheritance fixup occurring for channels %s(%p) and %s(%p)", old_chan->name, old_chan, new_chan->name, new_chan); + ast_debug(2, "inheritance fixup occurring for channels %s(%p) and %s(%p)", ast_channel_name(old_chan), old_chan, ast_channel_name(new_chan), new_chan); AST_LIST_TRAVERSE(&datastore->allowed_list, audiohook, list) { ast_audiohook_move_by_source(old_chan, new_chan, audiohook->source); ast_debug(3, "Moved audiohook %s from %s(%p) to %s(%p)\n", - audiohook->source, old_chan->name, old_chan, new_chan->name, new_chan); + audiohook->source, ast_channel_name(old_chan), old_chan, ast_channel_name(new_chan), new_chan); } return; } @@ -234,10 +234,10 @@ static int func_inheritance_write(struct ast_channel *chan, const char *function ast_channel_unlock(chan); /* In the case where we cannot find the datastore, we can take a few shortcuts */ if (!allow) { - ast_debug(1, "Audiohook %s is already set to not be inheritable on channel %s\n", data, chan->name); + ast_debug(1, "Audiohook %s is already set to not be inheritable on channel %s\n", data, ast_channel_name(chan)); return 0; } else if (!(inheritance_datastore = setup_inheritance_datastore(chan))) { - ast_log(LOG_WARNING, "Unable to set up audiohook inheritance datastore on channel %s\n", chan->name); + ast_log(LOG_WARNING, "Unable to set up audiohook inheritance datastore on channel %s\n", ast_channel_name(chan)); return -1; } else { return setup_inheritable_audiohook(inheritance_datastore, data); @@ -252,10 +252,10 @@ static int func_inheritance_write(struct ast_channel *chan, const char *function AST_LIST_TRAVERSE_SAFE_BEGIN(&inheritance_datastore->allowed_list, inheritable_audiohook, list) { if (!strcasecmp(inheritable_audiohook->source, data)) { if (allow) { - ast_debug(2, "Audiohook source %s is already set up to be inherited from channel %s\n", data, chan->name); + ast_debug(2, "Audiohook source %s is already set up to be inherited from channel %s\n", data, ast_channel_name(chan)); return 0; } else { - ast_debug(2, "Removing inheritability of audiohook %s from channel %s\n", data, chan->name); + ast_debug(2, "Removing inheritability of audiohook %s from channel %s\n", data, ast_channel_name(chan)); AST_LIST_REMOVE_CURRENT(list); ast_free(inheritable_audiohook); return 0; @@ -273,7 +273,7 @@ static int func_inheritance_write(struct ast_channel *chan, const char *function if (allow) { return setup_inheritable_audiohook(inheritance_datastore, data); } else { - ast_debug(1, "Audiohook %s is already set to not be inheritable on channel %s\n", data, chan->name); + ast_debug(1, "Audiohook %s is already set to not be inheritable on channel %s\n", data, ast_channel_name(chan)); return 0; } } diff --git a/funcs/func_channel.c b/funcs/func_channel.c index 0f27a3be8..ecf9deea2 100644 --- a/funcs/func_channel.c +++ b/funcs/func_channel.c @@ -333,7 +333,7 @@ static int func_channel_read(struct ast_channel *chan, const char *function, else if (!strcasecmp(data, "musicclass")) locked_copy_string(chan, buf, chan->musicclass, len); else if (!strcasecmp(data, "name")) { - locked_copy_string(chan, buf, chan->name, len); + locked_copy_string(chan, buf, ast_channel_name(chan), len); } else if (!strcasecmp(data, "parkinglot")) locked_copy_string(chan, buf, chan->parkinglot, len); else if (!strcasecmp(data, "state")) @@ -361,7 +361,7 @@ static int func_channel_read(struct ast_channel *chan, const char *function, else if (!strcasecmp(data, "userfield") && chan->data) locked_copy_string(chan, buf, chan->userfield, len); else if (!strcasecmp(data, "channame") && chan->data) - locked_copy_string(chan, buf, chan->name, len); + locked_copy_string(chan, buf, ast_channel_name(chan), len); else if (!strcasecmp(data, "linkedid")) { ast_channel_lock(chan); if (ast_strlen_zero(chan->linkedid)) { @@ -377,7 +377,7 @@ static int func_channel_read(struct ast_channel *chan, const char *function, ast_channel_lock(chan); p = ast_bridged_channel(chan); if (p || chan->tech || chan->cdr) /* dummy channel? if so, we hid the peer name in the language */ - ast_copy_string(buf, (p ? p->name : ""), len); + ast_copy_string(buf, (p ? ast_channel_name(p) : ""), len); else { /* a dummy channel can still pass along bridged peer info via the BRIDGEPEER variable */ @@ -593,14 +593,14 @@ static int func_channels_read(struct ast_channel *chan, const char *function, ch while ((c = ast_channel_iterator_next(iter))) { ast_channel_lock(c); - if (ast_strlen_zero(data) || regexec(&re, c->name, 0, NULL, 0) == 0) { - size_t namelen = strlen(c->name); + if (ast_strlen_zero(data) || regexec(&re, ast_channel_name(c), 0, NULL, 0) == 0) { + size_t namelen = strlen(ast_channel_name(c)); if (buflen + namelen + (ast_strlen_zero(buf) ? 0 : 1) + 1 < maxlen) { if (!ast_strlen_zero(buf)) { strcat(buf, " "); buflen++; } - strcat(buf, c->name); + strcat(buf, ast_channel_name(c)); buflen += namelen; } else { ast_log(LOG_WARNING, "Number of channels exceeds the available buffer space. Output will be truncated!\n"); diff --git a/funcs/func_frame_trace.c b/funcs/func_frame_trace.c index 4488577c6..feb004c30 100644 --- a/funcs/func_frame_trace.c +++ b/funcs/func_frame_trace.c @@ -140,7 +140,7 @@ static struct ast_frame *hook_event_cb(struct ast_channel *chan, struct ast_fram } if (show_frame) { - ast_verbose("%s on Channel %s\n", event == AST_FRAMEHOOK_EVENT_READ ? "<--Read" : "--> Write", chan->name); + ast_verbose("%s on Channel %s\n", event == AST_FRAMEHOOK_EVENT_READ ? "<--Read" : "--> Write", ast_channel_name(chan)); print_frame(frame); } return frame; diff --git a/funcs/func_global.c b/funcs/func_global.c index 6b158aafb..7ac3fba09 100644 --- a/funcs/func_global.c +++ b/funcs/func_global.c @@ -259,7 +259,7 @@ static int shared_write(struct ast_channel *chan, const char *cmd, char *data, c "Variable: SHARED(%s)\r\n" "Value: %s\r\n" "Uniqueid: %s\r\n", - chan ? chan->name : "none", args.var, value, + chan ? ast_channel_name(chan) : "none", args.var, value, chan ? chan->uniqueid : "none"); ast_channel_unlock(chan); diff --git a/funcs/func_groupcount.c b/funcs/func_groupcount.c index 609d01fef..255a28d69 100644 --- a/funcs/func_groupcount.c +++ b/funcs/func_groupcount.c @@ -127,7 +127,7 @@ static int group_count_function_read(struct ast_channel *chan, const char *cmd, } if ((count = ast_app_group_get_count(group, category)) == -1) { - ast_log(LOG_NOTICE, "No group could be found for channel '%s'\n", chan->name); + ast_log(LOG_NOTICE, "No group could be found for channel '%s'\n", ast_channel_name(chan)); } else { snprintf(buf, len, "%d", count); ret = 0; diff --git a/funcs/func_lock.c b/funcs/func_lock.c index c3cf7a987..625c61427 100644 --- a/funcs/func_lock.c +++ b/funcs/func_lock.c @@ -205,13 +205,13 @@ static void *lock_broker(void *unused) static int ast_channel_hash_cb(const void *obj, const int flags) { const struct ast_channel *chan = obj; - return ast_str_case_hash(chan->name); + return ast_str_case_hash(ast_channel_name(chan)); } static int ast_channel_cmp_cb(void *obj, void *arg, int flags) { struct ast_channel *chan = obj, *cmp_args = arg; - return strcasecmp(chan->name, cmp_args->name) ? 0 : CMP_MATCH; + return strcasecmp(ast_channel_name(chan), ast_channel_name(cmp_args)) ? 0 : CMP_MATCH; } static int get_lock(struct ast_channel *chan, char *lockname, int try) @@ -224,7 +224,7 @@ static int get_lock(struct ast_channel *chan, char *lockname, int try) struct timespec three_seconds = { .tv_sec = 3 }; if (!lock_store) { - ast_debug(1, "Channel %s has no lock datastore, so we're allocating one.\n", chan->name); + ast_debug(1, "Channel %s has no lock datastore, so we're allocating one.\n", ast_channel_name(chan)); lock_store = ast_datastore_alloc(&lock_info, NULL); if (!lock_store) { ast_log(LOG_ERROR, "Unable to allocate new datastore. No locks will be obtained.\n"); diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 4d25f66e6..d26a25722 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -770,7 +770,7 @@ struct ast_channel { #endif AST_DECLARE_STRING_FIELDS( - AST_STRING_FIELD(name); /*!< ASCII unique channel name */ + AST_STRING_FIELD(__do_not_use_name); /*!< ASCII unique channel name */ AST_STRING_FIELD(language); /*!< Language requested for voice prompts */ AST_STRING_FIELD(musicclass); /*!< Default music class */ AST_STRING_FIELD(accountcode); /*!< Account code for billing */ @@ -2435,7 +2435,7 @@ static inline enum ast_t38_state ast_channel_get_t38_state(struct ast_channel *c #define CHECK_BLOCKING(c) do { \ if (ast_test_flag(c, AST_FLAG_BLOCKING)) {\ - ast_debug(1, "Thread %ld Blocking '%s', already blocked by thread %ld in procedure %s\n", (long) pthread_self(), (c)->name, (long) (c)->blocker, (c)->blockproc); \ + ast_debug(1, "Thread %ld Blocking '%s', already blocked by thread %ld in procedure %s\n", (long) pthread_self(), ast_channel_name(c), (long) (c)->blocker, (c)->blockproc); \ } else { \ (c)->blocker = pthread_self(); \ (c)->blockproc = __PRETTY_FUNCTION__; \ @@ -3545,4 +3545,14 @@ int ast_channel_get_cc_agent_type(struct ast_channel *chan, char *agent_type, si */ void ast_channel_unlink(struct ast_channel *chan); +/* ACCESSOR FUNTIONS */ +/*! \brief Get the channel name */ +const char *ast_channel_name(const struct ast_channel *chan); + +/*! \brief Set the channel name */ +void ast_channel_name_set(struct ast_channel *chan, const char *name); + +/*! \brief Set the channel name with a format string */ +void ast_channel_name_set_va(struct ast_channel *chan, const char *name_fmt, va_list ap) __attribute__((format(printf, 2, 0))); + #endif /* _ASTERISK_CHANNEL_H */ diff --git a/main/abstract_jb.c b/main/abstract_jb.c index 5ecce8c40..3ae3e0331 100644 --- a/main/abstract_jb.c +++ b/main/abstract_jb.c @@ -279,14 +279,14 @@ int ast_jb_put(struct ast_channel *chan, struct ast_frame *f) if (!ast_test_flag(f, AST_FRFLAG_HAS_TIMING_INFO) || f->len < 2 || f->ts < 0) { ast_log(LOG_WARNING, "%s received frame with invalid timing info: " "has_timing_info=%d, len=%ld, ts=%ld, src=%s\n", - chan->name, ast_test_flag(f, AST_FRFLAG_HAS_TIMING_INFO), f->len, f->ts, f->src); + ast_channel_name(chan), ast_test_flag(f, AST_FRFLAG_HAS_TIMING_INFO), f->len, f->ts, f->src); return -1; } frr = ast_frdup(f); if (!frr) { - ast_log(LOG_ERROR, "Failed to isolate frame for the jitterbuffer on channel '%s'\n", chan->name); + ast_log(LOG_ERROR, "Failed to isolate frame for the jitterbuffer on channel '%s'\n", ast_channel_name(chan)); return -1; } @@ -411,7 +411,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr) jbobj = jb->jbobj = jbimpl->create(jbconf, jbconf->resync_threshold); if (!jbobj) { - ast_log(LOG_WARNING, "Failed to create jitterbuffer on channel '%s'\n", chan->name); + ast_log(LOG_WARNING, "Failed to create jitterbuffer on channel '%s'\n", ast_channel_name(chan)); return -1; } @@ -421,7 +421,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr) /* The result of putting the first frame should not differ from OK. However, its possible some implementations (i.e. adaptive's when resynch_threshold is specified) to drop it. */ if (res != AST_JB_IMPL_OK) { - ast_log(LOG_WARNING, "Failed to put first frame in the jitterbuffer on channel '%s'\n", chan->name); + ast_log(LOG_WARNING, "Failed to put first frame in the jitterbuffer on channel '%s'\n", ast_channel_name(chan)); /* jbimpl->destroy(jbobj); return -1; @@ -438,7 +438,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr) if (ast_test_flag(jbconf, AST_JB_LOG)) { char safe_logfile[30] = "/tmp/logfile-XXXXXX"; int safe_fd; - snprintf(name2, sizeof(name2), "%s", chan->name); + snprintf(name2, sizeof(name2), "%s", ast_channel_name(chan)); if ((tmp = strchr(name2, '/'))) { *tmp = '#'; } @@ -447,7 +447,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr) /* We should always have bridged chan if a jitterbuffer is in use */ ast_assert(bridged != NULL); - snprintf(name1, sizeof(name1), "%s", bridged->name); + snprintf(name1, sizeof(name1), "%s", ast_channel_name(bridged)); if ((tmp = strchr(name1, '/'))) { *tmp = '#'; } @@ -473,7 +473,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr) } } - ast_verb(3, "%s jitterbuffer created on channel %s\n", jbimpl->name, chan->name); + ast_verb(3, "%s jitterbuffer created on channel %s\n", jbimpl->name, ast_channel_name(chan)); /* Free the frame if it has not been queued in the jb */ if (res != AST_JB_IMPL_OK) { @@ -507,7 +507,7 @@ void ast_jb_destroy(struct ast_channel *chan) ast_clear_flag(jb, JB_CREATED); - ast_verb(3, "%s jitterbuffer destroyed on channel %s\n", jbimpl->name, chan->name); + ast_verb(3, "%s jitterbuffer destroyed on channel %s\n", jbimpl->name, ast_channel_name(chan)); } } diff --git a/main/aoc.c b/main/aoc.c index 733d322db..aaf4647b9 100644 --- a/main/aoc.c +++ b/main/aoc.c @@ -1288,7 +1288,7 @@ static void aoc_amount_str(struct ast_str **msg, const char *prefix, unsigned in static void aoc_request_event(const struct ast_aoc_decoded *decoded, struct ast_channel *chan, struct ast_str **msg) { if (chan) { - ast_str_append(msg, 0, "Channel: %s\r\n", chan->name); + ast_str_append(msg, 0, "Channel: %s\r\n", ast_channel_name(chan)); ast_str_append(msg, 0, "UniqueID: %s\r\n", chan->uniqueid); } @@ -1317,7 +1317,7 @@ static void aoc_s_event(const struct ast_aoc_decoded *decoded, struct ast_channe int idx; if (owner) { - ast_str_append(msg, 0, "Channel: %s\r\n", owner->name); + ast_str_append(msg, 0, "Channel: %s\r\n", ast_channel_name(owner)); ast_str_append(msg, 0, "UniqueID: %s\r\n", owner->uniqueid); } @@ -1390,7 +1390,7 @@ static void aoc_d_event(const struct ast_aoc_decoded *decoded, struct ast_channe char prefix[32]; if (chan) { - ast_str_append(msg, 0, "Channel: %s\r\n", chan->name); + ast_str_append(msg, 0, "Channel: %s\r\n", ast_channel_name(chan)); ast_str_append(msg, 0, "UniqueID: %s\r\n", chan->uniqueid); } @@ -1444,7 +1444,7 @@ static void aoc_e_event(const struct ast_aoc_decoded *decoded, struct ast_channe char prefix[32]; if (chan) { - ast_str_append(msg, 0, "Channel: %s\r\n", chan->name); + ast_str_append(msg, 0, "Channel: %s\r\n", ast_channel_name(chan)); ast_str_append(msg, 0, "UniqueID: %s\r\n", chan->uniqueid); } @@ -1585,7 +1585,7 @@ static void aoc_display_decoded_debug(const struct ast_aoc_decoded *decoded, int ast_str_append(&msg, 0, "---- ENCODED AOC MSG ----\r\n"); } if (chan) { - ast_str_append(&msg, 0, "CHANNEL: %s\r\n", chan->name); + ast_str_append(&msg, 0, "CHANNEL: %s\r\n", ast_channel_name(chan)); } if (ast_aoc_decoded2str(decoded, &msg)) { diff --git a/main/app.c b/main/app.c index 3e3cf5614..ca25964a5 100644 --- a/main/app.c +++ b/main/app.c @@ -183,7 +183,7 @@ enum ast_getdata_result ast_app_getdata(struct ast_channel *c, const char *promp filename = ast_strdupa(prompt); while ((front = strsep(&filename, "&"))) { - ast_test_suite_event_notify("PLAYBACK", "Message: %s\r\nChannel: %s", front, c->name); + ast_test_suite_event_notify("PLAYBACK", "Message: %s\r\nChannel: %s", front, ast_channel_name(c)); if (!ast_strlen_zero(front)) { res = ast_streamfile(c, front, c->language); if (res) @@ -455,7 +455,7 @@ static void linear_release(struct ast_channel *chan, void *params) struct linear_state *ls = params; if (ls->origwfmt.id && ast_set_write_format(chan, &ls->origwfmt)) { - ast_log(LOG_WARNING, "Unable to restore channel '%s' to format '%d'\n", chan->name, ls->origwfmt.id); + ast_log(LOG_WARNING, "Unable to restore channel '%s' to format '%d'\n", ast_channel_name(chan), ls->origwfmt.id); } if (ls->autoclose) { @@ -513,7 +513,7 @@ static void *linear_alloc(struct ast_channel *chan, void *params) ast_format_copy(&ls->origwfmt, &chan->writeformat); if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR)) { - ast_log(LOG_WARNING, "Unable to set '%s' to linear format (write)\n", chan->name); + ast_log(LOG_WARNING, "Unable to set '%s' to linear format (write)\n", ast_channel_name(chan)); ast_free(ls); ls = params = NULL; } @@ -700,7 +700,7 @@ int ast_play_and_wait(struct ast_channel *chan, const char *fn) { int d = 0; - ast_test_suite_event_notify("PLAYBACK", "Message: %s\r\nChannel: %s", fn, chan->name); + ast_test_suite_event_notify("PLAYBACK", "Message: %s\r\nChannel: %s", fn, ast_channel_name(chan)); if ((d = ast_streamfile(chan, fn, chan->language))) { return d; } @@ -771,7 +771,7 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile, } ast_debug(1, "play_and_record: %s, %s, '%s'\n", playfile ? playfile : "<None>", recordfile, fmt); - snprintf(comment, sizeof(comment), "Playing %s, Recording to: %s on %s\n", playfile ? playfile : "<None>", recordfile, chan->name); + snprintf(comment, sizeof(comment), "Playing %s, Recording to: %s on %s\n", playfile ? playfile : "<None>", recordfile, ast_channel_name(chan)); if (playfile || beep) { if (!beep) { @@ -853,7 +853,7 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile, ast_debug(1, "One waitfor failed, trying another\n"); /* Try one more time in case of masq */ if (!(res = ast_waitfor(chan, 2000))) { - ast_log(LOG_WARNING, "No audio available on %s??\n", chan->name); + ast_log(LOG_WARNING, "No audio available on %s??\n", ast_channel_name(chan)); res = -1; } } @@ -1031,7 +1031,7 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile, } } 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)); } if ((outmsg == 2) && (!skip_confirmation_sound)) { ast_stream_and_wait(chan, "auth-thankyou", ""); diff --git a/main/autochan.c b/main/autochan.c index 4ad65a371..31f11573f 100644 --- a/main/autochan.c +++ b/main/autochan.c @@ -51,7 +51,7 @@ struct ast_autochan *ast_autochan_setup(struct ast_channel *chan) AST_LIST_INSERT_TAIL(&autochan->chan->autochans, autochan, list); ast_channel_unlock(autochan->chan); - ast_debug(1, "Created autochan %p to hold channel %s (%p)\n", autochan, chan->name, chan); + ast_debug(1, "Created autochan %p to hold channel %s (%p)\n", autochan, ast_channel_name(chan), chan); return autochan; } @@ -88,7 +88,7 @@ void ast_autochan_new_channel(struct ast_channel *old_chan, struct ast_channel * autochan->chan = ast_channel_ref(new_chan); ast_debug(1, "Autochan %p used to hold channel %s (%p) but now holds channel %s (%p)\n", - autochan, old_chan->name, old_chan, new_chan->name, new_chan); + autochan, ast_channel_name(old_chan), old_chan, ast_channel_name(new_chan), new_chan); } } } diff --git a/main/bridging.c b/main/bridging.c index 9bc0edc82..abf5a0386 100644 --- a/main/bridging.c +++ b/main/bridging.c @@ -155,7 +155,7 @@ static void bridge_array_add(struct ast_bridge *bridge, struct ast_channel *chan bridge->array[bridge->array_num++] = chan; - ast_debug(1, "Added channel %s(%p) to bridge array on %p, new count is %d\n", chan->name, chan, bridge, (int)bridge->array_num); + ast_debug(1, "Added channel %s(%p) to bridge array on %p, new count is %d\n", ast_channel_name(chan), chan, bridge, (int)bridge->array_num); /* If the next addition of a channel will exceed our array size grow it out */ if (bridge->array_num == bridge->array_size) { @@ -570,12 +570,12 @@ static int bridge_make_compatible(struct ast_bridge *bridge, struct ast_bridge_c } /* Switch read format to the best one chosen */ if (ast_set_read_format(bridge_channel->chan, &best_format)) { - ast_log(LOG_WARNING, "Failed to set channel %s to read format %s\n", bridge_channel->chan->name, ast_getformatname(&best_format)); + ast_log(LOG_WARNING, "Failed to set channel %s to read format %s\n", ast_channel_name(bridge_channel->chan), ast_getformatname(&best_format)); return -1; } - ast_debug(1, "Bridge %p put channel %s into read format %s\n", bridge, bridge_channel->chan->name, ast_getformatname(&best_format)); + ast_debug(1, "Bridge %p put channel %s into read format %s\n", bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&best_format)); } else { - ast_debug(1, "Bridge %p is happy that channel %s already has read format %s\n", bridge, bridge_channel->chan->name, ast_getformatname(&formats[0])); + ast_debug(1, "Bridge %p is happy that channel %s already has read format %s\n", bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&formats[0])); } if (!ast_format_cap_iscompatible(bridge->technology->format_capabilities, &formats[1])) { @@ -591,12 +591,12 @@ static int bridge_make_compatible(struct ast_bridge *bridge, struct ast_bridge_c } /* Switch write format to the best one chosen */ if (ast_set_write_format(bridge_channel->chan, &best_format)) { - ast_log(LOG_WARNING, "Failed to set channel %s to write format %s\n", bridge_channel->chan->name, ast_getformatname(&best_format)); + ast_log(LOG_WARNING, "Failed to set channel %s to write format %s\n", ast_channel_name(bridge_channel->chan), ast_getformatname(&best_format)); return -1; } - ast_debug(1, "Bridge %p put channel %s into write format %s\n", bridge, bridge_channel->chan->name, ast_getformatname(&best_format)); + ast_debug(1, "Bridge %p put channel %s into write format %s\n", bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&best_format)); } else { - ast_debug(1, "Bridge %p is happy that channel %s already has write format %s\n", bridge, bridge_channel->chan->name, ast_getformatname(&formats[1])); + ast_debug(1, "Bridge %p is happy that channel %s already has write format %s\n", bridge, ast_channel_name(bridge_channel->chan), ast_getformatname(&formats[1])); } return 0; @@ -1511,7 +1511,7 @@ void ast_bridge_set_single_src_video_mode(struct ast_bridge *bridge, struct ast_ cleanup_video_mode(bridge); bridge->video_mode.mode = AST_BRIDGE_VIDEO_MODE_SINGLE_SRC; bridge->video_mode.mode_data.single_src_data.chan_vsrc = ast_channel_ref(video_src_chan); - ast_test_suite_event_notify("BRIDGE_VIDEO_MODE", "Message: video mode set to single source\r\nVideo Mode: %d\r\nVideo Channel: %s", bridge->video_mode.mode, video_src_chan->name); + ast_test_suite_event_notify("BRIDGE_VIDEO_MODE", "Message: video mode set to single source\r\nVideo Mode: %d\r\nVideo Channel: %s", bridge->video_mode.mode, ast_channel_name(video_src_chan)); ast_indicate(video_src_chan, AST_CONTROL_VIDUPDATE); ao2_unlock(bridge); } @@ -1548,14 +1548,14 @@ void ast_bridge_update_talker_src_video_mode(struct ast_bridge *bridge, struct a } data->chan_vsrc = ast_channel_ref(chan); data->average_talking_energy = talker_energy; - ast_test_suite_event_notify("BRIDGE_VIDEO_SRC", "Message: video source updated\r\nVideo Channel: %s", data->chan_vsrc->name); + ast_test_suite_event_notify("BRIDGE_VIDEO_SRC", "Message: video source updated\r\nVideo Channel: %s", ast_channel_name(data->chan_vsrc)); ast_indicate(data->chan_vsrc, AST_CONTROL_VIDUPDATE); } else if ((data->average_talking_energy < talker_energy) && !is_keyframe) { ast_indicate(chan, AST_CONTROL_VIDUPDATE); } else if (!data->chan_vsrc && is_keyframe) { data->chan_vsrc = ast_channel_ref(chan); data->average_talking_energy = talker_energy; - ast_test_suite_event_notify("BRIDGE_VIDEO_SRC", "Message: video source updated\r\nVideo Channel: %s", data->chan_vsrc->name); + ast_test_suite_event_notify("BRIDGE_VIDEO_SRC", "Message: video source updated\r\nVideo Channel: %s", ast_channel_name(data->chan_vsrc)); ast_indicate(chan, AST_CONTROL_VIDUPDATE); } else if (!data->chan_old_vsrc && is_keyframe) { data->chan_old_vsrc = ast_channel_ref(chan); diff --git a/main/ccss.c b/main/ccss.c index 2db5f338b..39fca0e15 100644 --- a/main/ccss.c +++ b/main/ccss.c @@ -2278,7 +2278,7 @@ int ast_cc_call_init(struct ast_channel *chan, int *ignore_cc) */ *ignore_cc = 1; ast_channel_unlock(chan); - ast_log_dynamic_level(cc_logger_level, "Agent policy for %s is 'never'. CC not possible\n", chan->name); + ast_log_dynamic_level(cc_logger_level, "Agent policy for %s is 'never'. CC not possible\n", ast_channel_name(chan)); return 0; } @@ -3608,7 +3608,7 @@ int ast_cc_offer(struct ast_channel *caller_chan) ast_channel_unlock(caller_chan); if (cc_is_offerable) { - res = cc_offer(core_id, "CC offered to caller %s", caller_chan->name); + res = cc_offer(core_id, "CC offered to caller %s", ast_channel_name(caller_chan)); } return res; } diff --git a/main/cdr.c b/main/cdr.c index fdfaad185..d70e2337f 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -926,7 +926,7 @@ int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *c) { for ( ; cdr ; cdr = cdr->next) { if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) { - ast_copy_string(cdr->channel, c->name, sizeof(cdr->channel)); + ast_copy_string(cdr->channel, ast_channel_name(c), sizeof(cdr->channel)); set_one_cid(cdr, c); cdr_seq_inc(cdr); @@ -1038,7 +1038,7 @@ int ast_cdr_setaccount(struct ast_channel *chan, const char *account) "Uniqueid: %s\r\n" "AccountCode: %s\r\n" "OldAccountCode: %s\r\n", - chan->name, chan->uniqueid, chan->accountcode, old_acct); + ast_channel_name(chan), chan->uniqueid, chan->accountcode, old_acct); return 0; } @@ -1064,7 +1064,7 @@ int ast_cdr_setpeeraccount(struct ast_channel *chan, const char *account) "Uniqueid: %s\r\n" "PeerAccount: %s\r\n" "OldPeerAccount: %s\r\n", - chan->name, chan->uniqueid, chan->peeraccount, old_acct); + ast_channel_name(chan), chan->uniqueid, chan->peeraccount, old_acct); return 0; } diff --git a/main/cel.c b/main/cel.c index ef37a1196..f03b51d60 100644 --- a/main/cel.c +++ b/main/cel.c @@ -455,7 +455,7 @@ struct ast_channel *ast_cel_fabricate_channel_from_event(const struct ast_event ast_copy_string(tchan->exten, record.extension, sizeof(tchan->exten)); ast_copy_string(tchan->context, record.context, sizeof(tchan->context)); - ast_string_field_set(tchan, name, record.channel_name); + ast_channel_name_set(tchan, record.channel_name); ast_string_field_set(tchan, uniqueid, record.unique_id); ast_string_field_set(tchan, linkedid, record.linked_id); ast_string_field_set(tchan, accountcode, record.account_code); @@ -515,11 +515,11 @@ int ast_cel_report_event(struct ast_channel *chan, enum ast_cel_event_type event if (peer) { ast_channel_lock(peer); - peername = ast_strdupa(peer->name); + peername = ast_strdupa(ast_channel_name(peer)); ast_channel_unlock(peer); } else if (peer2) { ast_channel_lock(peer2); - peername = ast_strdupa(peer2->name); + peername = ast_strdupa(ast_channel_name(peer2)); ast_channel_unlock(peer2); } @@ -552,7 +552,7 @@ int ast_cel_report_event(struct ast_channel *chan, enum ast_cel_event_type event S_OR(chan->dialed.number.str, ""), AST_EVENT_IE_CEL_EXTEN, AST_EVENT_IE_PLTYPE_STR, chan->exten, AST_EVENT_IE_CEL_CONTEXT, AST_EVENT_IE_PLTYPE_STR, chan->context, - AST_EVENT_IE_CEL_CHANNAME, AST_EVENT_IE_PLTYPE_STR, chan->name, + AST_EVENT_IE_CEL_CHANNAME, AST_EVENT_IE_PLTYPE_STR, ast_channel_name(chan), AST_EVENT_IE_CEL_APPNAME, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->appl, ""), AST_EVENT_IE_CEL_APPDATA, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->data, ""), AST_EVENT_IE_CEL_AMAFLAGS, AST_EVENT_IE_PLTYPE_UINT, chan->amaflags, diff --git a/main/channel.c b/main/channel.c index 017fba98d..3e9fb834e 100644 --- a/main/channel.c +++ b/main/channel.c @@ -141,51 +141,6 @@ static AST_RWLIST_HEAD_STATIC(backends, chanlist); #define NUM_CHANNEL_BUCKETS 1567 #endif -#if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */ -#define DATA_EXPORT_CALLERID(MEMBER) \ - MEMBER(ast_callerid, cid_dnid, AST_DATA_STRING) \ - MEMBER(ast_callerid, cid_num, AST_DATA_STRING) \ - MEMBER(ast_callerid, cid_name, AST_DATA_STRING) \ - MEMBER(ast_callerid, cid_ani, AST_DATA_STRING) \ - MEMBER(ast_callerid, cid_pres, AST_DATA_INTEGER) \ - MEMBER(ast_callerid, cid_ani2, AST_DATA_INTEGER) \ - MEMBER(ast_callerid, cid_tag, AST_DATA_STRING) - -AST_DATA_STRUCTURE(ast_callerid, DATA_EXPORT_CALLERID); -#endif - -#define DATA_EXPORT_CHANNEL(MEMBER) \ - MEMBER(ast_channel, blockproc, AST_DATA_STRING) \ - MEMBER(ast_channel, appl, AST_DATA_STRING) \ - MEMBER(ast_channel, data, AST_DATA_STRING) \ - MEMBER(ast_channel, name, AST_DATA_STRING) \ - MEMBER(ast_channel, language, AST_DATA_STRING) \ - MEMBER(ast_channel, musicclass, AST_DATA_STRING) \ - MEMBER(ast_channel, accountcode, AST_DATA_STRING) \ - MEMBER(ast_channel, peeraccount, AST_DATA_STRING) \ - MEMBER(ast_channel, userfield, AST_DATA_STRING) \ - MEMBER(ast_channel, call_forward, AST_DATA_STRING) \ - MEMBER(ast_channel, uniqueid, AST_DATA_STRING) \ - MEMBER(ast_channel, linkedid, AST_DATA_STRING) \ - MEMBER(ast_channel, parkinglot, AST_DATA_STRING) \ - MEMBER(ast_channel, hangupsource, AST_DATA_STRING) \ - MEMBER(ast_channel, dialcontext, AST_DATA_STRING) \ - MEMBER(ast_channel, rings, AST_DATA_INTEGER) \ - MEMBER(ast_channel, priority, AST_DATA_INTEGER) \ - MEMBER(ast_channel, macropriority, AST_DATA_INTEGER) \ - MEMBER(ast_channel, adsicpe, AST_DATA_INTEGER) \ - MEMBER(ast_channel, fin, AST_DATA_UNSIGNED_INTEGER) \ - MEMBER(ast_channel, fout, AST_DATA_UNSIGNED_INTEGER) \ - MEMBER(ast_channel, emulate_dtmf_duration, AST_DATA_UNSIGNED_INTEGER) \ - MEMBER(ast_channel, visible_indication, AST_DATA_INTEGER) \ - MEMBER(ast_channel, context, AST_DATA_STRING) \ - MEMBER(ast_channel, exten, AST_DATA_STRING) \ - MEMBER(ast_channel, macrocontext, AST_DATA_STRING) \ - MEMBER(ast_channel, macroexten, AST_DATA_STRING) - -AST_DATA_STRUCTURE(ast_channel, DATA_EXPORT_CHANNEL); - - /*! \brief All active channels on the system */ static struct ao2_container *channels; @@ -264,29 +219,6 @@ struct ast_variable *ast_channeltype_list(void) return var; } -static void channel_data_add_flags(struct ast_data *tree, - struct ast_channel *chan) -{ - ast_data_add_bool(tree, "DEFER_DTMF", ast_test_flag(chan, AST_FLAG_DEFER_DTMF)); - ast_data_add_bool(tree, "WRITE_INT", ast_test_flag(chan, AST_FLAG_WRITE_INT)); - ast_data_add_bool(tree, "BLOCKING", ast_test_flag(chan, AST_FLAG_BLOCKING)); - ast_data_add_bool(tree, "ZOMBIE", ast_test_flag(chan, AST_FLAG_ZOMBIE)); - ast_data_add_bool(tree, "EXCEPTION", ast_test_flag(chan, AST_FLAG_EXCEPTION)); - ast_data_add_bool(tree, "MOH", ast_test_flag(chan, AST_FLAG_MOH)); - ast_data_add_bool(tree, "SPYING", ast_test_flag(chan, AST_FLAG_SPYING)); - ast_data_add_bool(tree, "NBRIDGE", ast_test_flag(chan, AST_FLAG_NBRIDGE)); - ast_data_add_bool(tree, "IN_AUTOLOOP", ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP)); - ast_data_add_bool(tree, "OUTGOING", ast_test_flag(chan, AST_FLAG_OUTGOING)); - ast_data_add_bool(tree, "IN_DTMF", ast_test_flag(chan, AST_FLAG_IN_DTMF)); - ast_data_add_bool(tree, "EMULATE_DTMF", ast_test_flag(chan, AST_FLAG_EMULATE_DTMF)); - ast_data_add_bool(tree, "END_DTMF_ONLY", ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY)); - ast_data_add_bool(tree, "ANSWERED_ELSEWHERE", ast_test_flag(chan, AST_FLAG_ANSWERED_ELSEWHERE)); - ast_data_add_bool(tree, "MASQ_NOSTREAM", ast_test_flag(chan, AST_FLAG_MASQ_NOSTREAM)); - ast_data_add_bool(tree, "BRIDGE_HANGUP_RUN", ast_test_flag(chan, AST_FLAG_BRIDGE_HANGUP_RUN)); - ast_data_add_bool(tree, "BRIDGE_HANGUP_DONT", ast_test_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT)); - ast_data_add_bool(tree, "DISABLE_WORKAROUNDS", ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS)); -} - #if defined(KEEP_TILL_CHANNEL_PARTY_NUMBER_INFO_NEEDED) static const char *party_number_ton2str(int ton) { @@ -339,144 +271,6 @@ static const char *party_number_plan2str(int plan) } #endif /* defined(KEEP_TILL_CHANNEL_PARTY_NUMBER_INFO_NEEDED) */ -int ast_channel_data_add_structure(struct ast_data *tree, - struct ast_channel *chan, int add_bridged) -{ - struct ast_channel *bc; - struct ast_data *data_bridged; - struct ast_data *data_cdr; - struct ast_data *data_flags; - struct ast_data *data_zones; - struct ast_data *enum_node; - struct ast_data *data_softhangup; -#if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */ - struct ast_data *data_callerid; - char value_str[100]; -#endif - - if (!tree) { - return -1; - } - - ast_data_add_structure(ast_channel, tree, chan); - - if (add_bridged) { - bc = ast_bridged_channel(chan); - if (bc) { - data_bridged = ast_data_add_node(tree, "bridged"); - if (!data_bridged) { - return -1; - } - ast_channel_data_add_structure(data_bridged, bc, 0); - } - } - - ast_data_add_codec(tree, "oldwriteformat", &chan->oldwriteformat); - ast_data_add_codec(tree, "readformat", &chan->readformat); - ast_data_add_codec(tree, "writeformat", &chan->writeformat); - ast_data_add_codec(tree, "rawreadformat", &chan->rawreadformat); - ast_data_add_codec(tree, "rawwriteformat", &chan->rawwriteformat); - ast_data_add_codecs(tree, "nativeformats", chan->nativeformats); - - /* state */ - enum_node = ast_data_add_node(tree, "state"); - if (!enum_node) { - return -1; - } - ast_data_add_str(enum_node, "text", ast_state2str(chan->_state)); - ast_data_add_int(enum_node, "value", chan->_state); - - /* hangupcause */ - enum_node = ast_data_add_node(tree, "hangupcause"); - if (!enum_node) { - return -1; - } - ast_data_add_str(enum_node, "text", ast_cause2str(chan->hangupcause)); - ast_data_add_int(enum_node, "value", chan->hangupcause); - - /* amaflags */ - enum_node = ast_data_add_node(tree, "amaflags"); - if (!enum_node) { - return -1; - } - ast_data_add_str(enum_node, "text", ast_cdr_flags2str(chan->amaflags)); - ast_data_add_int(enum_node, "value", chan->amaflags); - - /* transfercapability */ - enum_node = ast_data_add_node(tree, "transfercapability"); - if (!enum_node) { - return -1; - } - ast_data_add_str(enum_node, "text", ast_transfercapability2str(chan->transfercapability)); - ast_data_add_int(enum_node, "value", chan->transfercapability); - - /* _softphangup */ - data_softhangup = ast_data_add_node(tree, "softhangup"); - if (!data_softhangup) { - return -1; - } - ast_data_add_bool(data_softhangup, "dev", chan->_softhangup & AST_SOFTHANGUP_DEV); - ast_data_add_bool(data_softhangup, "asyncgoto", chan->_softhangup & AST_SOFTHANGUP_ASYNCGOTO); - ast_data_add_bool(data_softhangup, "shutdown", chan->_softhangup & AST_SOFTHANGUP_SHUTDOWN); - ast_data_add_bool(data_softhangup, "timeout", chan->_softhangup & AST_SOFTHANGUP_TIMEOUT); - ast_data_add_bool(data_softhangup, "appunload", chan->_softhangup & AST_SOFTHANGUP_APPUNLOAD); - ast_data_add_bool(data_softhangup, "explicit", chan->_softhangup & AST_SOFTHANGUP_EXPLICIT); - ast_data_add_bool(data_softhangup, "unbridge", chan->_softhangup & AST_SOFTHANGUP_UNBRIDGE); - - /* channel flags */ - data_flags = ast_data_add_node(tree, "flags"); - if (!data_flags) { - return -1; - } - channel_data_add_flags(data_flags, chan); - - ast_data_add_uint(tree, "timetohangup", chan->whentohangup.tv_sec); - -#if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */ - /* callerid */ - data_callerid = ast_data_add_node(tree, "callerid"); - if (!data_callerid) { - return -1; - } - ast_data_add_structure(ast_callerid, data_callerid, &(chan->cid)); - /* insert the callerid ton */ - enum_node = ast_data_add_node(data_callerid, "cid_ton"); - if (!enum_node) { - return -1; - } - ast_data_add_int(enum_node, "value", chan->cid.cid_ton); - snprintf(value_str, sizeof(value_str), "TON: %s/Plan: %s", - party_number_ton2str(chan->cid.cid_ton), - party_number_plan2str(chan->cid.cid_ton)); - ast_data_add_str(enum_node, "text", value_str); -#endif - - /* tone zone */ - if (chan->zone) { - data_zones = ast_data_add_node(tree, "zone"); - if (!data_zones) { - return -1; - } - ast_tone_zone_data_add_structure(data_zones, chan->zone); - } - - /* insert cdr */ - data_cdr = ast_data_add_node(tree, "cdr"); - if (!data_cdr) { - return -1; - } - - ast_cdr_data_add_structure(data_cdr, chan->cdr, 1); - - return 0; -} - -int ast_channel_data_cmp_structure(const struct ast_data_search *tree, - struct ast_channel *chan, const char *structure_name) -{ - return ast_data_search_cmp_structure(tree, ast_channel, chan, structure_name); -} - /*! \brief Show channel types - CLI command */ static char *handle_cli_core_show_channeltypes(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { @@ -1264,8 +1058,8 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char * uses them to build the string, instead of forming the va_lists internally from the vararg ... list. * This new function was written so this can be accomplished. */ - ast_string_field_build_va(tmp, name, name_fmt, ap); - tech = ast_strdupa(tmp->name); + ast_channel_name_set_va(tmp, name_fmt, ap); + tech = ast_strdupa(ast_channel_name(tmp)); if ((slash = strchr(tech, '/'))) { if ((slash2 = strchr(slash + 1, '/'))) { tech2 = slash + 1; @@ -1278,7 +1072,7 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char * Start the string with '-' so it becomes an empty string * in the destructor. */ - ast_string_field_set(tmp, name, "-**Unknown**"); + ast_channel_name_set(tmp, "-**Unknown**"); } /* Reminder for the future: under what conditions do we NOT want to track cdrs on channels? */ @@ -1342,7 +1136,7 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char "Exten: %s\r\n" "Context: %s\r\n" "Uniqueid: %s\r\n", - tmp->name, + ast_channel_name(tmp), state, ast_state2str(state), S_OR(cid_num, ""), @@ -1484,7 +1278,7 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in if ((queued_frames + new_frames > 128 || queued_voice_frames + new_voice_frames > 96)) { int count = 0; - ast_log(LOG_WARNING, "Exceptionally long %squeue length queuing to %s\n", queued_frames + new_frames > 128 ? "" : "voice ", chan->name); + ast_log(LOG_WARNING, "Exceptionally long %squeue length queuing to %s\n", queued_frames + new_frames > 128 ? "" : "voice ", ast_channel_name(chan)); AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->readq, cur, frame_list) { /* Save the most recent frame */ if (!AST_LIST_NEXT(cur, frame_list)) { @@ -1516,7 +1310,7 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in memset(blah, 1, sizeof(blah)); if (write(chan->alertpipe[1], &blah, sizeof(blah)) != (sizeof(blah))) { ast_log(LOG_WARNING, "Unable to write to alert pipe on %s (qlen = %d): %s!\n", - chan->name, queued_frames, strerror(errno)); + ast_channel_name(chan), queued_frames, strerror(errno)); } } else if (chan->timingfd > -1) { ast_timer_enable_continuous(chan->timer); @@ -1549,7 +1343,7 @@ int ast_queue_hangup(struct ast_channel *chan) manager_event(EVENT_FLAG_CALL, "HangupRequest", "Channel: %s\r\n" "Uniqueid: %s\r\n", - chan->name, + ast_channel_name(chan), chan->uniqueid); ast_channel_unlock(chan); } @@ -1574,7 +1368,7 @@ int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause) "Channel: %s\r\n" "Uniqueid: %s\r\n" "Cause: %d\r\n", - chan->name, + ast_channel_name(chan), chan->uniqueid, cause); ast_channel_unlock(chan); @@ -1623,6 +1417,71 @@ struct ast_channel *ast_channel_callback(ao2_callback_data_fn *cb_fn, void *arg, return ao2_callback_data(channels, ao2_flags, cb_fn, arg, data); } +static int ast_channel_by_name_cb(void *obj, void *arg, void *data, int flags) +{ + struct ast_channel *chan = obj; + const char *name = (flags & OBJ_KEY) ? arg : ast_channel_name((struct ast_channel *)arg); + size_t name_len = *(size_t *)data; + int ret = CMP_MATCH; + + if (ast_strlen_zero(name)) { + ast_log(LOG_ERROR, "BUG! Must supply a name, or a channel with a name to match on!\n"); + return CMP_STOP; + } + + ast_channel_lock(chan); + if (!name_len && (strcasecmp(ast_channel_name(chan), name) || (name_len && strncasecmp(ast_channel_name(chan), name, name_len)))) { + ret = 0; /* name match failed, keep looking */ + } + ast_channel_unlock(chan); + + return ret; +} + +static int ast_channel_by_exten_cb(void *obj, void *arg, void *data, int flags) +{ + struct ast_channel *chan = obj; + char *context = arg, *exten = data; + int ret = CMP_MATCH; + + if (ast_strlen_zero(exten) || ast_strlen_zero(context)) { + ast_log(LOG_ERROR, "BUG! Must have a context and extension to match!\n"); + return CMP_STOP; + } + + ast_channel_lock(chan); + if (strcasecmp(chan->context, context) && strcasecmp(chan->macrocontext, context)) { + ret = 0; /* Context match failed, continue */ + } else if (strcasecmp(chan->exten, exten) && strcasecmp(chan->macroexten, exten)) { + ret = 0; /* Extension match failed, continue */ + } + ast_channel_unlock(chan); + + return ret; +} + +static int ast_channel_by_uniqueid_cb(void *obj, void *arg, void *data, int flags) +{ + struct ast_channel *chan = obj; + char *uniqueid = arg; + size_t name_len = *(size_t *) data; + int ret = CMP_MATCH; + + if (ast_strlen_zero(uniqueid)) { + ast_log(LOG_ERROR, "BUG! Must have a uniqueid to match!\n"); + return CMP_STOP; + } + + ast_channel_lock(chan); + if (!name_len && (strcasecmp(chan->uniqueid, uniqueid) || + (name_len && strncasecmp(chan->uniqueid, uniqueid, name_len)))) { + ret = 0; + } + ast_channel_unlock(chan); + + return ret; +} + struct ast_channel_iterator { /* storage for non-dynamically allocated iterator */ struct ao2_iterator simple_iterator; @@ -1645,30 +1504,18 @@ static struct ast_channel_iterator *channel_iterator_search(const char *name, const char *context) { struct ast_channel_iterator *i; - struct ast_channel tmp_chan = { - .name = name, - /* This is sort of a hack. Basically, we're using an arbitrary field - * in ast_channel to pass the name_len for a prefix match. If this - * gets changed, then the compare callback must be changed, too. */ - .rings = name_len, - }; if (!(i = ast_calloc(1, sizeof(*i)))) { return NULL; } - if (exten) { - ast_copy_string(tmp_chan.exten, exten, sizeof(tmp_chan.exten)); - } - - if (context) { - ast_copy_string(tmp_chan.context, context, sizeof(tmp_chan.context)); - } - - if (!(i->active_iterator = ao2_find(channels, &tmp_chan, - OBJ_MULTIPLE | ((!ast_strlen_zero(name) && (name_len == 0)) ? OBJ_POINTER : 0)))) { - ast_free(i); - return NULL; + if (ast_strlen_zero(name) && !(i->active_iterator = (void *) ast_channel_callback(ast_channel_by_exten_cb, (void *) context, (void *) exten, OBJ_MULTIPLE))) { + ast_free(i); + return NULL; + } else if (!(i->active_iterator = (void *) ast_channel_callback(ast_channel_by_name_cb, (void *) name, &name_len, + OBJ_MULTIPLE | (name_len == 0 /* match the whole word, so optimize */ ? OBJ_KEY : 0)))) { + ast_free(i); + return NULL; } return i; @@ -1703,9 +1550,10 @@ struct ast_channel *ast_channel_iterator_next(struct ast_channel_iterator *i) return ao2_iterator_next(i->active_iterator); } +/* Legacy function, not currently used for lookups, but we need a cmp_fn */ static int ast_channel_cmp_cb(void *obj, void *arg, int flags) { - struct ast_channel *chan = obj, *cmp_args = arg; + struct ast_channel *cmp_args = arg; size_t name_len; int ret = CMP_MATCH; @@ -1714,76 +1562,39 @@ static int ast_channel_cmp_cb(void *obj, void *arg, int flags) * gets changed, then the uses of ao2_find() must be changed, too. */ name_len = cmp_args->rings; - ast_channel_lock(chan); - - if (!ast_strlen_zero(cmp_args->name)) { /* match by name */ - if ((!name_len && strcasecmp(chan->name, cmp_args->name)) || - (name_len && strncasecmp(chan->name, cmp_args->name, name_len))) { - ret = 0; /* name match failed */ - } + if (!ast_strlen_zero(ast_channel_name(cmp_args))) { /* match by name */ + ret = ast_channel_by_name_cb(obj, arg, &name_len, flags); } else if (!ast_strlen_zero(cmp_args->exten)) { - if (cmp_args->context && strcasecmp(chan->context, cmp_args->context) && - strcasecmp(chan->macrocontext, cmp_args->context)) { - ret = 0; /* context match failed */ - } - if (ret && strcasecmp(chan->exten, cmp_args->exten) && - strcasecmp(chan->macroexten, cmp_args->exten)) { - ret = 0; /* exten match failed */ - } + ret = ast_channel_by_exten_cb(obj, cmp_args->context, cmp_args->exten, flags); } else if (!ast_strlen_zero(cmp_args->uniqueid)) { - if ((!name_len && strcasecmp(chan->uniqueid, cmp_args->uniqueid)) || - (name_len && strncasecmp(chan->uniqueid, cmp_args->uniqueid, name_len))) { - ret = 0; /* uniqueid match failed */ - } + ret = ast_channel_by_uniqueid_cb(obj, (void *) cmp_args->uniqueid, &name_len, flags); } else { ret = 0; } - ast_channel_unlock(chan); - return ret; } static struct ast_channel *ast_channel_get_full(const char *name, size_t name_len, const char *exten, const char *context) { - struct ast_channel tmp_chan = { - .name = name, - /* This is sort of a hack. Basically, we're using an arbitrary field - * in ast_channel to pass the name_len for a prefix match. If this - * gets changed, then the compare callback must be changed, too. */ - .rings = name_len, - }; struct ast_channel *chan; - if (exten) { - ast_copy_string(tmp_chan.exten, exten, sizeof(tmp_chan.exten)); - } - - if (context) { - ast_copy_string(tmp_chan.context, context, sizeof(tmp_chan.context)); - } - - if ((chan = ao2_find(channels, &tmp_chan, - (!ast_strlen_zero(name) && (name_len == 0)) ? OBJ_POINTER : 0))) { + if (ast_strlen_zero(name) && (chan = ast_channel_callback(ast_channel_by_exten_cb, (void *) context, (void *) exten, 0))) { + return chan; + } else if ((chan = ast_channel_callback(ast_channel_by_name_cb, (void *) name, &name_len, + (name_len == 0) /* optimize if it is a complete name match */ ? OBJ_KEY : 0))) { return chan; } + /* If we haven't found by name or context yet and don't have a name, give up. */ if (!name) { return NULL; } /* If name was specified, but the result was NULL, * try a search on uniqueid, instead. */ - - { - struct ast_channel tmp_chan2 = { - .uniqueid = name, - .rings = name_len, - }; - - return ao2_find(channels, &tmp_chan2, 0); - } + return ast_channel_callback(ast_channel_by_uniqueid_cb, (void *) name, &name_len, 0); } struct ast_channel *ast_channel_get_by_name(const char *name) @@ -2392,7 +2203,7 @@ static void ast_channel_destructor(void *obj) struct ast_datastore *datastore; char device_name[AST_CHANNEL_NAME]; - if (chan->name) { + if (ast_channel_name(chan)) { /* The string fields were initialized. */ ast_cel_report_event(chan, AST_CEL_CHANNEL_END, NULL, NULL, NULL); ast_cel_check_retire_linkedid(chan); @@ -2411,7 +2222,7 @@ static void ast_channel_destructor(void *obj) ast_channel_unlock(chan); if (chan->tech_pvt) { - ast_log(LOG_WARNING, "Channel '%s' may not have been hung up properly\n", chan->name); + ast_log(LOG_WARNING, "Channel '%s' may not have been hung up properly\n", ast_channel_name(chan)); ast_free(chan->tech_pvt); } @@ -2419,11 +2230,11 @@ static void ast_channel_destructor(void *obj) ast_sched_context_destroy(chan->sched); } - if (chan->name) { + if (ast_channel_name(chan)) { char *dashptr; /* The string fields were initialized. */ - ast_copy_string(device_name, chan->name, sizeof(device_name)); + ast_copy_string(device_name, ast_channel_name(chan), sizeof(device_name)); if ((dashptr = strrchr(device_name, '-'))) { *dashptr = '\0'; } @@ -2445,7 +2256,7 @@ static void ast_channel_destructor(void *obj) if (chan->writetrans) ast_translator_free_path(chan->writetrans); if (chan->pbx) - ast_log(LOG_WARNING, "PBX may not have been terminated properly on '%s'\n", chan->name); + ast_log(LOG_WARNING, "PBX may not have been terminated properly on '%s'\n", ast_channel_name(chan)); ast_party_dialed_free(&chan->dialed); ast_party_caller_free(&chan->caller); @@ -2705,7 +2516,7 @@ void ast_channel_clear_softhangup(struct ast_channel *chan, int flag) /*! \brief Softly hangup a channel, don't lock */ int ast_softhangup_nolock(struct ast_channel *chan, int cause) { - ast_debug(1, "Soft-Hanging up channel '%s'\n", chan->name); + ast_debug(1, "Soft-Hanging up channel '%s'\n", ast_channel_name(chan)); /* Inform channel driver that we need to be hung up, if it cares */ chan->_softhangup |= cause; ast_queue_frame(chan, &ast_null_frame); @@ -2726,7 +2537,7 @@ int ast_softhangup(struct ast_channel *chan, int cause) "Channel: %s\r\n" "Uniqueid: %s\r\n" "Cause: %d\r\n", - chan->name, + ast_channel_name(chan), chan->uniqueid, cause); ast_channel_unlock(chan); @@ -2855,11 +2666,11 @@ int ast_hangup(struct ast_channel *chan) if (ast_test_flag(chan, AST_FLAG_BLOCKING)) { ast_log(LOG_WARNING, "Hard hangup called by thread %ld on %s, while fd " "is blocked by thread %ld in procedure %s! Expect a failure\n", - (long) pthread_self(), chan->name, (long)chan->blocker, chan->blockproc); + (long) pthread_self(), ast_channel_name(chan), (long)chan->blocker, chan->blockproc); ast_assert(ast_test_flag(chan, AST_FLAG_BLOCKING) == 0); } if (!ast_test_flag(chan, AST_FLAG_ZOMBIE)) { - ast_debug(1, "Hanging up channel '%s'\n", chan->name); + ast_debug(1, "Hanging up channel '%s'\n", ast_channel_name(chan)); /* * This channel is now dead so mark it as a zombie so anyone @@ -2870,7 +2681,7 @@ int ast_hangup(struct ast_channel *chan) chan->tech->hangup(chan); } } else { - ast_debug(1, "Hanging up zombie '%s'\n", chan->name); + ast_debug(1, "Hanging up zombie '%s'\n", ast_channel_name(chan)); } ast_channel_unlock(chan); @@ -2885,7 +2696,7 @@ int ast_hangup(struct ast_channel *chan) "ConnectedLineName: %s\r\n" "Cause: %d\r\n" "Cause-txt: %s\r\n", - chan->name, + ast_channel_name(chan), chan->uniqueid, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "<unknown>"), S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, "<unknown>"), @@ -2989,12 +2800,12 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay, int cdr_answer) for (;;) { ms = ast_waitfor(chan, ms); if (ms < 0) { - ast_log(LOG_WARNING, "Error condition occurred when polling channel %s for a voice frame: %s\n", chan->name, strerror(errno)); + ast_log(LOG_WARNING, "Error condition occurred when polling channel %s for a voice frame: %s\n", ast_channel_name(chan), strerror(errno)); res = -1; break; } if (ms == 0) { - ast_debug(2, "Didn't receive a media frame from %s within %d ms of answering. Continuing anyway\n", chan->name, MAX(delay, 500)); + ast_debug(2, "Didn't receive a media frame from %s within %d ms of answering. Continuing anyway\n", ast_channel_name(chan), MAX(delay, 500)); break; } cur = ast_read(chan); @@ -3004,7 +2815,7 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay, int cdr_answer) ast_frfree(cur); } res = -1; - ast_debug(2, "Hangup of channel %s detected in answer routine\n", chan->name); + ast_debug(2, "Hangup of channel %s detected in answer routine\n", ast_channel_name(chan)); break; } @@ -3324,7 +3135,7 @@ static struct ast_channel *ast_waitfor_nandfds_simple(struct ast_channel *chan, /* See if this channel needs to be masqueraded */ if (chan->masq && ast_do_masquerade(chan)) { - ast_log(LOG_WARNING, "Failed to perform masquerade on %s\n", chan->name); + ast_log(LOG_WARNING, "Failed to perform masquerade on %s\n", ast_channel_name(chan)); *ms = -1; return NULL; } @@ -3654,7 +3465,7 @@ static void send_dtmf_event(struct ast_channel *chan, const char *direction, con "Direction: %s\r\n" "Begin: %s\r\n" "End: %s\r\n", - chan->name, chan->uniqueid, digit, direction, begin, end); + ast_channel_name(chan), chan->uniqueid, digit, direction, begin, end); } static void ast_read_generator_actions(struct ast_channel *chan, struct ast_frame *f) @@ -3821,7 +3632,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) if (chan->fdno == -1) { ast_log(LOG_ERROR, "ast_read() on chan '%s' called with no recorded file descriptor.\n", - chan->name); + ast_channel_name(chan)); } #endif } @@ -3835,7 +3646,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) /* For some odd reason, the alertpipe occasionally loses nonblocking status, * which immediately causes a deadlock scenario. Detect and prevent this. */ if ((flags & O_NONBLOCK) == 0) { - ast_log(LOG_ERROR, "Alertpipe on channel %s lost O_NONBLOCK?!!\n", chan->name); + ast_log(LOG_ERROR, "Alertpipe on channel %s lost O_NONBLOCK?!!\n", ast_channel_name(chan)); if (fcntl(chan->alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) { ast_log(LOG_WARNING, "Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno)); f = &ast_null_frame; @@ -3951,7 +3762,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) if (chan->tech->exception) f = chan->tech->exception(chan); else { - ast_log(LOG_WARNING, "Exception flag set on '%s', but no exception handler\n", chan->name); + ast_log(LOG_WARNING, "Exception flag set on '%s', but no exception handler\n", ast_channel_name(chan)); f = &ast_null_frame; } /* Clear the exception flag */ @@ -3959,7 +3770,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) } else if (chan->tech && chan->tech->read) f = chan->tech->read(chan); else - ast_log(LOG_WARNING, "No read routine on channel %s\n", chan->name); + ast_log(LOG_WARNING, "No read routine on channel %s\n", ast_channel_name(chan)); } /* Perform the framehook read event here. After the frame enters the framehook list @@ -4028,7 +3839,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) break; case AST_FRAME_DTMF_END: send_dtmf_event(chan, "Received", f->subclass.integer, "No", "Yes"); - ast_log(LOG_DTMF, "DTMF end '%c' received on %s, duration %ld ms\n", f->subclass.integer, chan->name, f->len); + ast_log(LOG_DTMF, "DTMF end '%c' received on %s, duration %ld ms\n", f->subclass.integer, ast_channel_name(chan), f->len); /* Queue it up if DTMF is deferred, or if DTMF emulation is forced. */ if (ast_test_flag(chan, AST_FLAG_DEFER_DTMF) || ast_test_flag(chan, AST_FLAG_EMULATE_DTMF)) { queue_dtmf_readq(chan, f); @@ -4054,7 +3865,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) chan->emulate_dtmf_duration = AST_MIN_DTMF_DURATION; } else chan->emulate_dtmf_duration = AST_DEFAULT_EMULATE_DTMF_DURATION; - ast_log(LOG_DTMF, "DTMF begin emulation of '%c' with duration %u queued on %s\n", f->subclass.integer, chan->emulate_dtmf_duration, chan->name); + ast_log(LOG_DTMF, "DTMF begin emulation of '%c' with duration %u queued on %s\n", f->subclass.integer, chan->emulate_dtmf_duration, ast_channel_name(chan)); } if (chan->audiohooks) { struct ast_frame *old_frame = f; @@ -4068,7 +3879,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) } else { struct timeval now = ast_tvnow(); if (ast_test_flag(chan, AST_FLAG_IN_DTMF)) { - ast_log(LOG_DTMF, "DTMF end accepted with begin '%c' on %s\n", f->subclass.integer, chan->name); + ast_log(LOG_DTMF, "DTMF end accepted with begin '%c' on %s\n", f->subclass.integer, ast_channel_name(chan)); ast_clear_flag(chan, AST_FLAG_IN_DTMF); if (!f->len) f->len = ast_tvdiff_ms(now, chan->dtmf_tv); @@ -4083,21 +3894,21 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) */ if (ast_tvdiff_ms(now, chan->dtmf_tv) < AST_MIN_DTMF_DURATION) { f->len = ast_tvdiff_ms(now, chan->dtmf_tv); - ast_log(LOG_DTMF, "DTMF end '%c' detected to have actual duration %ld on the wire, emulation will be triggered on %s\n", f->subclass.integer, f->len, chan->name); + ast_log(LOG_DTMF, "DTMF end '%c' detected to have actual duration %ld on the wire, emulation will be triggered on %s\n", f->subclass.integer, f->len, ast_channel_name(chan)); } } else if (!f->len) { - ast_log(LOG_DTMF, "DTMF end accepted without begin '%c' on %s\n", f->subclass.integer, chan->name); + ast_log(LOG_DTMF, "DTMF end accepted without begin '%c' on %s\n", f->subclass.integer, ast_channel_name(chan)); f->len = AST_MIN_DTMF_DURATION; } if (f->len < AST_MIN_DTMF_DURATION && !ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY)) { - ast_log(LOG_DTMF, "DTMF end '%c' has duration %ld but want minimum %d, emulating on %s\n", f->subclass.integer, f->len, AST_MIN_DTMF_DURATION, chan->name); + ast_log(LOG_DTMF, "DTMF end '%c' has duration %ld but want minimum %d, emulating on %s\n", f->subclass.integer, f->len, AST_MIN_DTMF_DURATION, ast_channel_name(chan)); ast_set_flag(chan, AST_FLAG_EMULATE_DTMF); chan->emulate_dtmf_digit = f->subclass.integer; chan->emulate_dtmf_duration = AST_MIN_DTMF_DURATION - f->len; ast_frfree(f); f = &ast_null_frame; } else { - ast_log(LOG_DTMF, "DTMF end passthrough '%c' on %s\n", f->subclass.integer, chan->name); + ast_log(LOG_DTMF, "DTMF end passthrough '%c' on %s\n", f->subclass.integer, ast_channel_name(chan)); if (f->len < AST_MIN_DTMF_DURATION) { f->len = AST_MIN_DTMF_DURATION; } @@ -4113,17 +3924,17 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) break; case AST_FRAME_DTMF_BEGIN: send_dtmf_event(chan, "Received", f->subclass.integer, "Yes", "No"); - ast_log(LOG_DTMF, "DTMF begin '%c' received on %s\n", f->subclass.integer, chan->name); + ast_log(LOG_DTMF, "DTMF begin '%c' received on %s\n", f->subclass.integer, ast_channel_name(chan)); if ( ast_test_flag(chan, AST_FLAG_DEFER_DTMF | AST_FLAG_END_DTMF_ONLY | AST_FLAG_EMULATE_DTMF) || (!ast_tvzero(chan->dtmf_tv) && ast_tvdiff_ms(ast_tvnow(), chan->dtmf_tv) < AST_MIN_DTMF_GAP) ) { - ast_log(LOG_DTMF, "DTMF begin ignored '%c' on %s\n", f->subclass.integer, chan->name); + ast_log(LOG_DTMF, "DTMF begin ignored '%c' on %s\n", f->subclass.integer, ast_channel_name(chan)); ast_frfree(f); f = &ast_null_frame; } else { ast_set_flag(chan, AST_FLAG_IN_DTMF); chan->dtmf_tv = ast_tvnow(); - ast_log(LOG_DTMF, "DTMF begin passthrough '%c' on %s\n", f->subclass.integer, chan->name); + ast_log(LOG_DTMF, "DTMF begin passthrough '%c' on %s\n", f->subclass.integer, ast_channel_name(chan)); } break; case AST_FRAME_NULL: @@ -4146,7 +3957,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) chan->dtmf_tv = now; ast_clear_flag(chan, AST_FLAG_EMULATE_DTMF); chan->emulate_dtmf_digit = 0; - ast_log(LOG_DTMF, "DTMF end emulation of '%c' queued on %s\n", f->subclass.integer, chan->name); + ast_log(LOG_DTMF, "DTMF end emulation of '%c' queued on %s\n", f->subclass.integer, ast_channel_name(chan)); if (chan->audiohooks) { struct ast_frame *old_frame = f; f = ast_audiohook_write_list(chan, chan->audiohooks, AST_AUDIOHOOK_DIRECTION_READ, f); @@ -4190,7 +4001,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) if (old_frame != f) ast_frfree(old_frame); } - ast_log(LOG_DTMF, "DTMF end emulation of '%c' queued on %s\n", f->subclass.integer, chan->name); + ast_log(LOG_DTMF, "DTMF end emulation of '%c' queued on %s\n", f->subclass.integer, ast_channel_name(chan)); } else { /* Drop voice frames while we're still in the middle of the digit */ ast_frfree(f); @@ -4200,7 +4011,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) /* This frame is not one of the current native formats -- drop it on the floor */ char to[200]; ast_log(LOG_NOTICE, "Dropping incompatible voice frame on %s of format %s since our native format has changed to %s\n", - chan->name, ast_getformatname(&f->subclass.format), ast_getformatname_multiple(to, sizeof(to), chan->nativeformats)); + ast_channel_name(chan), ast_getformatname(&f->subclass.format), ast_getformatname_multiple(to, sizeof(to), chan->nativeformats)); ast_frfree(f); f = &ast_null_frame; } else if ((f->frametype == AST_FRAME_VOICE)) { @@ -4281,7 +4092,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) /* High bit prints debugging */ if (chan->fin & DEBUGCHAN_FLAG) - ast_frame_dump(chan->name, f, "<<"); + ast_frame_dump(ast_channel_name(chan), f, "<<"); chan->fin = FRAMECOUNT_INC(chan->fin); done: @@ -4544,14 +4355,14 @@ int ast_indicate_data(struct ast_channel *chan, int _condition, if (ts) { /* We have a tone to play, yay. */ - ast_debug(1, "Driver for channel '%s' does not support indication %d, emulating it\n", chan->name, condition); + ast_debug(1, "Driver for channel '%s' does not support indication %d, emulating it\n", ast_channel_name(chan), condition); res = ast_playtones_start(chan, 0, ts->data, 1); ts = ast_tone_zone_sound_unref(ts); } if (res) { /* not handled */ - ast_log(LOG_WARNING, "Unable to handle indication %d for '%s'\n", condition, chan->name); + ast_log(LOG_WARNING, "Unable to handle indication %d for '%s'\n", condition, ast_channel_name(chan)); } indicate_cleanup: @@ -4678,7 +4489,7 @@ int ast_senddigit_begin(struct ast_channel *chan, char digit) ast_playtones_start(chan, 0, dtmf_tones[15], 0); else { /* not handled */ - ast_debug(1, "Unable to generate DTMF tone '%c' for '%s'\n", digit, chan->name); + ast_debug(1, "Unable to generate DTMF tone '%c' for '%s'\n", digit, ast_channel_name(chan)); } return 0; @@ -4714,12 +4525,12 @@ int ast_prod(struct ast_channel *chan) /* Send an empty audio frame to get things moving */ if (chan->_state != AST_STATE_UP) { - ast_debug(1, "Prodding channel '%s'\n", chan->name); + ast_debug(1, "Prodding channel '%s'\n", ast_channel_name(chan)); ast_format_copy(&a.subclass.format, &chan->rawwriteformat); a.data.ptr = nothing + AST_FRIENDLY_OFFSET; a.src = "ast_prod"; /* this better match check in ast_write */ if (ast_write(chan, &a)) - ast_log(LOG_WARNING, "Prodding channel '%s' failed\n", chan->name); + ast_log(LOG_WARNING, "Prodding channel '%s' failed\n", ast_channel_name(chan)); } return 0; } @@ -4849,7 +4660,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr) while(ast_channel_trylock(chan)) { /*cannot goto done since the channel is not locked*/ if(count++ > 10) { - ast_debug(1, "Deadlock avoided for write to channel '%s'\n", chan->name); + ast_debug(1, "Deadlock avoided for write to channel '%s'\n", ast_channel_name(chan)); return 0; } usleep(1); @@ -4903,7 +4714,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr) } /* High bit prints debugging */ if (chan->fout & DEBUGCHAN_FLAG) - ast_frame_dump(chan->name, fr, ">>"); + ast_frame_dump(ast_channel_name(chan), fr, ">>"); CHECK_BLOCKING(chan); switch (fr->frametype) { case AST_FRAME_CONTROL: @@ -4984,7 +4795,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr) (ast_format_cmp(&chan->writeformat, &fr->subclass.format) != AST_FORMAT_CMP_EQUAL)) { char nf[512]; ast_log(LOG_WARNING, "Codec mismatch on channel %s setting write format to %s from %s native formats %s\n", - chan->name, ast_getformatname(&fr->subclass.format), ast_getformatname(&chan->writeformat), + ast_channel_name(chan), ast_getformatname(&fr->subclass.format), ast_getformatname(&chan->writeformat), ast_getformatname_multiple(nf, sizeof(nf), chan->nativeformats)); ast_set_write_format_by_id(chan, fr->subclass.format.id); } @@ -5160,7 +4971,7 @@ static int set_format(struct ast_channel *chan, /* See if the underlying channel driver is capable of performing transcoding for us */ if (!ast_channel_setoption(chan, direction ? AST_OPTION_FORMAT_WRITE : AST_OPTION_FORMAT_READ, &best_set_fmt, sizeof(best_set_fmt), 0)) { - ast_debug(1, "Channel driver natively set channel %s to %s format %s\n", chan->name, + ast_debug(1, "Channel driver natively set channel %s to %s format %s\n", ast_channel_name(chan), direction ? "write" : "read", ast_getformatname(&best_set_fmt)); ast_channel_lock(chan); @@ -5239,7 +5050,7 @@ static int set_format(struct ast_channel *chan, ast_channel_unlock(chan); ast_debug(1, "Set channel %s to %s format %s\n", - chan->name, + ast_channel_name(chan), direction ? "write" : "read", ast_getformatname(&best_set_fmt)); @@ -5989,7 +5800,7 @@ static int ast_channel_make_compatible_helper(struct ast_channel *from, struct a return 0; if (ast_translator_best_choice(dst_cap, src_cap, &best_src_fmt, &best_dst_fmt) < 0) { - ast_log(LOG_WARNING, "No path to translate from %s to %s\n", from->name, to->name); + ast_log(LOG_WARNING, "No path to translate from %s to %s\n", ast_channel_name(from), ast_channel_name(to)); return -1; } @@ -6012,11 +5823,11 @@ static int ast_channel_make_compatible_helper(struct ast_channel *from, struct a } if (ast_set_read_format(from, &best_dst_fmt) < 0) { - ast_log(LOG_WARNING, "Unable to set read format on channel %s to %s\n", from->name, ast_getformatname(&best_dst_fmt)); + ast_log(LOG_WARNING, "Unable to set read format on channel %s to %s\n", ast_channel_name(from), ast_getformatname(&best_dst_fmt)); return -1; } if (ast_set_write_format(to, &best_dst_fmt) < 0) { - ast_log(LOG_WARNING, "Unable to set write format on channel %s to %s\n", to->name, ast_getformatname(&best_dst_fmt)); + ast_log(LOG_WARNING, "Unable to set write format on channel %s to %s\n", ast_channel_name(to), ast_getformatname(&best_dst_fmt)); return -1; } return 0; @@ -6055,7 +5866,7 @@ static int __ast_channel_masquerade(struct ast_channel *original, struct ast_cha /* Zombies! Run! */ ast_log(LOG_WARNING, "Can't setup masquerade. One or both channels is dead. (%s <-- %s)\n", - original->name, clonechan->name); + ast_channel_name(original), ast_channel_name(clonechan)); ast_channel_unlock(clonechan); ast_channel_unlock(original); return -1; @@ -6112,7 +5923,7 @@ static int __ast_channel_masquerade(struct ast_channel *original, struct ast_cha /* Zombies! Run! */ ast_log(LOG_WARNING, "Can't setup masquerade. One or both channels is dead. (%s <-- %s)\n", - original->name, clonechan->name); + ast_channel_name(original), ast_channel_name(clonechan)); ast_channel_unlock(clonechan); ast_channel_unlock(original); return -1; @@ -6122,14 +5933,14 @@ static int __ast_channel_masquerade(struct ast_channel *original, struct ast_cha } if (original == clonechan) { - ast_log(LOG_WARNING, "Can't masquerade channel '%s' into itself!\n", original->name); + ast_log(LOG_WARNING, "Can't masquerade channel '%s' into itself!\n", ast_channel_name(original)); ast_channel_unlock(clonechan); ast_channel_unlock(original); return -1; } ast_debug(1, "Planning to masquerade channel %s into the structure of %s\n", - clonechan->name, original->name); + ast_channel_name(clonechan), ast_channel_name(original)); if (!original->masqr && !original->masq && !clonechan->masq && !clonechan->masqr) { original->masq = clonechan; @@ -6139,21 +5950,21 @@ static int __ast_channel_masquerade(struct ast_channel *original, struct ast_cha } ast_queue_frame(original, &ast_null_frame); ast_queue_frame(clonechan, &ast_null_frame); - ast_debug(1, "Done planning to masquerade channel %s into the structure of %s\n", clonechan->name, original->name); + ast_debug(1, "Done planning to masquerade channel %s into the structure of %s\n", ast_channel_name(clonechan), ast_channel_name(original)); res = 0; } else if (original->masq) { ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n", - original->masq->name, original->name); + ast_channel_name(original->masq), ast_channel_name(original)); } else if (original->masqr) { /* not yet as a previously planned masq hasn't yet happened */ ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n", - original->name, original->masqr->name); + ast_channel_name(original), ast_channel_name(original->masqr)); } else if (clonechan->masq) { ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n", - clonechan->masq->name, clonechan->name); + ast_channel_name(clonechan->masq), ast_channel_name(clonechan)); } else { /* (clonechan->masqr) */ ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n", - clonechan->name, clonechan->masqr->name); + ast_channel_name(clonechan), ast_channel_name(clonechan->masqr)); } ast_channel_unlock(clonechan); @@ -6277,8 +6088,8 @@ int ast_channel_transfer_masquerade( */ static void __ast_change_name_nolink(struct ast_channel *chan, const char *newname) { - ast_manager_event(chan, EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", chan->name, newname, chan->uniqueid); - ast_string_field_set(chan, name, newname); + ast_manager_event(chan, EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", ast_channel_name(chan), newname, chan->uniqueid); + ast_channel_name_set(chan, newname); } void ast_change_name(struct ast_channel *chan, const char *newname) @@ -6483,32 +6294,32 @@ static void ast_set_owners_and_peers(struct ast_channel *chan1, { if (!ast_strlen_zero(chan1->accountcode) && ast_strlen_zero(chan2->peeraccount)) { ast_debug(1, "setting peeraccount to %s for %s from data on channel %s\n", - chan1->accountcode, chan2->name, chan1->name); + chan1->accountcode, ast_channel_name(chan2), ast_channel_name(chan1)); ast_string_field_set(chan2, peeraccount, chan1->accountcode); } if (!ast_strlen_zero(chan2->accountcode) && ast_strlen_zero(chan1->peeraccount)) { ast_debug(1, "setting peeraccount to %s for %s from data on channel %s\n", - chan2->accountcode, chan1->name, chan2->name); + chan2->accountcode, ast_channel_name(chan1), ast_channel_name(chan2)); ast_string_field_set(chan1, peeraccount, chan2->accountcode); } if (!ast_strlen_zero(chan1->peeraccount) && ast_strlen_zero(chan2->accountcode)) { ast_debug(1, "setting accountcode to %s for %s from data on channel %s\n", - chan1->peeraccount, chan2->name, chan1->name); + chan1->peeraccount, ast_channel_name(chan2), ast_channel_name(chan1)); ast_string_field_set(chan2, accountcode, chan1->peeraccount); } if (!ast_strlen_zero(chan2->peeraccount) && ast_strlen_zero(chan1->accountcode)) { ast_debug(1, "setting accountcode to %s for %s from data on channel %s\n", - chan2->peeraccount, chan1->name, chan2->name); + chan2->peeraccount, ast_channel_name(chan1), ast_channel_name(chan2)); ast_string_field_set(chan1, accountcode, chan2->peeraccount); } if (0 != strcmp(chan1->accountcode, chan2->peeraccount)) { ast_debug(1, "changing peeraccount from %s to %s on %s to match channel %s\n", - chan2->peeraccount, chan1->peeraccount, chan2->name, chan1->name); + chan2->peeraccount, chan1->peeraccount, ast_channel_name(chan2), ast_channel_name(chan1)); ast_string_field_set(chan2, peeraccount, chan1->accountcode); } if (0 != strcmp(chan2->accountcode, chan1->peeraccount)) { ast_debug(1, "changing peeraccount from %s to %s on %s to match channel %s\n", - chan1->peeraccount, chan2->peeraccount, chan1->name, chan2->name); + chan1->peeraccount, chan2->peeraccount, ast_channel_name(chan1), ast_channel_name(chan2)); ast_string_field_set(chan1, peeraccount, chan2->accountcode); } } @@ -6527,7 +6338,7 @@ static void report_new_callerid(struct ast_channel *chan) "CallerIDName: %s\r\n" "Uniqueid: %s\r\n" "CID-CallingPres: %d (%s)\r\n", - chan->name, + ast_channel_name(chan), S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""), S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, ""), chan->uniqueid, @@ -6703,7 +6514,7 @@ int ast_do_masquerade(struct ast_channel *original) ao2_unlink(channels, clonechan); ast_debug(4, "Actually Masquerading %s(%d) into the structure of %s(%d)\n", - clonechan->name, clonechan->_state, original->name, original->_state); + ast_channel_name(clonechan), clonechan->_state, ast_channel_name(original), original->_state); /* * Stop any visible indiction on the original channel so we can @@ -6719,7 +6530,7 @@ int ast_do_masquerade(struct ast_channel *original) "CloneState: %s\r\n" "Original: %s\r\n" "OriginalState: %s\r\n", - clonechan->name, ast_state2str(clonechan->_state), original->name, ast_state2str(original->_state)); + ast_channel_name(clonechan), ast_state2str(clonechan->_state), ast_channel_name(original), ast_state2str(original->_state)); /* Having remembered the original read/write formats, we turn off any translation on either one */ @@ -6727,9 +6538,9 @@ int ast_do_masquerade(struct ast_channel *original) free_translation(original); /* Save the original name */ - ast_copy_string(orig, original->name, sizeof(orig)); + ast_copy_string(orig, ast_channel_name(original), sizeof(orig)); /* Save the new name */ - ast_copy_string(newn, clonechan->name, sizeof(newn)); + ast_copy_string(newn, ast_channel_name(clonechan), sizeof(newn)); /* Create the masq name */ snprintf(masqn, sizeof(masqn), "%s<MASQ>", newn); @@ -6813,7 +6624,7 @@ int ast_do_masquerade(struct ast_channel *original) clonechan->_state = origstate; if (clonechan->tech->fixup && clonechan->tech->fixup(original, clonechan)) { - ast_log(LOG_WARNING, "Fixup failed on channel %s, strange things may happen.\n", clonechan->name); + ast_log(LOG_WARNING, "Fixup failed on channel %s, strange things may happen.\n", ast_channel_name(clonechan)); } /* Start by disconnecting the original's physical side */ @@ -6926,7 +6737,7 @@ int ast_do_masquerade(struct ast_channel *original) ast_cel_report_event(original, AST_CEL_BRIDGE_UPDATE, NULL, NULL, NULL); } - ast_debug(1, "Putting channel %s in %s/%s formats\n", original->name, + ast_debug(1, "Putting channel %s in %s/%s formats\n", ast_channel_name(original), ast_getformatname(&wformat), ast_getformatname(&rformat)); /* Okay. Last thing is to let the channel driver know about all this mess, so he @@ -6934,13 +6745,13 @@ int ast_do_masquerade(struct ast_channel *original) if (original->tech->fixup) { if (original->tech->fixup(clonechan, original)) { ast_log(LOG_WARNING, "Channel for type '%s' could not fixup channel %s\n", - original->tech->type, original->name); + original->tech->type, ast_channel_name(original)); res = -1; goto done; } } else ast_log(LOG_WARNING, "Channel type '%s' does not have a fixup routine (for %s)! Bad things may happen.\n", - original->tech->type, original->name); + original->tech->type, ast_channel_name(original)); /* * If an indication is currently playing, maintain it on the channel @@ -6958,21 +6769,21 @@ int ast_do_masquerade(struct ast_channel *original) a zombie so nothing tries to touch it. If it's already been marked as a zombie, then free it now (since it already is considered invalid). */ if (ast_test_flag(clonechan, AST_FLAG_ZOMBIE)) { - ast_debug(1, "Destroying channel clone '%s'\n", clonechan->name); + ast_debug(1, "Destroying channel clone '%s'\n", ast_channel_name(clonechan)); ast_channel_unlock(clonechan); ast_manager_event(clonechan, EVENT_FLAG_CALL, "Hangup", "Channel: %s\r\n" "Uniqueid: %s\r\n" "Cause: %d\r\n" "Cause-txt: %s\r\n", - clonechan->name, + ast_channel_name(clonechan), clonechan->uniqueid, clonechan->hangupcause, ast_cause2str(clonechan->hangupcause) ); clonechan = ast_channel_release(clonechan); } else { - ast_debug(1, "Released clone lock on '%s'\n", clonechan->name); + ast_debug(1, "Released clone lock on '%s'\n", ast_channel_name(clonechan)); ast_set_flag(clonechan, AST_FLAG_ZOMBIE); ast_queue_frame(clonechan, &ast_null_frame); } @@ -6980,7 +6791,7 @@ int ast_do_masquerade(struct ast_channel *original) /* Signal any blocker */ if (ast_test_flag(original, AST_FLAG_BLOCKING)) pthread_kill(original->blocker, SIGURG); - ast_debug(1, "Done Masquerading %s (%d)\n", original->name, original->_state); + ast_debug(1, "Done Masquerading %s (%d)\n", ast_channel_name(original), original->_state); if ((bridged = ast_bridged_channel(original))) { ast_channel_lock(bridged); @@ -7094,7 +6905,7 @@ int ast_setstate(struct ast_channel *chan, enum ast_channel_state state) if (oldstate == state) return 0; - ast_copy_string(name, chan->name, sizeof(name)); + ast_copy_string(name, ast_channel_name(chan), sizeof(name)); if ((dashptr = strrchr(name, '-'))) { *dashptr = '\0'; } @@ -7116,7 +6927,7 @@ int ast_setstate(struct ast_channel *chan, enum ast_channel_state state) "ConnectedLineNum: %s\r\n" "ConnectedLineName: %s\r\n" "Uniqueid: %s\r\n", - chan->name, chan->_state, ast_state2str(chan->_state), + ast_channel_name(chan), chan->_state, ast_state2str(chan->_state), S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""), S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, ""), S_COR(chan->connected.id.number.valid, chan->connected.id.number.str, ""), @@ -7283,7 +7094,7 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct if (!f) { *fo = NULL; *rc = who; - ast_debug(1, "Didn't get a frame from channel: %s\n", who->name); + ast_debug(1, "Didn't get a frame from channel: %s\n", ast_channel_name(who)); break; } @@ -7325,7 +7136,7 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct *fo = f; *rc = who; bridge_exit = 1; - ast_debug(1, "Got a FRAME_CONTROL (%d) frame on channel %s\n", f->subclass.integer, who->name); + ast_debug(1, "Got a FRAME_CONTROL (%d) frame on channel %s\n", f->subclass.integer, ast_channel_name(who)); break; } if (bridge_exit) @@ -7349,7 +7160,7 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct *rc = who; ast_debug(1, "Got DTMF %s on channel (%s)\n", f->frametype == AST_FRAME_DTMF_END ? "end" : "begin", - who->name); + ast_channel_name(who)); break; } @@ -7410,7 +7221,7 @@ static void manager_bridge_event(int onoff, int type, struct ast_channel *c0, st "CallerID2: %s\r\n", onoff ? "Link" : "Unlink", type == 1 ? "core" : "native", - c0->name, c1->name, + ast_channel_name(c0), ast_channel_name(c1), c0->uniqueid, c1->uniqueid, S_COR(c0->caller.id.number.valid, c0->caller.id.number.str, ""), S_COR(c1->caller.id.number.valid, c1->caller.id.number.str, "")); @@ -7424,7 +7235,7 @@ static void update_bridge_vars(struct ast_channel *c0, struct ast_channel *c1) const char *c1_pvtid = NULL; ast_channel_lock(c1); - c1_name = ast_strdupa(c1->name); + c1_name = ast_strdupa(ast_channel_name(c1)); if (c1->tech->get_pvt_uniqueid) { c1_pvtid = ast_strdupa(c1->tech->get_pvt_uniqueid(c1)); } @@ -7437,7 +7248,7 @@ static void update_bridge_vars(struct ast_channel *c0, struct ast_channel *c1) if (c1_pvtid) { pbx_builtin_setvar_helper(c0, "BRIDGEPVTCALLID", c1_pvtid); } - c0_name = ast_strdupa(c0->name); + c0_name = ast_strdupa(ast_channel_name(c0)); if (c0->tech->get_pvt_uniqueid) { c0_pvtid = ast_strdupa(c0->tech->get_pvt_uniqueid(c0)); } @@ -7495,12 +7306,12 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha if (c0->_bridge) { ast_log(LOG_WARNING, "%s is already in a bridge with %s\n", - c0->name, c0->_bridge->name); + ast_channel_name(c0), ast_channel_name(c0->_bridge)); return -1; } if (c1->_bridge) { ast_log(LOG_WARNING, "%s is already in a bridge with %s\n", - c1->name, c1->_bridge->name); + ast_channel_name(c1), ast_channel_name(c1->_bridge)); return -1; } @@ -7640,7 +7451,7 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha *fo = NULL; res = 0; ast_debug(1, "Bridge stops because we're zombie or need a soft hangup: c0=%s, c1=%s, flags: %s,%s,%s,%s\n", - c0->name, c1->name, + ast_channel_name(c0), ast_channel_name(c1), ast_test_flag(c0, AST_FLAG_ZOMBIE) ? "Yes" : "No", ast_check_hangup(c0) ? "Yes" : "No", ast_test_flag(c1, AST_FLAG_ZOMBIE) ? "Yes" : "No", @@ -7666,7 +7477,7 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha ast_set_flag(c1, AST_FLAG_NBRIDGE); if ((res = c0->tech->bridge(c0, c1, config->flags, fo, rc, timeoutms)) == AST_BRIDGE_COMPLETE) { manager_bridge_event(0, 1, c0, c1); - ast_debug(1, "Returning from native bridge, channels: %s, %s\n", c0->name, c1->name); + ast_debug(1, "Returning from native bridge, channels: %s, %s\n", ast_channel_name(c0), ast_channel_name(c1)); ast_clear_flag(c0, AST_FLAG_NBRIDGE); ast_clear_flag(c1, AST_FLAG_NBRIDGE); @@ -7691,7 +7502,7 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha } continue; default: - ast_verb(3, "Native bridging %s and %s ended\n", c0->name, c1->name); + ast_verb(3, "Native bridging %s and %s ended\n", ast_channel_name(c0), ast_channel_name(c1)); /* fallthrough */ case AST_BRIDGE_FAILED_NOWARN: break; @@ -7704,7 +7515,7 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha !ast_format_cap_identical(c1->nativeformats, o1nativeformats)) && !(c0->generator || c1->generator)) { if (ast_channel_make_compatible(c0, c1)) { - ast_log(LOG_WARNING, "Can't make %s and %s compatible\n", c0->name, c1->name); + ast_log(LOG_WARNING, "Can't make %s and %s compatible\n", ast_channel_name(c0), ast_channel_name(c1)); manager_bridge_event(0, 1, c0, c1); ast_format_cap_destroy(o0nativeformats); ast_format_cap_destroy(o1nativeformats); @@ -7737,7 +7548,7 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha c1->_bridge = NULL; manager_bridge_event(0, 1, c0, c1); - ast_debug(1, "Bridge stops bridging channels %s and %s\n", c0->name, c1->name); + ast_debug(1, "Bridge stops bridging channels %s and %s\n", ast_channel_name(c0), ast_channel_name(c1)); ast_format_cap_destroy(o0nativeformats); ast_format_cap_destroy(o1nativeformats); @@ -7828,7 +7639,7 @@ static void *tonepair_alloc(struct ast_channel *chan, void *params) return NULL; ast_format_copy(&ts->origwfmt, &chan->writeformat); if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR)) { - ast_log(LOG_WARNING, "Unable to set '%s' to signed linear format (write)\n", chan->name); + ast_log(LOG_WARNING, "Unable to set '%s' to signed linear format (write)\n", ast_channel_name(chan)); tonepair_release(NULL, ts); ts = NULL; } else { @@ -8015,15 +7826,15 @@ void ast_moh_cleanup(struct ast_channel *chan) static int ast_channel_hash_cb(const void *obj, const int flags) { - const struct ast_channel *chan = obj; + const char *name = (flags & OBJ_KEY) ? obj : ast_channel_name((struct ast_channel *) obj); /* If the name isn't set, return 0 so that the ao2_find() search will * start in the first bucket. */ - if (ast_strlen_zero(chan->name)) { + if (ast_strlen_zero(name)) { return 0; } - return ast_str_case_hash(chan->name); + return ast_str_case_hash(name); } int ast_plc_reload(void) @@ -8064,7 +7875,7 @@ static int data_channels_provider_handler(const struct ast_data_search *search, } if (ast_channel_data_add_structure(data_channel, c, 1) < 0) { - ast_log(LOG_ERROR, "Unable to add channel structure for channel: %s\n", c->name); + ast_log(LOG_ERROR, "Unable to add channel structure for channel: %s\n", ast_channel_name(c)); } ast_channel_unlock(c); @@ -8265,7 +8076,7 @@ struct ast_silence_generator *ast_channel_start_silence_generator(struct ast_cha ast_activate_generator(chan, &silence_generator, state); - ast_debug(1, "Started silence generator on '%s'\n", chan->name); + ast_debug(1, "Started silence generator on '%s'\n", ast_channel_name(chan)); return state; } @@ -8277,7 +8088,7 @@ void ast_channel_stop_silence_generator(struct ast_channel *chan, struct ast_sil ast_deactivate_generator(chan); - ast_debug(1, "Stopped silence generator on '%s'\n", chan->name); + ast_debug(1, "Stopped silence generator on '%s'\n", ast_channel_name(chan)); if (ast_set_write_format(chan, &state->old_write_format) < 0) ast_log(LOG_ERROR, "Could not return write format to its original state\n"); @@ -9689,7 +9500,7 @@ int ast_channel_get_device_name(struct ast_channel *chan, char *device_name, siz } /* Dang. Do it the old-fashioned way */ - ast_copy_string(device_name, chan->name, name_buffer_length); + ast_copy_string(device_name, ast_channel_name(chan), name_buffer_length); if ((dash = strrchr(device_name, '-'))) { *dash = '\0'; } @@ -9706,7 +9517,7 @@ int ast_channel_get_cc_agent_type(struct ast_channel *chan, char *agent_type, si return 0; } - ast_copy_string(agent_type, chan->name, size); + ast_copy_string(agent_type, ast_channel_name(chan), size); if ((slash = strchr(agent_type, '/'))) { *slash = '\0'; } diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c new file mode 100644 index 000000000..0e624dfb3 --- /dev/null +++ b/main/channel_internal_api.c @@ -0,0 +1,261 @@ +/* + * Asterisk -- An open source telephony toolkit. + * + * Copyright (C) 2012, Digium, Inc. + * + * Mark Spencer <markster@digium.com> + * + * See http://www.asterisk.org for more information about + * the Asterisk project. Please do not directly contact + * any of the maintainers of this project for assistance; + * the project provides a web site, mailing lists and IRC + * channels for your use. + * + * This program is free software, distributed under the terms of + * the GNU General Public License Version 2. See the LICENSE file + * at the top of the source tree. + */ + +/*! \file + * + * \brief Channel Accessor API + * + * This file is intended to be the only file that ever accesses the + * internals of an ast_channel. All other files should use the + * accessor functions defined here. + * + * \author Terry Wilson + */ + +#include "asterisk.h" + +ASTERISK_FILE_VERSION(__FILE__, "$Revision$") + +#include "asterisk/channel.h" +#include "asterisk/stringfields.h" +#include "asterisk/data.h" +#include "asterisk/indications.h" + +/* AST_DATA definitions, which will probably have to be re-thought since the channel will be opaque */ + +#if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */ +#define DATA_EXPORT_CALLERID(MEMBER) \ + MEMBER(ast_callerid, cid_dnid, AST_DATA_STRING) \ + MEMBER(ast_callerid, cid_num, AST_DATA_STRING) \ + MEMBER(ast_callerid, cid_name, AST_DATA_STRING) \ + MEMBER(ast_callerid, cid_ani, AST_DATA_STRING) \ + MEMBER(ast_callerid, cid_pres, AST_DATA_INTEGER) \ + MEMBER(ast_callerid, cid_ani2, AST_DATA_INTEGER) \ + MEMBER(ast_callerid, cid_tag, AST_DATA_STRING) + +AST_DATA_STRUCTURE(ast_callerid, DATA_EXPORT_CALLERID); +#endif + +#define DATA_EXPORT_CHANNEL(MEMBER) \ + MEMBER(ast_channel, blockproc, AST_DATA_STRING) \ + MEMBER(ast_channel, appl, AST_DATA_STRING) \ + MEMBER(ast_channel, data, AST_DATA_STRING) \ + MEMBER(ast_channel, __do_not_use_name, AST_DATA_STRING) \ + MEMBER(ast_channel, language, AST_DATA_STRING) \ + MEMBER(ast_channel, musicclass, AST_DATA_STRING) \ + MEMBER(ast_channel, accountcode, AST_DATA_STRING) \ + MEMBER(ast_channel, peeraccount, AST_DATA_STRING) \ + MEMBER(ast_channel, userfield, AST_DATA_STRING) \ + MEMBER(ast_channel, call_forward, AST_DATA_STRING) \ + MEMBER(ast_channel, uniqueid, AST_DATA_STRING) \ + MEMBER(ast_channel, linkedid, AST_DATA_STRING) \ + MEMBER(ast_channel, parkinglot, AST_DATA_STRING) \ + MEMBER(ast_channel, hangupsource, AST_DATA_STRING) \ + MEMBER(ast_channel, dialcontext, AST_DATA_STRING) \ + MEMBER(ast_channel, rings, AST_DATA_INTEGER) \ + MEMBER(ast_channel, priority, AST_DATA_INTEGER) \ + MEMBER(ast_channel, macropriority, AST_DATA_INTEGER) \ + MEMBER(ast_channel, adsicpe, AST_DATA_INTEGER) \ + MEMBER(ast_channel, fin, AST_DATA_UNSIGNED_INTEGER) \ + MEMBER(ast_channel, fout, AST_DATA_UNSIGNED_INTEGER) \ + MEMBER(ast_channel, emulate_dtmf_duration, AST_DATA_UNSIGNED_INTEGER) \ + MEMBER(ast_channel, visible_indication, AST_DATA_INTEGER) \ + MEMBER(ast_channel, context, AST_DATA_STRING) \ + MEMBER(ast_channel, exten, AST_DATA_STRING) \ + MEMBER(ast_channel, macrocontext, AST_DATA_STRING) \ + MEMBER(ast_channel, macroexten, AST_DATA_STRING) + +AST_DATA_STRUCTURE(ast_channel, DATA_EXPORT_CHANNEL); + +static void channel_data_add_flags(struct ast_data *tree, + struct ast_channel *chan) +{ + ast_data_add_bool(tree, "DEFER_DTMF", ast_test_flag(chan, AST_FLAG_DEFER_DTMF)); + ast_data_add_bool(tree, "WRITE_INT", ast_test_flag(chan, AST_FLAG_WRITE_INT)); + ast_data_add_bool(tree, "BLOCKING", ast_test_flag(chan, AST_FLAG_BLOCKING)); + ast_data_add_bool(tree, "ZOMBIE", ast_test_flag(chan, AST_FLAG_ZOMBIE)); + ast_data_add_bool(tree, "EXCEPTION", ast_test_flag(chan, AST_FLAG_EXCEPTION)); + ast_data_add_bool(tree, "MOH", ast_test_flag(chan, AST_FLAG_MOH)); + ast_data_add_bool(tree, "SPYING", ast_test_flag(chan, AST_FLAG_SPYING)); + ast_data_add_bool(tree, "NBRIDGE", ast_test_flag(chan, AST_FLAG_NBRIDGE)); + ast_data_add_bool(tree, "IN_AUTOLOOP", ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP)); + ast_data_add_bool(tree, "OUTGOING", ast_test_flag(chan, AST_FLAG_OUTGOING)); + ast_data_add_bool(tree, "IN_DTMF", ast_test_flag(chan, AST_FLAG_IN_DTMF)); + ast_data_add_bool(tree, "EMULATE_DTMF", ast_test_flag(chan, AST_FLAG_EMULATE_DTMF)); + ast_data_add_bool(tree, "END_DTMF_ONLY", ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY)); + ast_data_add_bool(tree, "ANSWERED_ELSEWHERE", ast_test_flag(chan, AST_FLAG_ANSWERED_ELSEWHERE)); + ast_data_add_bool(tree, "MASQ_NOSTREAM", ast_test_flag(chan, AST_FLAG_MASQ_NOSTREAM)); + ast_data_add_bool(tree, "BRIDGE_HANGUP_RUN", ast_test_flag(chan, AST_FLAG_BRIDGE_HANGUP_RUN)); + ast_data_add_bool(tree, "BRIDGE_HANGUP_DONT", ast_test_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT)); + ast_data_add_bool(tree, "DISABLE_WORKAROUNDS", ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS)); +} + +int ast_channel_data_add_structure(struct ast_data *tree, + struct ast_channel *chan, int add_bridged) +{ + struct ast_channel *bc; + struct ast_data *data_bridged; + struct ast_data *data_cdr; + struct ast_data *data_flags; + struct ast_data *data_zones; + struct ast_data *enum_node; + struct ast_data *data_softhangup; +#if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */ + struct ast_data *data_callerid; + char value_str[100]; +#endif + + if (!tree) { + return -1; + } + + ast_data_add_structure(ast_channel, tree, chan); + + if (add_bridged) { + bc = ast_bridged_channel(chan); + if (bc) { + data_bridged = ast_data_add_node(tree, "bridged"); + if (!data_bridged) { + return -1; + } + ast_channel_data_add_structure(data_bridged, bc, 0); + } + } + + ast_data_add_codec(tree, "oldwriteformat", &chan->oldwriteformat); + ast_data_add_codec(tree, "readformat", &chan->readformat); + ast_data_add_codec(tree, "writeformat", &chan->writeformat); + ast_data_add_codec(tree, "rawreadformat", &chan->rawreadformat); + ast_data_add_codec(tree, "rawwriteformat", &chan->rawwriteformat); + ast_data_add_codecs(tree, "nativeformats", chan->nativeformats); + + /* state */ + enum_node = ast_data_add_node(tree, "state"); + if (!enum_node) { + return -1; + } + ast_data_add_str(enum_node, "text", ast_state2str(chan->_state)); + ast_data_add_int(enum_node, "value", chan->_state); + + /* hangupcause */ + enum_node = ast_data_add_node(tree, "hangupcause"); + if (!enum_node) { + return -1; + } + ast_data_add_str(enum_node, "text", ast_cause2str(chan->hangupcause)); + ast_data_add_int(enum_node, "value", chan->hangupcause); + + /* amaflags */ + enum_node = ast_data_add_node(tree, "amaflags"); + if (!enum_node) { + return -1; + } + ast_data_add_str(enum_node, "text", ast_cdr_flags2str(chan->amaflags)); + ast_data_add_int(enum_node, "value", chan->amaflags); + + /* transfercapability */ + enum_node = ast_data_add_node(tree, "transfercapability"); + if (!enum_node) { + return -1; + } + ast_data_add_str(enum_node, "text", ast_transfercapability2str(chan->transfercapability)); + ast_data_add_int(enum_node, "value", chan->transfercapability); + + /* _softphangup */ + data_softhangup = ast_data_add_node(tree, "softhangup"); + if (!data_softhangup) { + return -1; + } + ast_data_add_bool(data_softhangup, "dev", chan->_softhangup & AST_SOFTHANGUP_DEV); + ast_data_add_bool(data_softhangup, "asyncgoto", chan->_softhangup & AST_SOFTHANGUP_ASYNCGOTO); + ast_data_add_bool(data_softhangup, "shutdown", chan->_softhangup & AST_SOFTHANGUP_SHUTDOWN); + ast_data_add_bool(data_softhangup, "timeout", chan->_softhangup & AST_SOFTHANGUP_TIMEOUT); + ast_data_add_bool(data_softhangup, "appunload", chan->_softhangup & AST_SOFTHANGUP_APPUNLOAD); + ast_data_add_bool(data_softhangup, "explicit", chan->_softhangup & AST_SOFTHANGUP_EXPLICIT); + ast_data_add_bool(data_softhangup, "unbridge", chan->_softhangup & AST_SOFTHANGUP_UNBRIDGE); + + /* channel flags */ + data_flags = ast_data_add_node(tree, "flags"); + if (!data_flags) { + return -1; + } + channel_data_add_flags(data_flags, chan); + + ast_data_add_uint(tree, "timetohangup", chan->whentohangup.tv_sec); + +#if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */ + /* callerid */ + data_callerid = ast_data_add_node(tree, "callerid"); + if (!data_callerid) { + return -1; + } + ast_data_add_structure(ast_callerid, data_callerid, &(chan->cid)); + /* insert the callerid ton */ + enum_node = ast_data_add_node(data_callerid, "cid_ton"); + if (!enum_node) { + return -1; + } + ast_data_add_int(enum_node, "value", chan->cid.cid_ton); + snprintf(value_str, sizeof(value_str), "TON: %s/Plan: %s", + party_number_ton2str(chan->cid.cid_ton), + party_number_plan2str(chan->cid.cid_ton)); + ast_data_add_str(enum_node, "text", value_str); +#endif + + /* tone zone */ + if (chan->zone) { + data_zones = ast_data_add_node(tree, "zone"); + if (!data_zones) { + return -1; + } + ast_tone_zone_data_add_structure(data_zones, chan->zone); + } + + /* insert cdr */ + data_cdr = ast_data_add_node(tree, "cdr"); + if (!data_cdr) { + return -1; + } + + ast_cdr_data_add_structure(data_cdr, chan->cdr, 1); + + return 0; +} + +int ast_channel_data_cmp_structure(const struct ast_data_search *tree, + struct ast_channel *chan, const char *structure_name) +{ + return ast_data_search_cmp_structure(tree, ast_channel, chan, structure_name); +} + +/* ACCESSORS */ + +const char *ast_channel_name(const struct ast_channel *chan) +{ + return chan->__do_not_use_name; +} + +void ast_channel_name_set(struct ast_channel *chan, const char *name) +{ + ast_string_field_set(chan, __do_not_use_name, name); +} + +void ast_channel_name_set_va(struct ast_channel *chan, const char *name_fmt, va_list ap) +{ + ast_string_field_build_va(chan, __do_not_use_name, name_fmt, ap); +} diff --git a/main/cli.c b/main/cli.c index c35b941d1..1923dd3d3 100644 --- a/main/cli.c +++ b/main/cli.c @@ -914,7 +914,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar } } if (concise) { - ast_cli(a->fd, CONCISE_FORMAT_STRING, c->name, c->context, c->exten, c->priority, ast_state2str(c->_state), + ast_cli(a->fd, CONCISE_FORMAT_STRING, ast_channel_name(c), c->context, c->exten, c->priority, ast_state2str(c->_state), c->appl ? c->appl : "(None)", S_OR(c->data, ""), /* XXX different from verbose ? */ S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""), @@ -922,17 +922,17 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar S_OR(c->peeraccount, ""), c->amaflags, durbuf, - bc ? bc->name : "(None)", + bc ? ast_channel_name(bc) : "(None)", c->uniqueid); } else if (verbose) { - ast_cli(a->fd, VERBOSE_FORMAT_STRING, c->name, c->context, c->exten, c->priority, ast_state2str(c->_state), + ast_cli(a->fd, VERBOSE_FORMAT_STRING, ast_channel_name(c), c->context, c->exten, c->priority, ast_state2str(c->_state), c->appl ? c->appl : "(None)", c->data ? S_OR(c->data, "(Empty)" ): "(None)", S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""), durbuf, S_OR(c->accountcode, ""), S_OR(c->peeraccount, ""), - bc ? bc->name : "(None)"); + bc ? ast_channel_name(bc) : "(None)"); } else { char locbuf[40] = "(None)"; char appdata[40] = "(None)"; @@ -941,7 +941,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar snprintf(locbuf, sizeof(locbuf), "%s@%s:%d", c->exten, c->context, c->priority); if (c->appl) snprintf(appdata, sizeof(appdata), "%s(%s)", c->appl, S_OR(c->data, "")); - ast_cli(a->fd, FORMAT_STRING, c->name, locbuf, ast_state2str(c->_state), appdata); + ast_cli(a->fd, FORMAT_STRING, ast_channel_name(c), locbuf, ast_state2str(c->_state), appdata); } } ast_channel_unlock(c); @@ -1002,14 +1002,14 @@ static char *handle_softhangup(struct ast_cli_entry *e, int cmd, struct ast_cli_ } for (; iter && (c = ast_channel_iterator_next(iter)); ast_channel_unref(c)) { ast_channel_lock(c); - ast_cli(a->fd, "Requested Hangup on channel '%s'\n", c->name); + ast_cli(a->fd, "Requested Hangup on channel '%s'\n", ast_channel_name(c)); ast_softhangup(c, AST_SOFTHANGUP_EXPLICIT); ast_channel_unlock(c); } ast_channel_iterator_destroy(iter); } else if ((c = ast_channel_get_by_name(a->argv[3]))) { ast_channel_lock(c); - ast_cli(a->fd, "Requested Hangup on channel '%s'\n", c->name); + ast_cli(a->fd, "Requested Hangup on channel '%s'\n", ast_channel_name(c)); ast_softhangup(c, AST_SOFTHANGUP_EXPLICIT); ast_channel_unlock(c); c = ast_channel_unref(c); @@ -1289,7 +1289,7 @@ static int channel_set_debug(void *obj, void *arg, void *data, int flags) chan->fout |= DEBUGCHAN_FLAG; } ast_cli(args->fd, "Debugging %s on channel %s\n", args->is_off ? "disabled" : "enabled", - chan->name); + ast_channel_name(chan)); } ast_channel_unlock(chan); @@ -1475,7 +1475,7 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar " Application: %s\n" " Data: %s\n" " Blocking in: %s\n", - c->name, c->tech->type, c->uniqueid, c->linkedid, + ast_channel_name(c), c->tech->type, c->uniqueid, c->linkedid, S_COR(c->caller.id.number.valid, c->caller.id.number.str, "(N/A)"), S_COR(c->caller.id.name.valid, c->caller.id.name.str, "(N/A)"), S_COR(c->connected.id.number.valid, c->connected.id.number.str, "(N/A)"), @@ -1494,7 +1494,7 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar c->fin & ~DEBUGCHAN_FLAG, (c->fin & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", (long)c->whentohangup.tv_sec, - cdrtime, c->_bridge ? c->_bridge->name : "<none>", ast_bridged_channel(c) ? ast_bridged_channel(c)->name : "<none>", + cdrtime, c->_bridge ? ast_channel_name(c->_bridge) : "<none>", ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>", c->context, c->exten, c->priority, c->callgroup, c->pickupgroup, ( c->appl ? c->appl : "(N/A)" ), ( c-> data ? S_OR(c->data, "(Empty)") : "(None)"), (ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)")); @@ -1565,7 +1565,7 @@ char *ast_complete_channels(const char *line, const char *word, int pos, int sta while (ret == ¬found && (c = ast_channel_iterator_next(iter))) { if (++which > state) { ast_channel_lock(c); - ret = ast_strdup(c->name); + ret = ast_strdup(ast_channel_name(c)); ast_channel_unlock(c); } ast_channel_unref(c); @@ -1614,7 +1614,7 @@ static char *group_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cl gi = ast_app_group_list_head(); while (gi) { if (!havepattern || !regexec(®exbuf, gi->group, 0, NULL, 0)) { - ast_cli(a->fd, FORMAT_STRING, gi->chan->name, gi->group, (ast_strlen_zero(gi->category) ? "(default)" : gi->category)); + ast_cli(a->fd, FORMAT_STRING, ast_channel_name(gi->chan), gi->group, (ast_strlen_zero(gi->category) ? "(default)" : gi->category)); numchans++; } gi = AST_LIST_NEXT(gi, group_list); diff --git a/main/dial.c b/main/dial.c index 420ce1995..7fe49be33 100644 --- a/main/dial.c +++ b/main/dial.c @@ -395,7 +395,7 @@ static void handle_frame(struct ast_dial *dial, struct ast_dial_channel *channel if (fr->frametype == AST_FRAME_CONTROL) { switch (fr->subclass.integer) { case AST_CONTROL_ANSWER: - ast_verb(3, "%s answered %s\n", channel->owner->name, chan->name); + ast_verb(3, "%s answered %s\n", ast_channel_name(channel->owner), ast_channel_name(chan)); AST_LIST_LOCK(&dial->channels); AST_LIST_REMOVE(&dial->channels, channel, list); AST_LIST_INSERT_HEAD(&dial->channels, channel, list); @@ -403,61 +403,61 @@ static void handle_frame(struct ast_dial *dial, struct ast_dial_channel *channel set_state(dial, AST_DIAL_RESULT_ANSWERED); break; case AST_CONTROL_BUSY: - ast_verb(3, "%s is busy\n", channel->owner->name); + ast_verb(3, "%s is busy\n", ast_channel_name(channel->owner)); ast_hangup(channel->owner); channel->owner = NULL; break; case AST_CONTROL_CONGESTION: - ast_verb(3, "%s is circuit-busy\n", channel->owner->name); + ast_verb(3, "%s is circuit-busy\n", ast_channel_name(channel->owner)); ast_hangup(channel->owner); channel->owner = NULL; break; case AST_CONTROL_INCOMPLETE: - ast_verb(3, "%s dialed Incomplete extension %s\n", channel->owner->name, channel->owner->exten); + ast_verb(3, "%s dialed Incomplete extension %s\n", ast_channel_name(channel->owner), channel->owner->exten); ast_indicate(chan, AST_CONTROL_INCOMPLETE); break; case AST_CONTROL_RINGING: - ast_verb(3, "%s is ringing\n", channel->owner->name); + ast_verb(3, "%s is ringing\n", ast_channel_name(channel->owner)); if (!dial->options[AST_DIAL_OPTION_MUSIC]) ast_indicate(chan, AST_CONTROL_RINGING); set_state(dial, AST_DIAL_RESULT_RINGING); break; case AST_CONTROL_PROGRESS: - ast_verb(3, "%s is making progress, passing it to %s\n", channel->owner->name, chan->name); + ast_verb(3, "%s is making progress, passing it to %s\n", ast_channel_name(channel->owner), ast_channel_name(chan)); ast_indicate(chan, AST_CONTROL_PROGRESS); set_state(dial, AST_DIAL_RESULT_PROGRESS); break; case AST_CONTROL_VIDUPDATE: - ast_verb(3, "%s requested a video update, passing it to %s\n", channel->owner->name, chan->name); + ast_verb(3, "%s requested a video update, passing it to %s\n", ast_channel_name(channel->owner), ast_channel_name(chan)); ast_indicate(chan, AST_CONTROL_VIDUPDATE); break; case AST_CONTROL_SRCUPDATE: - ast_verb(3, "%s requested a source update, passing it to %s\n", channel->owner->name, chan->name); + ast_verb(3, "%s requested a source update, passing it to %s\n", ast_channel_name(channel->owner), ast_channel_name(chan)); ast_indicate(chan, AST_CONTROL_SRCUPDATE); break; case AST_CONTROL_CONNECTED_LINE: - ast_verb(3, "%s connected line has changed, passing it to %s\n", channel->owner->name, chan->name); + ast_verb(3, "%s connected line has changed, passing it to %s\n", ast_channel_name(channel->owner), ast_channel_name(chan)); if (ast_channel_connected_line_macro(channel->owner, chan, fr, 1, 1)) { ast_indicate_data(chan, AST_CONTROL_CONNECTED_LINE, fr->data.ptr, fr->datalen); } break; case AST_CONTROL_REDIRECTING: - ast_verb(3, "%s redirecting info has changed, passing it to %s\n", channel->owner->name, chan->name); + ast_verb(3, "%s redirecting info has changed, passing it to %s\n", ast_channel_name(channel->owner), ast_channel_name(chan)); if (ast_channel_redirecting_macro(channel->owner, chan, fr, 1, 1)) { ast_indicate_data(chan, AST_CONTROL_REDIRECTING, fr->data.ptr, fr->datalen); } break; case AST_CONTROL_PROCEEDING: - ast_verb(3, "%s is proceeding, passing it to %s\n", channel->owner->name, chan->name); + ast_verb(3, "%s is proceeding, passing it to %s\n", ast_channel_name(channel->owner), ast_channel_name(chan)); ast_indicate(chan, AST_CONTROL_PROCEEDING); set_state(dial, AST_DIAL_RESULT_PROCEEDING); break; case AST_CONTROL_HOLD: - ast_verb(3, "Call on %s placed on hold\n", chan->name); + ast_verb(3, "Call on %s placed on hold\n", ast_channel_name(chan)); ast_indicate(chan, AST_CONTROL_HOLD); break; case AST_CONTROL_UNHOLD: - ast_verb(3, "Call on %s left from hold\n", chan->name); + ast_verb(3, "Call on %s left from hold\n", ast_channel_name(chan)); ast_indicate(chan, AST_CONTROL_UNHOLD); break; case AST_CONTROL_OFFHOOK: @@ -484,7 +484,7 @@ static void handle_frame_ownerless(struct ast_dial *dial, struct ast_dial_channe switch (fr->subclass.integer) { case AST_CONTROL_ANSWER: - ast_verb(3, "%s answered\n", channel->owner->name); + ast_verb(3, "%s answered\n", ast_channel_name(channel->owner)); AST_LIST_LOCK(&dial->channels); AST_LIST_REMOVE(&dial->channels, channel, list); AST_LIST_INSERT_HEAD(&dial->channels, channel, list); @@ -492,25 +492,25 @@ static void handle_frame_ownerless(struct ast_dial *dial, struct ast_dial_channe set_state(dial, AST_DIAL_RESULT_ANSWERED); break; case AST_CONTROL_BUSY: - ast_verb(3, "%s is busy\n", channel->owner->name); + ast_verb(3, "%s is busy\n", ast_channel_name(channel->owner)); ast_hangup(channel->owner); channel->owner = NULL; break; case AST_CONTROL_CONGESTION: - ast_verb(3, "%s is circuit-busy\n", channel->owner->name); + ast_verb(3, "%s is circuit-busy\n", ast_channel_name(channel->owner)); ast_hangup(channel->owner); channel->owner = NULL; break; case AST_CONTROL_RINGING: - ast_verb(3, "%s is ringing\n", channel->owner->name); + ast_verb(3, "%s is ringing\n", ast_channel_name(channel->owner)); set_state(dial, AST_DIAL_RESULT_RINGING); break; case AST_CONTROL_PROGRESS: - ast_verb(3, "%s is making progress\n", channel->owner->name); + ast_verb(3, "%s is making progress\n", ast_channel_name(channel->owner)); set_state(dial, AST_DIAL_RESULT_PROGRESS); break; case AST_CONTROL_PROCEEDING: - ast_verb(3, "%s is proceeding\n", channel->owner->name); + ast_verb(3, "%s is proceeding\n", ast_channel_name(channel->owner)); set_state(dial, AST_DIAL_RESULT_PROCEEDING); break; default: diff --git a/main/dsp.c b/main/dsp.c index ec25f96c6..d934c9cf5 100644 --- a/main/dsp.c +++ b/main/dsp.c @@ -1442,7 +1442,7 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, dsp->f.frametype = AST_FRAME_CONTROL; dsp->f.subclass.integer = AST_CONTROL_BUSY; ast_frfree(af); - ast_debug(1, "Requesting Hangup because the busy tone was detected on channel %s\n", chan->name); + ast_debug(1, "Requesting Hangup because the busy tone was detected on channel %s\n", ast_channel_name(chan)); return ast_frisolate(&dsp->f); } diff --git a/main/features.c b/main/features.c index 7b595fb49..5f9e2857f 100644 --- a/main/features.c +++ b/main/features.c @@ -669,7 +669,7 @@ static void set_kill_chan_tech(struct ast_channel *chan) } if (chan->tech_pvt) { ast_log(LOG_WARNING, "Channel '%s' may not have been hung up properly\n", - chan->name); + ast_channel_name(chan)); ast_free(chan->tech_pvt); chan->tech_pvt = NULL; } @@ -714,9 +714,9 @@ static void set_new_chan_name(struct ast_channel *chan) /* Create the new channel name string. */ ast_channel_lock(chan); seq_num = ast_atomic_fetchadd_int(&seq_num_last, +1); - len = snprintf(dummy, sizeof(dummy), "%s<XFER_%x>", chan->name, seq_num) + 1; + len = snprintf(dummy, sizeof(dummy), "%s<XFER_%x>", ast_channel_name(chan), seq_num) + 1; chan_name = alloca(len); - snprintf(chan_name, len, "%s<XFER_%x>", chan->name, seq_num); + snprintf(chan_name, len, "%s<XFER_%x>", ast_channel_name(chan), seq_num); ast_channel_unlock(chan); ast_change_name(chan, chan_name); @@ -858,10 +858,10 @@ static void check_goto_on_transfer(struct ast_channel *chan) goto_on_transfer = ast_strdupa(val); ast_channel_unlock(chan); - ast_debug(1, "Attempting GOTO_ON_BLINDXFR=%s for %s.\n", val, chan->name); + ast_debug(1, "Attempting GOTO_ON_BLINDXFR=%s for %s.\n", val, ast_channel_name(chan)); xferchan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", chan->linkedid, 0, - "%s", chan->name); + "%s", ast_channel_name(chan)); if (!xferchan) { return; } @@ -911,25 +911,25 @@ static void *bridge_call_thread(void *data) int res; tobj->chan->appl = !tobj->return_to_pbx ? "Transferred Call" : "ManagerBridge"; - tobj->chan->data = tobj->peer->name; + tobj->chan->data = ast_channel_name(tobj->peer); tobj->peer->appl = !tobj->return_to_pbx ? "Transferred Call" : "ManagerBridge"; - tobj->peer->data = tobj->chan->name; + tobj->peer->data = ast_channel_name(tobj->chan); ast_bridge_call(tobj->peer, tobj->chan, &tobj->bconfig); if (tobj->return_to_pbx) { if (!ast_check_hangup(tobj->peer)) { - ast_log(LOG_VERBOSE, "putting peer %s into PBX again\n", tobj->peer->name); + ast_log(LOG_VERBOSE, "putting peer %s into PBX again\n", ast_channel_name(tobj->peer)); res = ast_pbx_start(tobj->peer); if (res != AST_PBX_SUCCESS) - ast_log(LOG_WARNING, "FAILED continuing PBX on peer %s\n", tobj->peer->name); + ast_log(LOG_WARNING, "FAILED continuing PBX on peer %s\n", ast_channel_name(tobj->peer)); } else ast_hangup(tobj->peer); if (!ast_check_hangup(tobj->chan)) { - ast_log(LOG_VERBOSE, "putting chan %s into PBX again\n", tobj->chan->name); + ast_log(LOG_VERBOSE, "putting chan %s into PBX again\n", ast_channel_name(tobj->chan)); res = ast_pbx_start(tobj->chan); if (res != AST_PBX_SUCCESS) - ast_log(LOG_WARNING, "FAILED continuing PBX on chan %s\n", tobj->chan->name); + ast_log(LOG_WARNING, "FAILED continuing PBX on chan %s\n", ast_channel_name(tobj->chan)); } else ast_hangup(tobj->chan); } else { @@ -1240,7 +1240,7 @@ static struct parkeduser *park_space_reserve(struct ast_channel *park_me, struct } if (!parkinglot) { - ast_log(LOG_WARNING, "Parking lot not available to park %s.\n", park_me->name); + ast_log(LOG_WARNING, "Parking lot not available to park %s.\n", ast_channel_name(park_me)); return NULL; } @@ -1428,20 +1428,20 @@ static int park_call_full(struct ast_channel *chan, struct ast_channel *peer, st char other_side[AST_CHANNEL_NAME]; char *c; - ast_copy_string(other_side, S_OR(args->orig_chan_name, peer->name), sizeof(other_side)); + ast_copy_string(other_side, S_OR(args->orig_chan_name, ast_channel_name(peer)), sizeof(other_side)); if ((c = strrchr(other_side, ';'))) { *++c = '1'; } if ((tmpchan = ast_channel_get_by_name(other_side))) { ast_channel_lock(tmpchan); if ((base_peer = ast_bridged_channel(tmpchan))) { - ast_copy_string(pu->peername, base_peer->name, sizeof(pu->peername)); + ast_copy_string(pu->peername, ast_channel_name(base_peer), sizeof(pu->peername)); } ast_channel_unlock(tmpchan); tmpchan = ast_channel_unref(tmpchan); } } else { - ast_copy_string(pu->peername, S_OR(args->orig_chan_name, peer->name), sizeof(pu->peername)); + ast_copy_string(pu->peername, S_OR(args->orig_chan_name, ast_channel_name(peer)), sizeof(pu->peername)); } } @@ -1478,13 +1478,13 @@ static int park_call_full(struct ast_channel *chan, struct ast_channel *peer, st /* Wake up the (presumably select()ing) thread */ pthread_kill(parking_thread, SIGURG); ast_verb(2, "Parked %s on %d (lot %s). Will timeout back to extension [%s] %s, %d in %d seconds\n", - pu->chan->name, pu->parkingnum, pu->parkinglot->name, + ast_channel_name(pu->chan), pu->parkingnum, pu->parkinglot->name, pu->context, pu->exten, pu->priority, (pu->parkingtime / 1000)); ast_cel_report_event(pu->chan, AST_CEL_PARK_START, NULL, pu->parkinglot->name, peer); if (peer) { - event_from = peer->name; + event_from = ast_channel_name(peer); } else { event_from = pbx_builtin_getvar_helper(chan, "BLINDTRANSFER"); } @@ -1500,7 +1500,7 @@ static int park_call_full(struct ast_channel *chan, struct ast_channel *peer, st "ConnectedLineNum: %s\r\n" "ConnectedLineName: %s\r\n" "Uniqueid: %s\r\n", - pu->parkingexten, pu->chan->name, pu->parkinglot->name, event_from ? event_from : "", + pu->parkingexten, ast_channel_name(pu->chan), pu->parkinglot->name, event_from ? event_from : "", (long)pu->start.tv_sec + (long)(pu->parkingtime/1000) - (long)time(NULL), S_COR(pu->chan->caller.id.number.valid, pu->chan->caller.id.number.str, "<unknown>"), S_COR(pu->chan->caller.id.name.valid, pu->chan->caller.id.name.str, "<unknown>"), @@ -1528,7 +1528,7 @@ static int park_call_full(struct ast_channel *chan, struct ast_channel *peer, st /* Only say number if it's a number and the channel hasn't been masqueraded away */ if (peer && !ast_test_flag(args, AST_PARK_OPT_SILENCE) - && (ast_strlen_zero(args->orig_chan_name) || !strcasecmp(peer->name, args->orig_chan_name))) { + && (ast_strlen_zero(args->orig_chan_name) || !strcasecmp(ast_channel_name(peer), args->orig_chan_name))) { /* * If a channel is masqueraded into peer while playing back the * parking space number do not continue playing it back. This @@ -1628,7 +1628,7 @@ static int masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, s /* Make a new, channel that we'll use to masquerade in the real one */ chan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, rchan->accountcode, rchan->exten, - rchan->context, rchan->linkedid, rchan->amaflags, "Parked/%s", rchan->name); + rchan->context, rchan->linkedid, rchan->amaflags, "Parked/%s", ast_channel_name(rchan)); if (!chan) { ast_log(LOG_WARNING, "Unable to create parked channel\n"); if (!ast_test_flag(args, AST_PARK_OPT_SILENCE)) { @@ -1712,7 +1712,7 @@ int ast_masq_park_call_exten(struct ast_channel *park_me, struct ast_channel *pa }; if (parker) { - args.orig_chan_name = ast_strdupa(parker->name); + args.orig_chan_name = ast_strdupa(ast_channel_name(parker)); } if (!park_exten || !park_context) { return masq_park_call(park_me, parker, &args); @@ -1761,7 +1761,7 @@ int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, int }; if (peer) { - args.orig_chan_name = ast_strdupa(peer->name); + args.orig_chan_name = ast_strdupa(ast_channel_name(peer)); } return masq_park_call(rchan, peer, &args); } @@ -2057,9 +2057,9 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee snprintf(args, len, "%s,%s,m", S_OR(touch_format, "wav"), touch_filename); } else { caller_chan_id = ast_strdupa(S_COR(caller_chan->caller.id.number.valid, - caller_chan->caller.id.number.str, caller_chan->name)); + caller_chan->caller.id.number.str, ast_channel_name(caller_chan))); callee_chan_id = ast_strdupa(S_COR(callee_chan->caller.id.number.valid, - callee_chan->caller.id.number.str, callee_chan->name)); + callee_chan->caller.id.number.str, ast_channel_name(callee_chan))); len = strlen(caller_chan_id) + strlen(callee_chan_id) + 50; args = alloca(len); touch_filename = alloca(len); @@ -2173,9 +2173,9 @@ static int builtin_automixmonitor(struct ast_channel *chan, struct ast_channel * snprintf(args, len, "%s.%s,b", touch_filename, (touch_format) ? touch_format : "wav"); } else { caller_chan_id = ast_strdupa(S_COR(caller_chan->caller.id.number.valid, - caller_chan->caller.id.number.str, caller_chan->name)); + caller_chan->caller.id.number.str, ast_channel_name(caller_chan))); callee_chan_id = ast_strdupa(S_COR(callee_chan->caller.id.number.valid, - callee_chan->caller.id.number.str, callee_chan->name)); + callee_chan->caller.id.number.str, ast_channel_name(callee_chan))); len = strlen(caller_chan_id) + strlen(callee_chan_id) + 50; args = alloca(len); touch_filename = alloca(len); @@ -2254,7 +2254,7 @@ static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *p char xferto[256] = ""; int res; - ast_debug(1, "Executing Blind Transfer %s, %s (sense=%d) \n", chan->name, peer->name, sense); + ast_debug(1, "Executing Blind Transfer %s, %s (sense=%d) \n", ast_channel_name(chan), ast_channel_name(peer), sense); set_peers(&transferer, &transferee, peer, chan, sense); transferer_real_context = real_ctx(transferer, transferee); @@ -2298,10 +2298,10 @@ static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *p /* Do blind transfer. */ ast_verb(3, "Blind transferring %s to '%s' (context %s) priority 1\n", - transferee->name, xferto, transferer_real_context); + ast_channel_name(transferee), xferto, transferer_real_context); ast_cel_report_event(transferer, AST_CEL_BLINDTRANSFER, NULL, xferto, transferee); - pbx_builtin_setvar_helper(transferer, "BLINDTRANSFER", transferee->name); - pbx_builtin_setvar_helper(transferee, "BLINDTRANSFER", transferer->name); + pbx_builtin_setvar_helper(transferer, "BLINDTRANSFER", ast_channel_name(transferee)); + pbx_builtin_setvar_helper(transferee, "BLINDTRANSFER", ast_channel_name(transferer)); finishup(transferee); ast_channel_lock(transferer); if (!transferer->cdr) { /* this code should never get called (in a perfect world) */ @@ -2317,7 +2317,7 @@ static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *p ast_debug(1, "transferer=%s; transferee=%s; lastapp=%s; lastdata=%s; chan=%s; dstchan=%s\n", - transferer->name, transferee->name, transferer->cdr->lastapp, + ast_channel_name(transferer), ast_channel_name(transferee), transferer->cdr->lastapp, transferer->cdr->lastdata, transferer->cdr->channel, transferer->cdr->dstchannel); ast_debug(1, "TRANSFEREE; lastapp=%s; lastdata=%s, chan=%s; dstchan=%s\n", @@ -2331,7 +2331,7 @@ static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *p } if (!transferee->pbx) { /* Doh! Use our handy async_goto functions */ - ast_debug(1, "About to ast_async_goto %s.\n", transferee->name); + ast_debug(1, "About to ast_async_goto %s.\n", ast_channel_name(transferee)); if (ast_async_goto(transferee, transferer_real_context, xferto, 1)) { ast_log(LOG_WARNING, "Async goto failed :-(\n"); } @@ -2340,7 +2340,7 @@ static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *p res = -1; } else { /* Set the transferee's new extension, since it exists, using transferer context */ - ast_debug(1, "About to explicit goto %s, it has a PBX.\n", transferee->name); + ast_debug(1, "About to explicit goto %s, it has a PBX.\n", ast_channel_name(transferee)); ast_set_flag(transferee, AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */ set_c_e_p(transferee, transferer_real_context, xferto, 0); @@ -2365,7 +2365,7 @@ static int check_compat(struct ast_channel *c, struct ast_channel *newchan) { if (ast_channel_make_compatible(c, newchan) < 0) { ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", - c->name, newchan->name); + ast_channel_name(c), ast_channel_name(newchan)); ast_hangup(newchan); return -1; } @@ -2438,7 +2438,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st char *transferer_name_orig; char *dash; - ast_debug(1, "Executing Attended Transfer %s, %s (sense=%d) \n", chan->name, peer->name, sense); + ast_debug(1, "Executing Attended Transfer %s, %s (sense=%d) \n", ast_channel_name(chan), ast_channel_name(peer), sense); set_peers(&transferer, &transferee, peer, chan, sense); transferer_real_context = real_ctx(transferer, transferee); @@ -2500,7 +2500,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st } /* Extract redial transferer information from the channel name. */ - transferer_name_orig = ast_strdupa(transferer->name); + transferer_name_orig = ast_strdupa(ast_channel_name(transferer)); transferer_name = ast_strdupa(transferer_name_orig); transferer_tech = strsep(&transferer_name, "/"); dash = strrchr(transferer_name, '-'); @@ -2702,7 +2702,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st /* Initiate the channel transfer of party A to party C (or recalled party B). */ ast_cel_report_event(transferee, AST_CEL_ATTENDEDTRANSFER, NULL, NULL, newchan); - xferchan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", transferee->linkedid, 0, "Transfered/%s", transferee->name); + xferchan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", transferee->linkedid, 0, "Transfered/%s", ast_channel_name(transferee)); if (!xferchan) { ast_hangup(newchan); ast_party_connected_line_free(&connected_line); @@ -3071,8 +3071,8 @@ static int feature_exec_app(struct ast_channel *chan, struct ast_channel *peer, ast_autoservice_ignore(idle, AST_FRAME_DTMF_END); if(work && idle) { - pbx_builtin_setvar_helper(work, "DYNAMIC_PEERNAME", idle->name); - pbx_builtin_setvar_helper(idle, "DYNAMIC_PEERNAME", work->name); + pbx_builtin_setvar_helper(work, "DYNAMIC_PEERNAME", ast_channel_name(idle)); + pbx_builtin_setvar_helper(idle, "DYNAMIC_PEERNAME", ast_channel_name(work)); pbx_builtin_setvar_helper(work, "DYNAMIC_FEATURENAME", feature->sname); pbx_builtin_setvar_helper(idle, "DYNAMIC_FEATURENAME", feature->sname); } @@ -3269,7 +3269,7 @@ static int feature_interpret(struct ast_channel *chan, struct ast_channel *peer, snprintf(dynamic_features_buf, sizeof(dynamic_features_buf), "%s%s%s", S_OR(chan_dynamic_features, ""), chan_dynamic_features && peer_dynamic_features ? "#" : "", S_OR(peer_dynamic_features,"")); - ast_debug(3, "Feature interpret: chan=%s, peer=%s, code=%s, sense=%d, features=%d, dynamic=%s\n", chan->name, peer->name, code, sense, features.flags, dynamic_features_buf); + ast_debug(3, "Feature interpret: chan=%s, peer=%s, code=%s, sense=%d, features=%d, dynamic=%s\n", ast_channel_name(chan), ast_channel_name(peer), code, sense, features.flags, dynamic_features_buf); return feature_interpret_helper(chan, peer, config, code, sense, dynamic_features_buf, &features, FEATURE_INTERPRET_DO, &feature); } @@ -3509,7 +3509,7 @@ static struct ast_channel *feature_request_and_dial(struct ast_channel *caller, /* see if the timeout has been violated */ if (ast_tvdiff_ms(ast_tvnow(), started) > timeout) { state = AST_CONTROL_UNHOLD; - ast_log(LOG_NOTICE, "We exceeded our AT-timeout for %s\n", chan->name); + ast_log(LOG_NOTICE, "We exceeded our AT-timeout for %s\n", ast_channel_name(chan)); break; /*doh! timeout*/ } @@ -3565,19 +3565,19 @@ static struct ast_channel *feature_request_and_dial(struct ast_channel *caller, if (f->frametype == AST_FRAME_CONTROL) { if (f->subclass.integer == AST_CONTROL_RINGING) { - ast_verb(3, "%s is ringing\n", chan->name); + ast_verb(3, "%s is ringing\n", ast_channel_name(chan)); ast_indicate(caller, AST_CONTROL_RINGING); } else if (f->subclass.integer == AST_CONTROL_BUSY) { state = f->subclass.integer; - ast_verb(3, "%s is busy\n", chan->name); + ast_verb(3, "%s is busy\n", ast_channel_name(chan)); ast_indicate(caller, AST_CONTROL_BUSY); ast_frfree(f); break; } else if (f->subclass.integer == AST_CONTROL_INCOMPLETE) { - ast_verb(3, "%s dialed incomplete extension %s; ignoring\n", chan->name, chan->exten); + ast_verb(3, "%s dialed incomplete extension %s; ignoring\n", ast_channel_name(chan), chan->exten); } else if (f->subclass.integer == AST_CONTROL_CONGESTION) { state = f->subclass.integer; - ast_verb(3, "%s is congested\n", chan->name); + ast_verb(3, "%s is congested\n", ast_channel_name(chan)); ast_indicate(caller, AST_CONTROL_CONGESTION); ast_frfree(f); break; @@ -3691,7 +3691,7 @@ void ast_channel_log(char *title, struct ast_channel *chan) /* for debug, this i { ast_log(LOG_NOTICE, "______ %s (%lx)______\n", title, (unsigned long)chan); ast_log(LOG_NOTICE, "CHAN: name: %s; appl: %s; data: %s; contxt: %s; exten: %s; pri: %d;\n", - chan->name, chan->appl, chan->data, chan->context, chan->exten, chan->priority); + ast_channel_name(chan), chan->appl, chan->data, chan->context, chan->exten, chan->priority); ast_log(LOG_NOTICE, "CHAN: acctcode: %s; dialcontext: %s; amaflags: %x; maccontxt: %s; macexten: %s; macpri: %d;\n", chan->accountcode, chan->dialcontext, chan->amaflags, chan->macrocontext, chan->macroexten, chan->macropriority); ast_log(LOG_NOTICE, "CHAN: masq: %p; masqr: %p; _bridge: %p; uniqueID: %s; linkedID:%s\n", @@ -3699,9 +3699,9 @@ void ast_channel_log(char *title, struct ast_channel *chan) /* for debug, this i chan->_bridge, chan->uniqueid, chan->linkedid); if (chan->masqr) ast_log(LOG_NOTICE, "CHAN: masquerading as: %s; cdr: %p;\n", - chan->masqr->name, chan->masqr->cdr); + ast_channel_name(chan->masqr), chan->masqr->cdr); if (chan->_bridge) - ast_log(LOG_NOTICE, "CHAN: Bridged to %s\n", chan->_bridge->name); + ast_log(LOG_NOTICE, "CHAN: Bridged to %s\n", ast_channel_name(chan->_bridge)); ast_log(LOG_NOTICE, "===== done ====\n"); } @@ -3817,7 +3817,7 @@ static void clear_dialed_interfaces(struct ast_channel *chan) ast_channel_lock(chan); if ((di_datastore = ast_channel_datastore_find(chan, &dialed_interface_info, NULL))) { if (option_debug) { - ast_log(LOG_DEBUG, "Removing dialed interfaces datastore on %s since we're bridging\n", chan->name); + ast_log(LOG_DEBUG, "Removing dialed interfaces datastore on %s since we're bridging\n", ast_channel_name(chan)); } if (!ast_channel_datastore_remove(chan, di_datastore)) { ast_datastore_free(di_datastore); @@ -3865,8 +3865,8 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a const char *h_context; if (chan && peer) { - pbx_builtin_setvar_helper(chan, "BRIDGEPEER", peer->name); - pbx_builtin_setvar_helper(peer, "BRIDGEPEER", chan->name); + pbx_builtin_setvar_helper(chan, "BRIDGEPEER", ast_channel_name(peer)); + pbx_builtin_setvar_helper(peer, "BRIDGEPEER", ast_channel_name(chan)); } else if (chan) { pbx_builtin_setvar_helper(chan, "BLINDTRANSFER", NULL); } @@ -3931,8 +3931,8 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a ast_set_flag(peer->cdr, AST_CDR_FLAG_POST_DISABLED); we_disabled_peer_cdr = 1; } - ast_copy_string(orig_channame,chan->name,sizeof(orig_channame)); - ast_copy_string(orig_peername,peer->name,sizeof(orig_peername)); + ast_copy_string(orig_channame,ast_channel_name(chan),sizeof(orig_channame)); + ast_copy_string(orig_peername,ast_channel_name(peer),sizeof(orig_peername)); if (!chan_cdr || (chan_cdr && !ast_test_flag(chan_cdr, AST_CDR_FLAG_POST_DISABLED))) { ast_channel_lock_both(chan, peer); @@ -3953,8 +3953,8 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a } else { /* better yet, in a xfer situation, find out why the chan cdr got zapped (pun unintentional) */ bridge_cdr = ast_cdr_alloc(); /* this should be really, really rare/impossible? */ - ast_copy_string(bridge_cdr->channel, chan->name, sizeof(bridge_cdr->channel)); - ast_copy_string(bridge_cdr->dstchannel, peer->name, sizeof(bridge_cdr->dstchannel)); + ast_copy_string(bridge_cdr->channel, ast_channel_name(chan), sizeof(bridge_cdr->channel)); + ast_copy_string(bridge_cdr->dstchannel, ast_channel_name(peer), sizeof(bridge_cdr->dstchannel)); ast_copy_string(bridge_cdr->uniqueid, chan->uniqueid, sizeof(bridge_cdr->uniqueid)); ast_copy_string(bridge_cdr->lastapp, S_OR(chan->appl, ""), sizeof(bridge_cdr->lastapp)); ast_copy_string(bridge_cdr->lastdata, S_OR(chan->data, ""), sizeof(bridge_cdr->lastdata)); @@ -4103,7 +4103,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a } if (res < 0) { if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_test_flag(peer, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan) && !ast_check_hangup(peer)) { - ast_log(LOG_WARNING, "Bridge failed on channels %s and %s\n", chan->name, peer->name); + ast_log(LOG_WARNING, "Bridge failed on channels %s and %s\n", ast_channel_name(chan), ast_channel_name(peer)); } goto before_you_go; } @@ -4347,8 +4347,8 @@ before_you_go: } if (found && spawn_error) { /* Something bad happened, or a hangup has been requested. */ - ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", chan->context, chan->exten, chan->priority, chan->name); - ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", chan->context, chan->exten, chan->priority, chan->name); + ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", chan->context, chan->exten, chan->priority, ast_channel_name(chan)); + ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", chan->context, chan->exten, chan->priority, ast_channel_name(chan)); } /* swap it back */ @@ -4413,7 +4413,7 @@ before_you_go: if (new_chan_cdr) { struct ast_channel *chan_ptr = NULL; - if (strcasecmp(orig_channame, chan->name) != 0) { + if (strcasecmp(orig_channame, ast_channel_name(chan)) != 0) { /* old channel */ if ((chan_ptr = ast_channel_get_by_name(orig_channame))) { ast_channel_lock(chan_ptr); @@ -4443,7 +4443,7 @@ before_you_go: new_peer_cdr = pick_unlocked_cdr(peer->cdr); /* the proper chan cdr, if there are forked cdrs */ if (new_chan_cdr && ast_test_flag(new_chan_cdr, AST_CDR_FLAG_POST_DISABLED) && new_peer_cdr && !ast_test_flag(new_peer_cdr, AST_CDR_FLAG_POST_DISABLED)) ast_set_flag(new_peer_cdr, AST_CDR_FLAG_POST_DISABLED); /* DISABLED is viral-- it will propagate across a bridge */ - if (strcasecmp(orig_peername, peer->name) != 0) { + if (strcasecmp(orig_peername, ast_channel_name(peer)) != 0) { /* old channel */ if ((chan_ptr = ast_channel_get_by_name(orig_peername))) { ast_channel_lock(chan_ptr); @@ -4489,7 +4489,7 @@ static void post_manager_event(const char *s, struct parkeduser *pu) "ConnectedLineName: %s\r\n" "UniqueID: %s\r\n", pu->parkingexten, - pu->chan->name, + ast_channel_name(pu->chan), pu->parkinglot->name, S_COR(pu->chan->caller.id.number.valid, pu->chan->caller.id.number.str, "<unknown>"), S_COR(pu->chan->caller.id.name.valid, pu->chan->caller.id.name.str, "<unknown>"), @@ -4620,7 +4620,7 @@ static int manage_parked_call(struct parkeduser *pu, const struct pollfd *pfds, &(dialfeatures->features_caller), buf, sizeof(buf))); } else { /* Existing default */ ast_log(LOG_NOTICE, "Dial features not found on %s, using default!\n", - chan->name); + ast_channel_name(chan)); snprintf(returnexten, sizeof(returnexten), "%s,30,t", peername); } ast_channel_unlock(chan); @@ -4660,14 +4660,14 @@ static int manage_parked_call(struct parkeduser *pu, const struct pollfd *pfds, ast_cel_report_event(pu->chan, AST_CEL_PARK_END, NULL, "ParkedCallTimeOut", NULL); ast_verb(2, "Timeout for %s parked on %d (%s). Returning to %s,%s,%d\n", - pu->chan->name, pu->parkingnum, pu->parkinglot->name, pu->chan->context, + ast_channel_name(pu->chan), pu->parkingnum, pu->parkinglot->name, pu->chan->context, pu->chan->exten, pu->chan->priority); /* Start up the PBX, or hang them up */ if (ast_pbx_start(chan)) { ast_log(LOG_WARNING, "Unable to restart the PBX for user on '%s', hanging them up...\n", - pu->chan->name); + ast_channel_name(pu->chan)); ast_hangup(chan); } @@ -4718,7 +4718,7 @@ static int manage_parked_call(struct parkeduser *pu, const struct pollfd *pfds, NULL); /* There's a problem, hang them up */ - ast_verb(2, "%s got tired of being parked\n", chan->name); + ast_verb(2, "%s got tired of being parked\n", ast_channel_name(chan)); ast_hangup(chan); /* And take them out of the parking lot */ @@ -4732,7 +4732,7 @@ static int manage_parked_call(struct parkeduser *pu, const struct pollfd *pfds, && !chan->generatordata) { ast_debug(1, "MOH on parked call stopped by outside source. Restarting on channel %s.\n", - chan->name); + ast_channel_name(chan)); ast_indicate_data(chan, AST_CONTROL_HOLD, S_OR(pu->parkinglot->cfg.mohclass, NULL), (!ast_strlen_zero(pu->parkinglot->cfg.mohclass) @@ -4897,7 +4897,7 @@ static int park_call_exec(struct ast_channel *chan, const char *data) /* Cache the original channel name in case we get masqueraded in the middle * of a park--it is still theoretically possible for a transfer to happen before * we get here, but it is _really_ unlikely */ - char *orig_chan_name = ast_strdupa(chan->name); + char *orig_chan_name = ast_strdupa(ast_channel_name(chan)); struct ast_park_call_args args = { .orig_chan_name = orig_chan_name, }; @@ -5040,11 +5040,11 @@ static int parked_call_exec(struct ast_channel *chan, const char *data) } if (ast_stream_and_wait(chan, "pbx-invalidpark", "")) { ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", - "pbx-invalidpark", chan->name); + "pbx-invalidpark", ast_channel_name(chan)); } ast_log(LOG_WARNING, "Channel %s tried to retrieve parked call from unknown parking lot '%s'\n", - chan->name, pl_name); + ast_channel_name(chan), pl_name); return -1; } } @@ -5082,7 +5082,7 @@ static int parked_call_exec(struct ast_channel *chan, const char *data) "CallerIDName: %s\r\n" "ConnectedLineNum: %s\r\n" "ConnectedLineName: %s\r\n", - pu->parkingexten, pu->chan->name, chan->name, + pu->parkingexten, ast_channel_name(pu->chan), ast_channel_name(chan), S_COR(pu->chan->caller.id.number.valid, pu->chan->caller.id.number.str, "<unknown>"), S_COR(pu->chan->caller.id.name.valid, pu->chan->caller.id.name.str, "<unknown>"), S_COR(pu->chan->connected.id.number.valid, pu->chan->connected.id.number.str, "<unknown>"), @@ -5176,17 +5176,17 @@ static int parked_call_exec(struct ast_channel *chan, const char *data) res = ast_channel_make_compatible(chan, peer); if (res < 0) { - ast_log(LOG_WARNING, "Could not make channels %s and %s compatible for bridge\n", chan->name, peer->name); + ast_log(LOG_WARNING, "Could not make channels %s and %s compatible for bridge\n", ast_channel_name(chan), ast_channel_name(peer)); ast_hangup(peer); parkinglot_unref(parkinglot); return -1; } /* This runs sorta backwards, since we give the incoming channel control, as if it were the person called. */ - ast_verb(3, "Channel %s connected to parked call %d\n", chan->name, park); + ast_verb(3, "Channel %s connected to parked call %d\n", ast_channel_name(chan), park); - pbx_builtin_setvar_helper(chan, "PARKEDCHANNEL", peer->name); - ast_cdr_setdestchan(chan->cdr, peer->name); + pbx_builtin_setvar_helper(chan, "PARKEDCHANNEL", ast_channel_name(peer)); + ast_cdr_setdestchan(chan->cdr, ast_channel_name(peer)); memset(&config, 0, sizeof(struct ast_bridge_config)); /* Get datastore for peer and apply it's features to the callee side of the bridge config */ @@ -5235,18 +5235,18 @@ static int parked_call_exec(struct ast_channel *chan, const char *data) res = ast_bridge_call(chan, peer, &config); - pbx_builtin_setvar_helper(chan, "PARKEDCHANNEL", peer->name); - ast_cdr_setdestchan(chan->cdr, peer->name); + pbx_builtin_setvar_helper(chan, "PARKEDCHANNEL", ast_channel_name(peer)); + ast_cdr_setdestchan(chan->cdr, ast_channel_name(peer)); /* Simulate the PBX hanging up */ ast_hangup(peer); } else { if (ast_stream_and_wait(chan, "pbx-invalidpark", "")) { ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", "pbx-invalidpark", - chan->name); + ast_channel_name(chan)); } ast_verb(3, "Channel %s tried to retrieve nonexistent parked call %d\n", - chan->name, park); + ast_channel_name(chan), park); } parkinglot_unref(parkinglot); @@ -6816,7 +6816,7 @@ static int action_bridge(struct mansession *s, const struct message *m) /* create the placeholder channels and grab the other channels */ if (!(tmpchana = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL, - NULL, NULL, chana->linkedid, 0, "Bridge/%s", chana->name))) { + NULL, NULL, chana->linkedid, 0, "Bridge/%s", ast_channel_name(chana)))) { astman_send_error(s, m, "Unable to create temporary channel!"); chana = ast_channel_unref(chana); return 1; @@ -6843,7 +6843,7 @@ static int action_bridge(struct mansession *s, const struct message *m) /* create the placeholder channels and grab the other channels */ if (!(tmpchanb = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL, - NULL, NULL, chanb->linkedid, 0, "Bridge/%s", chanb->name))) { + NULL, NULL, chanb->linkedid, 0, "Bridge/%s", ast_channel_name(chanb)))) { astman_send_error(s, m, "Unable to create temporary channels!"); ast_hangup(tmpchana); chanb = ast_channel_unref(chanb); @@ -6856,7 +6856,7 @@ static int action_bridge(struct mansession *s, const struct message *m) /* make the channels compatible, send error if we fail doing so */ if (ast_channel_make_compatible(tmpchana, tmpchanb)) { - ast_log(LOG_WARNING, "Could not make channels %s and %s compatible for manager bridge\n", tmpchana->name, tmpchanb->name); + ast_log(LOG_WARNING, "Could not make channels %s and %s compatible for manager bridge\n", ast_channel_name(tmpchana), ast_channel_name(tmpchanb)); astman_send_error(s, m, "Could not make channels compatible for manager bridge"); ast_hangup(tmpchana); ast_hangup(tmpchanb); @@ -6865,7 +6865,7 @@ static int action_bridge(struct mansession *s, const struct message *m) /* setup the bridge thread object and start the bridge */ if (!(tobj = ast_calloc(1, sizeof(*tobj)))) { - ast_log(LOG_WARNING, "Unable to spawn a new bridge thread on %s and %s: %s\n", tmpchana->name, tmpchanb->name, strerror(errno)); + ast_log(LOG_WARNING, "Unable to spawn a new bridge thread on %s and %s: %s\n", ast_channel_name(tmpchana), ast_channel_name(tmpchanb), strerror(errno)); astman_send_error(s, m, "Unable to spawn a new bridge thread"); ast_hangup(tmpchana); ast_hangup(tmpchanb); @@ -6879,7 +6879,7 @@ static int action_bridge(struct mansession *s, const struct message *m) if (ast_true(playtone)) { if (!ast_strlen_zero(xfersound) && !ast_streamfile(tmpchanb, xfersound, tmpchanb->language)) { if (ast_waitstream(tmpchanb, "") < 0) - ast_log(LOG_WARNING, "Failed to play a courtesy tone on chan %s\n", tmpchanb->name); + ast_log(LOG_WARNING, "Failed to play a courtesy tone on chan %s\n", ast_channel_name(tmpchanb)); } } @@ -6889,7 +6889,7 @@ static int action_bridge(struct mansession *s, const struct message *m) ast_manager_event_multichan(EVENT_FLAG_CALL, "BridgeAction", 2, chans, "Response: Success\r\n" "Channel1: %s\r\n" - "Channel2: %s\r\n", tmpchana->name, tmpchanb->name); + "Channel2: %s\r\n", ast_channel_name(tmpchana), ast_channel_name(tmpchanb)); bridge_call_thread_launch(tobj); @@ -6944,7 +6944,7 @@ static char *handle_parkedcalls(struct ast_cli_entry *e, int cmd, struct ast_cli AST_LIST_LOCK(&curlot->parkings); AST_LIST_TRAVERSE(&curlot->parkings, cur, list) { ast_cli(a->fd, "%-10.10s %-25s (%-15s %-12s %4d) %6lds\n", - cur->parkingexten, cur->chan->name, cur->context, cur->exten, + cur->parkingexten, ast_channel_name(cur->chan), cur->context, cur->exten, cur->priority, (long) (cur->start.tv_sec + (cur->parkingtime / 1000) - time(NULL))); ++lotparked; @@ -7010,7 +7010,7 @@ static int manager_parking_status(struct mansession *s, const struct message *m) "%s" "\r\n", curlot->name, - cur->parkingnum, cur->chan->name, cur->peername, + cur->parkingnum, ast_channel_name(cur->chan), cur->peername, (long) cur->start.tv_sec + (long) (cur->parkingtime / 1000) - (long) time(NULL), S_COR(cur->chan->caller.id.number.valid, cur->chan->caller.id.number.str, ""), /* XXX in other places it is <unknown> */ S_COR(cur->chan->caller.id.name.valid, cur->chan->caller.id.name.str, ""), @@ -7184,12 +7184,12 @@ int ast_pickup_call(struct ast_channel *chan) { struct ast_channel *target;/*!< Potential pickup target */ int res = -1; - ast_debug(1, "pickup attempt by %s\n", chan->name); + ast_debug(1, "pickup attempt by %s\n", ast_channel_name(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); @@ -7198,13 +7198,13 @@ int ast_pickup_call(struct ast_channel *chan) pbx_builtin_setvar_helper(target, "BRIDGE_PLAY_SOUND", pickupsound); } } else { - ast_log(LOG_WARNING, "pickup %s failed by %s\n", target->name, chan->name); + ast_log(LOG_WARNING, "pickup %s failed by %s\n", ast_channel_name(target), ast_channel_name(chan)); } target = ast_channel_unref(target); } if (res < 0) { - ast_debug(1, "No call pickup possible... for %s\n", chan->name); + ast_debug(1, "No call pickup possible... for %s\n", ast_channel_name(chan)); if (!ast_strlen_zero(pickupfailsound)) { ast_answer(chan); ast_stream_and_wait(chan, pickupfailsound, ""); @@ -7223,8 +7223,8 @@ int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target) const char *target_name;/*!< A masquerade changes channel names. */ int res = -1; - target_name = ast_strdupa(target->name); - ast_debug(1, "Call pickup on '%s' by '%s'\n", target_name, chan->name); + target_name = ast_strdupa(ast_channel_name(target)); + ast_debug(1, "Call pickup on '%s' by '%s'\n", target_name, ast_channel_name(chan)); /* Mark the target to block any call pickup race. */ ds_pickup = ast_datastore_alloc(&pickup_active, NULL); @@ -7245,7 +7245,7 @@ int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target) ast_party_connected_line_free(&connected_caller); ast_channel_lock(chan); - chan_name = ast_strdupa(chan->name); + chan_name = ast_strdupa(ast_channel_name(chan)); ast_connected_line_copy_from_caller(&connected_caller, &chan->caller); ast_channel_unlock(chan); connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; @@ -7474,14 +7474,14 @@ static int bridge_exec(struct ast_channel *chan, const char *data) ast_app_parse_options(bridge_exec_options, &opts, opt_args, args.options); /* avoid bridge with ourselves */ - if (!strcmp(chan->name, args.dest_chan)) { - ast_log(LOG_WARNING, "Unable to bridge channel %s with itself\n", chan->name); + if (!strcmp(ast_channel_name(chan), args.dest_chan)) { + ast_log(LOG_WARNING, "Unable to bridge channel %s with itself\n", ast_channel_name(chan)); ast_manager_event(chan, EVENT_FLAG_CALL, "BridgeExec", "Response: Failed\r\n" "Reason: Unable to bridge channel to itself\r\n" "Channel1: %s\r\n" "Channel2: %s\r\n", - chan->name, args.dest_chan); + ast_channel_name(chan), args.dest_chan); pbx_builtin_setvar_helper(chan, "BRIDGERESULT", "LOOP"); return 0; } @@ -7495,7 +7495,7 @@ static int bridge_exec(struct ast_channel *chan, const char *data) "Response: Failed\r\n" "Reason: Cannot grab end point\r\n" "Channel1: %s\r\n" - "Channel2: %s\r\n", chan->name, args.dest_chan); + "Channel2: %s\r\n", ast_channel_name(chan), args.dest_chan); pbx_builtin_setvar_helper(chan, "BRIDGERESULT", "NONEXISTENT"); return 0; } @@ -7507,13 +7507,13 @@ static int bridge_exec(struct ast_channel *chan, const char *data) /* try to allocate a place holder where current_dest_chan will be placed */ if (!(final_dest_chan = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL, - NULL, NULL, current_dest_chan->linkedid, 0, "Bridge/%s", current_dest_chan->name))) { + NULL, NULL, current_dest_chan->linkedid, 0, "Bridge/%s", ast_channel_name(current_dest_chan)))) { ast_log(LOG_WARNING, "Cannot create placeholder channel for chan %s\n", args.dest_chan); ast_manager_event(chan, EVENT_FLAG_CALL, "BridgeExec", "Response: Failed\r\n" "Reason: cannot create placeholder\r\n" "Channel1: %s\r\n" - "Channel2: %s\r\n", chan->name, args.dest_chan); + "Channel2: %s\r\n", ast_channel_name(chan), args.dest_chan); } do_bridge_masquerade(current_dest_chan, final_dest_chan); @@ -7524,12 +7524,12 @@ static int bridge_exec(struct ast_channel *chan, const char *data) /* now current_dest_chan is a ZOMBIE and with softhangup set to 1 and final_dest_chan is our end point */ /* try to make compatible, send error if we fail */ if (ast_channel_make_compatible(chan, final_dest_chan) < 0) { - ast_log(LOG_WARNING, "Could not make channels %s and %s compatible for bridge\n", chan->name, final_dest_chan->name); + ast_log(LOG_WARNING, "Could not make channels %s and %s compatible for bridge\n", ast_channel_name(chan), ast_channel_name(final_dest_chan)); ast_manager_event_multichan(EVENT_FLAG_CALL, "BridgeExec", 2, chans, "Response: Failed\r\n" "Reason: Could not make channels compatible for bridge\r\n" "Channel1: %s\r\n" - "Channel2: %s\r\n", chan->name, final_dest_chan->name); + "Channel2: %s\r\n", ast_channel_name(chan), ast_channel_name(final_dest_chan)); ast_hangup(final_dest_chan); /* may be we should return this channel to the PBX? */ pbx_builtin_setvar_helper(chan, "BRIDGERESULT", "INCOMPATIBLE"); current_dest_chan = ast_channel_unref(current_dest_chan); @@ -7540,13 +7540,13 @@ static int bridge_exec(struct ast_channel *chan, const char *data) ast_manager_event_multichan(EVENT_FLAG_CALL, "BridgeExec", 2, chans, "Response: Success\r\n" "Channel1: %s\r\n" - "Channel2: %s\r\n", chan->name, final_dest_chan->name); + "Channel2: %s\r\n", ast_channel_name(chan), ast_channel_name(final_dest_chan)); /* we have 2 valid channels to bridge, now it is just a matter of setting up the bridge config and starting the bridge */ if (ast_test_flag(&opts, BRIDGE_OPT_PLAYTONE) && !ast_strlen_zero(xfersound)) { if (!ast_streamfile(final_dest_chan, xfersound, final_dest_chan->language)) { if (ast_waitstream(final_dest_chan, "") < 0) - ast_log(LOG_WARNING, "Failed to play courtesy tone on %s\n", final_dest_chan->name); + ast_log(LOG_WARNING, "Failed to play courtesy tone on %s\n", ast_channel_name(final_dest_chan)); } } @@ -7581,15 +7581,15 @@ static int bridge_exec(struct ast_channel *chan, const char *data) if (!ast_check_hangup(final_dest_chan) && !ast_test_flag(&opts, OPT_CALLEE_KILL)) { ast_debug(1, "starting new PBX in %s,%s,%d for chan %s\n", final_dest_chan->context, final_dest_chan->exten, - final_dest_chan->priority, final_dest_chan->name); + final_dest_chan->priority, ast_channel_name(final_dest_chan)); if (ast_pbx_start(final_dest_chan) != AST_PBX_SUCCESS) { - ast_log(LOG_WARNING, "FAILED continuing PBX on dest chan %s\n", final_dest_chan->name); + ast_log(LOG_WARNING, "FAILED continuing PBX on dest chan %s\n", ast_channel_name(final_dest_chan)); ast_hangup(final_dest_chan); } else - ast_debug(1, "SUCCESS continuing PBX on chan %s\n", final_dest_chan->name); + ast_debug(1, "SUCCESS continuing PBX on chan %s\n", ast_channel_name(final_dest_chan)); } else { - ast_debug(1, "hangup chan %s since the other endpoint has hung up or the x flag was passed\n", final_dest_chan->name); + ast_debug(1, "hangup chan %s since the other endpoint has hung up or the x flag was passed\n", ast_channel_name(final_dest_chan)); ast_hangup(final_dest_chan); } done: diff --git a/main/file.c b/main/file.c index 70b971cb3..8591637c8 100644 --- a/main/file.c +++ b/main/file.c @@ -818,7 +818,7 @@ static enum fsread_res ast_readaudio_callback(struct ast_filestream *s) while (!whennext) { struct ast_frame *fr; - if (s->orig_chan_name && strcasecmp(s->owner->name, s->orig_chan_name)) { + if (s->orig_chan_name && strcasecmp(ast_channel_name(s->owner), s->orig_chan_name)) { goto return_failure; } @@ -1044,7 +1044,7 @@ int ast_streamfile(struct ast_channel *chan, const char *filename, const char *p } if (ast_test_flag(chan, AST_FLAG_MASQ_NOSTREAM)) - fs->orig_chan_name = ast_strdup(chan->name); + fs->orig_chan_name = ast_strdup(ast_channel_name(chan)); if (ast_applystream(chan, fs)) return -1; if (vfs && ast_applystream(chan, vfs)) @@ -1052,7 +1052,7 @@ int ast_streamfile(struct ast_channel *chan, const char *filename, const char *p res = ast_playstream(fs); if (!res && vfs) res = ast_playstream(vfs); - ast_verb(3, "<%s> Playing '%s.%s' (language '%s')\n", chan->name, filename, ast_getformatname(&chan->writeformat), preflang ? preflang : "default"); + ast_verb(3, "<%s> Playing '%s.%s' (language '%s')\n", ast_channel_name(chan), filename, ast_getformatname(&chan->writeformat), preflang ? preflang : "default"); return res; } @@ -1258,13 +1258,13 @@ static int waitstream_core(struct ast_channel *c, const char *breakon, ast_set_flag(c, AST_FLAG_END_DTMF_ONLY); if (ast_test_flag(c, AST_FLAG_MASQ_NOSTREAM)) - orig_chan_name = ast_strdupa(c->name); + orig_chan_name = ast_strdupa(ast_channel_name(c)); while (c->stream) { int res; int ms; - if (orig_chan_name && strcasecmp(orig_chan_name, c->name)) { + if (orig_chan_name && strcasecmp(orig_chan_name, ast_channel_name(c))) { ast_stopstream(c); err = 1; break; @@ -1424,7 +1424,7 @@ int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char * { int res = 0; if (!ast_strlen_zero(file)) { - ast_test_suite_event_notify("PLAYBACK", "Message: %s\r\nChannel: %s", file, chan->name); + ast_test_suite_event_notify("PLAYBACK", "Message: %s\r\nChannel: %s", file, ast_channel_name(chan)); res = ast_streamfile(chan, file, chan->language); if (!res) { res = ast_waitstream(chan, digits); diff --git a/main/indications.c b/main/indications.c index f93239380..ef98407f5 100644 --- a/main/indications.c +++ b/main/indications.c @@ -150,7 +150,7 @@ static void *playtones_alloc(struct ast_channel *chan, void *params) ast_format_copy(&ps->origwfmt, &chan->writeformat); if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR)) { - ast_log(LOG_WARNING, "Unable to set '%s' to signed linear format (write)\n", chan->name); + ast_log(LOG_WARNING, "Unable to set '%s' to signed linear format (write)\n", ast_channel_name(chan)); playtones_release(NULL, ps); ps = NULL; } else { diff --git a/main/manager.c b/main/manager.c index d0729a8fc..f7144adc9 100644 --- a/main/manager.c +++ b/main/manager.c @@ -3157,7 +3157,7 @@ static int action_hangup(struct mansession *s, const struct message *m) ast_channel_lock(c); if (causecode > 0) { ast_debug(1, "Setting hangupcause of channel %s to %d (is %d now)\n", - c->name, causecode, c->hangupcause); + ast_channel_name(c), causecode, c->hangupcause); c->hangupcause = causecode; } ast_softhangup_nolock(c, AST_SOFTHANGUP_EXPLICIT); @@ -3322,7 +3322,7 @@ static int action_status(struct mansession *s, const struct message *m) channels++; if (c->_bridge) { - snprintf(bridge, sizeof(bridge), "BridgedChannel: %s\r\nBridgedUniqueid: %s\r\n", c->_bridge->name, c->_bridge->uniqueid); + snprintf(bridge, sizeof(bridge), "BridgedChannel: %s\r\nBridgedUniqueid: %s\r\n", ast_channel_name(c->_bridge), c->_bridge->uniqueid); } else { bridge[0] = '\0'; } @@ -3350,7 +3350,7 @@ static int action_status(struct mansession *s, const struct message *m) "%s" "%s" "\r\n", - c->name, + ast_channel_name(c), S_COR(c->caller.id.number.valid, c->caller.id.number.str, "<unknown>"), S_COR(c->caller.id.name.valid, c->caller.id.name.str, "<unknown>"), S_COR(c->connected.id.number.valid, c->connected.id.number.str, "<unknown>"), @@ -3375,7 +3375,7 @@ static int action_status(struct mansession *s, const struct message *m) "%s" "%s" "\r\n", - c->name, + ast_channel_name(c), S_COR(c->caller.id.number.valid, c->caller.id.number.str, "<unknown>"), S_COR(c->caller.id.name.valid, c->caller.id.name.str, "<unknown>"), S_COR(c->connected.id.number.valid, c->connected.id.number.str, "<unknown>"), @@ -3742,7 +3742,7 @@ static void *fast_originate(void *data) "CallerIDNum: %s\r\n" "CallerIDName: %s\r\n", in->idtext, ast_strlen_zero(in->idtext) ? "" : "\r\n", res ? "Failure" : "Success", - chan ? chan->name : requested_channel, in->context, in->exten, reason, + chan ? ast_channel_name(chan) : requested_channel, in->context, in->exten, reason, chan ? chan->uniqueid : "<null>", S_OR(in->cid_num, "<unknown>"), S_OR(in->cid_name, "<unknown>") @@ -4592,13 +4592,13 @@ static int action_coreshowchannels(struct mansession *s, const struct message *m "AccountCode: %s\r\n" "BridgedChannel: %s\r\n" "BridgedUniqueID: %s\r\n" - "\r\n", idText, c->name, c->uniqueid, c->context, c->exten, c->priority, c->_state, + "\r\n", idText, ast_channel_name(c), c->uniqueid, c->context, c->exten, c->priority, c->_state, ast_state2str(c->_state), c->appl ? c->appl : "", c->data ? S_OR(c->data, "") : "", S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""), S_COR(c->caller.id.name.valid, c->caller.id.name.str, ""), S_COR(c->connected.id.number.valid, c->connected.id.number.str, ""), S_COR(c->connected.id.name.valid, c->connected.id.name.str, ""), - durbuf, S_OR(c->accountcode, ""), bc ? bc->name : "", bc ? bc->uniqueid : ""); + durbuf, S_OR(c->accountcode, ""), bc ? ast_channel_name(bc) : "", bc ? bc->uniqueid : ""); ast_channel_unlock(c); @@ -5174,7 +5174,7 @@ static void append_channel_vars(struct ast_str **pbuf, struct ast_channel *chan) } else { val = pbx_builtin_getvar_helper(chan, var->name); } - ast_str_append(pbuf, 0, "ChanVariable(%s): %s=%s\r\n", chan->name, var->name, val ? val : ""); + ast_str_append(pbuf, 0, "ChanVariable(%s): %s=%s\r\n", ast_channel_name(chan), var->name, val ? val : ""); } AST_RWLIST_UNLOCK(&channelvars); } diff --git a/main/pbx.c b/main/pbx.c index dff45b813..d2a18fb64 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -3317,7 +3317,7 @@ const char *ast_str_retrieve_variable(struct ast_str **str, ssize_t maxlen, stru ast_str_set(str, maxlen, "%d", c->priority); s = ast_str_buffer(*str); } else if (!strcmp(var, "CHANNEL")) { - s = c->name; + s = ast_channel_name(c); } else if (!strcmp(var, "UNIQUEID")) { s = c->uniqueid; } else if (!strcmp(var, "HANGUPCAUSE")) { @@ -4374,7 +4374,7 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con, ast_verb(3, "Executing [%s@%s:%d] %s(\"%s\", \"%s\") %s\n", exten, context, priority, term_color(tmp, app->name, COLOR_BRCYAN, 0, sizeof(tmp)), - term_color(tmp2, c->name, COLOR_BRMAGENTA, 0, sizeof(tmp2)), + term_color(tmp2, ast_channel_name(c), COLOR_BRMAGENTA, 0, sizeof(tmp2)), term_color(tmp3, passdata, COLOR_BRMAGENTA, 0, sizeof(tmp3)), "in new stack"); } @@ -4386,7 +4386,7 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con, "Application: %s\r\n" "AppData: %s\r\n" "Uniqueid: %s\r\n", - c->name, c->context, c->exten, c->priority, app->name, passdata, c->uniqueid); + ast_channel_name(c), c->context, c->exten, c->priority, app->name, passdata, c->uniqueid); return pbx_exec(c, app, passdata); /* 0 on success, -1 on failure */ } } else if (q.swo) { /* not found here, but in another switch */ @@ -5106,7 +5106,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, /* A little initial setup here */ if (c->pbx) { - ast_log(LOG_WARNING, "%s already has PBX structure??\n", c->name); + ast_log(LOG_WARNING, "%s already has PBX structure??\n", ast_channel_name(c)); /* XXX and now what ? */ ast_free(c->pbx); } @@ -5121,7 +5121,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, if (ast_strlen_zero(c->exten)) { /* If not successful fall back to 's' - but only if there is no given exten */ - ast_verb(2, "Starting %s at %s,%s,%d failed so falling back to exten 's'\n", c->name, c->context, c->exten, c->priority); + ast_verb(2, "Starting %s at %s,%s,%d failed so falling back to exten 's'\n", ast_channel_name(c), c->context, c->exten, c->priority); /* XXX the original code used the existing priority in the call to * ast_exists_extension(), and reset it to 1 afterwards. * I believe the correct thing is to set it to 1 immediately. @@ -5190,8 +5190,8 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, dst_exten[pos++] = digit = res; dst_exten[pos] = '\0'; } else if (res == AST_PBX_INCOMPLETE) { - ast_debug(1, "Spawn extension (%s,%s,%d) exited INCOMPLETE on '%s'\n", c->context, c->exten, c->priority, c->name); - ast_verb(2, "Spawn extension (%s, %s, %d) exited INCOMPLETE on '%s'\n", c->context, c->exten, c->priority, c->name); + ast_debug(1, "Spawn extension (%s,%s,%d) exited INCOMPLETE on '%s'\n", c->context, c->exten, c->priority, ast_channel_name(c)); + ast_verb(2, "Spawn extension (%s, %s, %d) exited INCOMPLETE on '%s'\n", c->context, c->exten, c->priority, ast_channel_name(c)); /* Don't cycle on incomplete - this will happen if the only extension that matches is our "incomplete" extension */ if (!ast_matchmore_extension(c, c->context, c->exten, 1, @@ -5203,15 +5203,15 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, pos = strlen(dst_exten); } } else { - ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", c->context, c->exten, c->priority, c->name); - ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", c->context, c->exten, c->priority, c->name); + ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", c->context, c->exten, c->priority, ast_channel_name(c)); + ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", c->context, c->exten, c->priority, ast_channel_name(c)); if ((res == AST_PBX_ERROR) && ast_exists_extension(c, c->context, "e", 1, S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { /* if we are already on the 'e' exten, don't jump to it again */ if (!strcmp(c->exten, "e")) { - ast_verb(2, "Spawn extension (%s, %s, %d) exited ERROR while already on 'e' exten on '%s'\n", c->context, c->exten, c->priority, c->name); + ast_verb(2, "Spawn extension (%s, %s, %d) exited ERROR while already on 'e' exten on '%s'\n", c->context, c->exten, c->priority, ast_channel_name(c)); error = 1; } else { raise_exception(c, "ERROR", 1); @@ -5268,7 +5268,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, */ if (ast_exists_extension(c, c->context, "i", 1, S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { - ast_verb(3, "Sent into invalid extension '%s' in context '%s' on %s\n", c->exten, c->context, c->name); + ast_verb(3, "Sent into invalid extension '%s' in context '%s' on %s\n", c->exten, c->context, ast_channel_name(c)); pbx_builtin_setvar_helper(c, "INVALID_EXTEN", c->exten); set_ext_pri(c, "i", 1); } else if (ast_exists_extension(c, c->context, "e", 1, @@ -5276,7 +5276,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, raise_exception(c, "INVALID", 1); } else { ast_log(LOG_WARNING, "Channel '%s' sent into invalid extension '%s' in context '%s', but no invalid handler\n", - c->name, c->exten, c->context); + ast_channel_name(c), c->exten, c->context); error = 1; /* we know what to do with it */ break; } @@ -5293,7 +5293,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, const char *status = pbx_builtin_getvar_helper(c, "DIALSTATUS"); if (!status) status = "UNKNOWN"; - ast_verb(3, "Auto fallthrough, channel '%s' status is '%s'\n", c->name, status); + ast_verb(3, "Auto fallthrough, channel '%s' status is '%s'\n", ast_channel_name(c), status); if (!strcasecmp(status, "CONGESTION")) res = pbx_builtin_congestion(c, "10"); else if (!strcasecmp(status, "CHANUNAVAIL")) @@ -5318,7 +5318,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, /* An invalid extension */ if (ast_exists_extension(c, c->context, "i", 1, S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { - ast_verb(3, "Invalid extension '%s' in context '%s' on %s\n", dst_exten, c->context, c->name); + ast_verb(3, "Invalid extension '%s' in context '%s' on %s\n", dst_exten, c->context, ast_channel_name(c)); pbx_builtin_setvar_helper(c, "INVALID_EXTEN", dst_exten); set_ext_pri(c, "i", 1); } else if (ast_exists_extension(c, c->context, "e", 1, @@ -5335,7 +5335,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, /* A simple timeout */ if (ast_exists_extension(c, c->context, "t", 1, S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { - ast_verb(3, "Timeout on %s\n", c->name); + ast_verb(3, "Timeout on %s\n", ast_channel_name(c)); set_ext_pri(c, "t", 1); } else if (ast_exists_extension(c, c->context, "e", 1, S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { @@ -5351,7 +5351,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, } ast_channel_lock(c); if (c->cdr) { - ast_verb(2, "CDR updated on %s\n",c->name); + ast_verb(2, "CDR updated on %s\n",ast_channel_name(c)); ast_cdr_update(c); } ast_channel_unlock(c); @@ -5359,7 +5359,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, } if (!found && !error) { - ast_log(LOG_WARNING, "Don't know what to do with '%s'\n", c->name); + ast_log(LOG_WARNING, "Don't know what to do with '%s'\n", ast_channel_name(c)); } if (!args || !args->no_hangup_chan) { @@ -5381,8 +5381,8 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, } if (found && res) { /* Something bad happened, or a hangup has been requested. */ - ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", c->context, c->exten, c->priority, c->name); - ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", c->context, c->exten, c->priority, c->name); + ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", c->context, c->exten, c->priority, ast_channel_name(c)); + ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", c->context, c->exten, c->priority, ast_channel_name(c)); } } ast_set2_flag(c, autoloopflag, AST_FLAG_IN_AUTOLOOP); @@ -5414,14 +5414,14 @@ static int increase_call_count(const struct ast_channel *c) ast_mutex_lock(&maxcalllock); if (option_maxcalls) { if (countcalls >= option_maxcalls) { - ast_log(LOG_WARNING, "Maximum call limit of %d calls exceeded by '%s'!\n", option_maxcalls, c->name); + ast_log(LOG_WARNING, "Maximum call limit of %d calls exceeded by '%s'!\n", option_maxcalls, ast_channel_name(c)); failed = -1; } } if (option_maxload) { getloadavg(&curloadavg, 1); if (curloadavg >= option_maxload) { - ast_log(LOG_WARNING, "Maximum loadavg limit of %f load exceeded by '%s' (currently %f)!\n", option_maxload, c->name, curloadavg); + ast_log(LOG_WARNING, "Maximum loadavg limit of %f load exceeded by '%s' (currently %f)!\n", option_maxload, ast_channel_name(c), curloadavg); failed = -1; } } @@ -8339,7 +8339,7 @@ int ast_async_goto(struct ast_channel *chan, const char *context, const char *ex tmpvars.exten = ast_strdupa(chan->exten); tmpvars.context = ast_strdupa(chan->context); tmpvars.linkedid = ast_strdupa(chan->linkedid); - tmpvars.name = ast_strdupa(chan->name); + tmpvars.name = ast_strdupa(ast_channel_name(chan)); tmpvars.amaflags = chan->amaflags; tmpvars.state = chan->_state; ast_format_copy(&tmpvars.writeformat, &chan->writeformat); @@ -8380,7 +8380,7 @@ int ast_async_goto(struct ast_channel *chan, const char *context, const char *ex ast_do_masquerade(tmpchan); /* Start the PBX going on our stolen channel */ if (ast_pbx_start(tmpchan)) { - ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmpchan->name); + ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ast_channel_name(tmpchan)); ast_hangup(tmpchan); res = -1; } @@ -8877,7 +8877,7 @@ static void *async_wait(void *data) if (!ast_strlen_zero(as->app)) { app = pbx_findapp(as->app); if (app) { - ast_verb(3, "Launching %s(%s) on %s\n", as->app, as->appdata, chan->name); + ast_verb(3, "Launching %s(%s) on %s\n", as->app, as->appdata, ast_channel_name(chan)); pbx_exec(chan, app, as->appdata); } else ast_log(LOG_WARNING, "No such application '%s'\n", as->app); @@ -8890,7 +8890,7 @@ static void *async_wait(void *data) chan->priority = as->priority; /* Run the PBX */ if (ast_pbx_run(chan)) { - ast_log(LOG_ERROR, "Failed to start PBX on %s\n", chan->name); + ast_log(LOG_ERROR, "Failed to start PBX on %s\n", ast_channel_name(chan)); } else { /* PBX will have taken care of this */ chan = NULL; @@ -8960,13 +8960,13 @@ int ast_pbx_outgoing_exten(const char *type, struct ast_format_cap *cap, void *d if (chan) { if (chan->_state == AST_STATE_UP) { res = 0; - ast_verb(4, "Channel %s was answered.\n", chan->name); + ast_verb(4, "Channel %s was answered.\n", ast_channel_name(chan)); if (synchronous > 1) { if (channel) ast_channel_unlock(chan); if (ast_pbx_run(chan)) { - ast_log(LOG_ERROR, "Unable to run PBX on %s\n", chan->name); + ast_log(LOG_ERROR, "Unable to run PBX on %s\n", ast_channel_name(chan)); if (channel) *channel = NULL; ast_hangup(chan); @@ -8975,7 +8975,7 @@ int ast_pbx_outgoing_exten(const char *type, struct ast_format_cap *cap, void *d } } else { if (ast_pbx_start(chan)) { - ast_log(LOG_ERROR, "Unable to start PBX on %s\n", chan->name); + ast_log(LOG_ERROR, "Unable to start PBX on %s\n", ast_channel_name(chan)); if (channel) { *channel = NULL; ast_channel_unlock(chan); @@ -8986,7 +8986,7 @@ int ast_pbx_outgoing_exten(const char *type, struct ast_format_cap *cap, void *d chan = NULL; } } else { - ast_verb(4, "Channel %s was never answered.\n", chan->name); + ast_verb(4, "Channel %s was never answered.\n", ast_channel_name(chan)); if (chan->cdr) { /* update the cdr */ /* here we update the status of the call, which sould be busy. @@ -9029,7 +9029,7 @@ int ast_pbx_outgoing_exten(const char *type, struct ast_format_cap *cap, void *d if (account) ast_cdr_setaccount(chan, account); if (ast_pbx_run(chan)) { - ast_log(LOG_ERROR, "Unable to run PBX on %s\n", chan->name); + ast_log(LOG_ERROR, "Unable to run PBX on %s\n", ast_channel_name(chan)); ast_hangup(chan); } chan = NULL; @@ -9093,7 +9093,7 @@ static void *ast_pbx_run_app(void *data) struct ast_app *app; app = pbx_findapp(tmp->app); if (app) { - ast_verb(4, "Launching %s(%s) on %s\n", tmp->app, tmp->data, tmp->chan->name); + ast_verb(4, "Launching %s(%s) on %s\n", tmp->app, tmp->data, ast_channel_name(tmp->chan)); pbx_exec(tmp->chan, app, tmp->data); } else ast_log(LOG_WARNING, "No such application '%s'\n", tmp->app); @@ -9128,7 +9128,7 @@ int ast_pbx_outgoing_app(const char *type, struct ast_format_cap *cap, void *dat ast_cdr_setaccount(chan, account); if (chan->_state == AST_STATE_UP) { res = 0; - ast_verb(4, "Channel %s was answered.\n", chan->name); + ast_verb(4, "Channel %s was answered.\n", ast_channel_name(chan)); tmp = ast_calloc(1, sizeof(*tmp)); if (!tmp || ast_string_field_init(tmp, 252)) { if (tmp) { @@ -9147,7 +9147,7 @@ int ast_pbx_outgoing_app(const char *type, struct ast_format_cap *cap, void *dat if (locked_channel) ast_channel_lock(chan); if (ast_pthread_create_detached(&tmp->t, NULL, ast_pbx_run_app, tmp)) { - ast_log(LOG_WARNING, "Unable to spawn execute thread on %s: %s\n", chan->name, strerror(errno)); + ast_log(LOG_WARNING, "Unable to spawn execute thread on %s: %s\n", ast_channel_name(chan), strerror(errno)); ast_string_field_free_memory(tmp); ast_free(tmp); if (locked_channel) @@ -9161,7 +9161,7 @@ int ast_pbx_outgoing_app(const char *type, struct ast_format_cap *cap, void *dat } } } else { - ast_verb(4, "Channel %s was never answered.\n", chan->name); + ast_verb(4, "Channel %s was never answered.\n", ast_channel_name(chan)); if (chan->cdr) { /* update the cdr */ /* here we update the status of the call, which sould be busy. * if that fails then we set the status to failed */ @@ -9850,10 +9850,10 @@ static int pbx_builtin_waitexten(struct ast_channel *chan, const char *data) res = -1; } else if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { - ast_verb(3, "Timeout on %s, continuing...\n", chan->name); + ast_verb(3, "Timeout on %s, continuing...\n", ast_channel_name(chan)); } else if (ast_exists_extension(chan, chan->context, "t", 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { - ast_verb(3, "Timeout on %s, going to 't'\n", chan->name); + ast_verb(3, "Timeout on %s, going to 't'\n", ast_channel_name(chan)); set_ext_pri(chan, "t", 0); /* 0 will become 1, next time through the loop */ } else if (ast_exists_extension(chan, chan->context, "e", 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { @@ -9938,7 +9938,7 @@ static int pbx_builtin_background(struct ast_channel *chan, const char *data) /* Stream the list of files */ while (!res && (front = strsep(&back, "&")) ) { if ( (res = ast_streamfile(chan, front, args.lang)) ) { - 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; break; @@ -10150,7 +10150,7 @@ int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const "Variable: %s\r\n" "Value: %s\r\n" "Uniqueid: %s\r\n", - chan ? chan->name : "none", name, value, + chan ? ast_channel_name(chan) : "none", name, value, chan ? chan->uniqueid : "none"); } diff --git a/main/rtp_engine.c b/main/rtp_engine.c index 4f28bb9da..c5540b168 100644 --- a/main/rtp_engine.c +++ b/main/rtp_engine.c @@ -807,13 +807,13 @@ static enum ast_bridge_result local_bridge_loop(struct ast_channel *c0, struct a /* Start locally bridging both instances */ if (instance0->engine->local_bridge && instance0->engine->local_bridge(instance0, instance1)) { - ast_debug(1, "Failed to locally bridge %s to %s, backing out.\n", c0->name, c1->name); + ast_debug(1, "Failed to locally bridge %s to %s, backing out.\n", ast_channel_name(c0), ast_channel_name(c1)); ast_channel_unlock(c0); ast_channel_unlock(c1); return AST_BRIDGE_FAILED_NOWARN; } if (instance1->engine->local_bridge && instance1->engine->local_bridge(instance1, instance0)) { - ast_debug(1, "Failed to locally bridge %s to %s, backing out.\n", c1->name, c0->name); + ast_debug(1, "Failed to locally bridge %s to %s, backing out.\n", ast_channel_name(c1), ast_channel_name(c0)); if (instance0->engine->local_bridge) { instance0->engine->local_bridge(instance0, NULL); } @@ -929,7 +929,7 @@ static enum ast_bridge_result local_bridge_loop(struct ast_channel *c0, struct a } else { *fo = fr; *rc = who; - ast_debug(1, "rtp-engine-local-bridge: Got a FRAME_CONTROL (%d) frame on channel %s\n", fr->subclass.integer, who->name); + ast_debug(1, "rtp-engine-local-bridge: Got a FRAME_CONTROL (%d) frame on channel %s\n", fr->subclass.integer, ast_channel_name(who)); res = AST_BRIDGE_COMPLETE; break; } @@ -1011,7 +1011,7 @@ static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0, ast_rtp_instance_get_remote_address(tinstance1, &tac1); } } else { - ast_log(LOG_WARNING, "Channel '%s' failed to talk to '%s'\n", c0->name, c1->name); + ast_log(LOG_WARNING, "Channel '%s' failed to talk to '%s'\n", ast_channel_name(c0), ast_channel_name(c1)); } /* Test the second channel */ @@ -1024,7 +1024,7 @@ static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0, ast_rtp_instance_get_remote_address(instance0, &tac0); } } else { - ast_log(LOG_WARNING, "Channel '%s' failed to talk to '%s'\n", c1->name, c0->name); + ast_log(LOG_WARNING, "Channel '%s' failed to talk to '%s'\n", ast_channel_name(c1), ast_channel_name(c0)); } ast_channel_unlock(c0); @@ -1082,29 +1082,29 @@ static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0, (!ast_format_cap_identical(cap1, oldcap1))) { char tmp_buf[512] = { 0, }; ast_debug(1, "Oooh, '%s' changed end address to %s (format %s)\n", - c1->name, ast_sockaddr_stringify(&t1), + ast_channel_name(c1), ast_sockaddr_stringify(&t1), ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), cap1)); ast_debug(1, "Oooh, '%s' changed end vaddress to %s (format %s)\n", - c1->name, ast_sockaddr_stringify(&vt1), + ast_channel_name(c1), ast_sockaddr_stringify(&vt1), ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), cap1)); ast_debug(1, "Oooh, '%s' changed end taddress to %s (format %s)\n", - c1->name, ast_sockaddr_stringify(&tt1), + ast_channel_name(c1), ast_sockaddr_stringify(&tt1), ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), cap1)); ast_debug(1, "Oooh, '%s' was %s/(format %s)\n", - c1->name, ast_sockaddr_stringify(&ac1), + ast_channel_name(c1), ast_sockaddr_stringify(&ac1), ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), oldcap1)); ast_debug(1, "Oooh, '%s' was %s/(format %s)\n", - c1->name, ast_sockaddr_stringify(&vac1), + ast_channel_name(c1), ast_sockaddr_stringify(&vac1), ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), oldcap1)); ast_debug(1, "Oooh, '%s' was %s/(format %s)\n", - c1->name, ast_sockaddr_stringify(&tac1), + ast_channel_name(c1), ast_sockaddr_stringify(&tac1), ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), oldcap1)); if (glue0->update_peer(c0, ast_sockaddr_isnull(&t1) ? NULL : instance1, ast_sockaddr_isnull(&vt1) ? NULL : vinstance1, ast_sockaddr_isnull(&tt1) ? NULL : tinstance1, cap1, 0)) { - ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", c0->name, c1->name); + ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", ast_channel_name(c0), ast_channel_name(c1)); } ast_sockaddr_copy(&ac1, &t1); ast_sockaddr_copy(&vac1, &vt1); @@ -1117,16 +1117,16 @@ static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0, (!ast_format_cap_identical(cap0, oldcap0))) { char tmp_buf[512] = { 0, }; ast_debug(1, "Oooh, '%s' changed end address to %s (format %s)\n", - c0->name, ast_sockaddr_stringify(&t0), + ast_channel_name(c0), ast_sockaddr_stringify(&t0), ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), cap0)); ast_debug(1, "Oooh, '%s' was %s/(format %s)\n", - c0->name, ast_sockaddr_stringify(&ac0), + ast_channel_name(c0), ast_sockaddr_stringify(&ac0), ast_getformatname_multiple(tmp_buf, sizeof(tmp_buf), oldcap0)); if (glue1->update_peer(c1, t0.len ? instance0 : NULL, vt0.len ? vinstance0 : NULL, tt0.len ? tinstance0 : NULL, cap0, 0)) { - ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", c1->name, c0->name); + ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", ast_channel_name(c1), ast_channel_name(c0)); } ast_sockaddr_copy(&ac0, &t0); ast_sockaddr_copy(&vac0, &vt0); @@ -1218,7 +1218,7 @@ static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0, } else { *fo = fr; *rc = who; - ast_debug(1, "Got a FRAME_CONTROL (%d) frame on channel %s\n", fr->subclass.integer, who->name); + ast_debug(1, "Got a FRAME_CONTROL (%d) frame on channel %s\n", fr->subclass.integer, ast_channel_name(who)); res = AST_BRIDGE_COMPLETE; goto remote_bridge_cleanup; } @@ -1242,22 +1242,22 @@ static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0, } if (ast_test_flag(c0, AST_FLAG_ZOMBIE)) { - ast_debug(1, "Channel '%s' Zombie cleardown from bridge\n", c0->name); + ast_debug(1, "Channel '%s' Zombie cleardown from bridge\n", ast_channel_name(c0)); } else if (c0->tech_pvt != pvt0) { - ast_debug(1, "Channel c0->'%s' pvt changed, in bridge with c1->'%s'\n", c0->name, c1->name); + ast_debug(1, "Channel c0->'%s' pvt changed, in bridge with c1->'%s'\n", ast_channel_name(c0), ast_channel_name(c1)); } else if (glue0 != ast_rtp_instance_get_glue(c0->tech->type)) { - ast_debug(1, "Channel c0->'%s' technology changed, in bridge with c1->'%s'\n", c0->name, c1->name); + ast_debug(1, "Channel c0->'%s' technology changed, in bridge with c1->'%s'\n", ast_channel_name(c0), ast_channel_name(c1)); } else if (glue0->update_peer(c0, NULL, NULL, NULL, 0, 0)) { - ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", c0->name); + ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", ast_channel_name(c0)); } if (ast_test_flag(c1, AST_FLAG_ZOMBIE)) { - ast_debug(1, "Channel '%s' Zombie cleardown from bridge\n", c1->name); + ast_debug(1, "Channel '%s' Zombie cleardown from bridge\n", ast_channel_name(c1)); } else if (c1->tech_pvt != pvt1) { - ast_debug(1, "Channel c1->'%s' pvt changed, in bridge with c0->'%s'\n", c1->name, c0->name); + ast_debug(1, "Channel c1->'%s' pvt changed, in bridge with c0->'%s'\n", ast_channel_name(c1), ast_channel_name(c0)); } else if (glue1 != ast_rtp_instance_get_glue(c1->tech->type)) { - ast_debug(1, "Channel c1->'%s' technology changed, in bridge with c0->'%s'\n", c1->name, c0->name); + ast_debug(1, "Channel c1->'%s' technology changed, in bridge with c0->'%s'\n", ast_channel_name(c1), ast_channel_name(c0)); } else if (glue1->update_peer(c1, NULL, NULL, NULL, 0, 0)) { - ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", c1->name); + ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", ast_channel_name(c1)); } instance0->bridged = NULL; @@ -1313,13 +1313,13 @@ enum ast_bridge_result ast_rtp_instance_bridge(struct ast_channel *c0, struct as /* Ensure neither channel got hungup during lock avoidance */ if (ast_check_hangup(c0) || ast_check_hangup(c1)) { - ast_log(LOG_WARNING, "Got hangup while attempting to bridge '%s' and '%s'\n", c0->name, c1->name); + ast_log(LOG_WARNING, "Got hangup while attempting to bridge '%s' and '%s'\n", ast_channel_name(c0), ast_channel_name(c1)); goto done; } /* Grab glue that binds each channel to something using the RTP engine */ if (!(glue0 = ast_rtp_instance_get_glue(c0->tech->type)) || !(glue1 = ast_rtp_instance_get_glue(c1->tech->type))) { - ast_debug(1, "Can't find native functions for channel '%s'\n", glue0 ? c1->name : c0->name); + ast_debug(1, "Can't find native functions for channel '%s'\n", glue0 ? ast_channel_name(c1) : ast_channel_name(c0)); goto done; } @@ -1396,10 +1396,10 @@ enum ast_bridge_result ast_rtp_instance_bridge(struct ast_channel *c0, struct as /* Depending on the end result for bridging either do a local bridge or remote bridge */ if (audio_glue0_res == AST_RTP_GLUE_RESULT_LOCAL || audio_glue1_res == AST_RTP_GLUE_RESULT_LOCAL) { - ast_verb(3, "Locally bridging %s and %s\n", c0->name, c1->name); + ast_verb(3, "Locally bridging %s and %s\n", ast_channel_name(c0), ast_channel_name(c1)); res = local_bridge_loop(c0, c1, instance0, instance1, timeoutms, flags, fo, rc, c0->tech_pvt, c1->tech_pvt); } else { - ast_verb(3, "Remotely bridging %s and %s\n", c0->name, c1->name); + ast_verb(3, "Remotely bridging %s and %s\n", ast_channel_name(c0), ast_channel_name(c1)); res = remote_bridge_loop(c0, c1, instance0, instance1, vinstance0, vinstance1, tinstance0, tinstance1, glue0, glue1, cap0, cap1, timeoutms, flags, fo, rc, c0->tech_pvt, c1->tech_pvt); @@ -1461,7 +1461,7 @@ void ast_rtp_instance_early_bridge_make_compatible(struct ast_channel *c0, struc /* Grab glue that binds each channel to something using the RTP engine */ if (!(glue0 = ast_rtp_instance_get_glue(c0->tech->type)) || !(glue1 = ast_rtp_instance_get_glue(c1->tech->type))) { - ast_debug(1, "Can't find native functions for channel '%s'\n", glue0 ? c1->name : c0->name); + ast_debug(1, "Can't find native functions for channel '%s'\n", glue0 ? ast_channel_name(c1) : ast_channel_name(c0)); goto done; } @@ -1521,7 +1521,7 @@ done: unref_instance_cond(&tinstance1); if (!res) { - ast_debug(1, "Seeded SDP of '%s' with that of '%s'\n", c0->name, c1 ? c1->name : "<unspecified>"); + ast_debug(1, "Seeded SDP of '%s' with that of '%s'\n", ast_channel_name(c0), c1 ? ast_channel_name(c1) : "<unspecified>"); } } @@ -1558,7 +1558,7 @@ int ast_rtp_instance_early_bridge(struct ast_channel *c0, struct ast_channel *c1 /* Grab glue that binds each channel to something using the RTP engine */ if (!(glue0 = ast_rtp_instance_get_glue(c0->tech->type)) || !(glue1 = ast_rtp_instance_get_glue(c1->tech->type))) { - ast_log(LOG_WARNING, "Can't find native functions for channel '%s'\n", glue0 ? c1->name : c0->name); + ast_log(LOG_WARNING, "Can't find native functions for channel '%s'\n", glue0 ? ast_channel_name(c1) : ast_channel_name(c0)); goto done; } @@ -1594,7 +1594,7 @@ int ast_rtp_instance_early_bridge(struct ast_channel *c0, struct ast_channel *c1 /* Bridge media early */ if (glue0->update_peer(c0, instance1, vinstance1, tinstance1, cap1, 0)) { - ast_log(LOG_WARNING, "Channel '%s' failed to setup early bridge to '%s'\n", c0->name, c1 ? c1->name : "<unspecified>"); + ast_log(LOG_WARNING, "Channel '%s' failed to setup early bridge to '%s'\n", ast_channel_name(c0), c1 ? ast_channel_name(c1) : "<unspecified>"); } res = 0; @@ -1614,7 +1614,7 @@ done: unref_instance_cond(&tinstance1); if (!res) { - ast_debug(1, "Setting early bridge SDP of '%s' with that of '%s'\n", c0->name, c1 ? c1->name : "<unspecified>"); + ast_debug(1, "Setting early bridge SDP of '%s' with that of '%s'\n", ast_channel_name(c0), c1 ? ast_channel_name(c1) : "<unspecified>"); } return res; diff --git a/main/say.c b/main/say.c index f5d8f8bd9..dbeb8ba9c 100644 --- a/main/say.c +++ b/main/say.c @@ -434,7 +434,7 @@ static int wait_file(struct ast_channel *chan, const char *ints, const char *fil \note Called from AGI */ static int say_number_full(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd) { - ast_test_suite_event_notify("SAYNUM", "Message: saying number %d\r\nNumber: %d\r\nChannel: %s", num, num, chan->name); + ast_test_suite_event_notify("SAYNUM", "Message: saying number %d\r\nNumber: %d\r\nChannel: %s", num, num, ast_channel_name(chan)); if (!strncasecmp(language, "en_GB", 5)) { /* British syntax */ return ast_say_number_full_en_GB(chan, num, ints, language, audiofd, ctrlfd); } else if (!strncasecmp(language, "en", 2)) { /* English syntax */ diff --git a/main/udptl.c b/main/udptl.c index 3fc5b5b9e..943cd286a 100644 --- a/main/udptl.c +++ b/main/udptl.c @@ -1158,13 +1158,13 @@ int ast_udptl_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, pr0 = get_proto(c0); pr1 = get_proto(c1); if (!pr0) { - ast_log(LOG_WARNING, "Can't find native functions for channel '%s'\n", c0->name); + ast_log(LOG_WARNING, "Can't find native functions for channel '%s'\n", ast_channel_name(c0)); ast_channel_unlock(c0); ast_channel_unlock(c1); return -1; } if (!pr1) { - ast_log(LOG_WARNING, "Can't find native functions for channel '%s'\n", c1->name); + ast_log(LOG_WARNING, "Can't find native functions for channel '%s'\n", ast_channel_name(c1)); ast_channel_unlock(c0); ast_channel_unlock(c1); return -1; @@ -1180,14 +1180,14 @@ int ast_udptl_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, return -2; } if (pr0->set_udptl_peer(c0, p1)) { - ast_log(LOG_WARNING, "Channel '%s' failed to talk to '%s'\n", c0->name, c1->name); + ast_log(LOG_WARNING, "Channel '%s' failed to talk to '%s'\n", ast_channel_name(c0), ast_channel_name(c1)); memset(&ac1, 0, sizeof(ac1)); } else { /* Store UDPTL peer */ ast_udptl_get_peer(p1, &ac1); } if (pr1->set_udptl_peer(c1, p0)) { - ast_log(LOG_WARNING, "Channel '%s' failed to talk back to '%s'\n", c1->name, c0->name); + ast_log(LOG_WARNING, "Channel '%s' failed to talk back to '%s'\n", ast_channel_name(c1), ast_channel_name(c0)); memset(&ac0, 0, sizeof(ac0)); } else { /* Store UDPTL peer */ @@ -1211,16 +1211,16 @@ int ast_udptl_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, ast_udptl_get_peer(p0, &t0); if (ast_sockaddr_cmp(&t1, &ac1)) { ast_debug(1, "Oooh, '%s' changed end address to %s\n", - c1->name, ast_sockaddr_stringify(&t1)); + ast_channel_name(c1), ast_sockaddr_stringify(&t1)); ast_debug(1, "Oooh, '%s' was %s\n", - c1->name, ast_sockaddr_stringify(&ac1)); + ast_channel_name(c1), ast_sockaddr_stringify(&ac1)); ast_sockaddr_copy(&ac1, &t1); } if (ast_sockaddr_cmp(&t0, &ac0)) { ast_debug(1, "Oooh, '%s' changed end address to %s\n", - c0->name, ast_sockaddr_stringify(&t0)); + ast_channel_name(c0), ast_sockaddr_stringify(&t0)); ast_debug(1, "Oooh, '%s' was %s\n", - c0->name, ast_sockaddr_stringify(&ac0)); + ast_channel_name(c0), ast_sockaddr_stringify(&ac0)); ast_sockaddr_copy(&ac0, &t0); } who = ast_waitfor_n(cs, 2, &to); diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index 7eafaa501..2b7f71dba 100644 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -3673,7 +3673,7 @@ static int dundi_lookup_internal(struct dundi_result *result, int maxret, struct ast_waitfor_n_fd(dr.pfds, 1, &ms, NULL); } if (chan && ast_check_hangup(chan)) - ast_debug(1, "Hrm, '%s' hungup before their query for %s@%s finished\n", chan->name, dr.number, dr.dcontext); + ast_debug(1, "Hrm, '%s' hungup before their query for %s@%s finished\n", ast_channel_name(chan), dr.number, dr.dcontext); cancel_request(&dr); unregister_request(&dr); res = dr.respcount; diff --git a/pbx/pbx_lua.c b/pbx/pbx_lua.c index 2c1487466..7ddebbb44 100644 --- a/pbx/pbx_lua.c +++ b/pbx/pbx_lua.c @@ -222,7 +222,7 @@ static int lua_pbx_exec(lua_State *L) ast_verb(3, "Executing [%s@%s:%d] %s(\"%s\", \"%s\")\n", exten, context, priority, term_color(tmp, app_name, COLOR_BRCYAN, 0, sizeof(tmp)), - term_color(tmp2, chan->name, COLOR_BRMAGENTA, 0, sizeof(tmp2)), + term_color(tmp2, ast_channel_name(chan), COLOR_BRMAGENTA, 0, sizeof(tmp2)), term_color(tmp3, data, COLOR_BRMAGENTA, 0, sizeof(tmp3))); lua_getfield(L, LUA_REGISTRYINDEX, "autoservice"); @@ -1298,7 +1298,7 @@ static lua_State *lua_get_state(struct ast_channel *chan) if (lua_load_extensions(L, chan)) { const char *error = lua_tostring(L, -1); - ast_log(LOG_ERROR, "Error loading extensions.lua for %s: %s\n", chan->name, error); + ast_log(LOG_ERROR, "Error loading extensions.lua for %s: %s\n", ast_channel_name(chan), error); ast_channel_lock(chan); ast_channel_datastore_remove(chan, datastore); diff --git a/pbx/pbx_realtime.c b/pbx/pbx_realtime.c index e952f8f2f..c3e1556d4 100644 --- a/pbx/pbx_realtime.c +++ b/pbx/pbx_realtime.c @@ -354,7 +354,7 @@ static int realtime_exec(struct ast_channel *chan, const char *context, const ch ast_verb(3, "Executing [%s@%s:%d] %s(\"%s\", \"%s\")\n", chan->exten, chan->context, chan->priority, term_color(tmp1, app, COLOR_BRCYAN, 0, sizeof(tmp1)), - term_color(tmp2, chan->name, COLOR_BRMAGENTA, 0, sizeof(tmp2)), + term_color(tmp2, ast_channel_name(chan), COLOR_BRMAGENTA, 0, sizeof(tmp2)), term_color(tmp3, S_OR(appdata, ""), COLOR_BRMAGENTA, 0, sizeof(tmp3))); manager_event(EVENT_FLAG_DIALPLAN, "Newexten", "Channel: %s\r\n" @@ -364,7 +364,7 @@ static int realtime_exec(struct ast_channel *chan, const char *context, const ch "Application: %s\r\n" "AppData: %s\r\n" "Uniqueid: %s\r\n", - chan->name, chan->context, chan->exten, chan->priority, app, !ast_strlen_zero(appdata) ? appdata : "(NULL)", chan->uniqueid); + ast_channel_name(chan), chan->context, chan->exten, chan->priority, app, !ast_strlen_zero(appdata) ? appdata : "(NULL)", chan->uniqueid); res = pbx_exec(chan, a, appdata); } else diff --git a/res/res_adsi.c b/res/res_adsi.c index 778752495..327ab130d 100644 --- a/res/res_adsi.c +++ b/res/res_adsi.c @@ -282,7 +282,7 @@ static int __adsi_transmit_messages(struct ast_channel *chan, unsigned char **ms #endif while ((x < 6) && msg[x]) { if ((res = adsi_generate(buf + pos, msgtype[x], msg[x], msglen[x], x+1 - start, (x == 5) || !msg[x+1], ast_format_set(&tmpfmt, AST_FORMAT_ULAW,0))) < 0) { - ast_log(LOG_WARNING, "Failed to generate ADSI message %d on channel %s\n", x + 1, chan->name); + ast_log(LOG_WARNING, "Failed to generate ADSI message %d on channel %s\n", x + 1, ast_channel_name(chan)); return -1; } ast_debug(1, "Message %d, of %d input bytes, %d output bytes\n", x + 1, msglen[x], res); diff --git a/res/res_agi.c b/res/res_agi.c index 1809c6d5a..a5cd5ecc8 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -956,7 +956,7 @@ int AST_OPTIONAL_API_NAME(ast_agi_send)(int fd, struct ast_channel *chan, char * if (agidebug) { if (chan) { - ast_verbose("<%s>AGI Tx >> %s", chan->name, ast_str_buffer(buf)); + ast_verbose("<%s>AGI Tx >> %s", ast_channel_name(chan), ast_str_buffer(buf)); } else { ast_verbose("AGI Tx >> %s", ast_str_buffer(buf)); } @@ -1010,7 +1010,7 @@ static struct agi_cmd *get_agi_cmd(struct ast_channel *chan) ast_channel_unlock(chan); if (!store) { ast_log(LOG_ERROR, "Huh? Async AGI datastore disappeared on Channel %s!\n", - chan->name); + ast_channel_name(chan)); return NULL; } agi_commands = store->data; @@ -1029,7 +1029,7 @@ static int add_agi_cmd(struct ast_channel *chan, const char *cmd_buff, const cha store = ast_channel_datastore_find(chan, &agi_commands_datastore_info, NULL); if (!store) { - ast_log(LOG_WARNING, "Channel %s is not setup for Async AGI.\n", chan->name); + ast_log(LOG_WARNING, "Channel %s is not setup for Async AGI.\n", ast_channel_name(chan)); return -1; } agi_commands = store->data; @@ -1125,13 +1125,13 @@ static char *handle_cli_agi_add_cmd(struct ast_cli_entry *e, int cmd, struct ast ast_channel_lock(chan); if (add_agi_cmd(chan, a->argv[3], (a->argc > 4 ? a->argv[4] : ""))) { - ast_cli(a->fd, "Failed to add AGI command to queue of channel %s\n", chan->name); + ast_cli(a->fd, "Failed to add AGI command to queue of channel %s\n", ast_channel_name(chan)); ast_channel_unlock(chan); chan = ast_channel_unref(chan); return CLI_FAILURE; } - ast_debug(1, "Added AGI command to channel %s queue\n", chan->name); + ast_debug(1, "Added AGI command to channel %s queue\n", ast_channel_name(chan)); ast_channel_unlock(chan); chan = ast_channel_unref(chan); @@ -1172,7 +1172,7 @@ static int action_add_agi_cmd(struct mansession *s, const struct message *m) ast_channel_lock(chan); if (add_agi_cmd(chan, cmdbuff, cmdid)) { - snprintf(buf, sizeof(buf), "Failed to add AGI command to channel %s queue", chan->name); + snprintf(buf, sizeof(buf), "Failed to add AGI command to channel %s queue", ast_channel_name(chan)); astman_send_error(s, m, buf); ast_channel_unlock(chan); chan = ast_channel_unref(chan); @@ -1206,7 +1206,7 @@ static enum agi_result async_agi_read_frame(struct ast_channel *chan) f = ast_read(chan); if (!f) { - ast_debug(3, "No frame read on channel %s, going out ...\n", chan->name); + ast_debug(3, "No frame read on channel %s, going out ...\n", ast_channel_name(chan)); return AGI_RESULT_HANGUP; } if (f->frametype == AST_FRAME_CONTROL) { @@ -1216,7 +1216,7 @@ static enum agi_result async_agi_read_frame(struct ast_channel *chan) */ switch (f->subclass.integer) { case AST_CONTROL_HANGUP: - ast_debug(3, "Got HANGUP frame on channel %s, going out ...\n", chan->name); + ast_debug(3, "Got HANGUP frame on channel %s, going out ...\n", ast_channel_name(chan)); ast_frfree(f); return AGI_RESULT_HANGUP; default: @@ -1267,7 +1267,7 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i /* add AsyncAGI datastore to the channel */ if (add_to_agi(chan)) { - ast_log(LOG_ERROR, "Failed to start Async AGI on channel %s\n", chan->name); + ast_log(LOG_ERROR, "Failed to start Async AGI on channel %s\n", ast_channel_name(chan)); return AGI_RESULT_FAILURE; } @@ -1299,7 +1299,7 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i res = read(fds[0], agi_buffer, AGI_BUF_SIZE); if (!res) { ast_log(LOG_ERROR, "Failed to read from Async AGI pipe on channel %s\n", - chan->name); + ast_channel_name(chan)); returnstatus = AGI_RESULT_FAILURE; goto async_agi_abort; } @@ -1311,7 +1311,7 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i manager_event(EVENT_FLAG_AGI, "AsyncAGI", "SubEvent: Start\r\n" "Channel: %s\r\n" - "Env: %s\r\n", chan->name, ami_buffer); + "Env: %s\r\n", ast_channel_name(chan), ami_buffer); hungup = ast_check_hangup(chan); for (;;) { /* @@ -1329,7 +1329,7 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i res = read(fds[0], agi_buffer, AGI_BUF_SIZE); if (!res) { ast_log(LOG_ERROR, "Failed to read from Async AGI pipe on channel %s\n", - chan->name); + ast_channel_name(chan)); free_agi_cmd(cmd); returnstatus = AGI_RESULT_FAILURE; goto async_agi_done; @@ -1345,13 +1345,13 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i manager_event(EVENT_FLAG_AGI, "AsyncAGI", "SubEvent: Exec\r\n" "Channel: %s\r\n" - "Result: %s\r\n", chan->name, ami_buffer); + "Result: %s\r\n", ast_channel_name(chan), ami_buffer); } else { manager_event(EVENT_FLAG_AGI, "AsyncAGI", "SubEvent: Exec\r\n" "Channel: %s\r\n" "CommandID: %s\r\n" - "Result: %s\r\n", chan->name, cmd->cmd_id, ami_buffer); + "Result: %s\r\n", ast_channel_name(chan), cmd->cmd_id, ami_buffer); } free_agi_cmd(cmd); @@ -1381,7 +1381,7 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i /* Wait a bit for a frame to read or to poll for a new command. */ res = ast_waitfor(chan, timeout); if (res < 0) { - ast_debug(1, "ast_waitfor returned <= 0 on chan %s\n", chan->name); + ast_debug(1, "ast_waitfor returned <= 0 on chan %s\n", ast_channel_name(chan)); returnstatus = AGI_RESULT_FAILURE; break; } @@ -1414,7 +1414,7 @@ async_agi_done: controlled anymore by Async AGI */ manager_event(EVENT_FLAG_AGI, "AsyncAGI", "SubEvent: End\r\n" - "Channel: %s\r\n", chan->name); + "Channel: %s\r\n", ast_channel_name(chan)); async_agi_abort: /* close the pipe */ @@ -1721,7 +1721,7 @@ static void setup_env(struct ast_channel *chan, char *request, int fd, int enhan /* Print initial environment, with agi_request always being the first thing */ ast_agi_send(fd, chan, "agi_request: %s\n", request); - ast_agi_send(fd, chan, "agi_channel: %s\n", chan->name); + ast_agi_send(fd, chan, "agi_channel: %s\n", ast_channel_name(chan)); ast_agi_send(fd, chan, "agi_language: %s\n", chan->language); ast_agi_send(fd, chan, "agi_type: %s\n", chan->tech->type); ast_agi_send(fd, chan, "agi_uniqueid: %s\n", chan->uniqueid); @@ -2413,7 +2413,7 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, const if (silence > 0) { res = ast_set_read_format(chan, &rfmt); if (res) - ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", chan->name); + ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", ast_channel_name(chan)); ast_dsp_free(sildet); } @@ -3380,7 +3380,7 @@ static enum agi_result agi_handle_command(struct ast_channel *chan, AGI *agi, ch "SubEvent: Start\r\n" "Channel: %s\r\n" "CommandId: %d\r\n" - "Command: %s\r\n", chan->name, command_id, ami_cmd); + "Command: %s\r\n", ast_channel_name(chan), command_id, ami_cmd); parse_args(buf, &argc, argv); c = find_command(argv, 0); if (c && (!dead || (dead && c->dead))) { @@ -3421,7 +3421,7 @@ static enum agi_result agi_handle_command(struct ast_channel *chan, AGI *agi, ch "CommandId: %d\r\n" "Command: %s\r\n" "ResultCode: %d\r\n" - "Result: %s\r\n", chan->name, command_id, ami_cmd, resultcode, ami_res); + "Result: %s\r\n", ast_channel_name(chan), command_id, ami_cmd, resultcode, ami_res); switch (res) { case RESULT_SHOWUSAGE: if (ast_strlen_zero(c->usage)) { @@ -3448,7 +3448,7 @@ static enum agi_result agi_handle_command(struct ast_channel *chan, AGI *agi, ch "CommandId: %d\r\n" "Command: %s\r\n" "ResultCode: 511\r\n" - "Result: Command not permitted on a dead channel\r\n", chan->name, command_id, ami_cmd); + "Result: Command not permitted on a dead channel\r\n", ast_channel_name(chan), command_id, ami_cmd); } else { ast_agi_send(agi->fd, chan, "510 Invalid or unknown command\n"); manager_event(EVENT_FLAG_AGI, "AGIExec", @@ -3457,7 +3457,7 @@ static enum agi_result agi_handle_command(struct ast_channel *chan, AGI *agi, ch "CommandId: %d\r\n" "Command: %s\r\n" "ResultCode: 510\r\n" - "Result: Invalid or unknown command\r\n", chan->name, command_id, ami_cmd); + "Result: Invalid or unknown command\r\n", ast_channel_name(chan), command_id, ami_cmd); } return AGI_RESULT_SUCCESS; } @@ -3522,7 +3522,7 @@ static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi /* Idle the channel until we get a command */ f = ast_read(c); if (!f) { - ast_debug(1, "%s hungup\n", chan->name); + ast_debug(1, "%s hungup\n", ast_channel_name(chan)); needhup = 1; if (!returnstatus) { returnstatus = AGI_RESULT_HANGUP; @@ -3562,7 +3562,7 @@ static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi if (!buf[0]) { /* Program terminated */ - ast_verb(3, "<%s>AGI Script %s completed, returning %d\n", chan->name, request, returnstatus); + ast_verb(3, "<%s>AGI Script %s completed, returning %d\n", ast_channel_name(chan), request, returnstatus); if (pid > 0) waitpid(pid, status, 0); /* No need to kill the pid anymore, since they closed us */ @@ -3583,7 +3583,7 @@ static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi } if (agidebug) - ast_verbose("<%s>AGI Rx << %s\n", chan->name, buf); + ast_verbose("<%s>AGI Rx << %s\n", ast_channel_name(chan), buf); cmd_status = agi_handle_command(chan, agi, buf, dead); switch (cmd_status) { case AGI_RESULT_FAILURE: @@ -3926,13 +3926,13 @@ static int eagi_exec(struct ast_channel *chan, const char *data) } ast_format_copy(&readformat, &chan->readformat); if (ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR)) { - ast_log(LOG_WARNING, "Unable to set channel '%s' to linear mode\n", chan->name); + ast_log(LOG_WARNING, "Unable to set channel '%s' to linear mode\n", ast_channel_name(chan)); return -1; } res = agi_exec_full(chan, data, 1, 0); if (!res) { if (ast_set_read_format(chan, &readformat)) { - ast_log(LOG_WARNING, "Unable to restore channel '%s' to format %s\n", chan->name, ast_getformatname(&readformat)); + ast_log(LOG_WARNING, "Unable to restore channel '%s' to format %s\n", ast_channel_name(chan), ast_getformatname(&readformat)); } } return res; diff --git a/res/res_calendar.c b/res/res_calendar.c index 604d0b5c4..bc3689e8b 100644 --- a/res/res_calendar.c +++ b/res/res_calendar.c @@ -1279,7 +1279,7 @@ static int calendar_query_result_exec(struct ast_channel *chan, const char *cmd, ast_channel_lock(chan); if (!(datastore = ast_channel_datastore_find(chan, &eventlist_datastore_info, args.id))) { - ast_log(LOG_WARNING, "There is no event notification datastore with id '%s' on '%s'!\n", args.id, chan->name); + ast_log(LOG_WARNING, "There is no event notification datastore with id '%s' on '%s'!\n", args.id, ast_channel_name(chan)); ast_channel_unlock(chan); return -1; } @@ -1647,7 +1647,7 @@ static int calendar_event_read(struct ast_channel *chan, const char *cmd, char * ast_channel_lock(chan); if (!(datastore = ast_channel_datastore_find(chan, &event_notification_datastore, NULL))) { - ast_log(LOG_WARNING, "There is no event notification datastore on '%s'!\n", chan->name); + ast_log(LOG_WARNING, "There is no event notification datastore on '%s'!\n", ast_channel_name(chan)); ast_channel_unlock(chan); return -1; } diff --git a/res/res_fax.c b/res/res_fax.c index e7070fff2..95d46f3bd 100644 --- a/res/res_fax.c +++ b/res/res_fax.c @@ -426,7 +426,7 @@ static struct ast_fax_session_details *find_details(struct ast_channel *chan) return NULL; } if (!(details = datastore->data)) { - ast_log(LOG_WARNING, "Huh? channel '%s' has a FAX datastore without data!\n", chan->name); + ast_log(LOG_WARNING, "Huh? channel '%s' has a FAX datastore without data!\n", ast_channel_name(chan)); ast_channel_unlock(chan); return NULL; } @@ -522,12 +522,12 @@ static struct ast_fax_session_details *find_or_create_details(struct ast_channel } /* channel does not have one so we must create one */ if (!(details = session_details_new())) { - ast_log(LOG_WARNING, "channel '%s' can't get a FAX details structure for the datastore!\n", chan->name); + ast_log(LOG_WARNING, "channel '%s' can't get a FAX details structure for the datastore!\n", ast_channel_name(chan)); return NULL; } if (!(datastore = ast_datastore_alloc(&fax_datastore, NULL))) { ao2_ref(details, -1); - ast_log(LOG_WARNING, "channel '%s' can't get a datastore!\n", chan->name); + ast_log(LOG_WARNING, "channel '%s' can't get a datastore!\n", ast_channel_name(chan)); return NULL; } /* add the datastore to the channel and increment the refcount */ @@ -1003,7 +1003,7 @@ static struct ast_fax_session *fax_session_new(struct ast_fax_session_details *d ast_dsp_set_threshold(s->debug_info->dsp, 128); } - if (!(s->channame = ast_strdup(chan->name))) { + if (!(s->channame = ast_strdup(ast_channel_name(chan)))) { fax_session_release(s, token); ao2_ref(s, -1); return NULL; @@ -1138,7 +1138,7 @@ static int report_fax_status(struct ast_channel *chan, struct ast_fax_session_de "%s%s", (details->caps & AST_FAX_TECH_GATEWAY) ? "gateway" : (details->caps & AST_FAX_TECH_RECEIVE) ? "receive" : "send", status, - chan->name, + ast_channel_name(chan), info.context, info.exten, info.cid, @@ -1190,7 +1190,7 @@ static void set_channel_variables(struct ast_channel *chan, struct ast_fax_sessi #define GENERIC_FAX_EXEC_ERROR(fax, chan, errorstr, reason) \ do { \ - ast_log(LOG_ERROR, "channel '%s' FAX session '%d' failure, reason: '%s' (%s)\n", chan->name, fax->id, reason, errorstr); \ + ast_log(LOG_ERROR, "channel '%s' FAX session '%d' failure, reason: '%s' (%s)\n", ast_channel_name(chan), fax->id, reason, errorstr); \ GENERIC_FAX_EXEC_ERROR_QUIET(fax, chan, errorstr, reason); \ } while (0) @@ -1216,14 +1216,14 @@ static int set_fax_t38_caps(struct ast_channel *chan, struct ast_fax_session_det */ struct ast_control_t38_parameters parameters = { .request_response = AST_T38_REQUEST_PARMS, }; if (ast_indicate_data(chan, AST_CONTROL_T38_PARAMETERS, ¶meters, sizeof(parameters)) != AST_T38_REQUEST_PARMS) { - ast_log(LOG_ERROR, "channel '%s' is in an unsupported T.38 negotiation state, cannot continue.\n", chan->name); + ast_log(LOG_ERROR, "channel '%s' is in an unsupported T.38 negotiation state, cannot continue.\n", ast_channel_name(chan)); return -1; } details->caps |= AST_FAX_TECH_T38; break; } default: - ast_log(LOG_ERROR, "channel '%s' is in an unsupported T.38 negotiation state, cannot continue.\n", chan->name); + ast_log(LOG_ERROR, "channel '%s' is in an unsupported T.38 negotiation state, cannot continue.\n", ast_channel_name(chan)); return -1; } @@ -1236,9 +1236,9 @@ static int disable_t38(struct ast_channel *chan) struct ast_frame *frame = NULL; struct ast_control_t38_parameters t38_parameters = { .request_response = AST_T38_REQUEST_TERMINATE, }; - ast_debug(1, "Shutting down T.38 on %s\n", chan->name); + ast_debug(1, "Shutting down T.38 on %s\n", ast_channel_name(chan)); if (ast_indicate_data(chan, AST_CONTROL_T38_PARAMETERS, &t38_parameters, sizeof(t38_parameters)) != 0) { - ast_debug(1, "error while disabling T.38 on channel '%s'\n", chan->name); + ast_debug(1, "error while disabling T.38 on channel '%s'\n", ast_channel_name(chan)); return -1; } @@ -1248,12 +1248,12 @@ static int disable_t38(struct ast_channel *chan) while (ms > 0) { ms = ast_waitfor(chan, ms); if (ms < 0) { - ast_debug(1, "error while disabling T.38 on channel '%s'\n", chan->name); + ast_debug(1, "error while disabling T.38 on channel '%s'\n", ast_channel_name(chan)); return -1; } if (ms == 0) { /* all done, nothing happened */ - ast_debug(1, "channel '%s' timed-out during T.38 shutdown\n", chan->name); + ast_debug(1, "channel '%s' timed-out during T.38 shutdown\n", ast_channel_name(chan)); break; } @@ -1267,14 +1267,14 @@ static int disable_t38(struct ast_channel *chan) switch (parameters->request_response) { case AST_T38_TERMINATED: - ast_debug(1, "Shut down T.38 on %s\n", chan->name); + ast_debug(1, "Shut down T.38 on %s\n", ast_channel_name(chan)); break; case AST_T38_REFUSED: - ast_log(LOG_WARNING, "channel '%s' refused to disable T.38\n", chan->name); + ast_log(LOG_WARNING, "channel '%s' refused to disable T.38\n", ast_channel_name(chan)); ast_frfree(frame); return -1; default: - ast_log(LOG_ERROR, "channel '%s' failed to disable T.38\n", chan->name); + ast_log(LOG_ERROR, "channel '%s' failed to disable T.38\n", ast_channel_name(chan)); ast_frfree(frame); return -1; } @@ -1333,7 +1333,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det ast_format_set(&expected_framesubclass.format, AST_FORMAT_SLINEAR, 0); ast_format_copy(&orig_write_format, &chan->writeformat); if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) { - ast_log(LOG_ERROR, "channel '%s' failed to set write format to signed linear'.\n", chan->name); + ast_log(LOG_ERROR, "channel '%s' failed to set write format to signed linear'.\n", ast_channel_name(chan)); ao2_lock(faxregistry.container); ao2_unlink(faxregistry.container, fax); ao2_unlock(faxregistry.container); @@ -1343,7 +1343,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det } ast_format_copy(&orig_read_format, &chan->readformat); if (ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) { - ast_log(LOG_ERROR, "channel '%s' failed to set read format to signed linear.\n", chan->name); + ast_log(LOG_ERROR, "channel '%s' failed to set read format to signed linear.\n", ast_channel_name(chan)); ao2_lock(faxregistry.container); ao2_unlink(faxregistry.container, fax); ao2_unlock(faxregistry.container); @@ -1356,7 +1356,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det fax->smoother = NULL; } if (!(fax->smoother = ast_smoother_new(320))) { - ast_log(LOG_WARNING, "Channel '%s' FAX session '%d' failed to obtain a smoother.\n", chan->name, fax->id); + ast_log(LOG_WARNING, "Channel '%s' FAX session '%d' failed to obtain a smoother.\n", ast_channel_name(chan), fax->id); } } else { expected_frametype = AST_FRAME_MODEM; @@ -1380,7 +1380,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det report_fax_status(chan, details, "FAX Transmission In Progress"); - ast_debug(5, "channel %s will wait on FAX fd %d\n", chan->name, fax->fd); + ast_debug(5, "channel %s will wait on FAX fd %d\n", ast_channel_name(chan), fax->fd); /* handle frames for the session */ ms = 1000; @@ -1397,7 +1397,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det * FAX session complete before we exit the application. if needed, * send the FAX stack silence so the modems can finish their session without * any problems */ - ast_debug(1, "Channel '%s' did not return a frame; probably hung up.\n", chan->name); + ast_debug(1, "Channel '%s' did not return a frame; probably hung up.\n", ast_channel_name(chan)); GENERIC_FAX_EXEC_SET_VARS(fax, chan, "HANGUP", "remote channel hungup"); c = NULL; chancount = 0; @@ -1443,7 +1443,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det report_fax_status(chan, details, "T.38 Negotiated"); - ast_verb(3, "Channel '%s' switched to T.38 FAX session '%d'.\n", chan->name, fax->id); + ast_verb(3, "Channel '%s' switched to T.38 FAX session '%d'.\n", ast_channel_name(chan), fax->id); } } else if ((frame->frametype == expected_frametype) && (!memcmp(&frame->subclass, &expected_framesubclass, sizeof(frame->subclass)))) { @@ -1496,7 +1496,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det GENERIC_FAX_EXEC_ERROR(fax, chan, "TIMEOUT", "fax session timed-out"); continue; } else { - ast_log(LOG_WARNING, "something bad happened while channel '%s' was polling.\n", chan->name); + ast_log(LOG_WARNING, "something bad happened while channel '%s' was polling.\n", ast_channel_name(chan)); GENERIC_FAX_EXEC_ERROR(fax, chan, "UNKNOWN", "error polling data"); res = ms; break; @@ -1509,14 +1509,14 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det GENERIC_FAX_EXEC_ERROR(fax, chan, "TIMEOUT", "fax session timed-out"); continue; } else { - ast_log(LOG_WARNING, "channel '%s' timed-out during the FAX transmission.\n", chan->name); + ast_log(LOG_WARNING, "channel '%s' timed-out during the FAX transmission.\n", ast_channel_name(chan)); GENERIC_FAX_EXEC_ERROR(fax, chan, "TIMEOUT", "fax session timed-out"); break; } } } } - ast_debug(3, "channel '%s' - event loop stopped { timeout: %d, ms: %d, res: %d }\n", chan->name, timeout, ms, res); + ast_debug(3, "channel '%s' - event loop stopped { timeout: %d, ms: %d, res: %d }\n", ast_channel_name(chan), timeout, ms, res); set_channel_variables(chan, details); @@ -1558,7 +1558,7 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_ if (ast_channel_get_t38_state(chan) != T38_STATE_NEGOTIATING) { /* generate 3 seconds of CED */ if (ast_playtones_start(chan, 1024, "!2100/3000", 1)) { - ast_log(LOG_ERROR, "error generating CED tone on %s\n", chan->name); + ast_log(LOG_ERROR, "error generating CED tone on %s\n", ast_channel_name(chan)); return -1; } @@ -1566,7 +1566,7 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_ while (ms > 0) { ms = ast_waitfor(chan, ms); if (ms < 0) { - ast_log(LOG_ERROR, "error while generating CED tone on %s\n", chan->name); + ast_log(LOG_ERROR, "error while generating CED tone on %s\n", ast_channel_name(chan)); ast_playtones_stop(chan); return -1; } @@ -1576,7 +1576,7 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_ } if (!(frame = ast_read(chan))) { - ast_log(LOG_ERROR, "error reading frame while generating CED tone on %s\n", chan->name); + ast_log(LOG_ERROR, "error reading frame while generating CED tone on %s\n", ast_channel_name(chan)); ast_playtones_stop(chan); return -1; } @@ -1597,7 +1597,7 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_ ast_playtones_stop(chan); break; case AST_T38_NEGOTIATED: - ast_debug(1, "Negotiated T.38 for receive on %s\n", chan->name); + ast_debug(1, "Negotiated T.38 for receive on %s\n", ast_channel_name(chan)); t38_parameters_ast_to_fax(&details->their_t38_parameters, parameters); details->caps &= ~AST_FAX_TECH_AUDIO; report_fax_status(chan, details, "T.38 Negotiated"); @@ -1618,7 +1618,7 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_ } /* request T.38 */ - ast_debug(1, "Negotiating T.38 for receive on %s\n", chan->name); + ast_debug(1, "Negotiating T.38 for receive on %s\n", ast_channel_name(chan)); /* wait up to five seconds for negotiation to complete */ ms = 5000; @@ -1633,18 +1633,18 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_ while (ms > 0) { ms = ast_waitfor(chan, ms); if (ms < 0) { - ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", chan->name); + ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", ast_channel_name(chan)); return -1; } if (ms == 0) { /* all done, nothing happened */ - ast_log(LOG_WARNING, "channel '%s' timed-out during the T.38 negotiation.\n", chan->name); + ast_log(LOG_WARNING, "channel '%s' timed-out during the T.38 negotiation.\n", ast_channel_name(chan)); details->caps &= ~AST_FAX_TECH_T38; break; } if (!(frame = ast_read(chan))) { - ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", chan->name); + ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", ast_channel_name(chan)); return -1; } @@ -1660,19 +1660,19 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_ ast_indicate_data(chan, AST_CONTROL_T38_PARAMETERS, &t38_parameters, sizeof(t38_parameters)); break; case AST_T38_NEGOTIATED: - ast_debug(1, "Negotiated T.38 for receive on %s\n", chan->name); + ast_debug(1, "Negotiated T.38 for receive on %s\n", ast_channel_name(chan)); t38_parameters_ast_to_fax(&details->their_t38_parameters, parameters); details->caps &= ~AST_FAX_TECH_AUDIO; report_fax_status(chan, details, "T.38 Negotiated"); ms = 0; break; case AST_T38_REFUSED: - ast_log(LOG_WARNING, "channel '%s' refused to negotiate T.38\n", chan->name); + ast_log(LOG_WARNING, "channel '%s' refused to negotiate T.38\n", ast_channel_name(chan)); details->caps &= ~AST_FAX_TECH_T38; ms = 0; break; default: - ast_log(LOG_ERROR, "channel '%s' failed to negotiate T.38\n", chan->name); + ast_log(LOG_ERROR, "channel '%s' failed to negotiate T.38\n", ast_channel_name(chan)); details->caps &= ~AST_FAX_TECH_T38; ms = 0; break; @@ -1688,7 +1688,7 @@ static int receivefax_t38_init(struct ast_channel *chan, struct ast_fax_session_ /* if we made it here, then T.38 failed, check the 'f' flag */ if (details->option.allow_audio != AST_FAX_OPTFLAG_TRUE) { - ast_log(LOG_WARNING, "Audio FAX not allowed on channel '%s' and T.38 negotiation failed; aborting.\n", chan->name); + ast_log(LOG_WARNING, "Audio FAX not allowed on channel '%s' and T.38 negotiation failed; aborting.\n", ast_channel_name(chan)); return -1; } @@ -1828,7 +1828,7 @@ static int receivefax_exec(struct ast_channel *chan, const char *data) strcpy(doc->filename, args.filename); AST_LIST_INSERT_TAIL(&details->documents, doc, next); - ast_verb(3, "Channel '%s' receiving FAX '%s'\n", chan->name, args.filename); + ast_verb(3, "Channel '%s' receiving FAX '%s'\n", ast_channel_name(chan), args.filename); details->caps = AST_FAX_TECH_RECEIVE; @@ -1862,7 +1862,7 @@ static int receivefax_exec(struct ast_channel *chan, const char *data) if (ast_answer(chan)) { ast_string_field_set(details, resultstr, "error answering channel"); set_channel_variables(chan, details); - ast_log(LOG_WARNING, "Channel '%s' failed answer attempt.\n", chan->name); + ast_log(LOG_WARNING, "Channel '%s' failed answer attempt.\n", ast_channel_name(chan)); fax_session_release(s, token); ao2_ref(s, -1); ao2_ref(details, -1); @@ -1892,7 +1892,7 @@ static int receivefax_exec(struct ast_channel *chan, const char *data) fax_session_release(s, token); ao2_ref(s, -1); ao2_ref(details, -1); - ast_log(LOG_ERROR, "error initializing channel '%s' in T.38 mode\n", chan->name); + ast_log(LOG_ERROR, "error initializing channel '%s' in T.38 mode\n", ast_channel_name(chan)); return -1; } } else { @@ -1905,7 +1905,7 @@ static int receivefax_exec(struct ast_channel *chan, const char *data) if (ast_channel_get_t38_state(chan) == T38_STATE_NEGOTIATED) { if (disable_t38(chan)) { - ast_debug(1, "error disabling T.38 mode on %s\n", chan->name); + ast_debug(1, "error disabling T.38 mode on %s\n", ast_channel_name(chan)); } } @@ -1925,7 +1925,7 @@ static int receivefax_exec(struct ast_channel *chan, const char *data) "Resolution: %s\r\n" "TransferRate: %s\r\n" "FileName: %s\r\n", - chan->name, + ast_channel_name(chan), info.context, info.exten, info.cid, @@ -1961,7 +1961,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det /* don't send any audio if we've already received a T.38 reinvite */ if (ast_channel_get_t38_state(chan) != T38_STATE_NEGOTIATING) { if (ast_playtones_start(chan, 1024, "!1100/500,!0/3000,!1100/500,!0/3000,!1100/500,!0/3000", 1)) { - ast_log(LOG_ERROR, "error generating CNG tone on %s\n", chan->name); + ast_log(LOG_ERROR, "error generating CNG tone on %s\n", ast_channel_name(chan)); return -1; } } @@ -1969,7 +1969,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det while (ms > 0) { ms = ast_waitfor(chan, ms); if (ms < 0) { - ast_log(LOG_ERROR, "error while generating CNG tone on %s\n", chan->name); + ast_log(LOG_ERROR, "error while generating CNG tone on %s\n", ast_channel_name(chan)); ast_playtones_stop(chan); return -1; } @@ -1979,7 +1979,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det } if (!(frame = ast_read(chan))) { - ast_log(LOG_ERROR, "error reading frame while generating CNG tone on %s\n", chan->name); + ast_log(LOG_ERROR, "error reading frame while generating CNG tone on %s\n", ast_channel_name(chan)); ast_playtones_stop(chan); return -1; } @@ -2000,7 +2000,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det ast_playtones_stop(chan); break; case AST_T38_NEGOTIATED: - ast_debug(1, "Negotiated T.38 for send on %s\n", chan->name); + ast_debug(1, "Negotiated T.38 for send on %s\n", ast_channel_name(chan)); t38_parameters_ast_to_fax(&details->their_t38_parameters, parameters); details->caps &= ~AST_FAX_TECH_AUDIO; report_fax_status(chan, details, "T.38 Negotiated"); @@ -2021,7 +2021,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det /* T.38 negotiation did not happen, initiate a switch if requested */ if (details->option.request_t38 == AST_FAX_OPTFLAG_TRUE) { - ast_debug(1, "Negotiating T.38 for send on %s\n", chan->name); + ast_debug(1, "Negotiating T.38 for send on %s\n", ast_channel_name(chan)); /* wait up to five seconds for negotiation to complete */ ms = 5000; @@ -2036,18 +2036,18 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det while (ms > 0) { ms = ast_waitfor(chan, ms); if (ms < 0) { - ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", chan->name); + ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", ast_channel_name(chan)); return -1; } if (ms == 0) { /* all done, nothing happened */ - ast_log(LOG_WARNING, "channel '%s' timed-out during the T.38 negotiation.\n", chan->name); + ast_log(LOG_WARNING, "channel '%s' timed-out during the T.38 negotiation.\n", ast_channel_name(chan)); details->caps &= ~AST_FAX_TECH_T38; break; } if (!(frame = ast_read(chan))) { - ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", chan->name); + ast_log(LOG_WARNING, "error on '%s' while waiting for T.38 negotiation.\n", ast_channel_name(chan)); return -1; } @@ -2063,19 +2063,19 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det ast_indicate_data(chan, AST_CONTROL_T38_PARAMETERS, &t38_parameters, sizeof(t38_parameters)); break; case AST_T38_NEGOTIATED: - ast_debug(1, "Negotiated T.38 for receive on %s\n", chan->name); + ast_debug(1, "Negotiated T.38 for receive on %s\n", ast_channel_name(chan)); t38_parameters_ast_to_fax(&details->their_t38_parameters, parameters); details->caps &= ~AST_FAX_TECH_AUDIO; report_fax_status(chan, details, "T.38 Negotiated"); ms = 0; break; case AST_T38_REFUSED: - ast_log(LOG_WARNING, "channel '%s' refused to negotiate T.38\n", chan->name); + ast_log(LOG_WARNING, "channel '%s' refused to negotiate T.38\n", ast_channel_name(chan)); details->caps &= ~AST_FAX_TECH_T38; ms = 0; break; default: - ast_log(LOG_ERROR, "channel '%s' failed to negotiate T.38\n", chan->name); + ast_log(LOG_ERROR, "channel '%s' failed to negotiate T.38\n", ast_channel_name(chan)); details->caps &= ~AST_FAX_TECH_T38; ms = 0; break; @@ -2093,7 +2093,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det * carriers if we are going to fall back to audio mode */ if (details->option.allow_audio == AST_FAX_OPTFLAG_TRUE) { if (ast_playtones_start(chan, 1024, "!1100/500,!0/3000", 1)) { - ast_log(LOG_ERROR, "error generating second CNG tone on %s\n", chan->name); + ast_log(LOG_ERROR, "error generating second CNG tone on %s\n", ast_channel_name(chan)); return -1; } @@ -2101,7 +2101,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det while (ms > 0) { ms = ast_waitfor(chan, ms); if (ms < 0) { - ast_log(LOG_ERROR, "error while generating second CNG tone on %s\n", chan->name); + ast_log(LOG_ERROR, "error while generating second CNG tone on %s\n", ast_channel_name(chan)); ast_playtones_stop(chan); return -1; } @@ -2111,7 +2111,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det } if (!(frame = ast_read(chan))) { - ast_log(LOG_ERROR, "error reading frame while generating second CNG tone on %s\n", chan->name); + ast_log(LOG_ERROR, "error reading frame while generating second CNG tone on %s\n", ast_channel_name(chan)); ast_playtones_stop(chan); return -1; } @@ -2132,7 +2132,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det ast_playtones_stop(chan); break; case AST_T38_NEGOTIATED: - ast_debug(1, "Negotiated T.38 for send on %s\n", chan->name); + ast_debug(1, "Negotiated T.38 for send on %s\n", ast_channel_name(chan)); t38_parameters_ast_to_fax(&details->their_t38_parameters, parameters); details->caps &= ~AST_FAX_TECH_AUDIO; report_fax_status(chan, details, "T.38 Negotiated"); @@ -2156,7 +2156,7 @@ static int sendfax_t38_init(struct ast_channel *chan, struct ast_fax_session_det /* if we made it here, then T.38 failed, check the 'f' flag */ if (details->option.allow_audio == AST_FAX_OPTFLAG_FALSE) { - ast_log(LOG_WARNING, "Audio FAX not allowed on channel '%s' and T.38 negotiation failed; aborting.\n", chan->name); + ast_log(LOG_WARNING, "Audio FAX not allowed on channel '%s' and T.38 negotiation failed; aborting.\n", ast_channel_name(chan)); return -1; } @@ -2309,7 +2309,7 @@ static int sendfax_exec(struct ast_channel *chan, const char *data) file_count++; } - ast_verb(3, "Channel '%s' sending FAX:\n", chan->name); + ast_verb(3, "Channel '%s' sending FAX:\n", ast_channel_name(chan)); AST_LIST_TRAVERSE(&details->documents, doc, next) { ast_verb(3, " %s\n", doc->filename); } @@ -2354,7 +2354,7 @@ static int sendfax_exec(struct ast_channel *chan, const char *data) if (ast_answer(chan)) { ast_string_field_set(details, resultstr, "error answering channel"); set_channel_variables(chan, details); - ast_log(LOG_WARNING, "Channel '%s' failed answer attempt.\n", chan->name); + ast_log(LOG_WARNING, "Channel '%s' failed answer attempt.\n", ast_channel_name(chan)); fax_session_release(s, token); ao2_ref(s, -1); ao2_ref(details, -1); @@ -2384,7 +2384,7 @@ static int sendfax_exec(struct ast_channel *chan, const char *data) fax_session_release(s, token); ao2_ref(s, -1); ao2_ref(details, -1); - ast_log(LOG_ERROR, "error initializing channel '%s' in T.38 mode\n", chan->name); + ast_log(LOG_ERROR, "error initializing channel '%s' in T.38 mode\n", ast_channel_name(chan)); return -1; } } else { @@ -2397,7 +2397,7 @@ static int sendfax_exec(struct ast_channel *chan, const char *data) if (ast_channel_get_t38_state(chan) == T38_STATE_NEGOTIATED) { if (disable_t38(chan)) { - ast_debug(1, "error disabling T.38 mode on %s\n", chan->name); + ast_debug(1, "error disabling T.38 mode on %s\n", ast_channel_name(chan)); } } @@ -2423,7 +2423,7 @@ static int sendfax_exec(struct ast_channel *chan, const char *data) "Resolution: %s\r\n" "TransferRate: %s\r\n" "%s\r\n", - chan->name, + ast_channel_name(chan), info.context, info.exten, info.cid, @@ -2590,7 +2590,7 @@ static struct ast_frame *fax_gateway_request_t38(struct fax_gateway *gateway, st struct ast_fax_session_details *details = find_details(chan); if (!details) { - ast_log(LOG_ERROR, "no FAX session details found on chan %s for T.38 gateway session, odd\n", chan->name); + ast_log(LOG_ERROR, "no FAX session details found on chan %s for T.38 gateway session, odd\n", ast_channel_name(chan)); ast_framehook_detach(chan, gateway->framehook); return f; } @@ -2599,7 +2599,7 @@ static struct ast_frame *fax_gateway_request_t38(struct fax_gateway *gateway, st ao2_ref(details, -1); if (!(fp = ast_frisolate(&control_frame))) { - ast_log(LOG_ERROR, "error generating T.38 request control frame on chan %s for T.38 gateway session\n", chan->name); + ast_log(LOG_ERROR, "error generating T.38 request control frame on chan %s for T.38 gateway session\n", ast_channel_name(chan)); return f; } @@ -2607,7 +2607,7 @@ static struct ast_frame *fax_gateway_request_t38(struct fax_gateway *gateway, st gateway->timeout_start = ast_tvnow(); details->gateway_timeout = FAX_GATEWAY_TIMEOUT; - ast_debug(1, "requesting T.38 for gateway session for %s\n", chan->name); + ast_debug(1, "requesting T.38 for gateway session for %s\n", ast_channel_name(chan)); return fp; } @@ -2628,10 +2628,10 @@ static struct ast_frame *fax_gateway_detect_v21(struct fax_gateway *gateway, str if (gateway->detected_v21) { destroy_v21_sessions(gateway); if (ast_channel_get_t38_state(other) == T38_STATE_UNKNOWN) { - ast_debug(1, "detected v21 preamble from %s\n", active->name); + ast_debug(1, "detected v21 preamble from %s\n", ast_channel_name(active)); return fax_gateway_request_t38(gateway, chan, f); } else { - ast_debug(1, "detected v21 preamble on %s, but %s does not support T.38 for T.38 gateway session\n", active->name, other->name); + ast_debug(1, "detected v21 preamble on %s, but %s does not support T.38 for T.38 gateway session\n", ast_channel_name(active), ast_channel_name(other)); } } @@ -2676,7 +2676,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str } if (!(details = find_details(chan))) { - ast_log(LOG_ERROR, "no FAX session details found on chan %s for T.38 gateway session, odd\n", chan->name); + ast_log(LOG_ERROR, "no FAX session details found on chan %s for T.38 gateway session, odd\n", ast_channel_name(chan)); ast_framehook_detach(chan, gateway->framehook); return f; } @@ -2689,7 +2689,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str * other channel appears to support T.38, we'll pass * the request through and only step in if the other * channel rejects the request */ - ast_debug(1, "%s is attempting to negotiate T.38 with %s, we'll see what happens\n", active->name, other->name); + ast_debug(1, "%s is attempting to negotiate T.38 with %s, we'll see what happens\n", ast_channel_name(active), ast_channel_name(other)); t38_parameters_ast_to_fax(&details->their_t38_parameters, control_params); gateway->t38_state = T38_STATE_UNKNOWN; gateway->timeout_start = ast_tvnow(); @@ -2699,14 +2699,14 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str } else if (state == T38_STATE_UNAVAILABLE || state == T38_STATE_REJECTED) { /* the other channel does not support T.38, we need to * step in here */ - ast_debug(1, "%s is attempting to negotiate T.38 but %s does not support it\n", active->name, other->name); - ast_debug(1, "starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", active->name, other->name); + ast_debug(1, "%s is attempting to negotiate T.38 but %s does not support it\n", ast_channel_name(active), ast_channel_name(other)); + ast_debug(1, "starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(active), ast_channel_name(other)); t38_parameters_ast_to_fax(&details->their_t38_parameters, control_params); t38_parameters_fax_to_ast(control_params, &details->our_t38_parameters); if (fax_gateway_start(gateway, details, chan)) { - ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", active->name, other->name); + ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(active), ast_channel_name(other)); gateway->t38_state = T38_STATE_REJECTED; control_params->request_response = AST_T38_REFUSED; @@ -2733,7 +2733,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str gateway->timeout_start = ast_tvnow(); details->gateway_timeout = FAX_GATEWAY_TIMEOUT; - ast_debug(1, "%s is attempting to negotiate T.38 after we already sent a negotiation request based on v21 preamble detection\n", active->name); + ast_debug(1, "%s is attempting to negotiate T.38 after we already sent a negotiation request based on v21 preamble detection\n", ast_channel_name(active)); ao2_ref(details, -1); return &ast_null_frame; } else if (gateway->t38_state == T38_STATE_NEGOTIATED) { @@ -2755,18 +2755,18 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str ast_string_field_set(details, error, "NATIVE_T38"); set_channel_variables(chan, details); - ast_debug(1, "%s is attempting to negotiate T.38 after we already negotiated T.38 with %s, disabling the gateway\n", active->name, other->name); + ast_debug(1, "%s is attempting to negotiate T.38 after we already negotiated T.38 with %s, disabling the gateway\n", ast_channel_name(active), ast_channel_name(other)); ao2_ref(details, -1); return &ast_null_frame; } else { - ast_log(LOG_WARNING, "%s is attempting to negotiate T.38 while %s is in an unsupported state\n", active->name, other->name); + ast_log(LOG_WARNING, "%s is attempting to negotiate T.38 while %s is in an unsupported state\n", ast_channel_name(active), ast_channel_name(other)); ao2_ref(details, -1); return f; } } else if (gateway->t38_state == T38_STATE_NEGOTIATING && control_params->request_response == AST_T38_REFUSED) { - ast_debug(1, "unable to negotiate T.38 on %s for fax gateway\n", active->name); + ast_debug(1, "unable to negotiate T.38 on %s for fax gateway\n", ast_channel_name(active)); /* our request to negotiate T.38 was refused, if the other * channel supports T.38, they might still reinvite and save @@ -2788,12 +2788,12 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str } else if (gateway->t38_state == T38_STATE_NEGOTIATING && control_params->request_response == AST_T38_NEGOTIATED) { - ast_debug(1, "starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", active->name, other->name); + ast_debug(1, "starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(active), ast_channel_name(other)); t38_parameters_ast_to_fax(&details->their_t38_parameters, control_params); if (fax_gateway_start(gateway, details, chan)) { - ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", active->name, other->name); + ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(active), ast_channel_name(other)); gateway->t38_state = T38_STATE_NEGOTIATING; control_params->request_response = AST_T38_REQUEST_TERMINATE; @@ -2809,13 +2809,13 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str /* the other channel refused the request to negotiate T.38, * we'll step in here and pretend the request was accepted */ - ast_debug(1, "%s attempted to negotiate T.38 but %s refused the request\n", other->name, active->name); - ast_debug(1, "starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", other->name, active->name); + ast_debug(1, "%s attempted to negotiate T.38 but %s refused the request\n", ast_channel_name(other), ast_channel_name(active)); + ast_debug(1, "starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(other), ast_channel_name(active)); t38_parameters_fax_to_ast(control_params, &details->our_t38_parameters); if (fax_gateway_start(gateway, details, chan)) { - ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", active->name, other->name); + ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(active), ast_channel_name(other)); gateway->t38_state = T38_STATE_REJECTED; control_params->request_response = AST_T38_REFUSED; @@ -2832,7 +2832,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str /* the channel wishes to end our short relationship, we shall * oblige */ - ast_debug(1, "T.38 channel %s is requesting a shutdown of T.38, disabling the gateway\n", active->name); + ast_debug(1, "T.38 channel %s is requesting a shutdown of T.38, disabling the gateway\n", ast_channel_name(active)); ast_framehook_detach(chan, details->gateway_id); details->gateway_id = -1; @@ -2845,7 +2845,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str ao2_ref(details, -1); return &ast_null_frame; } else if (control_params->request_response == AST_T38_NEGOTIATED) { - ast_debug(1, "T.38 successfully negotiated between %s and %s, no gateway necessary\n", active->name, other->name); + ast_debug(1, "T.38 successfully negotiated between %s and %s, no gateway necessary\n", ast_channel_name(active), ast_channel_name(other)); ast_framehook_detach(chan, details->gateway_id); details->gateway_id = -1; @@ -2858,7 +2858,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str ao2_ref(details, -1); return f; } else if (control_params->request_response == AST_T38_TERMINATED) { - ast_debug(1, "T.38 disabled on channel %s\n", active->name); + ast_debug(1, "T.38 disabled on channel %s\n", ast_channel_name(active)); ast_framehook_detach(chan, details->gateway_id); details->gateway_id = -1; @@ -2917,7 +2917,7 @@ static struct ast_frame *fax_gateway_framehook(struct ast_channel *chan, struct ao2_ref(details, 1); } else { if (!(details = find_details(chan))) { - ast_log(LOG_ERROR, "no FAX session details found on chan %s for T.38 gateway session, odd\n", chan->name); + ast_log(LOG_ERROR, "no FAX session details found on chan %s for T.38 gateway session, odd\n", ast_channel_name(chan)); ast_framehook_detach(chan, gateway->framehook); details->gateway_id = -1; return f; @@ -2963,7 +2963,7 @@ static struct ast_frame *fax_gateway_framehook(struct ast_channel *chan, struct if (!gateway->bridged && peer) { /* don't start a gateway if neither channel can handle T.38 */ if (ast_channel_get_t38_state(chan) == T38_STATE_UNAVAILABLE && ast_channel_get_t38_state(peer) == T38_STATE_UNAVAILABLE) { - ast_debug(1, "not starting gateway for %s and %s; neither channel supports T.38\n", chan->name, peer->name); + ast_debug(1, "not starting gateway for %s and %s; neither channel supports T.38\n", ast_channel_name(chan), ast_channel_name(peer)); ast_framehook_detach(chan, gateway->framehook); details->gateway_id = -1; @@ -2999,7 +2999,7 @@ static struct ast_frame *fax_gateway_framehook(struct ast_channel *chan, struct if (gateway->bridged && !ast_tvzero(gateway->timeout_start)) { if (ast_tvdiff_ms(ast_tvnow(), gateway->timeout_start) > details->gateway_timeout) { - ast_debug(1, "no fax activity between %s and %s after %d ms, disabling gateway\n", chan->name, peer->name, details->gateway_timeout); + ast_debug(1, "no fax activity between %s and %s after %d ms, disabling gateway\n", ast_channel_name(chan), ast_channel_name(peer), details->gateway_timeout); ast_framehook_detach(chan, gateway->framehook); details->gateway_id = -1; @@ -3343,10 +3343,10 @@ static struct ast_frame *fax_detect_framehook(struct ast_channel *chan, struct a S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { ast_channel_lock(chan); ast_verb(2, "Redirecting '%s' to fax extension due to %s detection\n", - chan->name, (result == 'f') ? "CNG" : "T38"); + ast_channel_name(chan), (result == 'f') ? "CNG" : "T38"); pbx_builtin_setvar_helper(chan, "FAXEXTEN", chan->exten); if (ast_async_goto(chan, target_context, "fax", 1)) { - ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", chan->name, target_context); + ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(chan), target_context); } ast_frfree(f); f = &ast_null_frame; @@ -3826,7 +3826,7 @@ static int acf_faxopt_read(struct ast_channel *chan, const char *cmd, char *data char *filenames; if (!details) { - ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s) because it has never been written.\n", chan->name, data); + ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s) because it has never been written.\n", ast_channel_name(chan), data); return -1; } if (!strcasecmp(data, "ecm")) { @@ -3840,20 +3840,20 @@ static int acf_faxopt_read(struct ast_channel *chan, const char *cmd, char *data ast_copy_string(buf, details->error, len); } else if (!strcasecmp(data, "filename")) { if (AST_LIST_EMPTY(&details->documents)) { - ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s) because it has never been written.\n", chan->name, data); + ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s) because it has never been written.\n", ast_channel_name(chan), data); res = -1; } else { ast_copy_string(buf, AST_LIST_FIRST(&details->documents)->filename, len); } } else if (!strcasecmp(data, "filenames")) { if (AST_LIST_EMPTY(&details->documents)) { - ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s) because it has never been written.\n", chan->name, data); + ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s) because it has never been written.\n", ast_channel_name(chan), data); res = -1; } else if ((filenames = generate_filenames_string(details, "", ","))) { ast_copy_string(buf, filenames, len); ast_free(filenames); } else { - ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s), there was an error generating the filenames list.\n", chan->name, data); + ast_log(LOG_ERROR, "channel '%s' can't read FAXOPT(%s), there was an error generating the filenames list.\n", ast_channel_name(chan), data); res = -1; } } else if (!strcasecmp(data, "headerinfo")) { @@ -3881,7 +3881,7 @@ static int acf_faxopt_read(struct ast_channel *chan, const char *cmd, char *data } else if ((!strcasecmp(data, "modem")) || (!strcasecmp(data, "modems"))) { ast_fax_modem_to_str(details->modems, buf, len); } else { - ast_log(LOG_WARNING, "channel '%s' can't read FAXOPT(%s) because it is unhandled!\n", chan->name, data); + ast_log(LOG_WARNING, "channel '%s' can't read FAXOPT(%s) because it is unhandled!\n", ast_channel_name(chan), data); res = -1; } ao2_ref(details, -1); @@ -3896,10 +3896,10 @@ static int acf_faxopt_write(struct ast_channel *chan, const char *cmd, char *dat struct ast_fax_session_details *details; if (!(details = find_or_create_details(chan))) { - ast_log(LOG_WARNING, "channel '%s' can't set FAXOPT(%s) to '%s' because it failed to create a datastore.\n", chan->name, data, value); + ast_log(LOG_WARNING, "channel '%s' can't set FAXOPT(%s) to '%s' because it failed to create a datastore.\n", ast_channel_name(chan), data, value); return -1; } - ast_debug(3, "channel '%s' setting FAXOPT(%s) to '%s'\n", chan->name, data, value); + ast_debug(3, "channel '%s' setting FAXOPT(%s) to '%s'\n", ast_channel_name(chan), data, value); if (!strcasecmp(data, "ecm")) { const char *val = ast_skip_blanks(value); @@ -3933,13 +3933,13 @@ static int acf_faxopt_write(struct ast_channel *chan, const char *cmd, char *dat details->gateway_id = fax_gateway_attach(chan, details); if (details->gateway_id < 0) { - ast_log(LOG_ERROR, "Error attaching T.38 gateway to channel %s.\n", chan->name); + ast_log(LOG_ERROR, "Error attaching T.38 gateway to channel %s.\n", ast_channel_name(chan)); res = -1; } else { - ast_debug(1, "Attached T.38 gateway to channel %s.\n", chan->name); + ast_debug(1, "Attached T.38 gateway to channel %s.\n", ast_channel_name(chan)); } } else { - ast_log(LOG_WARNING, "Attempt to attach a T.38 gateway on channel (%s) with gateway already running.\n", chan->name); + ast_log(LOG_WARNING, "Attempt to attach a T.38 gateway on channel (%s) with gateway already running.\n", ast_channel_name(chan)); } } else if (ast_false(val)) { ast_framehook_detach(chan, details->gateway_id); @@ -3978,13 +3978,13 @@ static int acf_faxopt_write(struct ast_channel *chan, const char *cmd, char *dat faxdetect = fax_detect_attach(chan, fdtimeout, flags); if (faxdetect < 0) { - ast_log(LOG_ERROR, "Error attaching FAX detect to channel %s.\n", chan->name); + ast_log(LOG_ERROR, "Error attaching FAX detect to channel %s.\n", ast_channel_name(chan)); res = -1; } else { - ast_debug(1, "Attached FAX detect to channel %s.\n", chan->name); + ast_debug(1, "Attached FAX detect to channel %s.\n", ast_channel_name(chan)); } } else { - ast_log(LOG_WARNING, "Attempt to attach a FAX detect on channel (%s) with FAX detect already running.\n", chan->name); + ast_log(LOG_WARNING, "Attempt to attach a FAX detect on channel (%s) with FAX detect already running.\n", ast_channel_name(chan)); } } else if (ast_false(val)) { ast_framehook_detach(chan, details->faxdetect_id); @@ -4009,7 +4009,7 @@ static int acf_faxopt_write(struct ast_channel *chan, const char *cmd, char *dat } else if ((!strcasecmp(data, "modem")) || (!strcasecmp(data, "modems"))) { update_modem_bits(&details->modems, value); } else { - ast_log(LOG_WARNING, "channel '%s' set FAXOPT(%s) to '%s' is unhandled!\n", chan->name, data, value); + ast_log(LOG_WARNING, "channel '%s' set FAXOPT(%s) to '%s' is unhandled!\n", ast_channel_name(chan), data, value); res = -1; } diff --git a/res/res_jabber.c b/res/res_jabber.c index f1e9c740c..b808e51ba 100644 --- a/res/res_jabber.c +++ b/res/res_jabber.c @@ -838,7 +838,7 @@ static int acf_jabberreceive_read(struct ast_channel *chan, const char *name, ch start = ast_tvnow(); if (ast_autoservice_start(chan) < 0) { - ast_log(LOG_WARNING, "Cannot start autoservice for channel %s\n", chan->name); + ast_log(LOG_WARNING, "Cannot start autoservice for channel %s\n", ast_channel_name(chan)); ASTOBJ_UNREF(client, ast_aji_client_destroy); return -1; } @@ -910,7 +910,7 @@ static int acf_jabberreceive_read(struct ast_channel *chan, const char *name, ch ASTOBJ_UNREF(client, ast_aji_client_destroy); if (ast_autoservice_stop(chan) < 0) { - ast_log(LOG_WARNING, "Cannot stop autoservice for channel %s\n", chan->name); + ast_log(LOG_WARNING, "Cannot stop autoservice for channel %s\n", ast_channel_name(chan)); } /* return if we timed out */ diff --git a/res/res_monitor.c b/res/res_monitor.c index 9dac05177..c5ecda4e4 100644 --- a/res/res_monitor.c +++ b/res/res_monitor.c @@ -333,7 +333,7 @@ int AST_OPTIONAL_API_NAME(ast_monitor_start)(struct ast_channel *chan, const cha seq++; ast_mutex_unlock(&monitorlock); - channel_name = ast_strdupa(chan->name); + channel_name = ast_strdupa(ast_channel_name(chan)); while ((p = strchr(channel_name, '/'))) { *p = '-'; } @@ -392,10 +392,10 @@ int AST_OPTIONAL_API_NAME(ast_monitor_start)(struct ast_channel *chan, const cha ast_manager_event(chan, EVENT_FLAG_CALL, "MonitorStart", "Channel: %s\r\n" "Uniqueid: %s\r\n", - chan->name, + ast_channel_name(chan), chan->uniqueid); } else { - ast_debug(1,"Cannot start monitoring %s, already monitored\n", chan->name); + ast_debug(1,"Cannot start monitoring %s, already monitored\n", ast_channel_name(chan)); res = -1; } @@ -510,7 +510,7 @@ int AST_OPTIONAL_API_NAME(ast_monitor_stop)(struct ast_channel *chan, int need_l ast_manager_event(chan, EVENT_FLAG_CALL, "MonitorStop", "Channel: %s\r\n" "Uniqueid: %s\r\n", - chan->name, + ast_channel_name(chan), chan->uniqueid ); pbx_builtin_setvar_helper(chan, "MONITORED", NULL); @@ -558,7 +558,7 @@ static int unpause_monitor_exec(struct ast_channel *chan, const char *data) int AST_OPTIONAL_API_NAME(ast_monitor_change_fname)(struct ast_channel *chan, const char *fname_base, int need_lock) { if (ast_strlen_zero(fname_base)) { - ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to null\n", chan->name); + ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to null\n", ast_channel_name(chan)); return -1; } @@ -621,7 +621,7 @@ int AST_OPTIONAL_API_NAME(ast_monitor_change_fname)(struct ast_channel *chan, co ast_copy_string(chan->monitor->filename_base, tmpstring, sizeof(chan->monitor->filename_base)); chan->monitor->filename_changed = 1; } else { - ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to %s, monitoring not started\n", chan->name, fname_base); + ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to %s, monitoring not started\n", ast_channel_name(chan), fname_base); } UNLOCK_IF_NEEDED(chan, need_lock); @@ -759,7 +759,7 @@ static int start_monitor_action(struct mansession *s, const struct message *m) if (ast_strlen_zero(fname)) { /* No filename base specified, default to channel name as per CLI */ ast_channel_lock(c); - fname = ast_strdupa(c->name); + fname = ast_strdupa(ast_channel_name(c)); ast_channel_unlock(c); /* Channels have the format technology/channel_name - have to replace that / */ if ((d = strchr(fname, '/'))) { diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 21a2c97e8..0b04c9d39 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -268,11 +268,11 @@ static void moh_files_release(struct ast_channel *chan, void *data) chan->stream = NULL; } - ast_verb(3, "Stopped music on hold on %s\n", chan->name); + ast_verb(3, "Stopped music on hold on %s\n", ast_channel_name(chan)); ast_format_clear(&state->mohwfmt); /* make sure to clear this format before restoring the original format. */ if (state->origwfmt.id && ast_set_write_format(chan, &state->origwfmt)) { - ast_log(LOG_WARNING, "Unable to restore channel '%s' to format '%s'\n", chan->name, ast_getformatname(&state->origwfmt)); + ast_log(LOG_WARNING, "Unable to restore channel '%s' to format '%s'\n", ast_channel_name(chan), ast_getformatname(&state->origwfmt)); } state->save_pos = state->pos; @@ -338,7 +338,7 @@ static int ast_moh_files_next(struct ast_channel *chan) /* Record the pointer to the filename for position resuming later */ ast_copy_string(state->save_pos_filename, state->class->filearray[state->pos], sizeof(state->save_pos_filename)); - ast_debug(1, "%s Opened file %d '%s'\n", chan->name, state->pos, state->class->filearray[state->pos]); + ast_debug(1, "%s Opened file %d '%s'\n", ast_channel_name(chan), state->pos, state->class->filearray[state->pos]); if (state->samples) { size_t loc; @@ -413,7 +413,7 @@ static int moh_files_generator(struct ast_channel *chan, void *data, int len, in res = ast_write(chan, f); ast_frfree(f); if (res < 0) { - ast_log(LOG_WARNING, "Failed to write frame to '%s': %s\n", chan->name, strerror(errno)); + ast_log(LOG_WARNING, "Failed to write frame to '%s': %s\n", ast_channel_name(chan), strerror(errno)); return -1; } } else { @@ -463,7 +463,7 @@ static void *moh_files_alloc(struct ast_channel *chan, void *params) ast_copy_string(state->name, class->name, sizeof(state->name)); state->save_total = class->total_files; - ast_verb(3, "Started music on hold, class '%s', on %s\n", class->name, chan->name); + ast_verb(3, "Started music on hold, class '%s', on %s\n", class->name, ast_channel_name(chan)); return chan->music_state; } @@ -782,7 +782,7 @@ static int play_moh_exec(struct ast_channel *chan, const char *data) class = S_OR(args.class, NULL); if (ast_moh_start(chan, class, NULL)) { - ast_log(LOG_WARNING, "Unable to start music on hold class '%s' on channel %s\n", class, chan->name); + ast_log(LOG_WARNING, "Unable to start music on hold class '%s' on channel %s\n", class, ast_channel_name(chan)); return 0; } @@ -812,7 +812,7 @@ static int wait_moh_exec(struct ast_channel *chan, const char *data) return -1; } if (ast_moh_start(chan, NULL, NULL)) { - ast_log(LOG_WARNING, "Unable to start music on hold for %d seconds on channel %s\n", atoi(data), chan->name); + ast_log(LOG_WARNING, "Unable to start music on hold for %d seconds on channel %s\n", atoi(data), ast_channel_name(chan)); return 0; } res = ast_safe_sleep(chan, atoi(data) * 1000); @@ -851,7 +851,7 @@ static int start_moh_exec(struct ast_channel *chan, const char *data) class = S_OR(args.class, NULL); if (ast_moh_start(chan, class, NULL)) - ast_log(LOG_WARNING, "Unable to start music on hold class '%s' on channel %s\n", class, chan->name); + ast_log(LOG_WARNING, "Unable to start music on hold class '%s' on channel %s\n", class, ast_channel_name(chan)); return 0; } @@ -948,10 +948,10 @@ static void moh_release(struct ast_channel *chan, void *data) } if (oldwfmt.id && ast_set_write_format(chan, &oldwfmt)) { ast_log(LOG_WARNING, "Unable to restore channel '%s' to format %s\n", - chan->name, ast_getformatname(&oldwfmt)); + ast_channel_name(chan), ast_getformatname(&oldwfmt)); } - ast_verb(3, "Stopped music on hold on %s\n", chan->name); + ast_verb(3, "Stopped music on hold on %s\n", ast_channel_name(chan)); } } @@ -980,13 +980,13 @@ static void *moh_alloc(struct ast_channel *chan, void *params) if ((res = mohalloc(class))) { ast_format_copy(&res->origwfmt, &chan->writeformat); if (ast_set_write_format(chan, &class->format)) { - ast_log(LOG_WARNING, "Unable to set channel '%s' to format '%s'\n", chan->name, ast_codec2str(&class->format)); + ast_log(LOG_WARNING, "Unable to set channel '%s' to format '%s'\n", ast_channel_name(chan), ast_codec2str(&class->format)); moh_release(NULL, res); res = NULL; } else { state->class = mohclass_ref(class, "Placing reference into state container"); } - ast_verb(3, "Started music on hold, class '%s', on channel '%s'\n", class->name, chan->name); + ast_verb(3, "Started music on hold, class '%s', on channel '%s'\n", class->name, ast_channel_name(chan)); } return res; } @@ -1000,7 +1000,7 @@ static int moh_generate(struct ast_channel *chan, void *data, int len, int sampl len = ast_codec_get_len(&moh->parent->format, samples); if (len > sizeof(buf) - AST_FRIENDLY_OFFSET) { - ast_log(LOG_WARNING, "Only doing %d of %d requested bytes on %s\n", (int)sizeof(buf), len, chan->name); + ast_log(LOG_WARNING, "Only doing %d of %d requested bytes on %s\n", (int)sizeof(buf), len, ast_channel_name(chan)); len = sizeof(buf) - AST_FRIENDLY_OFFSET; } res = read(moh->pipe[0], buf + AST_FRIENDLY_OFFSET/2, len); @@ -1012,7 +1012,7 @@ static int moh_generate(struct ast_channel *chan, void *data, int len, int sampl moh->f.samples = ast_codec_get_samples(&moh->f); if (ast_write(chan, &moh->f) < 0) { - ast_log(LOG_WARNING, "Failed to write frame to '%s': %s\n", chan->name, strerror(errno)); + ast_log(LOG_WARNING, "Failed to write frame to '%s': %s\n", ast_channel_name(chan), strerror(errno)); return -1; } @@ -1542,7 +1542,7 @@ static int local_ast_moh_start(struct ast_channel *chan, const char *mclass, con "Channel: %s\r\n" "UniqueID: %s\r\n" "Class: %s\r\n", - chan->name, chan->uniqueid, + ast_channel_name(chan), chan->uniqueid, mohclass->name); ast_set_flag(chan, AST_FLAG_MOH); @@ -1575,7 +1575,7 @@ static void local_ast_moh_stop(struct ast_channel *chan) "State: Stop\r\n" "Channel: %s\r\n" "UniqueID: %s\r\n", - chan->name, chan->uniqueid); + ast_channel_name(chan), chan->uniqueid); ast_channel_unlock(chan); } diff --git a/res/res_mutestream.c b/res/res_mutestream.c index 92d01c7c7..04106656d 100644 --- a/res/res_mutestream.c +++ b/res/res_mutestream.c @@ -191,11 +191,11 @@ static int mute_add_audiohook(struct ast_channel *chan, struct mute_information /* Activate the settings */ ast_channel_datastore_add(chan, datastore); if (ast_audiohook_attach(chan, &mute->audiohook)) { - ast_log(LOG_ERROR, "Failed to attach audiohook for muting channel %s\n", chan->name); + ast_log(LOG_ERROR, "Failed to attach audiohook for muting channel %s\n", ast_channel_name(chan)); return -1; } ast_module_ref(ast_module_info->self); - ast_debug(2, "Initialized audiohook on channel %s\n", chan->name); + ast_debug(2, "Initialized audiohook on channel %s\n", ast_channel_name(chan)); return 0; } diff --git a/res/snmp/agent.c b/res/snmp/agent.c index bd84c1b6b..ff5410d96 100644 --- a/res/snmp/agent.c +++ b/res/snmp/agent.c @@ -268,8 +268,8 @@ static u_char *ast_var_channels_table(struct variable *vp, oid *name, size_t *le ret = (u_char *)&long_ret; break; case ASTCHANNAME: - if (!ast_strlen_zero(chan->name)) { - strncpy(string_ret, chan->name, sizeof(string_ret)); + if (!ast_strlen_zero(ast_channel_name(chan))) { + strncpy(string_ret, ast_channel_name(chan), sizeof(string_ret)); string_ret[sizeof(string_ret) - 1] = '\0'; *var_len = strlen(string_ret); ret = (u_char *)string_ret; @@ -299,23 +299,23 @@ static u_char *ast_var_channels_table(struct variable *vp, oid *name, size_t *le break; case ASTCHANBRIDGE: if ((bridge = ast_bridged_channel(chan)) != NULL) { - strncpy(string_ret, bridge->name, sizeof(string_ret)); + strncpy(string_ret, ast_channel_name(bridge), sizeof(string_ret)); string_ret[sizeof(string_ret) - 1] = '\0'; *var_len = strlen(string_ret); ret = (u_char *)string_ret; } break; case ASTCHANMASQ: - if (chan->masq && !ast_strlen_zero(chan->masq->name)) { - strncpy(string_ret, chan->masq->name, sizeof(string_ret)); + if (chan->masq && !ast_strlen_zero(ast_channel_name(chan->masq))) { + strncpy(string_ret, ast_channel_name(chan->masq), sizeof(string_ret)); string_ret[sizeof(string_ret) - 1] = '\0'; *var_len = strlen(string_ret); ret = (u_char *)string_ret; } break; case ASTCHANMASQR: - if (chan->masqr && !ast_strlen_zero(chan->masqr->name)) { - strncpy(string_ret, chan->masqr->name, sizeof(string_ret)); + if (chan->masqr && !ast_strlen_zero(ast_channel_name(chan->masqr))) { + strncpy(string_ret, ast_channel_name(chan->masqr), sizeof(string_ret)); string_ret[sizeof(string_ret) - 1] = '\0'; *var_len = strlen(string_ret); ret = (u_char *)string_ret; |