Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 230381) +++ channels/chan_sip.c (working copy) @@ -4849,6 +4849,7 @@ p->chanvars = NULL; } +ast_log(LOG_WARNING, "jpeeler: freed contents of sip_pvt %p and mohsuggest = %p %s\n", p, p->mohsuggest, p->mohsuggest); ast_string_field_free_memory(p); if (p->socket.tcptls_session) { @@ -7806,9 +7807,11 @@ ast_clear_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD); /* Clear both flags */ } else if (!sin.sin_addr.s_addr || (sendonly && sendonly != -1)) { int already_on_hold = ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD); +ast_log(LOG_WARNING, "jpeeler: inside sip_pvt %p MOH suggest %s\n", p, p->mohsuggest); ast_queue_control_data(p->owner, AST_CONTROL_HOLD, S_OR(p->mohsuggest, NULL), !ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0); + //ast_queue_hangup_with_cause(p->owner, AST_CAUSE_PROTOCOL_ERROR); if (sendonly) ast_rtp_stop(p->rtp); /* RTCP needs to go ahead, even if we're on hold!!! */ Index: main/channel.c =================================================================== --- main/channel.c (revision 230381) +++ main/channel.c (working copy) @@ -1009,6 +1009,13 @@ return -1; } +if (f->frametype == AST_FRAME_CONTROL && (f->subclass == AST_CONTROL_HOLD || f->subclass == AST_CONTROL_UNHOLD)) { + ast_log(LOG_WARNING, "jpeeler: inserting frame %p into frame list with datalen %d and data at %p...", f, f->datalen, f->datalen ? f->data.ptr : &f->data.uint32); + if (f->datalen) + ast_log(LOG_WARNING, "jpeeler: with data with length %s\n", (char *) f->data.ptr); + else + ast_log(LOG_WARNING, "jpeeler: with data %u\n", f->data.uint32); +} AST_LIST_INSERT_TAIL(&frames, f, frame_list); new_frames++; if (f->frametype == AST_FRAME_VOICE) { @@ -1019,6 +1026,7 @@ /* Count how many frames exist on the queue */ AST_LIST_TRAVERSE(&chan->readq, cur, frame_list) { queued_frames++; + ast_log(LOG_WARNING, "jpeeler: checking frame %p in readq with datalen %d and data.ptr %p\n", cur, cur->datalen, cur->datalen ? cur->data.ptr : &cur->data.uint32); if (cur->frametype == AST_FRAME_VOICE) { queued_voice_frames++; } @@ -1126,6 +1134,9 @@ { struct ast_frame f = { AST_FRAME_CONTROL, }; + //ast_assert(datalen > 0 ? data != NULL : data == NULL); +ast_log(LOG_WARNING, "jpeeler datalen %d data %p\n", (int) datalen, data); + f.subclass = control; f.data.ptr = (void *) data; f.datalen = datalen; @@ -3001,6 +3012,12 @@ if (chan->music_state && chan->generator && chan->generator->digit && f && f->frametype == AST_FRAME_DTMF_END) chan->generator->digit(chan, f->subclass); +if (f && f->datalen==0 && f->data.ptr) { + ast_log(LOG_WARNING,"jpeeler: Found frame with datalen=0 but initialized data pointer!!!---------------------------------------------------\n"); + ast_frame_dump(chan->name, f, "<<"); + /* Fix the frame */ + f->data.ptr = NULL; +} ast_channel_unlock(chan); return f; } @@ -3378,6 +3395,7 @@ CHECK_BLOCKING(chan); switch (fr->frametype) { case AST_FRAME_CONTROL: + ast_log(LOG_WARNING, "jpeeler: music on hold class %s\n", (char *) fr->data.ptr); res = (chan->tech->indicate == NULL) ? 0 : chan->tech->indicate(chan, fr->subclass, fr->data.ptr, fr->datalen); break; @@ -4763,6 +4781,7 @@ if ((f->frametype == AST_FRAME_CONTROL) && !(config->flags & AST_BRIDGE_IGNORE_SIGS)) { int bridge_exit = 0; +ast_log(LOG_WARNING, "jpeeler: frame datalen = %d subclass = %d data.ptr = %p reading '%s'\n", f->datalen, f->subclass, f->data.ptr, (char *) f->data.ptr); switch (f->subclass) { case AST_CONTROL_HOLD: case AST_CONTROL_UNHOLD: Index: main/frame.c =================================================================== --- main/frame.c (revision 230381) +++ main/frame.c (working copy) @@ -526,8 +526,10 @@ if (out->datalen) { out->data.ptr = buf + sizeof(*out) + AST_FRIENDLY_OFFSET; memcpy(out->data.ptr, f->data.ptr, out->datalen); +ast_log(LOG_WARNING, "jpeeler: frametype=%d data.ptr set to %p %s and out %p %s\n", f->frametype, f->data.ptr, (char *) f->data.ptr, out->data.ptr, (char *) out->data.ptr); } else { out->data.uint32 = f->data.uint32; +ast_log(LOG_WARNING, "jpeeler: frametype=%d data.uint32 set to %p %u and out %p %u\n", f->frametype, &f->data.uint32, f->data.uint32, &out->data.uint32, out->data.uint32); } if (srclen > 0) { /* This may seem a little strange, but it's to avoid a gcc (4.2.4) compiler warning */