From 0efcf371b4a61fa1376e83d2b7404aeb47a36e26 Mon Sep 17 00:00:00 2001 From: Super User Date: Thu, 1 May 2008 10:35:20 +0200 Subject: 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 --- callerid.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 callerid.c (limited to 'callerid.c') 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); + } +} + + + -- cgit v1.2.3-55-g7522