Index: rtp.c =================================================================== RCS file: /usr/cvsroot/asterisk/rtp.c,v retrieving revision 1.84 diff -u -r1.84 rtp.c --- rtp.c 7 Aug 2004 14:22:09 -0000 1.84 +++ rtp.c 26 Aug 2004 04:30:24 -0000 @@ -99,6 +99,7 @@ int rtp_lookup_code_cache_isAstFormat; /* a cache for the result of rtp_lookup_code(): */ int rtp_lookup_code_cache_code; int rtp_lookup_code_cache_result; + int rtp_offered_from_local; struct ast_rtcp *rtcp; }; @@ -587,7 +588,7 @@ {{1, AST_FORMAT_SLINEAR}, "audio", "L16"}, {{1, AST_FORMAT_LPC10}, "audio", "LPC"}, {{1, AST_FORMAT_G729A}, "audio", "G729"}, - {{1, AST_FORMAT_SPEEX}, "audio", "SPEEX"}, + {{1, AST_FORMAT_SPEEX}, "audio", "speex"}, {{1, AST_FORMAT_ILBC}, "audio", "iLBC"}, {{0, AST_RTP_DTMF}, "audio", "telephone-event"}, {{0, AST_RTP_CISCO_DTMF}, "audio", "cisco-telephone-event"}, @@ -698,6 +699,13 @@ } } +void ast_rtp_offered_from_local(struct ast_rtp* rtp, int local) { + if (rtp) + rtp->rtp_offered_from_local = local; + else + ast_log(LOG_WARNING, "rtp structure is null\n"); +} + struct rtpPayloadType ast_rtp_lookup_pt(struct ast_rtp* rtp, int pt) { struct rtpPayloadType result; @@ -707,10 +715,11 @@ return result; /* bogus payload type */ } /* Start with the negotiated codecs */ - result = rtp->current_RTP_PT[pt]; + if (!rtp->rtp_offered_from_local) + result = rtp->current_RTP_PT[pt]; /* If it doesn't exist, check our static RTP type list, just in case */ if (!result.code) - result = static_RTP_PT[pt]; + result = static_RTP_PT[pt]; return result; } Index: channels/chan_mgcp.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v retrieving revision 1.75 diff -u -r1.75 chan_mgcp.c --- channels/chan_mgcp.c 13 Aug 2004 13:19:29 -0000 1.75 +++ channels/chan_mgcp.c 26 Aug 2004 04:30:29 -0000 @@ -1945,6 +1945,7 @@ add_header(&resp, "X", sub->txident); add_header(&resp, "I", sub->cxident); /*add_header(&resp, "S", "");*/ + ast_rtp_offered_from_local(rtp, 0); add_sdp(&resp, sub, rtp); /* SC: fill in new fields */ resp.cmd = MGCP_CMD_MDCX; @@ -1978,6 +1979,7 @@ /* SC: X header should not be sent. kept for compatibility */ add_header(&resp, "X", sub->txident); /*add_header(&resp, "S", "");*/ + ast_rtp_offered_from_local(rtp, 1); add_sdp(&resp, sub, rtp); /* SC: fill in new fields */ resp.cmd = MGCP_CMD_CRCX; Index: channels/chan_sip.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v retrieving revision 1.477 diff -u -r1.477 chan_sip.c --- channels/chan_sip.c 23 Aug 2004 14:31:20 -0000 1.477 +++ channels/chan_sip.c 26 Aug 2004 04:30:36 -0000 @@ -3511,6 +3512,7 @@ return -1; } respprep(&resp, p, msg, req); + ast_rtp_offered_from_local(p->rtp, 0); add_sdp(&resp, p); return send_response(p, &resp, retrans, seqno); } @@ -3587,6 +3589,7 @@ reqprep(&req, p, "INVITE", 0, 1); add_header(&req, "Allow", ALLOWED_METHODS); + ast_rtp_offered_from_local(p->rtp, 1); add_sdp(&req, p); /* Use this as the basis */ copy_request(&p->initreq, &req); @@ -3745,6 +3748,7 @@ } add_header(&req, "Allow", ALLOWED_METHODS); if (sdp) { + ast_rtp_offered_from_local(p->rtp, 1); add_sdp(&req, p); } else { add_header(&req, "Content-Length", "0"); Index: include/asterisk/rtp.h =================================================================== RCS file: /usr/cvsroot/asterisk/include/asterisk/rtp.h,v retrieving revision 1.15 diff -u -r1.15 rtp.h --- include/asterisk/rtp.h 8 Jul 2004 11:46:15 -0000 1.15 +++ include/asterisk/rtp.h 26 Aug 2004 04:30:36 -0000 @@ -89,6 +89,7 @@ // Mapping between RTP payload format codes and Asterisk codes: struct rtpPayloadType ast_rtp_lookup_pt(struct ast_rtp* rtp, int pt); int ast_rtp_lookup_code(struct ast_rtp* rtp, int isAstFormat, int code); +void ast_rtp_offered_from_local(struct ast_rtp* rtp, int local); void ast_rtp_get_current_formats(struct ast_rtp* rtp, int* astFormats, int* nonAstFormats);