Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 308944) +++ channels/chan_sip.c (working copy) @@ -4118,6 +4118,9 @@ case T38_ENABLED: state = T38_STATE_NEGOTIATED; break; + case T38_REJECTED: + state = T38_STATE_REJECTED; + break; default: state = T38_STATE_UNKNOWN; } @@ -4780,6 +4783,7 @@ parameters.request_response = AST_T38_NEGOTIATED; ast_udptl_set_tag(p->udptl, "SIP/%s", p->username); break; + case T38_REJECTED: case T38_DISABLED: if (old == T38_ENABLED) { parameters.request_response = AST_T38_TERMINATED; @@ -6329,11 +6333,11 @@ case AST_T38_REQUEST_NEGOTIATE: /* Request T38 */ /* Negotiation can not take place without a valid max_ifp value. */ if (!parameters->max_ifp) { - change_t38_state(p, T38_DISABLED); if (p->t38.state == T38_PEER_REINVITE) { AST_SCHED_DEL_UNREF(sched, p->t38id, dialog_unref(p, "when you delete the t38id sched, you should dec the refcount for the stored dialog ptr")); transmit_response_reliable(p, "488 Not acceptable here", &p->initreq); } + change_t38_state(p, T38_REJECTED); break; } else if (p->t38.state == T38_PEER_REINVITE) { AST_SCHED_DEL_UNREF(sched, p->t38id, dialog_unref(p, "when you delete the t38id sched, you should dec the refcount for the stored dialog ptr")); @@ -6371,7 +6375,7 @@ case AST_T38_REQUEST_TERMINATE: /* Shutdown T38 */ if (p->t38.state == T38_PEER_REINVITE) { AST_SCHED_DEL_UNREF(sched, p->t38id, dialog_unref(p, "when you delete the t38id sched, you should dec the refcount for the stored dialog ptr")); - change_t38_state(p, T38_DISABLED); + change_t38_state(p, T38_REJECTED); transmit_response_reliable(p, "488 Not acceptable here", &p->initreq); } else if (p->t38.state == T38_ENABLED) transmit_reinvite_with_sdp(p, FALSE, FALSE); @@ -8870,7 +8880,7 @@ } } - if ((portno == -1) && (p->t38.state != T38_DISABLED)) { + if ((portno == -1) && (p->t38.state != T38_DISABLED) && (p->t38.state != T38_REJECTED)) { ast_debug(3, "Have T.38 but no audio, accepting offer anyway\n"); res = 0; goto process_sdp_cleanup; @@ -18792,7 +18802,7 @@ } else if (!strcasecmp(data, "peername")) { ast_copy_string(buf, p->peername, len); } else if (!strcasecmp(data, "t38passthrough")) { - if (p->t38.state == T38_DISABLED) { + if ((p->t38.state == T38_DISABLED) || (p->t38.state == T38_REJECTED)) { ast_copy_string(buf, "0", len); } else { /* T38 is offered or enabled in this call */ ast_copy_string(buf, "1", len); @@ -19553,7 +19563,7 @@ case 606: /* Not Acceptable */ xmitres = transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE); if (p->udptl && p->t38.state == T38_LOCAL_REINVITE) { - change_t38_state(p, T38_DISABLED); + change_t38_state(p, T38_REJECTED); /* Try to reset RTP timers */ //ast_rtp_set_rtptimers_onhold(p->rtp); @@ -21223,7 +21233,7 @@ * want to abort the negotiation process */ if (p->t38id != -1) { - change_t38_state(p, T38_DISABLED); + change_t38_state(p, T38_REJECTED); transmit_response_reliable(p, "488 Not acceptable here", &p->initreq); p->t38id = -1; dialog_unref(p, "unref the dialog ptr from sip_t38_abort, because it held a dialog ptr"); @@ -22094,7 +22104,7 @@ } else if (p->t38.state == T38_ENABLED) { ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED); transmit_response_with_t38_sdp(p, "200 OK", req, (reinvite ? XMIT_RELIABLE : (req->ignore ? XMIT_UNRELIABLE : XMIT_CRITICAL))); - } else if (p->t38.state == T38_DISABLED) { + } else if ((p->t38.state == T38_DISABLED) || (p->t38.state == T38_REJECTED)) { /* If this is not a re-invite or something to ignore - it's critical */ if (p->srtp && !ast_test_flag(p->srtp, SRTP_CRYPTO_OFFER_OK)) { ast_log(LOG_WARNING, "Target does not support required crypto\n"); Index: channels/sip/include/sip.h =================================================================== --- channels/sip/include/sip.h (revision 308944) +++ channels/sip/include/sip.h (working copy) @@ -591,7 +592,8 @@ T38_DISABLED = 0, /*!< Not enabled */ T38_LOCAL_REINVITE, /*!< Offered from local - REINVITE */ T38_PEER_REINVITE, /*!< Offered from peer - REINVITE */ - T38_ENABLED /*!< Negotiated (enabled) */ + T38_ENABLED, /*!< Negotiated (enabled) */ + T38_REJECTED /*!< Refused */ }; /*! \brief Parameters to know status of transfer */