int wake_pipe[2];
struct lcr_fd wake_fd;
-int quit;
-
int glob_channel = 0;
int lcr_sock = -1;
CDEBUG(NULL, NULL, "Ignoring message %d, because socket is closed.\n", message_type);
return -1;
}
- CDEBUG(NULL, NULL, "Sending %s to socket.\n", messages_txt[message_type]);
+ CDEBUG(NULL, NULL, "Sending %s to socket. (ref=%d)\n", messages_txt[message_type], ref);
adminp = &admin_first;
while(*adminp)
call->state = CHAN_LCR_STATE_CONNECT;
/* request bchannel */
if (!call->bchannel) {
- CDEBUG(call, call->ast, "Requesting B-channel.\n");
+ CDEBUG(call, call->ast, "Requesting B-channel. (ref=%d)\n", call->ref);
memset(&newparam, 0, sizeof(union parameter));
newparam.bchannel.type = BCHANNEL_REQUEST;
send_message(MESSAGE_BCHANNEL, call->ref, &newparam);
/* request bchannel, if call is resumed and we don't have it */
if (param->notifyinfo.notify == INFO_NOTIFY_USER_RESUMED && !call->bchannel && call->ref) {
- CDEBUG(call, call->ast, "Reqesting bchannel at resume.\n");
+ CDEBUG(call, call->ast, "Reqesting bchannel at resume. (ref=%d)\n", call->ref);
memset(&newparam, 0, sizeof(union parameter));
newparam.bchannel.type = BCHANNEL_REQUEST;
send_message(MESSAGE_BCHANNEL, call->ref, &newparam);
/* request bchannel */
if (!call->bchannel) {
- CDEBUG(call, call->ast, "Requesting B-channel.\n");
+ CDEBUG(call, call->ast, "Requesting B-channel. (ref=%d)\n", call->ref);
memset(&newparam, 0, sizeof(union parameter));
newparam.bchannel.type = BCHANNEL_REQUEST;
send_message(MESSAGE_BCHANNEL, call->ref, &newparam);
ast_mutex_lock(&chan_lock);
- while(!quit) {
+ while(1) {
handle_queue();
select_main(0, &global_change, lock_chan, unlock_chan);
}
- close_socket();
-
- del_timer(&socket_retry);
-
- unregister_fd(&wake_fd);
- close(wake_pipe[0]);
- close(wake_pipe[1]);
-
- CERROR(NULL, NULL, "Thread exit.\n");
-
- ast_mutex_unlock(&chan_lock);
-
return NULL;
}
ast_cli_register(&cli_port_unload);
#endif
- quit = 0;
if ((pthread_create(&chan_tid, NULL, chan_thread, NULL)<0)) {
/* failed to create thread */
bchannel_deinitialize();
int unload_module(void)
{
/* First, take us out of the channel loop */
- CDEBUG(NULL, NULL, "-- Unregistering mISDN Channel Driver --\n");
+ CDEBUG(NULL, NULL, "-- Unregistering Linux-Call-Router Channel Driver --\n");
+
+ pthread_cancel(chan_tid);
+
+ close_socket();
- quit = 1;
- pthread_join(chan_tid, NULL);
+ del_timer(&socket_retry);
+
+ unregister_fd(&wake_fd);
+ close(wake_pipe[0]);
+ close(wake_pipe[1]);
+
+// ast_mutex_unlock(&chan_lock);
ast_channel_unregister(&lcr_tech);
ast_unregister_application("lcr_config");
-
if (mISDN_created) {
bchannel_deinitialize();
mISDN_created = 0;