Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (Revision 246298) +++ channels/chan_sip.c (Arbeitskopie) @@ -3794,6 +3794,7 @@ } } else { /* Call is in UP state, send BYE */ if (!p->pendinginvite) { + ast_log(LOG_NOTICE, "!pendinginvite Hanging up channel in state %s (not UP)\n", ast_state2str(ast->_state)); char *audioqos = ""; char *videoqos = ""; if (p->rtp) @@ -3817,6 +3818,8 @@ if (p->vrtp && oldowner) pbx_builtin_setvar_helper(oldowner, "RTPVIDEOQOS", videoqos); } else { + ast_log(LOG_NOTICE, "pendinginvite Hanging up channel in state %s (not UP)\n", ast_state2str(ast->_state)); + transmit_request_with_auth(p, SIP_CANCEL, 0, XMIT_RELIABLE, 1); /* Note we will need a BYE when this all settles out but we can't send one while we have "INVITE" outstanding. */ ast_set_flag(&p->flags[0], SIP_PENDINGBYE); @@ -12974,6 +12977,7 @@ bridgepvt = (struct sip_pvt*)(bridgepeer->tech_pvt); if (bridgepvt->udptl) { if (p->t38.state == T38_PEER_REINVITE) { + ast_log(LOG_NOTICE, "Ooooh.. Here we goto to sip_handle_t38_reinvite\n"); sip_handle_t38_reinvite(bridgepeer, p, 0); ast_rtp_set_rtptimers_onhold(p->rtp); if (p->vrtp) @@ -13092,25 +13096,34 @@ } break; case 488: /* Not acceptable here */ + case 606: /* Not acceptable here */ xmitres = transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE); if (reinvite && p->udptl) { - /* If this is a T.38 call, we should go back to - audio. If this is an audio call - something went - terribly wrong since we don't renegotiate codecs, - only IP/port . - */ p->t38.state = T38_DISABLED; /* Try to reset RTP timers */ ast_rtp_set_rtptimers_onhold(p->rtp); - ast_log(LOG_ERROR, "Got error on T.38 re-invite. Bad configuration. Peer needs to have T.38 disabled.\n"); - /*! \bug Is there any way we can go back to the audio call on both - sides here? - */ - /* While figuring that out, hangup the call */ - if (p->owner && !ast_test_flag(req, SIP_PKT_IGNORE)) - ast_queue_control(p->owner, AST_CONTROL_CONGESTION); - ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); + /* Trigger a reinvite back to audio */ + transmit_reinvite_with_sdp(p); + + ast_log(LOG_DEBUG, "T38 changed state to %d on channel %s\n", p->t38.state, p->owner ? p->owner->name : ""); + + ast_log(LOG_NOTICE, "Ooooh.. 1\n"); + if (p->owner && (p->owner->_state == AST_STATE_UP) && (bridgepeer = ast_bridged_channel(p->owner))) { /* if this is a re-invite */ + struct sip_pvt *bridgepvt = NULL; + ast_log(LOG_NOTICE, "Ooooh.. 2\n"); + if (bridgepeer->tech == &sip_tech || bridgepeer->tech == &sip_tech_info) { + ast_log(LOG_NOTICE, "Ooooh.. 3\n"); + bridgepvt = (struct sip_pvt*)(bridgepeer->tech_pvt); + if (bridgepvt->udptl) { + + ast_log(LOG_NOTICE, "Ooooh.. 4\n"); + sip_handle_t38_reinvite(bridgepeer, p, 0); + ast_rtp_set_rtptimers_onhold(p->rtp); + } + } + } + } else { /* We can't set up this call, so give up */ if (p->owner && !ast_test_flag(req, SIP_PKT_IGNORE)) @@ -13646,6 +13659,7 @@ handle_response_invite(p, resp, rest, req, seqno); break; case 488: /* Not acceptable here - codec error */ + case 606: /* Not acceptable here */ if (sipmethod == SIP_INVITE) handle_response_invite(p, resp, rest, req, seqno); break; @@ -18943,7 +18957,7 @@ p->lastrtprx = p->lastrtptx = time(NULL); ast_mutex_unlock(&p->lock); return 0; - } else { /* If we are handling sending 200 OK to the other side of the bridge */ + } else if (pvt->t38.state != T38_DISABLED) { /* If we are handling sending 200 OK to the other side of the bridge */ if (ast_test_flag(&p->flags[0], SIP_CAN_REINVITE) && ast_test_flag(&pvt->flags[0], SIP_CAN_REINVITE)) { ast_udptl_get_peer(pvt->udptl, &p->udptlredirip); flag = 1; @@ -18958,14 +18972,32 @@ } pvt->t38.state = T38_ENABLED; p->t38.state = T38_ENABLED; + + ast_log(LOG_DEBUG, "T38 changed state to %d on channel %s\n", pvt->t38.state, pvt->owner ? pvt->owner->name : ""); if (option_debug > 1) { ast_log(LOG_DEBUG, "T38 changed state to %d on channel %s\n", pvt->t38.state, pvt->owner ? pvt->owner->name : ""); ast_log(LOG_DEBUG, "T38 changed state to %d on channel %s\n", p->t38.state, chan ? chan->name : ""); } transmit_response_with_t38_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL); + p->lastrtprx = p->lastrtptx = time(NULL); ast_mutex_unlock(&p->lock); return 0; + } else if (pvt->t38.state == T38_DISABLED) { /* The othe side can no talk T.38 with us, tell it to the the originating T.38 party. */ + + if (option_debug > 1) { + ast_log(LOG_DEBUG, "T38 changed state to %d on channel %s\n", pvt->t38.state, pvt->owner ? pvt->owner->name : ""); + ast_log(LOG_DEBUG, "T38 changed state to %d on channel %s\n", p->t38.state, chan ? chan->name : ""); + } + + transmit_response_reliable(p, "488 Not acceptable here", &p->initreq); + + p->lastrtprx = p->lastrtptx = time(NULL); + ast_mutex_unlock(&p->lock); + return 0; + } else { + ast_log(LOG_DEBUG, "Nothing happend here, T38 changed state to %d on channel %s\n", pvt->t38.state, pvt->owner ? pvt->owner->name : ""); + ast_log(LOG_DEBUG, "Nothing happend here, T38 changed state to %d on channel %s\n", p->t38.state, chan ? chan->name : ""); } }