public class AstUtil extends Object
util.c
. Modifier and Type | Method and Description |
---|---|
static boolean |
isEqual(Object a,
Object b) |
static boolean |
isNull(Object s)
Checks if the value of s was
null in Asterisk. |
static boolean |
isTrue(Object o)
Checks if a String represents
true or false
according to Asterisk's logic. |
static String[] |
parseCallerId(String s)
Parses a string for caller id information.
|
public static boolean isTrue(Object o)
true
or false
according to Asterisk's logic. util.c
is as follows: int ast_true(const char *s) { if (!s || ast_strlen_zero(s)) return 0;
if (!strcasecmp(s, "yes") || !strcasecmp(s, "true") || !strcasecmp(s, "y") || !strcasecmp(s, "t") || !strcasecmp(s, "1") || !strcasecmp(s, "on")) return -1;
return 0; }
ZapShowChannelsEvent
this method
also consideres the string "Enabled" as true.o
- the Object (usually a String) to check for true
.true
if s represents true
,
false
otherwise.public static boolean isEqual(Object a, Object b)
a
- an objectb
- an object to be compared with a
for equalitytrue
if the arguments are equal to each other and
false
otherwisepublic static String[] parseCallerId(String s)
"Some Name" <1234>
. ast_callerid_parse
in callerid.c
but strips any whitespace.s
- the string to parsepublic static boolean isNull(Object s)
null
in Asterisk. null
values with different string values like "unknown", "<unknown>" or
"<null>". S_OR
in Asterisk's
source code. You will find things like
S_OR(chan->cid.cid_num, "<unknown>") fdprintf(fd, "agi_callerid: %s\n", S_OR(chan->cid.cid_num, "unknown"));and more...
s
- the string to test, may be null
. If s is not a
string the only test that is performed is a check for
null
.true
if the s was null
in Asterisk;
false
otherwise.Copyright © 2004–2020. All rights reserved.