Index: create_config.sh
===================================================================
--- create_config.sh	(revision 536)
+++ create_config.sh	(working copy)
@@ -155,16 +155,14 @@
 fi
 
 if grep -q "ASTERISK_VERSION_NUM.*104" $INCLUDEDIR/version.h; then
-	echo "#define ___CC_AST_VERSION(a,b) a##b" >>$CONFIGFILE
-	echo "#define __CC_AST_VERSION(a,b) ___CC_AST_VERSION(a,b)" >>$CONFIGFILE
-	echo "#define CC_AST_VERSION __CC_AST_VERSION(0,ASTERISK_VERSION_NUM)" >>$CONFIGFILE
+	echo "#define CC_AST_VERSION ASTERISK_VERSION_NUM" >>$CONFIGFILE
 	echo " * found Asterisk version 1.4.x"
 else
-if grep -q "ASTERISK_VERSION_NUM.*0102" $INCLUDEDIR/version.h; then
+if grep -q "ASTERISK_VERSION_NUM.*102" $INCLUDEDIR/version.h; then
 	echo "#define CC_AST_VERSION ASTERISK_VERSION_NUM" >>$CONFIGFILE
 	echo " * found Asterisk version 1.2.x"
 else
-	echo "#define CC_AST_VERSION 010200" >>$CONFIGFILE
+	echo "#define CC_AST_VERSION 10200" >>$CONFIGFILE
 	echo " * forcing Asterisk version 1.2.0"
 fi
 fi
Index: chan_capi.c
===================================================================
--- chan_capi.c	(revision 536)
+++ chan_capi.c	(working copy)
@@ -30,7 +30,7 @@
  */
 #include "config.h"
 
-#if (CC_AST_VERSION >= 010400)
+#if (CC_AST_VERSION >= 10400)
 #include <asterisk.h>
 #endif
 
@@ -89,7 +89,7 @@
 
 static const char * const config_file = "capi.conf";
 
-#if (CC_AST_VERSION < 010400)
+#if (CC_AST_VERSION < 10400)
 STANDARD_LOCAL_USER;
 LOCAL_USER_DECL;
 #else
@@ -2372,8 +2372,8 @@
 
     /* try to allocate a PBX channel */
 
-#if (CC_AST_VERSION >= 010400)
-#if (CC_AST_VERSION >= 010403)
+#if (CC_AST_VERSION >= 10400)
+#if (CC_AST_VERSION >= 10403)
     pbx_chan = ast_channel_alloc(0, 0, 0, 0, "", "", "", 0, 0);
 #else
     pbx_chan = ast_channel_alloc(0, 0, 0, 0, "");
@@ -2389,7 +2389,7 @@
 
     cd->pbx_chan = pbx_chan;
 
-#if (CC_AST_VERSION < 010400)
+#if (CC_AST_VERSION < 10400)
     pbx_chan->type                = chan_capi_pbx_type;
 #endif
     pbx_chan->fds[0]              = fds[0];
@@ -2539,7 +2539,7 @@
 	  strlcpy(pbx_chan->context, cep->context, 
 		  sizeof(pbx_chan->context));
 
-#if (CC_AST_VERSION >= 010400)
+#if (CC_AST_VERSION >= 10400)
 	  ast_string_field_set(pbx_chan, accountcode, cep->accountcode);
 	  ast_string_field_set(pbx_chan, language, cep->language);
 #else
@@ -3147,7 +3147,7 @@
 	     */
 	    t = time(NULL);
 
