denke an alle info-elements in jeder message (from asterisk & from lcr)
ausloesen beim socket-verlust
+bei "ast_channel_alloc" kannste die Callerid und den type usw. setzten.
+da kannste auch die calledPartyNum setzen. Um asterisk ein Setup zu schicken rufst du einfach "ast_pbx_start( channel ) " auf. Die ganzen queue baren indications und Controls findest du in "include/asterisk/frame.h"
+
+Also zusammenfassend:
+
+Messages die zum Asterisk gehen:
+
+SETUP - > ast_pbx_start(ast)
+ CONNECT -> ast_queue_control(ast,
+ AST_CONTROL_ANSWER);
+PROCEEDING -> ast_queue_control(ast,
+ AST_CONTROL_PROCEEDING);
+ALERTING -> ast_queue_control(ast,
+ AST_CONTROL_RINGING);
+DISCONNECT -> ast_queue_hangup(ast);
+
+Messages die vom Asterisk kommen:
+
+lcr_request -> NEWREF
+lcr_call -> SETUP
+lcr_answer -> CONNECT
+lcr_hangup -> RELEASE_(complete)
+ lcr_indicate(AST_CONTROL_RINGING) -> ALERTING
+ lcr_indicate(AST_CONTROL_PROCEEDING) -> PROCEEDING
+ lcr_indicate(AST_CONTROL_PROGRESS) -> PROGRESS
+ lcr_indicate(AST_CONTROL_BUSY) -> DISCONNECT ( cause=17 )
+
+
+
+
+
+
+
+
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char lcr_type[]="LCR";
+pthread_t chan_tid;
pthread_mutex_t chan_lock;
+int quit;
int lcr_sock = -1;
}
-hander thread muss noch
socket muss per timer fuer das öffnen checken
-void lcr_thread(void)
+static void *chan_thread(void *arg)
{
int work;
- while(42)
+ pthread_mutex_lock(&chan_lock);
+
+ while(!quit)
{
work = 0;
pthread_mutex_lock(&chan_lock);
}
}
+
+ pthread_mutex_unlock(&chan_lock);
+
+ return NULL;
}
/*
if (!bchannel_initialize()) {
ast_log(LOG_ERROR, "Unable to open mISDN device\n");
+ close_socket(lcr_sock);
return -1;
}
mISDN_created = 1;
if (ast_channel_register(&lcr_tech)) {
ast_log(LOG_ERROR, "Unable to register channel class\n");
+ bchannel_deinitialize();
+ close_socket(lcr_sock);
return -1;
}
//lcr_cfg_get( 0, LCR_GEN_TRACEFILE, global_tracefile, BUFFERSIZE);
#endif
+ quit = 1;
+ if ((pthread_create(&chan_tid, NULL, chan_thread, arg)<0))
+ {
+ failed to create thread
+ bchannel_deinitialize();
+ close_socket(lcr_sock);
+ ast_channel_unregister(&lcr_tech);
+ return -1;
+ }
return 0;
}
{
/* First, take us out of the channel loop */
ast_log(LOG_VERBOSE, "-- Unregistering mISDN Channel Driver --\n");
-
+
+ quit = 1;
+ pthread_join(chan_tid, NULL);
ast_channel_unregister(&lcr_tech);