/* driver scheduler */
static struct sched_context *sched;
@@ -581,11 +581,11 @@
/* Protect the monitoring thread, so only one process can kill or start it, and not
when it's doing something critical. */
static ast_mutex_t monlock = AST_MUTEX_INITIALIZER;
-/* Protect the network socket */
+/* Protect the network socket */
static ast_mutex_t netlock = AST_MUTEX_INITIALIZER;
-/* Protect the session list */
-static ast_mutex_t sessionlock = AST_MUTEX_INITIALIZER;
-/* Protect the device list */
+/* Protect the session list */
+static ast_mutex_t sessionlock = AST_MUTEX_INITIALIZER;
+/* Protect the device list */
static ast_mutex_t devicelock = AST_MUTEX_INITIALIZER;
/* This is the thread for the monitor which checks for input on the channels
@@ -699,60 +699,60 @@
struct skinny_subchannel *sub = l->sub;
return sub;
}
-
-static struct skinny_subchannel *find_subchannel_by_name(char *dest)
-{
- struct skinny_line *l;
- struct skinny_device *d;
- char line[256];
- char *at;
- char *device;
-
- printf("dest: %s\n", dest);
-
- strncpy(line, dest, sizeof(line) - 1);
- at = strchr(line, '@');
- if (!at) {
- ast_log(LOG_NOTICE, "Device '%s' has no @ (at) sign!\n", dest);
- return NULL;
- }
- *at = '\0';
- at++;
- device = at;
-
- printf("line: %s\n", line);
- printf("device: %s\n", device);
-
- ast_mutex_lock(&devicelock);
- d = devices;
- while(d) {
- if (!strcasecmp(d->name, device)) {
- if (skinnydebug) {
- printf("Found device: %s\n", d->name);
- }
- /* Found the device */
- l = d->lines;
- while (l) {
- /* Search for the right line */
- if (!strcasecmp(l->name, line)) {
- ast_mutex_unlock(&devicelock);
- if (skinnydebug) {
- printf("Found line: %s\n", l->name);
- }
- return l->sub;
- }
- printf("line cycle\n");
- l = l->next;
- }
- }
- printf("device cycle\n");
- d = d->next;
- }
- /* Device not found*/
- ast_mutex_unlock(&devicelock);
- return NULL;
-}
-
+
+static struct skinny_subchannel *find_subchannel_by_name(char *dest)
+{
+ struct skinny_line *l;
+ struct skinny_device *d;
+ char line[256];
+ char *at;
+ char *device;
+
+ printf("dest: %s\n", dest);
+
+ strncpy(line, dest, sizeof(line) - 1);
+ at = strchr(line, '@');
+ if (!at) {
+ ast_log(LOG_NOTICE, "Device '%s' has no @ (at) sign!\n", dest);
+ return NULL;
+ }
+ *at = '\0';
+ at++;
+ device = at;
+
+ printf("line: %s\n", line);
+ printf("device: %s\n", device);
+
+ ast_mutex_lock(&devicelock);
+ d = devices;
+ while(d) {
+ if (!strcasecmp(d->name, device)) {
+ if (skinnydebug) {
+ printf("Found device: %s\n", d->name);
+ }
+ /* Found the device */
+ l = d->lines;
+ while (l) {
+ /* Search for the right line */
+ if (!strcasecmp(l->name, line)) {
+ ast_mutex_unlock(&devicelock);
+ if (skinnydebug) {
+ printf("Found line: %s\n", l->name);
+ }
+ return l->sub;
+ }
+ printf("line cycle\n");
+ l = l->next;
+ }
+ }
+ printf("device cycle\n");
+ d = d->next;
+ }
+ /* Device not found*/
+ ast_mutex_unlock(&devicelock);
+ return NULL;
+}
+
static int transmit_response(struct skinnysession *s, skinny_req *req)
{
int res = 0;
@@ -1432,52 +1432,52 @@
static int skinny_call(struct ast_channel *ast, char *dest, int timeout)
{
- int res = 0;
+ int res = 0;
int tone = 0;
struct skinny_line *l;
- struct skinny_subchannel *sub;
+ struct skinny_subchannel *sub;
struct skinnysession *session;
-
- if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) {
- ast_log(LOG_WARNING, "skinny_call called on %s, neither down nor reserved\n", ast->name);
- return -1;
- }
-
+
+ if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) {
+ ast_log(LOG_WARNING, "skinny_call called on %s, neither down nor reserved\n", ast->name);
+ return -1;
+ }
+
if (skinnydebug) {
ast_verbose(VERBOSE_PREFIX_3 "skinny_call(%s)\n", ast->name);
}
sub = ast->pvt->pvt;
- l = sub->parent;
+ l = sub->parent;
session = l->parent->session;
-
- if (l->dnd) {
- ast_queue_control(ast, AST_CONTROL_BUSY, 0);
- return 0;
- }
-
+
+ if (l->dnd) {
+ ast_queue_control(ast, AST_CONTROL_BUSY, 0);
+ return 0;
+ }
+
switch (l->hookstate) {
case SKINNY_OFFHOOK:
tone = SKINNY_CALLWAITTONE;
break;
- case SKINNY_ONHOOK:
- tone = SKINNY_ALERT;
+ case SKINNY_ONHOOK:
+ tone = SKINNY_ALERT;
break;
default:
ast_log(LOG_ERROR, "Don't know how to deal with hookstate %d\n", l->hookstate);
break;
}
-
- transmit_lamp_indication(session, l->instance, SKINNY_LAMP_BLINK);
- transmit_ringer_mode(session, SKINNY_RING_INSIDE);
- transmit_tone(session, tone);
- transmit_callstate(session, l->instance, SKINNY_RINGIN, sub->callid);
-
-// Set the prompt
-// Select the active softkeys
-
- ast_setstate(ast, AST_STATE_RINGING);
- ast_queue_control(ast, AST_CONTROL_RINGING, 0);
+
+ transmit_lamp_indication(session, l->instance, SKINNY_LAMP_BLINK);
+ transmit_ringer_mode(session, SKINNY_RING_INSIDE);
+ transmit_tone(session, tone);
+ transmit_callstate(session, l->instance, SKINNY_RINGIN, sub->callid);
+
+// Set the prompt
+// Select the active softkeys
+
+ ast_setstate(ast, AST_STATE_RINGING);
+ ast_queue_control(ast, AST_CONTROL_RINGING, 0);
sub->outgoing = 1;
// sub->cxmode = SKINNY_CX_RECVONLY;
@@ -1485,10 +1485,10 @@
if (!sub->rtp) {
start_rtp(sub);
} else {
- /* do we need to anything if there already is an RTP allocated? */
+ /* do we need to anything if there already is an RTP allocated? */
// transmit_modify_request(sub);
}
-
+
#if 0
if (sub->next->owner && sub->next->callid) {
/* try to prevent a callwait from disturbing the other connection */
@@ -1502,8 +1502,8 @@
sub->next->cxmode = SKINNY_CX_SENDRECV;
// transmit_modify_request(sub->next);
}
-#endif
-
+#endif
+
} else {
ast_log(LOG_NOTICE, "Don't know how to dial on trunks yet\n");
res = -1;
@@ -1693,7 +1693,7 @@
case AST_CONTROL_RINGING:
transmit_tone(s, SKINNY_ALERT);
transmit_callstate(s, l->instance, SKINNY_PROGRESS, sub->callid);
- break;
+ break;
case AST_CONTROL_BUSY:
transmit_tone(s, SKINNY_BUSYTONE);
transmit_callstate(s, l->instance, SKINNY_BUSY, sub->callid);
@@ -1801,12 +1801,12 @@
time_t timer;
struct tm *cmtime;
pthread_t t;
-
- if ( (!s->device) && (req->e != REGISTER_MESSAGE && req->e != ALARM_MESSAGE)) {
- ast_log(LOG_WARNING, "Client sent message #%d without first registering.\n", req->e);
- free(req);
- return 0;
- }
+
+ if ( (!s->device) && (req->e != REGISTER_MESSAGE && req->e != ALARM_MESSAGE)) {
+ ast_log(LOG_WARNING, "Client sent message #%d without first registering.\n", req->e);
+ free(req);
+ return 0;
+ }
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum