[asterisk-commits] nadi: branch group/trunk-cm-csel-hash r46928 - in
/team/group/trunk-cm-csel-h...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Nov 2 09:05:16 MST 2006
Author: nadi
Date: Thu Nov 2 10:05:16 2006
New Revision: 46928
URL: http://svn.digium.com/view/asterisk?rev=46928&view=rev
Log:
Merged revisions 46884-46886,46902,46906 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r46884 | russell | 2006-11-02 15:03:42 +0100 (Do, 02 Nov 2006) | 10 lines
Blocked revisions 46883 via svnmerge
........
r46883 | russell | 2006-11-02 09:02:37 -0500 (Thu, 02 Nov 2006) | 3 lines
Add the missing call to free described in issue #8268. Also, add a bunch of
missing calls to free in callerid_feed_jp().
........
................
r46885 | russell | 2006-11-02 15:07:48 +0100 (Do, 02 Nov 2006) | 4 lines
Change the buffer used in callerid_feed() and callerid_feed_jp() to be
allocated on the stack using alloca() instead of using malloc() since
they are only used locally to these functions.
................
r46886 | russell | 2006-11-02 15:15:12 +0100 (Do, 02 Nov 2006) | 3 lines
various whitespace changes to reduce indentation and to better conform to
formatting guidelines
................
r46902 | oej | 2006-11-02 16:31:53 +0100 (Do, 02 Nov 2006) | 2 lines
Don't overwrite pkt->flags (imported from 1.2/1.4)
................
r46906 | nadi | 2006-11-02 16:47:23 +0100 (Do, 02 Nov 2006) | 2 lines
find_free_chan_in_stack: cleanup buggy usage
................
Modified:
team/group/trunk-cm-csel-hash/ (props changed)
team/group/trunk-cm-csel-hash/channels/chan_sip.c
team/group/trunk-cm-csel-hash/channels/misdn/isdn_lib.c
team/group/trunk-cm-csel-hash/main/callerid.c
Propchange: team/group/trunk-cm-csel-hash/
------------------------------------------------------------------------------
--- branch-1.4-blocked (original)
+++ branch-1.4-blocked Thu Nov 2 10:05:16 2006
@@ -1,1 +1,1 @@
-/branches/1.4:43484,43510,43582,43626,43703,43756,44023,44760,45246,45313-45314,45381,46165,46214,46253,46255,46401,46431,46583,46716
+/branches/1.4:43484,43510,43582,43626,43703,43756,44023,44760,45246,45313-45314,45381,46165,46214,46253,46255,46401,46431,46583,46716,46883
Propchange: team/group/trunk-cm-csel-hash/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/group/trunk-cm-csel-hash/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Nov 2 10:05:16 2006
@@ -1,1 +1,1 @@
-/trunk:1-46875
+/trunk:1-46907
Modified: team/group/trunk-cm-csel-hash/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/trunk-cm-csel-hash/channels/chan_sip.c?rev=46928&r1=46927&r2=46928&view=diff
==============================================================================
--- team/group/trunk-cm-csel-hash/channels/chan_sip.c (original)
+++ team/group/trunk-cm-csel-hash/channels/chan_sip.c Thu Nov 2 10:05:16 2006
@@ -1939,7 +1939,8 @@
pkt->next = p->packets;
pkt->owner = p;
pkt->seqno = seqno;
- pkt->flags = resp;
+ if (resp)
+ ast_set_flag(pkt->flags, FLAG_RESPONSE);
pkt->data[len] = '\0';
pkt->timer_t1 = p->timer_t1; /* Set SIP timer T1 */
if (fatal)
Modified: team/group/trunk-cm-csel-hash/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/group/trunk-cm-csel-hash/channels/misdn/isdn_lib.c?rev=46928&r1=46927&r2=46928&view=diff
==============================================================================
--- team/group/trunk-cm-csel-hash/channels/misdn/isdn_lib.c (original)
+++ team/group/trunk-cm-csel-hash/channels/misdn/isdn_lib.c Thu Nov 2 10:05:16 2006
@@ -814,14 +814,13 @@
int l3_id;
int i;
struct misdn_stack *stack=get_stack_by_bc(bc);
- int free_chan;
if (stack->nt) {
- free_chan = find_free_chan_in_stack(stack, bc, bc->channel_preselected?bc->channel:0);
- if (!free_chan) return -1;
+ if (!find_free_chan_in_stack(stack, bc, bc->channel_preselected ? bc->channel : 0))
+ return -1;
/*bc->channel=free_chan;*/
- cb_log(4,stack->port, " --> found channel: %d\n",free_chan);
+ cb_log(4,stack->port, " --> found channel: %d\n", bc->channel);
for (i=0; i <= MAXPROCS; i++)
if (stack->procids[i]==0) break;
@@ -847,10 +846,10 @@
} else {
if (stack->ptp || bc->te_choose_channel) {
/* we know exactly which channels are in use */
- free_chan = find_free_chan_in_stack(stack, bc, bc->channel_preselected?bc->channel:0);
- if (!free_chan) return -1;
+ if (!find_free_chan_in_stack(stack, bc, bc->channel_preselected ? bc->channel : 0))
+ return -1;
/*bc->channel=free_chan;*/
- cb_log(2,stack->port, " --> found channel: %d\n",free_chan);
+ cb_log(2,stack->port, " --> found channel: %d\n", bc->channel);
} else {
/* other phones could have made a call also on this port (ptmp) */
bc->channel=0xff;
@@ -1482,8 +1481,7 @@
{
if (bc->channel == 0xff) {
- bc->channel=find_free_chan_in_stack(stack, bc, 0);
- if (!bc->channel) {
+ if (!find_free_chan_in_stack(stack, bc, 0)) {
cb_log(0, stack->port, "Any Channel Requested, but we have no more!!\n");
break;
}
@@ -2028,8 +2026,7 @@
} else {
- bc->channel = find_free_chan_in_stack(stack, bc, 0);
- if (!bc->channel) {
+ if (!find_free_chan_in_stack(stack, bc, 0)) {
cb_log(0, stack->port, " No free channel at the moment\n");
msg_t *dmsg;
@@ -3218,8 +3215,7 @@
if (stack->nt) {
if (bc->channel <=0 ) { /* else we have the channel already */
- bc->channel = find_free_chan_in_stack(stack, bc, 0);
- if (!bc->channel) {
+ if (!find_free_chan_in_stack(stack, bc, 0)) {
cb_log(0, stack->port, " No free channel at the moment\n");
err=-ENOCHAN;
Modified: team/group/trunk-cm-csel-hash/main/callerid.c
URL: http://svn.digium.com/view/asterisk/team/group/trunk-cm-csel-hash/main/callerid.c?rev=46928&r1=46927&r2=46928&view=diff
==============================================================================
--- team/group/trunk-cm-csel-hash/main/callerid.c (original)
+++ team/group/trunk-cm-csel-hash/main/callerid.c Thu Nov 2 10:05:16 2006
@@ -203,7 +203,7 @@
*flags = CID_UNKNOWN_NUMBER;
} else if (cidstring[0] == 'D' || cidstring[0] == 'A') {
/* "Standard" callerid */
- for (i = 1; i < strlen(cidstring); i++ ) {
+ for (i = 1; i < strlen(cidstring); i++) {
if (cidstring[i] == 'C' || cidstring[i] == '#')
break;
if (isdigit(cidstring[i]))
@@ -259,7 +259,7 @@
org = data;
dst = 0;
- for (i=0; i < CHAR_BIT; i++) {
+ for (i = 0; i < CHAR_BIT; i++) {
org <<= 1;
dst >>= 1;
if (org & 0x100) {
@@ -268,8 +268,8 @@
}
data = (unsigned char)dst;
crc ^= (unsigned int)data << (16 - CHAR_BIT);
- for ( j=0; j<CHAR_BIT; j++ ) {
- if ( crc & 0x8000U )
+ for (j = 0; j < CHAR_BIT; j++) {
+ if (crc & 0x8000U)
crc = (crc << 1) ^ 0x1021U ;
else
crc <<= 1 ;
@@ -282,25 +282,21 @@
int mylen = len;
int olen;
int b = 'X';
- int b2 ;
+ int b2;
int res;
int x;
short *buf;
- short *obuf;
-
- if (!(buf = ast_calloc(1, 2 * len + cid->oldlen))) {
- return -1;
- }
-
- obuf = buf;
+
+ buf = alloca(2 * len + cid->oldlen);
+
memcpy(buf, cid->oldstuff, cid->oldlen);
mylen += cid->oldlen/2;
- for (x=0;x<len;x++)
+ for (x = 0; x < len; x++)
buf[x+cid->oldlen/2] = AST_XLAW(ubuf[x]);
while (mylen >= 160) {
- b = b2 = 0 ;
+ b = b2 = 0;
olen = mylen;
res = fsk_serie(&cid->fskd, buf, &mylen, &b);
@@ -317,208 +313,204 @@
}
if (res == 1) {
-
- b2 = b ;
- b = b & 0x7f ;
+ b2 = b;
+ b &= 0x7f;
/* crc checksum calculation */
- if ( cid->sawflag > 1 ) {
- cid->crc = calc_crc(cid->crc, (unsigned char)b2);
- }
+ if (cid->sawflag > 1)
+ cid->crc = calc_crc(cid->crc, (unsigned char) b2);
/* Ignore invalid bytes */
- if (b > 0xff) {
+ if (b > 0xff)
continue;
- }
/* skip DLE if needed */
- if ( cid->sawflag > 0 ) {
- if ( cid->sawflag != 5 && cid->skipflag == 0 && b == 0x10 ) {
+ if (cid->sawflag > 0) {
+ if (cid->sawflag != 5 && cid->skipflag == 0 && b == 0x10) {
cid->skipflag = 1 ;
continue ;
}
}
- if ( cid->skipflag == 1 ) {
+ if (cid->skipflag == 1)
cid->skipflag = 0 ;
- }
/* caller id retrieval */
switch(cid->sawflag) {
- case 0: /* DLE */
- if (b == 0x10) {
- cid->sawflag = 1;
- cid->skipflag = 0;
- cid->crc = 0;
- }
- break;
- case 1: /* SOH */
- if (b == 0x01) {
- cid->sawflag = 2;
- }
- break ;
- case 2: /* HEADER */
- if (b == 0x07) {
- cid->sawflag = 3;
- }
- break;
- case 3: /* STX */
- if (b == 0x02) {
- cid->sawflag = 4;
- }
- break;
- case 4: /* SERVICE TYPE */
- if (b == 0x40) {
- cid->sawflag = 5;
- }
- break;
- case 5: /* Frame Length */
- cid->sawflag = 6;
- break;
- case 6: /* NUMBER TYPE */
- cid->sawflag = 7;
- cid->pos = 0;
- cid->rawdata[cid->pos++] = b;
- break;
- case 7: /* NUMBER LENGTH */
- cid->sawflag = 8;
- cid->len = b;
- if ( (cid->len+2) >= sizeof( cid->rawdata ) ) {
- ast_log(LOG_WARNING, "too long caller id string\n" ) ;
- return -1;
- }
- cid->rawdata[cid->pos++] = b;
- break;
- case 8: /* Retrieve message */
- cid->rawdata[cid->pos++] = b;
- cid->len--;
- if (cid->len<=0) {
- cid->rawdata[cid->pos] = '\0';
- cid->sawflag = 9;
- }
- break;
- case 9: /* ETX */
- cid->sawflag = 10;
- break;
- case 10: /* CRC Checksum 1 */
- cid->sawflag = 11;
- break;
- case 11: /* CRC Checksum 2 */
- cid->sawflag = 12;
- if ( cid->crc != 0 ) {
- ast_log(LOG_WARNING, "crc checksum error\n" ) ;
- return -1;
- }
- /* extract caller id data */
- for (x=0; x<cid->pos; ) {
- switch (cid->rawdata[x++]) {
- case 0x02: /* caller id number */
- cid->number[0] = '\0';
- cid->name[0] = '\0';
- cid->flags = 0;
- res = cid->rawdata[x++];
- ast_copy_string(cid->number, &cid->rawdata[x], res+1 );
- x += res;
- break;
- case 0x21: /* additional information */
- /* length */
- x++;
- /* number type */
- switch (cid->rawdata[x]) {
- case 0x00: /* unknown */
- case 0x01: /* international number */
- case 0x02: /* domestic number */
- case 0x03: /* network */
- case 0x04: /* local call */
- case 0x06: /* short dial number */
- case 0x07: /* reserved */
- default: /* reserved */
- if (option_debug > 1)
- ast_log(LOG_DEBUG, "cid info:#1=%X\n", cid->rawdata[x]);
- break ;
- }
- x++;
- /* numbering plan octed 4 */
- x++;
- /* numbering plan octed 5 */
- switch (cid->rawdata[x]) {
- case 0x00: /* unknown */
- case 0x01: /* recommendation E.164 ISDN */
- case 0x03: /* recommendation X.121 */
- case 0x04: /* telex dial plan */
- case 0x08: /* domestic dial plan */
- case 0x09: /* private dial plan */
- case 0x05: /* reserved */
- default: /* reserved */
- if (option_debug > 1)
- ast_log(LOG_DEBUG, "cid info:#2=%X\n", cid->rawdata[x]);
- break ;
- }
- x++;
- break ;
- case 0x04: /* no callerid reason */
- /* length */
- x++;
- /* no callerid reason code */
- switch (cid->rawdata[x]) {
- case 'P': /* caller id denied by user */
- case 'O': /* service not available */
- case 'C': /* pay phone */
- case 'S': /* service congested */
- cid->flags |= CID_UNKNOWN_NUMBER;
- if (option_debug > 1)
- ast_log(LOG_DEBUG, "no cid reason:%c\n",cid->rawdata[x]);
- break ;
- }
- x++;
- break ;
- case 0x09: /* dialed number */
- /* length */
- res = cid->rawdata[x++];
- /* dialed number */
- x += res;
- break ;
- case 0x22: /* dialed number additional information */
- /* length */
- x++;
- /* number type */
- switch (cid->rawdata[x]) {
- case 0x00: /* unknown */
- case 0x01: /* international number */
- case 0x02: /* domestic number */
- case 0x03: /* network */
- case 0x04: /* local call */
- case 0x06: /* short dial number */
- case 0x07: /* reserved */
- default: /* reserved */
- if (option_debug > 1)
- ast_log(LOG_NOTICE, "did info:#1=%X\n", cid->rawdata[x]);
- break ;
- }
- x++;
- /* numbering plan octed 4 */
- x++;
- /* numbering plan octed 5 */
- switch (cid->rawdata[x]) {
- case 0x00: /* unknown */
- case 0x01: /* recommendation E.164 ISDN */
- case 0x03: /* recommendation X.121 */
- case 0x04: /* telex dial plan */
- case 0x08: /* domestic dial plan */
- case 0x09: /* private dial plan */
- case 0x05: /* reserved */
- default: /* reserved */
- if (option_debug > 1)
- ast_log(LOG_DEBUG, "did info:#2=%X\n", cid->rawdata[x]);
- break ;
- }
- x++;
+ case 0: /* DLE */
+ if (b == 0x10) {
+ cid->sawflag = 1;
+ cid->skipflag = 0;
+ cid->crc = 0;
+ }
+ break;
+ case 1: /* SOH */
+ if (b == 0x01) {
+ cid->sawflag = 2;
+ }
+ break ;
+ case 2: /* HEADER */
+ if (b == 0x07) {
+ cid->sawflag = 3;
+ }
+ break;
+ case 3: /* STX */
+ if (b == 0x02) {
+ cid->sawflag = 4;
+ }
+ break;
+ case 4: /* SERVICE TYPE */
+ if (b == 0x40) {
+ cid->sawflag = 5;
+ }
+ break;
+ case 5: /* Frame Length */
+ cid->sawflag = 6;
+ break;
+ case 6: /* NUMBER TYPE */
+ cid->sawflag = 7;
+ cid->pos = 0;
+ cid->rawdata[cid->pos++] = b;
+ break;
+ case 7: /* NUMBER LENGTH */
+ cid->sawflag = 8;
+ cid->len = b;
+ if ((cid->len+2) >= sizeof(cid->rawdata)) {
+ ast_log(LOG_WARNING, "too long caller id string\n") ;
+ return -1;
+ }
+ cid->rawdata[cid->pos++] = b;
+ break;
+ case 8: /* Retrieve message */
+ cid->rawdata[cid->pos++] = b;
+ cid->len--;
+ if (cid->len<=0) {
+ cid->rawdata[cid->pos] = '\0';
+ cid->sawflag = 9;
+ }
+ break;
+ case 9: /* ETX */
+ cid->sawflag = 10;
+ break;
+ case 10: /* CRC Checksum 1 */
+ cid->sawflag = 11;
+ break;
+ case 11: /* CRC Checksum 2 */
+ cid->sawflag = 12;
+ if (cid->crc != 0) {
+ ast_log(LOG_WARNING, "crc checksum error\n") ;
+ return -1;
+ }
+ /* extract caller id data */
+ for (x=0; x<cid->pos;) {
+ switch (cid->rawdata[x++]) {
+ case 0x02: /* caller id number */
+ cid->number[0] = '\0';
+ cid->name[0] = '\0';
+ cid->flags = 0;
+ res = cid->rawdata[x++];
+ ast_copy_string(cid->number, &cid->rawdata[x], res+1);
+ x += res;
+ break;
+ case 0x21: /* additional information */
+ /* length */
+ x++;
+ /* number type */
+ switch (cid->rawdata[x]) {
+ case 0x00: /* unknown */
+ case 0x01: /* international number */
+ case 0x02: /* domestic number */
+ case 0x03: /* network */
+ case 0x04: /* local call */
+ case 0x06: /* short dial number */
+ case 0x07: /* reserved */
+ default: /* reserved */
+ if (option_debug > 1)
+ ast_log(LOG_DEBUG, "cid info:#1=%X\n", cid->rawdata[x]);
break ;
}
+ x++;
+ /* numbering plan octed 4 */
+ x++;
+ /* numbering plan octed 5 */
+ switch (cid->rawdata[x]) {
+ case 0x00: /* unknown */
+ case 0x01: /* recommendation E.164 ISDN */
+ case 0x03: /* recommendation X.121 */
+ case 0x04: /* telex dial plan */
+ case 0x08: /* domestic dial plan */
+ case 0x09: /* private dial plan */
+ case 0x05: /* reserved */
+ default: /* reserved */
+ if (option_debug > 1)
+ ast_log(LOG_DEBUG, "cid info:#2=%X\n", cid->rawdata[x]);
+ break ;
+ }
+ x++;
+ break ;
+ case 0x04: /* no callerid reason */
+ /* length */
+ x++;
+ /* no callerid reason code */
+ switch (cid->rawdata[x]) {
+ case 'P': /* caller id denied by user */
+ case 'O': /* service not available */
+ case 'C': /* pay phone */
+ case 'S': /* service congested */
+ cid->flags |= CID_UNKNOWN_NUMBER;
+ if (option_debug > 1)
+ ast_log(LOG_DEBUG, "no cid reason:%c\n",cid->rawdata[x]);
+ break ;
+ }
+ x++;
+ break ;
+ case 0x09: /* dialed number */
+ /* length */
+ res = cid->rawdata[x++];
+ /* dialed number */
+ x += res;
+ break ;
+ case 0x22: /* dialed number additional information */
+ /* length */
+ x++;
+ /* number type */
+ switch (cid->rawdata[x]) {
+ case 0x00: /* unknown */
+ case 0x01: /* international number */
+ case 0x02: /* domestic number */
+ case 0x03: /* network */
+ case 0x04: /* local call */
+ case 0x06: /* short dial number */
+ case 0x07: /* reserved */
+ default: /* reserved */
+ if (option_debug > 1)
+ ast_log(LOG_NOTICE, "did info:#1=%X\n", cid->rawdata[x]);
+ break ;
+ }
+ x++;
+ /* numbering plan octed 4 */
+ x++;
+ /* numbering plan octed 5 */
+ switch (cid->rawdata[x]) {
+ case 0x00: /* unknown */
+ case 0x01: /* recommendation E.164 ISDN */
+ case 0x03: /* recommendation X.121 */
+ case 0x04: /* telex dial plan */
+ case 0x08: /* domestic dial plan */
+ case 0x09: /* private dial plan */
+ case 0x05: /* reserved */
+ default: /* reserved */
+ if (option_debug > 1)
+ ast_log(LOG_DEBUG, "did info:#2=%X\n", cid->rawdata[x]);
+ break ;
+ }
+ x++;
+ break ;
}
- return 1;
- break;
- default:
- ast_log(LOG_ERROR, "invalid value in sawflag %d\n", cid->sawflag);
+ }
+ return 1;
+ break;
+ default:
+ ast_log(LOG_ERROR, "invalid value in sawflag %d\n", cid->sawflag);
}
}
}
@@ -527,7 +519,7 @@
cid->oldlen = mylen * 2;
} else
cid->oldlen = 0;
- free(obuf);
+
return 0;
}
@@ -540,24 +532,19 @@
int res;
int x;
short *buf;
- short *obuf;
-
- if (!(buf = ast_calloc(1, 2 * len + cid->oldlen))) {
- return -1;
- }
-
- obuf = buf;
+
+ buf = alloca(2 * len + cid->oldlen);
+
memcpy(buf, cid->oldstuff, cid->oldlen);
mylen += cid->oldlen/2;
- for (x=0;x<len;x++)
+ for (x = 0; x < len; x++)
buf[x+cid->oldlen/2] = AST_XLAW(ubuf[x]);
- while(mylen >= 160) {
+ while (mylen >= 160) {
olen = mylen;
res = fsk_serie(&cid->fskd, buf, &mylen, &b);
if (mylen < 0) {
ast_log(LOG_ERROR, "fsk_serie made mylen < 0 (%d)\n", mylen);
- free(obuf);
return -1;
}
buf += (olen - mylen);
@@ -591,7 +578,6 @@
case 4: /* Retrieve message */
if (cid->pos >= 128) {
ast_log(LOG_WARNING, "Caller ID too long???\n");
- free(obuf);
return -1;
}
cid->rawdata[cid->pos++] = b;
@@ -616,7 +602,7 @@
if (cid->type == 0x80) {
/* MDMF */
/* Go through each element and process */
- for (x=0;x< cid->pos;) {
+ for (x = 0; x < cid->pos;) {
switch(cid->rawdata[x++]) {
case 1:
/* Date */
@@ -652,7 +638,7 @@
case 22: /* Something French */
break;
default:
- ast_log(LOG_NOTICE, "Unknown IE %d\n", cid->rawdata[x-1]);
+ ast_log(LOG_NOTICE, "Unknown IE %d\n", cid->rawdata[x - 1]);
}
x += cid->rawdata[x];
x++;
@@ -677,7 +663,6 @@
strcpy(cid->name, "");
cid->flags |= CID_UNKNOWN_NAME;
}
- free(obuf);
return 1;
break;
default:
@@ -690,7 +675,7 @@
cid->oldlen = mylen * 2;
} else
cid->oldlen = 0;
- free(obuf);
+
return 0;
}
@@ -901,7 +886,7 @@
n[y++] = n[x];
break;
default:
- if (!strchr("( )", n[x]))
+ if (!strchr("()", n[x]))
n[y++] = n[x];
}
}
More information about the asterisk-commits
mailing list