-	    if (localtime_r(&t, &tm)) {
+	    if (ast_localtime(&t, &tm, NULL)) {
 	        tm_buf[0] = 6;
 		capi_put_1(tm_buf, 0, tm.tm_year % 100);
 		capi_put_1(tm_buf, 1, tm.tm_mon + 1);
@@ -3846,7 +3846,7 @@
 
 	    /* set default channel name */
 
-#if (CC_AST_VERSION >= 010400)
+#if (CC_AST_VERSION >= 10400)
 	    ast_string_field_build(pbx_chan, name,
 				   "CAPI/%s/%s", cep->name, dest);
 #else
@@ -4622,7 +4622,7 @@
  *      chan_capi_indicate - called from "ast_indicate()"
  *---------------------------------------------------------------------------*/
 static int
-#if (CC_AST_VERSION >= 010400)
+#if (CC_AST_VERSION >= 10400)
 chan_capi_indicate(struct ast_channel *pbx_chan, int condition, 
 		   const void *data, size_t datalen)
 #else
@@ -4806,7 +4806,7 @@
     return error;
 }
 
-#if (CC_AST_VERSION >= 010400)
+#if (CC_AST_VERSION >= 10400)
 /*---------------------------------------------------------------------------*
  *      chan_capi_send_digit_begin - not needed
  *---------------------------------------------------------------------------*/
@@ -4842,7 +4842,7 @@
     return error;
 }
 
-#if (CC_AST_VERSION >= 010400)
+#if (CC_AST_VERSION >= 10400)
 /*---------------------------------------------------------------------------*
  *      chan_capi_send_digit_end - called from "ast_write()" and "ast_senddigit()"
  *---------------------------------------------------------------------------*/
@@ -5843,7 +5843,7 @@
 
         strlcpy(pbx_chan->exten, exten, sizeof(pbx_chan->exten));
 
-#if (CC_AST_VERSION >= 010400)
+#if (CC_AST_VERSION >= 10400)
 	ast_string_field_build(pbx_chan, name, "CAPI/%s/%s-%x",
 			       cep->name, cd->dst_telno, capi_get_counter());
 #else
@@ -6917,7 +6917,7 @@
 static int
 chan_capi_command_exec(struct ast_channel *chan, void *data)
 {
-#if (CC_AST_VERSION >= 010400)
+#if (CC_AST_VERSION >= 10400)
 	struct ast_module_user *u;
 #else
 	struct localuser *u = NULL;
@@ -6937,7 +6937,7 @@
 		return -1;
 	}
 
-#if (CC_AST_VERSION >= 010400)
+#if (CC_AST_VERSION >= 10400)
 	u = ast_module_user_add(chan);
 #else
 	LOCAL_USER_ADD(u);
@@ -6971,7 +6971,7 @@
 	}
 
 	if (capicmd->capi_only) {
-#if (CC_AST_VERSION >= 010400)
+#if (CC_AST_VERSION >= 10400)
 	    if (chan->tech != &chan_capi_tech) {
 #else
 	    if (strcmp(chan->type, "CAPI")) {
@@ -7025,7 +7025,7 @@
 
  done:
 	if (u) {
-#if (CC_AST_VERSION >= 010400)
+#if (CC_AST_VERSION >= 10400)
 	    ast_module_user_remove(u);
 #else
 	    LOCAL_USER_REMOVE(u);
@@ -7528,7 +7528,7 @@
 	.description        = CHAN_CAPI_DESC,
 	.capabilities       = AST_FORMAT_ALAW,
 	.requester          = chan_capi_request,
-#if (CC_AST_VERSION >= 010400)
+#if (CC_AST_VERSION >= 10400)
 	.send_digit_begin   = chan_capi_send_digit_begin,
 	.send_digit_end     = chan_capi_send_digit_end,
 #else
@@ -8165,7 +8165,7 @@
 /*
  * main: load the module
  */
-#if (CC_AST_VERSION >= 010400)
+#if (CC_AST_VERSION >= 10400)
 static
 #endif
 int load_module(void)
@@ -8343,7 +8343,7 @@
 /*
  * unload the module
  */
-#if (CC_AST_VERSION >= 010400)
+#if (CC_AST_VERSION >= 10400)
 static
 #endif
 int unload_module()
@@ -8413,7 +8413,7 @@
 	return 0;
 }
 
-#if (CC_AST_VERSION >= 010400)
+#if (CC_AST_VERSION >= 10400)
 static int
 reload_module(void)
 {
