Universal cid handler
This commit is contained in:
parent
bedea8c6fb
commit
ef3c0a66b8
@ -3,7 +3,7 @@
|
||||
* (C)2005, Dan Ponte
|
||||
* BSDL w/ advert.
|
||||
*/
|
||||
/* $Amigan: phoned/include/phoned.h,v 1.17 2005/06/19 00:10:56 dcp1990 Exp $ */
|
||||
/* $Amigan: phoned/include/phoned.h,v 1.18 2005/06/19 01:24:15 dcp1990 Exp $ */
|
||||
#include <pcre.h> /* fugly, I know... */
|
||||
#define VERSION "0.1"
|
||||
#define LOGFILE "/var/log/phoned.log"
|
||||
@ -166,6 +166,8 @@ char *parse_command(const char *cmd, short *cont, state_info_t *s);
|
||||
void begin_dialogue(FILE* fp, int fd);
|
||||
short db_init(char* dbfilename);
|
||||
short db_destroy(void);
|
||||
short db_add_call(cid_t* c, time_t t);
|
||||
void cid_handle(cid_t *c);
|
||||
/* old stuff...
|
||||
void modem_pickup(void);
|
||||
void modem_hangup(void);
|
||||
|
12
phoned/cid.c
12
phoned/cid.c
@ -27,7 +27,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/* $Amigan: phoned/phoned/cid.c,v 1.5 2005/06/18 20:51:29 dcp1990 Exp $ */
|
||||
/* $Amigan: phoned/phoned/cid.c,v 1.6 2005/06/19 01:24:16 dcp1990 Exp $ */
|
||||
/* system includes */
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
@ -167,3 +167,13 @@ cid_t* parse_cid(char* cidstring)
|
||||
date[2] = '/';
|
||||
return c;
|
||||
}
|
||||
void cid_handle(c)
|
||||
cid_t *c;
|
||||
{
|
||||
time_t ti;
|
||||
ti = time(NULL);
|
||||
cid_log(c);
|
||||
cid_notify(c);
|
||||
check_condition(c);
|
||||
db_add_call(c, ti);
|
||||
}
|
||||
|
@ -157,9 +157,7 @@ void modem_hread(char* cbuf)
|
||||
if(doing_cid) {
|
||||
cid_t *rc;
|
||||
rc = parse_cid(buffer);
|
||||
cid_log(rc);
|
||||
cid_notify(rc);
|
||||
check_condition(rc);
|
||||
cid_handle(rc);
|
||||
free_cid(rc);
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
doing_cid = 0;
|
||||
|
@ -28,7 +28,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/* $Amigan: phoned/phoned/remote.c,v 1.5 2005/06/16 20:57:10 dcp1990 Exp $ */
|
||||
/* $Amigan: phoned/phoned/remote.c,v 1.6 2005/06/19 01:24:16 dcp1990 Exp $ */
|
||||
/* system includes */
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@ -68,7 +68,7 @@ char *parse_command(cmd, cont, s)
|
||||
} else {
|
||||
RNF("513 ERROR: Syntax error: Needs usernamd as argument.\n");
|
||||
}
|
||||
} else if(CHK("tnotify")) {
|
||||
} else if(CHK("thandler")) {
|
||||
cid_t c;
|
||||
c.number = "7823020300";
|
||||
c.name = "BUSH,GEORGE W.";
|
||||
@ -76,10 +76,9 @@ char *parse_command(cmd, cont, s)
|
||||
c.hour = 3;
|
||||
c.month = 4;
|
||||
c.minute = 20;
|
||||
cid_notify(&c);
|
||||
cid_log(&c);
|
||||
cid_handle(&c);
|
||||
*cont = 0;
|
||||
RNF("500 OK: Notify tested.\n");
|
||||
RNF("500 OK: Handler tested.\n");
|
||||
} else if(CHK("tparse")) {
|
||||
cid_t* rc;
|
||||
rc = parse_cid("802701083132323130383234070F5354414E444953482048454154494E020A343031333937333337325C\n");
|
||||
|
Loading…
Reference in New Issue
Block a user