+static int cli_port_unblock (int fd, int argc, char *argv[])
+{
+}
+
+static int cli_port_unload (int fd, int argc, char *argv[])
+{
+}
+
+static struct ast_cli_entry cli_show_lcr =
+{ {"lcr", "show", "lcr", NULL},
+ lcr_show_lcr,
+ "Shows current states of LCR core",
+ "Usage: lcr show lcr\n",
+};
+
+static struct ast_cli_entry cli_show_calls =
+{ {"lcr", "show", "calls", NULL},
+ lcr_show_calls,
+ "Shows current calls made by LCR and Asterisk",
+ "Usage: lcr show calls\n",
+};
+
+static struct ast_cli_entry cli_reload_routing =
+{ {"lcr", "reload", "routing", NULL},
+ lcr_reload_routing,
+ "Reloads routing conf of LCR, current uncomplete calls will be disconnected",
+ "Usage: lcr reload routing\n",
+};
+
+static struct ast_cli_entry cli_reload_interfaces =
+{ {"lcr", "reload", "interfaces", NULL},
+ lcr_reload_interfaces,
+ "Reloads interfaces conf of LCR",
+ "Usage: lcr reload interfaces\n",
+};
+
+static struct ast_cli_entry cli_port_block =
+{ {"lcr", "port", "block", NULL},
+ lcr_port_block,
+ "Blocks LCR port for further calls",
+ "Usage: lcr port block \"<port>\"\n",
+};
+
+static struct ast_cli_entry cli_port_unblock =
+{ {"lcr", "port", "unblock", NULL},
+ lcr_port_unblock,
+ "Unblocks or loads LCR port, port is opened my mISDN",
+ "Usage: lcr port unblock \"<port>\"\n",
+};
+
+static struct ast_cli_entry cli_port_unload =
+{ {"lcr", "port", "unload", NULL},
+ lcr_port_unload,
+ "Unloads LCR port, port is closes by mISDN",
+ "Usage: lcr port unload \"<port>\"\n",
+};
+
+
+/*
+ * module loading and destruction
+ */
+int load_module(void)
+{
+// ast_mutex_init(&release_lock);
+
+// lcr_cfg_update_ptp();
+
+ if (!(lcr_sock = open_socket())) {
+ ast_log(LOG_ERROR, "Unable to connect %s\n", misdn_type);
+ lcr_sock = -1;
+ /* continue with closed socket */
+ }
+
+ if (!bchannel_initialize()) {
+ ast_log(LOG_ERROR, "Unable to open mISDN device\n");
+ unload_module();
+ return -1;
+ }
+ mISDN_created = 1;
+
+ if (ast_channel_register(&lcr_tech)) {
+ ast_log(LOG_ERROR, "Unable to register channel class %s\n", misdn_type);
+ unload_module();
+ return -1;
+ }
+
+ ast_cli_register(&cli_show_lcr);
+ ast_cli_register(&cli_show_calls);
+
+ ast_cli_register(&cli_reload_routing);
+ ast_cli_register(&cli_reload_interfaces);
+ ast_cli_register(&cli_port_block);
+ ast_cli_register(&cli_port_unblock);
+ ast_cli_register(&cli_port_unload);
+
+ ast_register_application("misdn_set_opt", misdn_set_opt_exec, "misdn_set_opt",
+ "misdn_set_opt(:<opt><optarg>:<opt><optarg>..):\n"
+ "Sets mISDN opts. and optargs\n"
+ "\n"
+ "The available options are:\n"
+ " d - Send display text on called phone, text is the optparam\n"
+ " n - don't detect dtmf tones on called channel\n"
+ " h - make digital outgoing call\n"
+ " c - make crypted outgoing call, param is keyindex\n"
+ " e - perform echo cancelation on this channel,\n"
+ " takes taps as arguments (32,64,128,256)\n"
+ " s - send Non Inband DTMF as inband\n"
+ " vr - rxgain control\n"
+ " vt - txgain control\n"
+ );
+
+
+ lcr_cfg_get( 0, LCR_GEN_TRACEFILE, global_tracefile, BUFFERSIZE);
+
+ chan_lcr_log(0, 0, "-- mISDN Channel Driver Registred -- (BE AWARE THIS DRIVER IS EXPERIMENTAL!)\n");
+
+ return 0;
+}
+
+int unload_module(void)
+{
+ /* First, take us out of the channel loop */
+ ast_log(LOG_VERBOSE, "-- Unregistering mISDN Channel Driver --\n");
+
+ misdn_tasks_destroy();
+
+ if (!g_config_initialized) return 0;
+
+ ast_cli_unregister(&cli_show_lcr);
+ ast_cli_unregister(&cli_show_calls);
+ ast_cli_unregister(&cli_reload_routing);
+ ast_cli_unregister(&cli_reload_interfaces);
+ ast_cli_unregister(&cli_port_block);
+ ast_cli_unregister(&cli_port_unblock);
+ ast_unregister_application("misdn_set_opt");
+
+ ast_channel_unregister(&lcr_tech);
+
+ if (mISDN_created) {
+ bchannel_deinitialize();
+ mISDN_created = 0;
+ }
+
+ if (lcr_sock >= 0) {
+ close(lcr_sock);
+ lcr_sock = -1;
+ }
+
+ was ist mit dem mutex
+
+ return 0;
+}
+
+int reload(void)
+{
+ reload_config();
+
+ return 0;
+}
+
+int usecount(void)
+{
+ int res;
+ ast_mutex_lock(&usecnt_lock);
+ res = usecnt;
+ ast_mutex_unlock(&usecnt_lock);
+ return res;
+}
+
+char *description(void)
+{
+ return desc;
+}
+
+char *key(void)
+{
+ return ASTERISK_GPL_KEY;
+}