[asterisk-commits] rmudgett: branch 10 r339626 - in /branches/10: ./ channels/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 6 12:53:04 CDT 2011
Author: rmudgett
Date: Thu Oct 6 12:53:00 2011
New Revision: 339626
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=339626
Log:
Merged revisions 339625 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r339625 | rmudgett | 2011-10-06 12:49:38 -0500 (Thu, 06 Oct 2011) | 18 lines
Fix debugging messages generated by 'udptl debug'.
* Makes chan_sip set the tag to the channel name.
* Fixes received debug message sequence number.
* Removed tx/rx debug message type since it was hard coded to 0.
* Made udptl.c logged message header consistent if possible: "UDPTL (%s): ".
* Removed unused rx_expected_seq_no from struct ast_udptl.
(closes issue ASTERISK-18401)
Reported by: Kevin P. Fleming
Patches:
jira_asterisk_18401_v1.8.patch (license #5621) patch uploaded by rmudgett
Tested by: Matthew Nicholson
........
Modified:
branches/10/ (props changed)
branches/10/channels/chan_sip.c
branches/10/main/udptl.c
Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/10/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/channels/chan_sip.c?view=diff&rev=339626&r1=339625&r2=339626
==============================================================================
--- branches/10/channels/chan_sip.c (original)
+++ branches/10/channels/chan_sip.c Thu Oct 6 12:53:00 2011
@@ -5012,13 +5012,13 @@
parameters = p->t38.their_parms;
parameters.max_ifp = ast_udptl_get_far_max_ifp(p->udptl);
parameters.request_response = AST_T38_REQUEST_NEGOTIATE;
- ast_udptl_set_tag(p->udptl, "SIP/%s", p->username);
+ ast_udptl_set_tag(p->udptl, "%s", chan->name);
break;
case T38_ENABLED:
parameters = p->t38.their_parms;
parameters.max_ifp = ast_udptl_get_far_max_ifp(p->udptl);
parameters.request_response = AST_T38_NEGOTIATED;
- ast_udptl_set_tag(p->udptl, "SIP/%s", p->username);
+ ast_udptl_set_tag(p->udptl, "%s", chan->name);
break;
case T38_REJECTED:
case T38_DISABLED:
Modified: branches/10/main/udptl.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/main/udptl.c?view=diff&rev=339626&r1=339625&r2=339626
==============================================================================
--- branches/10/main/udptl.c (original)
+++ branches/10/main/udptl.c Thu Oct 6 12:53:00 2011
@@ -172,7 +172,6 @@
unsigned int tx_seq_no;
unsigned int rx_seq_no;
- unsigned int rx_expected_seq_no;
udptl_fec_tx_buffer_t tx[UDPTL_BUF_MASK + 1];
udptl_fec_rx_buffer_t rx[UDPTL_BUF_MASK + 1];
@@ -289,7 +288,7 @@
if ((enclen = encode_length(buf, len, num_octets)) < 0)
return -1;
if (enclen + *len > buflen) {
- ast_log(LOG_ERROR, "(%s): Buffer overflow detected (%d + %d > %d)\n",
+ ast_log(LOG_ERROR, "UDPTL (%s): Buffer overflow detected (%d + %d > %d)\n",
LOG_TAG(udptl), enclen, *len, buflen);
return -1;
}
@@ -577,7 +576,7 @@
for (i = 0; i < entries; i++) {
j = (entry - i - 1) & UDPTL_BUF_MASK;
if (encode_open_type(s, buf, buflen, &len, s->tx[j].buf, s->tx[j].buf_len) < 0) {
- ast_debug(1, "(%s): Encoding failed at i=%d, j=%d\n",
+ ast_debug(1, "UDPTL (%s): Encoding failed at i=%d, j=%d\n",
LOG_TAG(s), i, j);
return -1;
}
@@ -663,17 +662,19 @@
{
int res;
struct ast_sockaddr addr;
- uint16_t seqno = 0;
-
+ uint8_t *buf;
+
+ buf = udptl->rawdata + AST_FRIENDLY_OFFSET;
+
/* Cache where the header will go */
res = ast_recvfrom(udptl->fd,
- udptl->rawdata + AST_FRIENDLY_OFFSET,
+ buf,
sizeof(udptl->rawdata) - AST_FRIENDLY_OFFSET,
0,
&addr);
if (res < 0) {
if (errno != EAGAIN)
- ast_log(LOG_WARNING, "(%s): UDPTL read error: %s\n",
+ ast_log(LOG_WARNING, "UDPTL (%s): read error: %s\n",
LOG_TAG(udptl), strerror(errno));
ast_assert(errno != EBADF);
return &ast_null_frame;
@@ -688,17 +689,28 @@
/* Send to whoever sent to us */
if (ast_sockaddr_cmp(&udptl->them, &addr)) {
ast_sockaddr_copy(&udptl->them, &addr);
- ast_debug(1, "UDPTL NAT (%s): Using address %s\n",
+ ast_debug(1, "UDPTL (%s): NAT, Using address %s\n",
LOG_TAG(udptl), ast_sockaddr_stringify(&udptl->them));
}
}
if (udptl_debug_test_addr(&addr)) {
- ast_verb(1, "UDPTL (%s): packet from %s (type %d, seq %d, len %d)\n",
- LOG_TAG(udptl), ast_sockaddr_stringify(&addr), 0, seqno, res);
- }
- if (udptl_rx_packet(udptl, udptl->rawdata + AST_FRIENDLY_OFFSET, res) < 1)
+ int seq_no;
+
+ /* Decode sequence number just for verbose message. */
+ if (res < 2) {
+ /* Short packet. */
+ seq_no = -1;
+ } else {
+ seq_no = (buf[0] << 8) | buf[1];
+ }
+
+ ast_verb(1, "UDPTL (%s): packet from %s (seq %d, len %d)\n",
+ LOG_TAG(udptl), ast_sockaddr_stringify(&addr), seq_no, res);
+ }
+ if (udptl_rx_packet(udptl, buf, res) < 1) {
return &ast_null_frame;
+ }
return &udptl->f[0];
}
@@ -708,7 +720,7 @@
unsigned int new_max = 0;
if (udptl->local_max_ifp == -1) {
- ast_log(LOG_WARNING, "(%s): Cannot calculate local_max_datagram before local_max_ifp has been set.\n",
+ ast_log(LOG_WARNING, "UDPTL (%s): Cannot calculate local_max_datagram before local_max_ifp has been set.\n",
LOG_TAG(udptl));
udptl->local_max_datagram = -1;
return;
@@ -749,7 +761,7 @@
unsigned new_max = 0;
if (udptl->far_max_datagram == -1) {
- ast_log(LOG_WARNING, "(%s): Cannot calculate far_max_ifp before far_max_datagram has been set.\n",
+ ast_log(LOG_WARNING, "UDPTL (%s): Cannot calculate far_max_ifp before far_max_datagram has been set.\n",
LOG_TAG(udptl));
udptl->far_max_ifp = -1;
return;
@@ -981,10 +993,8 @@
{
va_list ap;
- if (udptl->tag) {
- ast_free(udptl->tag);
- udptl->tag = NULL;
- }
+ ast_free(udptl->tag);
+ udptl->tag = NULL;
va_start(ap, format);
if (ast_vasprintf(&udptl->tag, format, ap) == -1) {
udptl->tag = NULL;
@@ -1050,14 +1060,14 @@
if ((f->frametype != AST_FRAME_MODEM) ||
(f->subclass.integer != AST_MODEM_T38)) {
- ast_log(LOG_WARNING, "(%s): UDPTL can only send T.38 data.\n",
+ ast_log(LOG_WARNING, "UDPTL (%s): UDPTL can only send T.38 data.\n",
LOG_TAG(s));
return -1;
}
if (len > s->far_max_ifp) {
ast_log(LOG_WARNING,
- "(%s): UDPTL asked to send %d bytes of IFP when far end only prepared to accept %d bytes; data loss will occur."
+ "UDPTL (%s): UDPTL asked to send %d bytes of IFP when far end only prepared to accept %d bytes; data loss will occur."
"You may need to override the T38FaxMaxDatagram value for this endpoint in the channel driver configuration.\n",
LOG_TAG(s), len, s->far_max_ifp);
len = s->far_max_ifp;
@@ -1071,11 +1081,11 @@
if ((signed int) len > 0 && !ast_sockaddr_isnull(&s->them)) {
if ((res = ast_sendto(s->fd, buf, len, 0, &s->them)) < 0)
- ast_log(LOG_NOTICE, "(%s): UDPTL Transmission error to %s: %s\n",
+ ast_log(LOG_NOTICE, "UDPTL (%s): Transmission error to %s: %s\n",
LOG_TAG(s), ast_sockaddr_stringify(&s->them), strerror(errno));
if (udptl_debug_test_addr(&s->them))
- ast_verb(1, "UDPTL (%s): packet to %s (type %d, seq %d, len %d)\n",
- LOG_TAG(s), ast_sockaddr_stringify(&s->them), 0, seq, len);
+ ast_verb(1, "UDPTL (%s): packet to %s (seq %d, len %d)\n",
+ LOG_TAG(s), ast_sockaddr_stringify(&s->them), seq, len);
}
return 0;
More information about the asterisk-commits
mailing list