mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-20 12:20:12 +00:00
- Formatting fixes
- Doxygen git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@16011 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
27
callerid.c
27
callerid.c
@@ -257,6 +257,7 @@ static unsigned short calc_crc(unsigned short crc, unsigned char data)
|
|||||||
unsigned int i, j, org, dst;
|
unsigned int i, j, org, dst;
|
||||||
org = data;
|
org = data;
|
||||||
dst = 0;
|
dst = 0;
|
||||||
|
|
||||||
for (i=0; i < CHAR_BIT; i++) {
|
for (i=0; i < CHAR_BIT; i++) {
|
||||||
org <<= 1;
|
org <<= 1;
|
||||||
dst >>= 1;
|
dst >>= 1;
|
||||||
@@ -267,8 +268,10 @@ static unsigned short calc_crc(unsigned short crc, unsigned char data)
|
|||||||
data = (unsigned char)dst;
|
data = (unsigned char)dst;
|
||||||
crc ^= (unsigned int)data << (16 - CHAR_BIT);
|
crc ^= (unsigned int)data << (16 - CHAR_BIT);
|
||||||
for ( j=0; j<CHAR_BIT; j++ ) {
|
for ( j=0; j<CHAR_BIT; j++ ) {
|
||||||
if ( crc & 0x8000U ) crc = (crc << 1) ^ 0x1021U ;
|
if ( crc & 0x8000U )
|
||||||
else crc <<= 1 ;
|
crc = (crc << 1) ^ 0x1021U ;
|
||||||
|
else
|
||||||
|
crc <<= 1 ;
|
||||||
}
|
}
|
||||||
return crc;
|
return crc;
|
||||||
}
|
}
|
||||||
@@ -428,7 +431,8 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, i
|
|||||||
case 0x06: /* short dial number */
|
case 0x06: /* short dial number */
|
||||||
case 0x07: /* reserved */
|
case 0x07: /* reserved */
|
||||||
default: /* reserved */
|
default: /* reserved */
|
||||||
ast_log(LOG_NOTICE, "cid info:#1=%X\n", cid->rawdata[x]);
|
if (option_debug > 1)
|
||||||
|
ast_log(LOG_DEBUG, "cid info:#1=%X\n", cid->rawdata[x]);
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
x++;
|
x++;
|
||||||
@@ -444,7 +448,8 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, i
|
|||||||
case 0x09: /* private dial plan */
|
case 0x09: /* private dial plan */
|
||||||
case 0x05: /* reserved */
|
case 0x05: /* reserved */
|
||||||
default: /* reserved */
|
default: /* reserved */
|
||||||
ast_log(LOG_NOTICE, "cid info:#2=%X\n", cid->rawdata[x]);
|
if (option_debug > 1)
|
||||||
|
ast_log(LOG_DEBUG, "cid info:#2=%X\n", cid->rawdata[x]);
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
x++;
|
x++;
|
||||||
@@ -459,7 +464,8 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, i
|
|||||||
case 'C': /* pay phone */
|
case 'C': /* pay phone */
|
||||||
case 'S': /* service congested */
|
case 'S': /* service congested */
|
||||||
cid->flags |= CID_UNKNOWN_NUMBER;
|
cid->flags |= CID_UNKNOWN_NUMBER;
|
||||||
ast_log(LOG_NOTICE, "no cid reason:%c\n",cid->rawdata[x]);
|
if (option_debug > 1)
|
||||||
|
ast_log(LOG_DEBUG, "no cid reason:%c\n",cid->rawdata[x]);
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
x++;
|
x++;
|
||||||
@@ -483,6 +489,7 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, i
|
|||||||
case 0x06: /* short dial number */
|
case 0x06: /* short dial number */
|
||||||
case 0x07: /* reserved */
|
case 0x07: /* reserved */
|
||||||
default: /* reserved */
|
default: /* reserved */
|
||||||
|
if (option_debug > 1)
|
||||||
ast_log(LOG_NOTICE, "did info:#1=%X\n", cid->rawdata[x]);
|
ast_log(LOG_NOTICE, "did info:#1=%X\n", cid->rawdata[x]);
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
@@ -499,7 +506,8 @@ int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int len, i
|
|||||||
case 0x09: /* private dial plan */
|
case 0x09: /* private dial plan */
|
||||||
case 0x05: /* reserved */
|
case 0x05: /* reserved */
|
||||||
default: /* reserved */
|
default: /* reserved */
|
||||||
ast_log(LOG_NOTICE, "did info:#2=%X\n", cid->rawdata[x]);
|
if (option_debug > 1)
|
||||||
|
ast_log(LOG_DEBUG, "did info:#2=%X\n", cid->rawdata[x]);
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
x++;
|
x++;
|
||||||
@@ -823,6 +831,7 @@ int callerid_generate(unsigned char *buf, char *number, char *name, int flags, i
|
|||||||
int bytes=0;
|
int bytes=0;
|
||||||
int x, sum;
|
int x, sum;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
/* Initial carriers (real/imaginary) */
|
/* Initial carriers (real/imaginary) */
|
||||||
float cr = 1.0;
|
float cr = 1.0;
|
||||||
float ci = 0.0;
|
float ci = 0.0;
|
||||||
@@ -860,7 +869,7 @@ int callerid_generate(unsigned char *buf, char *number, char *name, int flags, i
|
|||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*! \brief Clean up phone string
|
||||||
* remove '(', ' ', ')', non-trailing '.', and '-' not in square brackets.
|
* remove '(', ' ', ')', non-trailing '.', and '-' not in square brackets.
|
||||||
* Basically, remove anything that could be invalid in a pattern.
|
* Basically, remove anything that could be invalid in a pattern.
|
||||||
*/
|
*/
|
||||||
@@ -868,6 +877,7 @@ void ast_shrink_phone_number(char *n)
|
|||||||
{
|
{
|
||||||
int x, y=0;
|
int x, y=0;
|
||||||
int bracketed = 0;
|
int bracketed = 0;
|
||||||
|
|
||||||
for (x=0; n[x]; x++) {
|
for (x=0; n[x]; x++) {
|
||||||
switch(n[x]) {
|
switch(n[x]) {
|
||||||
case '[':
|
case '[':
|
||||||
@@ -936,6 +946,7 @@ int ast_callerid_parse(char *instr, char **name, char **location)
|
|||||||
}
|
}
|
||||||
} else { /* no valid brackets */
|
} else { /* no valid brackets */
|
||||||
char tmp[256];
|
char tmp[256];
|
||||||
|
|
||||||
ast_copy_string(tmp, instr, sizeof(tmp));
|
ast_copy_string(tmp, instr, sizeof(tmp));
|
||||||
ast_shrink_phone_number(tmp);
|
ast_shrink_phone_number(tmp);
|
||||||
if (ast_isphonenumber(tmp)) { /* Assume it's just a location */
|
if (ast_isphonenumber(tmp)) { /* Assume it's just a location */
|
||||||
@@ -994,6 +1005,7 @@ int ast_callerid_split(const char *buf, char *name, int namelen, char *num, int
|
|||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
char *l = NULL, *n = NULL;
|
char *l = NULL, *n = NULL;
|
||||||
|
|
||||||
tmp = ast_strdupa(buf);
|
tmp = ast_strdupa(buf);
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
name[0] = '\0';
|
name[0] = '\0';
|
||||||
@@ -1013,6 +1025,7 @@ int ast_callerid_split(const char *buf, char *name, int namelen, char *num, int
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! \brief Translation table for Caller ID Presentation settings */
|
||||||
static struct {
|
static struct {
|
||||||
int val;
|
int val;
|
||||||
char *name;
|
char *name;
|
||||||
|
Reference in New Issue
Block a user