--- channels/chan_bluetooth.c.orig	2006-10-23 11:07:20.000000000 +0100
+++ channels/chan_bluetooth.c	2006-10-23 10:21:27.000000000 +0100
@@ -91,6 +91,7 @@
 
 /* ---------------------------------- */
 
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <string.h>
 #include <asterisk/lock.h>
@@ -217,7 +218,7 @@
   // device
   int autoconnect;                  /* 1 for autoconnect */
   int outgoing_id;                  /* Outgoing connection scheduler id */
-  char * name;                      /* Devices friendly name */
+  const char * name;                /* Devices friendly name */
   blt_role_t role;                  /* Device role (HS or AG) */
   bdaddr_t bdaddr;                  /* remote address */
   int channel;                      /* remote channel */
@@ -228,7 +229,7 @@
   char rd_buff[BLT_RDBUFF_MAX];     /* RFCOMM input buffer */
   int rd_buff_pos;                  /* RFCOMM input buffer position */
   int ready;                        /* 1 When ready */
-  char *context;
+  const char *context;
 
   /* AG mode */
   char last_ok_cmd[BLT_RDBUFF_MAX];        /* Runtime[AG]: Last AT command that was OK */
@@ -328,7 +329,7 @@
 static struct ast_frame *blt_read(struct ast_channel *chan);
 static int blt_call(struct ast_channel *c, char *dest, int timeout);
 static int blt_write(struct ast_channel *chan, struct ast_frame *f);
-static int blt_indicate(struct ast_channel *chan, int cond);
+static int blt_indicate(struct ast_channel *chan, int cond, const void *data, size_t datalen);
 
 static const struct ast_channel_tech blt_tech = {
 	.type = BLT_CHAN_NAME,
@@ -378,7 +379,7 @@
   return "Unknown";
 }
 
-int sock_err(int fd)
+static int sock_err(int fd)
 {
   int ret;
   int len = sizeof(ret);
@@ -387,7 +388,7 @@
 }
 
 /* ---------------------------------- */
-int parse_clip(const char * str, char *number, int number_len, char * name, int name_len, int *type)
+static int parse_clip(const char * str, char *number, int number_len, char * name, int name_len, int *type)
 {
   const char *c = str;
   const char *start;
@@ -531,7 +532,7 @@
 
 /* ---------------------------------- */
 
-int
+static int
 set_buffer(char * ring, char * data, int circular_len, int * pos, int data_len)
 {
   int start_pos = *(pos);
@@ -555,7 +556,7 @@
   return 0;
 }
 
-int
+static int
 get_buffer(char * dst, char * ring, int ring_size, int * head, int to_copy)
 {
   int copy;
@@ -1128,7 +1129,7 @@
 }
 
 static int 
-blt_indicate(struct ast_channel * c, int condition)
+blt_indicate(struct ast_channel * c, int condition, const void *data, size_t datalen)
 {
   ast_log(LOG_DEBUG, "blt_indicate (%d)\n", condition);
 
@@ -1178,7 +1179,7 @@
     return NULL;
   }
 
-  snprintf(ast->name, sizeof(ast->name), "BLT/%s", dev->name);
+  snprintf((char *)ast->name, sizeof(ast->name), "BLT/%s", dev->name);
 
   // ast->fds[0] = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_SCO);
 
@@ -1190,7 +1191,7 @@
 
   ast_setstate(ast, state);
 
-  ast->type = BLT_CHAN_NAME;
+  //ast->type = BLT_CHAN_NAME;  XXX REMOVED FOR TRUNK
 
   ast->tech_pvt = dev;
 #if ASTERISK_VERSION_NUM > 010107
@@ -1210,7 +1211,7 @@
     ast_set_callerid(ast, dev->cid_num, dev->cid_name, dev->cid_num);
   }
 
-  ast->language[0] = '\0';
+  //ast->language[0] = '\0';   XXX REMOVED FOR TRUNK
 
   ast->fds[0] = dev->sco_pipe[0];
   write(dev->sco_pipe[1], &c, 1);
@@ -1757,7 +1758,7 @@
 
 /* -- Handle negotiation when we're a HS -- */
 
-void
+static void
 ag_unknown_response(blt_dev_t * dev, char * cmd)
 {
   ast_log(LOG_DEBUG, "Got UNKN response: %s\n", cmd);
@@ -1767,7 +1768,7 @@
 
 }
 
-void
+static void
 ag_cgmi_response(blt_dev_t * dev, char * cmd)
 {
   // CGMM - Phone Model
@@ -1788,7 +1789,7 @@
   dev->cb = ag_unknown_response;
 }
 
