[Asterisk-Dev] Open source time card application for Asterisk

Steven critch at basesys.com
Tue Sep 27 06:27:23 MST 2005


On Mon, 2005-09-26 at 14:57 -0500, Tilghman Lesher wrote:
> http://bugs.digium.com/view.php?id=5055
> 
> timeclock.sql:
> CREATE TABLE timeclock (
> 	userid char(4) default '' not null,
> 	timein integer,
> 	timeout integer,
> 	PRIMARY KEY (userid,timeout)
> );
> 
> func_odbc.conf:
> [CLOCKIN]
> write=INSERT INTO timeclock (userid,timein) VALUES 
> ('${ARG1}','${VAL1}')
> 
> [CLOCKOUT]
> write=UPDATE timeclock SET timeout='${VAL1}' WHERE timeout IS NULL and 
> userid='${ARG1}'
> 
> extensions.conf:
> exten => 9991,1,VMAuthenticate
> exten => 9991,2,Set(ODBC_CLOCKIN(${VM_AUTH})=${EPOCH})
> exten => 9991,3,Hangup
> 
> exten => 9990,1,VMAuthenticate
> exten => 9990,2,Set(ODBC_CLOCKOUT(${VM_AUTH})=${EPOCH})
> exten => 9990,3,Hangup
> 
> Voila!  Instant timeclock.

Small problem, this gives you no ability to log a clock out if you
missed the clock in. 

Also I don't know enough about the ODBC functions, but does it give you
any feedback on failure?

On suggestion to act more like a time clock would be to merge them
together into one function that just recorded a clock event. Then you
use knowledge about the time and ordering of events to determine if it
is a clock in or clock out event. 

If the two are merged, and a clock in event failed or, more likely,
missed by the user, a clock out event can still be processed and later
corrected by inserting a value that the administrator is willing to
accept as a clock in event.  
-- 
Steven Critchfield
critch at basesys.com
KI4KTY




More information about the asterisk-dev mailing list