aboutsummaryrefslogtreecommitdiffstats
path: root/callerid.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-02-26 07:34:09 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-02-26 07:34:09 +0000
commitf82ee2792834df8058f8adaae73b26803f789584 (patch)
tree84cf0173c7d7ad0e32cae89bb74d08e960a31882 /callerid.c
parent94ab7ec60be4cc4005e5324a537726efb36e0f03 (diff)
Add new callerpres parsing API (bug #3648)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5086 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'callerid.c')
-rwxr-xr-xcallerid.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/callerid.c b/callerid.c
index 19d0d4b6e..3a55a7311 100755
--- a/callerid.c
+++ b/callerid.c
@@ -715,3 +715,43 @@ int ast_callerid_split(const char *buf, char *name, int namelen, char *num, int
num[0] = '\0';
return 0;
}
+
+static struct {
+ int val;
+ char *name;
+ char *description;
+} pres_types[] = {
+ { AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED, "allowed_not_screened", "Presentation Allowed, Not Screened"},
+ { AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, "allowed_passed_screen", "Presentation Allowed, Passed Screen"},
+ { AST_PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN, "allowed_failed_screen", "Presentation Allowed, Failed Screen"},
+ { AST_PRES_ALLOWED_NETWORK_NUMBER, "allowed", "Presentation Allowed, Network Number"},
+ { AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED, "prohib_not_screened", "Presentation Prohibited, Not Screened"},
+ { AST_PRES_PROHIB_USER_NUMBER_PASSED_SCREEN, "prohib_passed_screen", "Presentation Prohibited, Passed Screen"},
+ { AST_PRES_PROHIB_USER_NUMBER_FAILED_SCREEN, "prohib_failed_screen", "Presentation Prohibited, Failed Screen"},
+ { AST_PRES_PROHIB_NETWORK_NUMBER, "prohib", "Presentation Prohibited, Network Number"},
+ { AST_PRES_NUMBER_NOT_AVAILABLE, "unavailable", "Number Unavailable"},
+};
+
+int ast_parse_caller_presentation(const char *data)
+{
+ int i;
+
+ for (i = 0; i < ((sizeof(pres_types) / sizeof(pres_types[0]))); i++) {
+ if (!strcasecmp(pres_types[i].name, data))
+ return pres_types[i].val;
+ }
+
+ return -1;
+}
+
+const char *ast_describe_caller_presentation(int data)
+{
+ int i;
+
+ for (i = 0; i < ((sizeof(pres_types) / sizeof(pres_types[0]))); i++) {
+ if (pres_types[i].val == data)
+ return pres_types[i].description;
+ }
+
+ return "unknown";
+}