-void
+static void
 ag_cgmi_valid_response(blt_dev_t * dev, char * cmd)
 {
   // send_atcmd(dev, "AT+WS46?");
@@ -1803,14 +1804,14 @@
   }
 }
 
-void
+static void
 ag_clip_response(blt_dev_t * dev, char * cmd)
 {
   send_atcmd(dev, "AT+CGMI=?");
   dev->cb = ag_cgmi_valid_response;
 }
 
-void
+static void
 ag_cmer_response(blt_dev_t * dev, char * cmd)
 {
   dev->cb = ag_clip_response;
@@ -1819,7 +1820,7 @@
   send_atcmd(dev, "AT+CLIP=1");
 }
 
-void
+static void
 ag_cind_status_response(blt_dev_t * dev, char * cmd)
 {
   // XXX:T: Handle response.
@@ -1828,7 +1829,7 @@
   // Initiase SCO link!
 }
 
-void
+static void
 ag_cind_response(blt_dev_t * dev, char * cmd)
 {
   dev->cb = ag_cind_status_response;
@@ -1836,7 +1837,7 @@
   send_atcmd(dev, "AT+CIND?");
 }
 
-void
+static void
 ag_brsf_response(blt_dev_t * dev, char * cmd)
 {
   dev->cb = ag_cind_response;
@@ -2879,7 +2880,7 @@
 {
   struct ast_config * cfg;
   struct ast_variable * v;
-  char * cat;
+  const char * cat;
 
   cfg = ast_config_load(BLT_CONFIG_FILE);
 
@@ -2906,7 +2907,7 @@
 
   while(cat) {
 
-    char * str;
+    const char * str;
 
     if (strcasecmp(cat, "general")) {
       blt_dev_t * device = malloc(sizeof(blt_dev_t));
@@ -3056,7 +3057,7 @@
 }
 
 static char *
-complete_device(char * line, char * word, int pos, int state, int rpos, blt_role_t role)
+complete_device(const char * line, const char * word, int pos, int state, int rpos, blt_role_t role)
 {
   blt_dev_t * dev;
   int which = 0;
@@ -3090,7 +3091,7 @@
 }
 
 static char *
-complete_device_2_ag(char * line, char * word, int pos, int state)
+complete_device_2_ag(const char * line, const char * word, int pos, int state)
 {
   return complete_device(line, word, pos, state, 2, BLT_ROLE_AG);
 }
@@ -3103,7 +3104,6 @@
 cli_show_peers =
     { { "bluetooth", "show", "peers", NULL }, blt_show_peers, "List Bluetooth Peers", show_peers_usage };
 
-
 static char ag_sendcmd[] =
 "Usage: bluetooth ag <device> sendcmd <cmd>\n"
 "       Sends a AT cmd over the RFCOMM link, and print result (AG only)\n";
@@ -3120,7 +3120,7 @@
 cli_show_information =
     { { "bluetooth", "show", "information", NULL }, blt_show_information, "List Bluetooth Info", show_information };
 
-void
+static void
 remove_sdp_records(void)
 {
 
@@ -3198,13 +3198,16 @@
 
   }
 
-  ast_unregister_atexit(remove_sdp_records);
+  //ast_unregister_atexit(remove_sdp_records); XXX REMOVED FOR TRUNK
   remove_sdp_records();
   return 0;
 }
 
-int
-load_module()
+static int
+unload_module(void);
+
+static int
+load_module(void)
 {
   sdp_session_t * sess;
   int dd;
@@ -3285,14 +3288,14 @@
   ast_cli_register(&cli_show_peers);
   ast_cli_register(&cli_ag_sendcmd);
 
-  ast_register_atexit(remove_sdp_records);
+  //ast_register_atexit(remove_sdp_records); XXX REMOVED FOR TRUNK
 
   ast_log(LOG_NOTICE, "Loaded Bluetooth support, %s\n", BLT_SVN_REVISION + 1);
 
   return 0;
 }
 
-int
+static int
 unload_module(void)
 {
   ast_cli_unregister(&cli_ag_sendcmd);
@@ -3301,25 +3304,8 @@
   return __unload_module();
 }
 
-int
-usecount()
-{
-  int res;
-  ast_mutex_lock(&usecnt_lock);
-  res = usecnt;
-  ast_mutex_unlock(&usecnt_lock);
-  return res;
-}
-
-char *description()
-{
-  return "Bluetooth Channel Driver";
-}
-
-char *
-key()
-{
-  return ASTERISK_GPL_KEY;
-}
-
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Bluetooth channel driver",
+		.load = load_module,
+		.unload = unload_module,
+);
 
