}
}
}
- if (!ast_strlen_zero(peer->fromuser))
+ if (!ast_strlen_zero(peer->fromuser)) {
ast_string_field_set(dialog, fromuser, peer->fromuser);
- if (!ast_strlen_zero(peer->language))
+ }
+ if (!ast_strlen_zero(peer->language)) {
ast_string_field_set(dialog, language, peer->language);
+ }
/* Set timer T1 to RTT for this peer (if known by qualify=) */
/* Minimum is settable or default to 100 ms */
/* If there is a maxms and lastms from a qualify use that over a manual T1
value. Otherwise, use the peer's T1 value. */
- if (peer->maxms && peer->lastms)
+ if (peer->maxms && peer->lastms) {
dialog->timer_t1 = peer->lastms < global_t1min ? global_t1min : peer->lastms;
- else
+ } else {
dialog->timer_t1 = peer->timer_t1;
+ }
/* Set timer B to control transaction timeouts, the peer setting is the default and overrides
the known timer */
- if (peer->timer_b)
+ if (peer->timer_b) {
dialog->timer_b = peer->timer_b;
- else
+ } else {
dialog->timer_b = 64 * dialog->timer_t1;
+ }
if ((ast_test_flag(&dialog->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833) ||
- (ast_test_flag(&dialog->flags[0], SIP_DTMF) == SIP_DTMF_AUTO))
+ (ast_test_flag(&dialog->flags[0], SIP_DTMF) == SIP_DTMF_AUTO)) {
dialog->noncodeccapability |= AST_RTP_DTMF;
- else
+ } else {
dialog->noncodeccapability &= ~AST_RTP_DTMF;
+ }
dialog->directmediaacl = ast_duplicate_acl_list(peer->directmediaacl);
- if (peer->call_limit)
+ if (peer->call_limit) {
ast_set_flag(&dialog->flags[0], SIP_CALL_LIMIT);
- if (!dialog->portinuri)
+ }
+ if (!dialog->portinuri) {
dialog->portinuri = peer->portinuri;
+ }
dialog->chanvars = copy_vars(peer->chanvars);
- if (peer->fromdomainport)
+ if (peer->fromdomainport) {
dialog->fromdomainport = peer->fromdomainport;
+ }
return 0;
}
f = create_dtmf_frame(instance, AST_FRAME_DTMF_END, ast_rtp_instance_get_prop(instance, AST_RTP_PROPERTY_DTMF_COMPENSATE));
f->samples = rtp->dtmfsamples * (rtp->lastrxformat.id ? (rtp_get_rate(&rtp->lastrxformat) / 1000) : 8);
rtp->resp = 0;
- } else if (rtp->resp == resp)
+ } else if (rtp->resp == resp) {
rtp->dtmfsamples += 20 * (rtp->lastrxformat.id ? (rtp_get_rate(&rtp->lastrxformat) / 1000) : 8);
+ }
rtp->dtmf_timeout = 0;
/* Convert comfort noise into audio with various codecs. Unfortunately this doesn't
totally help us out becuase we don't have an engine to keep it going and we are not
guaranteed to have it every 20ms or anything */
- if (rtpdebug)
+ if (rtpdebug) {
ast_debug(0, "- RTP 3389 Comfort noise event: Level %d (len = %d)\n", (int) rtp->lastrxformat.id, len);
+ }
if (ast_test_flag(rtp, FLAG_3389_WARNING)) {
struct ast_sockaddr remote_address = { {0,} };
}
/* Must have at least one byte */
- if (!len)
+ if (!len) {
return NULL;
+ }
if (len < 24) {
rtp->f.data.ptr = rtp->rawdata + AST_FRIENDLY_OFFSET;
rtp->f.datalen = len - 1;
/* Send to whoever sent to us */
if (ast_sockaddr_cmp(&rtp->rtcp->them, &addr)) {
ast_sockaddr_copy(&rtp->rtcp->them, &addr);
- if (rtpdebug)
+ if (rtpdebug) {
ast_debug(0, "RTCP NAT: Got RTCP from other end. Now sending to address %s\n",
ast_sockaddr_stringify(&rtp->rtcp->them));
+ }
}
}
length &= 0xffff;
if ((i + length) > packetwords) {
- if (rtpdebug)
+ if (rtpdebug) {
ast_debug(1, "RTCP Read too short\n");
+ }
return &ast_null_frame;
}
ast_verbose("SPC: %lu\tSOC: %lu\n", (unsigned long) ntohl(rtcpheader[i + 3]), (unsigned long) ntohl(rtcpheader[i + 4]));
}
i += 5;
- if (rc < 1)
+ if (rc < 1) {
break;
+ }
/* Intentional fall through */
case RTCP_PT_RR:
/* Don't handle multiple reception reports (rc > 1) yet */
if (comp - dlsr >= lsr) {
rtp->rtcp->accumulated_transit += rttsec;
- if (rtp->rtcp->rtt_count == 0)
+ if (rtp->rtcp->rtt_count == 0) {
rtp->rtcp->minrtt = rttsec;
+ }
- if (rtp->rtcp->maxrtt<rttsec)
+ if (rtp->rtcp->maxrtt<rttsec) {
rtp->rtcp->maxrtt = rttsec;
- if (rtp->rtcp->minrtt>rttsec)
+ }
+ if (rtp->rtcp->minrtt>rttsec) {
rtp->rtcp->minrtt = rttsec;
+ }
normdevrtt_current = normdev_compute(rtp->rtcp->normdevrtt, rttsec, rtp->rtcp->rtt_count);
rtp->rtcp->reported_jitter = ntohl(rtcpheader[i + 3]);
reported_jitter = (double) rtp->rtcp->reported_jitter;
- if (rtp->rtcp->reported_jitter_count == 0)
+ if (rtp->rtcp->reported_jitter_count == 0) {
rtp->rtcp->reported_minjitter = reported_jitter;
+ }
- if (reported_jitter < rtp->rtcp->reported_minjitter)
+ if (reported_jitter < rtp->rtcp->reported_minjitter) {
rtp->rtcp->reported_minjitter = reported_jitter;
+ }
- if (reported_jitter > rtp->rtcp->reported_maxjitter)
+ if (reported_jitter > rtp->rtcp->reported_maxjitter) {
rtp->rtcp->reported_maxjitter = reported_jitter;
+ }
reported_normdev_jitter_current = normdev_compute(rtp->rtcp->reported_normdev_jitter, reported_jitter, rtp->rtcp->reported_jitter_count);
reported_lost = (double) rtp->rtcp->reported_lost;
/* using same counter as for jitter */
- if (rtp->rtcp->reported_jitter_count == 0)
+ if (rtp->rtcp->reported_jitter_count == 0) {
rtp->rtcp->reported_minlost = reported_lost;
+ }
- if (reported_lost < rtp->rtcp->reported_minlost)
+ if (reported_lost < rtp->rtcp->reported_minlost) {
rtp->rtcp->reported_minlost = reported_lost;
+ }
- if (reported_lost > rtp->rtcp->reported_maxlost)
+ if (reported_lost > rtp->rtcp->reported_maxlost) {
rtp->rtcp->reported_maxlost = reported_lost;
+ }
reported_normdev_lost_current = normdev_compute(rtp->rtcp->reported_normdev_lost, reported_lost, rtp->rtcp->reported_jitter_count);
rtp->rtcp->reported_stdev_lost = stddev_compute(rtp->rtcp->reported_stdev_lost, reported_lost, rtp->rtcp->reported_normdev_lost, reported_normdev_lost_current, rtp->rtcp->reported_jitter_count);
ast_verbose(" Interarrival jitter: %u\n", rtp->rtcp->reported_jitter);
ast_verbose(" Last SR(our NTP): %lu.%010lu\n",(unsigned long) ntohl(rtcpheader[i + 4]) >> 16,((unsigned long) ntohl(rtcpheader[i + 4]) << 16) * 4096);
ast_verbose(" DLSR: %4.4f (sec)\n",ntohl(rtcpheader[i + 5])/65536.0);
- if (rtt)
+ if (rtt) {
ast_verbose(" RTT: %lu(sec)\n", (unsigned long) rtt);
+ }
}
if (rtt) {
manager_event(EVENT_FLAG_REPORTING, "RTCPReceived", "From: %s\r\n"
}
break;
case RTCP_PT_FUR:
- if (rtcp_debug_test_addr(&addr))
+ if (rtcp_debug_test_addr(&addr)) {
ast_verbose("Received an RTCP Fast Update Request\n");
+ }
rtp->f.frametype = AST_FRAME_CONTROL;
rtp->f.subclass.integer = AST_CONTROL_VIDUPDATE;
rtp->f.datalen = 0;
f = &rtp->f;
break;
case RTCP_PT_SDES:
- if (rtcp_debug_test_addr(&addr))
+ if (rtcp_debug_test_addr(&addr)) {
ast_verbose("Received an SDES from %s\n",
ast_sockaddr_stringify(&rtp->rtcp->them));
+ }
break;
case RTCP_PT_BYE:
- if (rtcp_debug_test_addr(&addr))
+ if (rtcp_debug_test_addr(&addr)) {
ast_verbose("Received a BYE from %s\n",
ast_sockaddr_stringify(&rtp->rtcp->them));
+ }
break;
default:
ast_debug(1, "Unknown RTCP packet (pt=%d) received from %s\n",
ast_sockaddr_stringify(&remote_address),
strerror(errno));
} else if (((ast_test_flag(bridged, FLAG_NAT_ACTIVE) == FLAG_NAT_INACTIVE) || rtpdebug) && !ast_test_flag(bridged, FLAG_NAT_INACTIVE_NOWARN)) {
- if (option_debug || rtpdebug)
+ if (option_debug || rtpdebug) {
ast_log(LOG_WARNING,
"RTP NAT: Can't write RTP to private "
"address %s, waiting for other end to "
"send audio...\n",
ast_sockaddr_stringify(&remote_address));
+ }
ast_set_flag(bridged, FLAG_NAT_INACTIVE_NOWARN);
}
return 0;