summaryrefslogtreecommitdiffstats
path: root/callerid.c
diff options
context:
space:
mode:
authorSuper User2008-05-01 10:35:20 +0200
committerSuper User2008-05-01 10:35:20 +0200
commit0efcf371b4a61fa1376e83d2b7404aeb47a36e26 (patch)
tree490134ca54abca5c1983b8d40648acdf03de3b39 /callerid.c
parentwork (diff)
downloadlcr-0efcf371b4a61fa1376e83d2b7404aeb47a36e26.tar.gz
lcr-0efcf371b4a61fa1376e83d2b7404aeb47a36e26.tar.xz
lcr-0efcf371b4a61fa1376e83d2b7404aeb47a36e26.zip
work on chan_lcr
modified: Makefile modified: action.cpp modified: action_efi.cpp modified: action_vbox.cpp modified: apppbx.cpp modified: apppbx.h modified: bchannel.c modified: bchannel.h new file: callerid.c new file: callerid.h modified: chan_lcr.c modified: chan_lcr.h modified: crypt.cpp modified: endpoint.cpp modified: endpointapp.cpp modified: interface.c modified: join.cpp modified: joinpbx.cpp modified: joinremote.cpp modified: mISDN.cpp modified: mail.c modified: main.h modified: message.h modified: port.cpp modified: route.c modified: route.h modified: socket_server.c modified: todo.txt modified: vbox.cpp modified: watch.c
Diffstat (limited to 'callerid.c')
-rw-r--r--callerid.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/callerid.c b/callerid.c
new file mode 100644
index 0000000..47b51da
--- /dev/null
+++ b/callerid.c
@@ -0,0 +1,60 @@
+/*****************************************************************************\
+** **
+** PBX4Linux **
+** **
+**---------------------------------------------------------------------------**
+** Copyright: Andreas Eversberg **
+** **
+** caller id support file **
+** **
+\*****************************************************************************/
+
+#include "main.h"
+
+/* create caller id from digits by comparing with national and international
+ * prefixes.
+ */
+char *nationalize_callerinfo(char *string, int *ntype, char *national, char *international)
+{
+ if (!strncmp(options.international, string, strlen(options.international)))
+ {
+ *ntype = INFO_NTYPE_INTERNATIONAL;
+ return(string+strlen(international));
+ }
+ if (!strncmp(options.national, string, strlen(options.national)))
+ {
+ *ntype = INFO_NTYPE_NATIONAL;
+ return(string+strlen(national));
+ }
+ *ntype = INFO_NTYPE_SUBSCRIBER;
+ return(string);
+}
+
+/* create number (including access codes) from caller id
+ * prefixes.
+ */
+char *numberrize_callerinfo(char *string, int ntype, char *national, char *international)
+{
+ static char result[256];
+
+ switch(ntype)
+ {
+ case INFO_NTYPE_INTERNATIONAL:
+ UCPY(result, international);
+ SCAT(result, string);
+ return(result);
+ break;
+
+ case INFO_NTYPE_NATIONAL:
+ UCPY(result, national);
+ SCAT(result, string);
+ return(result);
+ break;
+
+ default:
+ return(string);
+ }
+}
+
+
+