work...
authorSuper User <root@isdn.jolly.ten>
Sun, 12 Aug 2007 11:05:26 +0000 (13:05 +0200)
committerSuper User <root@isdn.jolly.ten>
Sun, 12 Aug 2007 11:05:26 +0000 (13:05 +0200)
admin_client.c
asterisk_client.h [new file with mode: 0644]

index dac2b78..215aa46 100644 (file)
@@ -712,46 +712,43 @@ char *admin_state(int sock, char *argv[])
                                                        else
                                                                SPRINT(buffer,"B%2d: ", j+1);
                                                        addstr(buffer);
-                                                       if (!m[i].u.i.ptp)
-                                                               goto ptmp;
-                                                       if (m[i].u.i.l2link && m[i].u.i.block==0)
+                                                       switch(m[i].u.i.busy[j])
                                                        {
-                                                               ptmp:
-                                                               switch(m[i].u.i.busy[j])
+                                                               case B_STATE_IDLE:
+                                                               if ((!m[i].u.i.l2link && m[i].u.i.ptp) || m[i].u.i.block)
+                                                               {
+                                                                       color(red);
+                                                                       addstr("blocked ");
+                                                               } else
                                                                {
-                                                                       case B_STATE_IDLE:
                                                                        color(blue);
                                                                        addstr("idle    ");
-                                                                       break;
-                                                                       case B_STATE_ACTIVATING:
-                                                                       color(yellow);
-                                                                       addstr("act'ing ");
-                                                                       break;
-                                                                       case B_STATE_ACTIVE:
-                                                                       color(green);
-                                                                       addstr("busy    ");
-                                                                       break;
-                                                                       case B_STATE_DEACTIVATING:
-                                                                       color(yellow);
-                                                                       addstr("dact'ing");
-                                                                       break;
-                                                                       case B_STATE_EXPORTING:
-                                                                       color(yellow);
-                                                                       addstr("exp'ing ");
-                                                                       break;
-                                                                       case B_STATE_REMOTE:
-                                                                       color(green);
-                                                                       addstr("remote  ");
-                                                                       break;
-                                                                       case B_STATE_IMPORTING:
-                                                                       color(yellow);
-                                                                       addstr("imp'ing ");
-                                                                       break;
                                                                }
-                                                       } else
-                                                       {
-                                                               color(red);
-                                                               addstr("blocked ");
+                                                               break;
+                                                               case B_STATE_ACTIVATING:
+                                                               color(yellow);
+                                                               addstr("act'ing ");
+                                                               break;
+                                                               case B_STATE_ACTIVE:
+                                                               color(green);
+                                                               addstr("busy    ");
+                                                               break;
+                                                               case B_STATE_DEACTIVATING:
+                                                               color(yellow);
+                                                               addstr("dact'ing");
+                                                               break;
+                                                               case B_STATE_EXPORTING:
+                                                               color(yellow);
+                                                               addstr("exp'ing ");
+                                                               break;
+                                                               case B_STATE_REMOTE:
+                                                               color(green);
+                                                               addstr("remote  ");
+                                                               break;
+                                                               case B_STATE_IMPORTING:
+                                                               color(yellow);
+                                                               addstr("imp'ing ");
+                                                               break;
                                                        }
                                                        if (m[i].u.i.port[j])
                                                        {
diff --git a/asterisk_client.h b/asterisk_client.h
new file mode 100644 (file)
index 0000000..40493d3
--- /dev/null
@@ -0,0 +1,25 @@
+/*****************************************************************************\
+**                                                                           **
+** Linux Call Router                                                         **
+**                                                                           **
+**---------------------------------------------------------------------------**
+** Copyright: Andreas Eversberg                                              **
+**                                                                           **
+** Asterisk socket client header                                             **
+**                                                                           **
+\*****************************************************************************/
+
+/* structure for all calls */
+struct chan_call {
+       struct chan_call *next;
+       unsigned long ref;      /* callref, is 0, if not yet set */
+       unsigned long addr;     /* reference to bchannel, if set */
+};
+
+/* structure of all bchannels (that are assinged by lcr) */
+struct chan_bchannel {
+       struct chan_bchannel *next;
+       unsigned long addr;     /* stack address */
+       unsigned long ref;      /* if linked with a call, ref is set */
+};
+