Index: include/asterisk/channel.h =================================================================== --- include/asterisk/channel.h (revision 232949) +++ include/asterisk/channel.h (working copy) @@ -738,8 +738,11 @@ * \retval 0 success * \retval non-zero failure */ -int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f); +int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *f, const char *file, int line, const char *function); +#define ast_queue_frame(chan, f) \ + __ast_queue_frame(chan, f, __FILE__, __LINE__, __PRETTY_FUNCTION__) + /*! * \brief Queue one or more frames to the head of a channel's frame queue * @@ -752,8 +755,11 @@ * \retval 0 success * \retval non-zero failure */ -int ast_queue_frame_head(struct ast_channel *chan, struct ast_frame *f); +int __ast_queue_frame_head(struct ast_channel *chan, struct ast_frame *f, const char *file, int line, const char *function); +#define ast_queue_frame_head(chan, f) \ + __ast_queue_frame_head(chan, f, __FILE__, __LINE__, __PRETTY_FUNCTION__) + /*! * \brief Queue a hangup frame * @@ -783,8 +789,11 @@ * \retval zero on success * \retval non-zero on failure */ -int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control); +int __ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control, const char *file, int line, const char *function); +#define ast_queue_control(chan, control) \ + __ast_queue_control(chan, control, __FILE__, __LINE__, __PRETTY_FUNCTION__) + /*! * \brief Queue a control frame with payload * @@ -809,9 +818,12 @@ * * \note The channel does not need to be locked before calling this function. */ -int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control, - const void *data, size_t datalen); +int __ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control, + const void *data, size_t datalen, const char *file, int line, const char *function); +#define ast_queue_control_data(chan, control, data, datalen) \ + __ast_queue_control_data(chan, control, data, datalen, __FILE__, __LINE__, __PRETTY_FUNCTION__) + /*! * \brief Change channel name * Index: main/channel.c =================================================================== --- main/channel.c (revision 232949) +++ main/channel.c (working copy) @@ -982,7 +982,7 @@ return result; } -static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, int head, struct ast_frame *after) +static int __ast_queue_frame_helper(struct ast_channel *chan, struct ast_frame *fin, int head, struct ast_frame *after, const char *file, int line, const char *function) { struct ast_frame *f; struct ast_frame *cur; @@ -995,6 +995,12 @@ ast_channel_lock(chan); + if (ast_strlen_zero(fin->src)) { + int size = strlen(file) + ceil(log10(line)) + strlen(function) + 3; + fin->src = ast_malloc(size); + sprintf((char *) fin->src, "%s %s:%d", function, file, line); + } + /* See if the last frame on the queue is a hangup, if so don't queue anything */ if ((cur = AST_LIST_LAST(&chan->readq)) && (cur->frametype == AST_FRAME_CONTROL) && @@ -1071,14 +1077,14 @@ return 0; } -int ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin) +int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, const char *file, int line, const char *function) { - return __ast_queue_frame(chan, fin, 0, NULL); + return __ast_queue_frame_helper(chan, fin, 0, NULL, file, line, function); } -int ast_queue_frame_head(struct ast_channel *chan, struct ast_frame *fin) +int __ast_queue_frame_head(struct ast_channel *chan, struct ast_frame *fin, const char *file, int line, const char *function) { - return __ast_queue_frame(chan, fin, 1, NULL); + return __ast_queue_frame_helper(chan, fin, 1, NULL, file, line, function); } /*! \brief Queue a hangup frame for channel */ @@ -1114,18 +1120,18 @@ } /*! \brief Queue a control frame */ -int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control) +int __ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control, const char *file, int line, const char *function) { struct ast_frame f = { AST_FRAME_CONTROL, }; f.subclass = control; - return ast_queue_frame(chan, &f); + return __ast_queue_frame(chan, &f, file, line, function); } /*! \brief Queue a control frame with payload */ -int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control, - const void *data, size_t datalen) +int __ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control, + const void *data, size_t datalen, const char *file, int line, const char *function) { struct ast_frame f = { AST_FRAME_CONTROL, }; @@ -1133,7 +1139,7 @@ f.data.ptr = (void *) data; f.datalen = datalen; - return ast_queue_frame(chan, &f); + return __ast_queue_frame(chan, &f, file, line, function); } /*! \brief Set defer DTMF flag on channel */ @@ -2983,7 +2989,7 @@ if (!readq_tail) { ast_queue_frame_head(chan, AST_LIST_NEXT(f, frame_list)); } else { - __ast_queue_frame(chan, AST_LIST_NEXT(f, frame_list), 0, readq_tail); + __ast_queue_frame_helper(chan, AST_LIST_NEXT(f, frame_list), 0, readq_tail, __FILE__, __LINE__, __PRETTY_FUNCTION__); } ast_frfree(AST_LIST_NEXT(f, frame_list)); AST_LIST_NEXT(f, frame_list) = NULL; Index: main/frame.c =================================================================== --- main/frame.c (revision 232949) +++ main/frame.c (working copy) @@ -923,22 +923,24 @@ snprintf(ftype, sizeof(ftype), "Unknown Frametype '%d'", f->frametype); } if (!ast_strlen_zero(moreinfo)) - ast_verbose("%s [ TYPE: %s (%d) SUBCLASS: %s (%d) '%s' ] [%s]\n", + ast_verbose("%s [ TYPE: %s (%d) SUBCLASS: %s (%d) '%s' ] [%s] [src: %s]\n", term_color(cp, prefix, COLOR_BRMAGENTA, COLOR_BLACK, sizeof(cp)), term_color(cft, ftype, COLOR_BRRED, COLOR_BLACK, sizeof(cft)), f->frametype, term_color(csub, subclass, COLOR_BRCYAN, COLOR_BLACK, sizeof(csub)), f->subclass, term_color(cmn, moreinfo, COLOR_BRGREEN, COLOR_BLACK, sizeof(cmn)), - term_color(cn, name, COLOR_YELLOW, COLOR_BLACK, sizeof(cn))); + term_color(cn, name, COLOR_YELLOW, COLOR_BLACK, sizeof(cn)), + f->src); else - ast_verbose("%s [ TYPE: %s (%d) SUBCLASS: %s (%d) ] [%s]\n", + ast_verbose("%s [ TYPE: %s (%d) SUBCLASS: %s (%d) ] [%s] [src: %s]\n", term_color(cp, prefix, COLOR_BRMAGENTA, COLOR_BLACK, sizeof(cp)), term_color(cft, ftype, COLOR_BRRED, COLOR_BLACK, sizeof(cft)), f->frametype, term_color(csub, subclass, COLOR_BRCYAN, COLOR_BLACK, sizeof(csub)), f->subclass, - term_color(cn, name, COLOR_YELLOW, COLOR_BLACK, sizeof(cn))); + term_color(cn, name, COLOR_YELLOW, COLOR_BLACK, sizeof(cn)), + f->src); }