summaryrefslogtreecommitdiff
path: root/channels/chan_iax2.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r--channels/chan_iax2.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index c88cd4dd4..a50289b21 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -1918,24 +1918,25 @@ static void send_signaling(struct chan_iax2_pvt *pvt)
* we have received a destination call number. */
static int queue_signalling(struct chan_iax2_pvt *pvt, struct ast_frame *f)
{
- struct signaling_queue_entry *new;
+ struct signaling_queue_entry *qe;
if (f->frametype == AST_FRAME_IAX || !pvt->hold_signaling) {
return 1; /* do not queue this frame */
- } else if (!(new = ast_calloc(1, sizeof(struct signaling_queue_entry)))) {
+ } else if (!(qe = ast_calloc(1, sizeof(struct signaling_queue_entry)))) {
return -1; /* out of memory */
}
- memcpy(&new->f, f, sizeof(new->f)); /* copy ast_frame into our queue entry */
-
- if (new->f.datalen) { /* if there is data in this frame copy it over as well */
- if (!(new->f.data.ptr = ast_calloc(1, new->f.datalen))) {
- free_signaling_queue_entry(new);
+ /* copy ast_frame into our queue entry */
+ qe->f = *f;
+ if (qe->f.datalen) {
+ /* if there is data in this frame copy it over as well */
+ if (!(qe->f.data.ptr = ast_malloc(qe->f.datalen))) {
+ free_signaling_queue_entry(qe);
return -1;
}
- memcpy(new->f.data.ptr, f->data.ptr, sizeof(*new->f.data.ptr));
+ memcpy(qe->f.data.ptr, f->data.ptr, qe->f.datalen);
}
- AST_LIST_INSERT_TAIL(&pvt->signaling_queue, new, next);
+ AST_LIST_INSERT_TAIL(&pvt->signaling_queue, qe, next);
return 0;
}
@@ -4153,6 +4154,15 @@ static int schedule_delivery(struct iax_frame *fr, int updatehistory, int fromtr
struct ast_channel *owner = NULL;
struct ast_channel *bridge = NULL;
+ /*
+ * Clear fr->af.data if there is no data in the buffer. Things
+ * like AST_CONTROL_HOLD without a suggested music class must
+ * have a NULL pointer.
+ */
+ if (!fr->af.datalen) {
+ memset(&fr->af.data, 0, sizeof(fr->af.data));
+ }
+
/* Attempt to recover wrapped timestamps */
unwrap_timestamp(fr);