actually make the non-standard G726-32 behavior available for SIP clients

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@37564 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Kevin P. Fleming 20 years ago
parent e5555bc4eb
commit 4376af0080

@ -285,6 +285,19 @@ The Zap channel:
* Support for MFC/R2 has been removed, as it has not been functional for some
time and it has no maintainer.
The G726-32 codec:
* It has been determined that previous versions of Asterisk used the wrong codeword
packing order for G726-32 data. This version supports both available packing orders,
and can transcode between them. It also now selects the proper order when
negotiating with a SIP peer based on the codec name supplied in the SDP. However,
there are existing devices that improperly request one order and then use another;
Sipura and Grandstream ATAs are known to do this, and there may be others. To
be able to continue to use these devices with this version of Asterisk and the
G726-32 codec, a configuration parameter called 'g726nonstandard' has been added
to sip.conf, so that Asterisk can use the packing order expected by the device (even
though it requested a different order).
Installation:
* On BSD systems, the installation directories have changed to more "FreeBSDish"

@ -705,10 +705,11 @@ struct sip_auth {
#define SIP_CALL_LIMIT (1 << 28) /*!< Call limit enforced for this call */
#define SIP_SENDRPID (1 << 29) /*!< Remote Party-ID Support */
#define SIP_INC_COUNT (1 << 30) /*!< Did this connection increment the counter of in-use calls? */
#define SIP_G726_NONSTANDARD (1 << 31) /*!< Use non-standard packing for G726-32 data */
#define SIP_FLAGS_TO_COPY \
(SIP_PROMISCREDIR | SIP_TRUSTRPID | SIP_SENDRPID | SIP_DTMF | SIP_REINVITE | \
SIP_PROG_INBAND | SIP_USECLIENTCODE | SIP_NAT | \
SIP_PROG_INBAND | SIP_USECLIENTCODE | SIP_NAT | SIP_G726_NONSTANDARD | \
SIP_USEREQPHONE | SIP_INSECURE_PORT | SIP_INSECURE_INVITE)
/* a new page of flags */
@ -778,7 +779,7 @@ static int global_t38_capability = T38FAX_VERSION_0 | T38FAX_RATE_2400 | T38FAX_
#define sipdebug_config ast_test_flag(&global_flags[1], SIP_PAGE2_DEBUG_CONFIG)
#define sipdebug_console ast_test_flag(&global_flags[1], SIP_PAGE2_DEBUG_CONSOLE)
/*! \brief T38 Sates for a call */
/*! \brief T38 States for a call */
enum t38state {
T38_DISABLED = 0, /*! Not enabled */
T38_LOCAL_DIRECT, /*! Offered from local */
@ -4719,7 +4720,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
ast_verbose("Found description format %s for ID %d\n", mimeSubtype, codec);
/* Note: should really look at the 'freq' and '#chans' params too */
ast_rtp_set_rtpmap_type(newaudiortp, codec, "audio", mimeSubtype, 0);
ast_rtp_set_rtpmap_type(newaudiortp, codec, "audio", mimeSubtype,
ast_test_flag(&p->flags[0], SIP_G726_NONSTANDARD) ? AST_RTP_OPT_G726_NONSTANDARD : 0);
if (p->vrtp)
ast_rtp_set_rtpmap_type(newvideortp, codec, "video", mimeSubtype, 0);
}
@ -5571,7 +5573,8 @@ static void add_codec_to_sdp(const struct sip_pvt *p, int codec, int sample_rate
ast_build_string(m_buf, m_size, " %d", rtp_code);
ast_build_string(a_buf, a_size, "a=rtpmap:%d %s/%d\r\n", rtp_code,
ast_rtp_lookup_mime_subtype(1, codec, 0),
ast_rtp_lookup_mime_subtype(1, codec,
ast_test_flag(&p->flags[0], SIP_G726_NONSTANDARD) ? AST_RTP_OPT_G726_NONSTANDARD : 0),
sample_rate);
if (codec == AST_FORMAT_G729A) {
/* Indicate that we don't support VAD (G.729 annex B) */
@ -5583,7 +5586,7 @@ static void add_codec_to_sdp(const struct sip_pvt *p, int codec, int sample_rate
}
}
/*! \brief Get Max T.38 Transmision rate from T38 capabilities */
/*! \brief Get Max T.38 Transmission rate from T38 capabilities */
static int t38_get_rate(int t38cap)
{
int maxrate = (t38cap & (T38FAX_RATE_14400 | T38FAX_RATE_12000 | T38FAX_RATE_9600 | T38FAX_RATE_7200 | T38FAX_RATE_4800 | T38FAX_RATE_2400));
@ -14716,6 +14719,10 @@ static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask
ast_set_flag(&mask[0], SIP_SENDRPID);
ast_set2_flag(&flags[0], ast_true(v->value), SIP_SENDRPID);
res = 1;
} else if (!strcasecmp(v->name, "g726nonstandard")) {
ast_set_flag(&mask[0], SIP_G726_NONSTANDARD);
ast_set2_flag(&flags[0], ast_true(v->value), SIP_G726_NONSTANDARD);
res = 1;
} else if (!strcasecmp(v->name, "useclientcode")) {
ast_set_flag(&mask[0], SIP_USECLIENTCODE);
ast_set2_flag(&flags[0], ast_true(v->value), SIP_USECLIENTCODE);

@ -111,6 +111,13 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls
; for any reason, always reject with '401 Unauthorized'
; instead of letting the requester know whether there was
; a matching user or peer for their request
;g726nonstandard = yes ; If the peer negotiates G726-32 audio, use AAL2 packing
; order instead of RFC3551 packing order (this is required
; for Sipura and Grandstream ATAs, among others). This is
; contrary to the RFC3551 specification, the peer _should_
; be negotiating AAL2-G726-32 instead :-(
;
; If regcontext is specified, Asterisk will dynamically create and destroy a
; NoOp priority 1 extension for a given peer who registers or unregisters with

Loading…
Cancel
Save