Merge branch 'master' of ssh://jolly@www.misdn.org/var/git/lcr
[lcr.git] / socket_server.c
index 1e6d5da..e84fa5e 100644 (file)
@@ -13,6 +13,7 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <curses.h>
+#include "config.h"
 
 
 char socket_name[128];
@@ -530,7 +531,7 @@ int admin_call(struct admin_list *admin, struct admin_message *msg)
        apppbx->e_dialinginfo.sending_complete = 1;
 
        apppbx->new_state(PORT_STATE_OUT_SETUP);
-       apppbx->out_setup();
+       apppbx->out_setup(0);
        return(0);
 }
 
@@ -739,6 +740,7 @@ int admin_state(struct admin_queue **responsep)
        struct interface        *interface;
        struct interface_port   *ifport;
        struct mISDNport        *mISDNport;
+       struct select_channel   *selchannel;
        int                     i;
        int                     num;
        int                     anybusy;
@@ -871,7 +873,40 @@ int admin_state(struct admin_queue **responsep)
                                response->am[num].u.i.slip_rx = mISDNport->slip_rx;
                                /* channels */
                                response->am[num].u.i.channels = mISDNport->b_num;
-                               /* channel info */
+                               /* channel selection */
+                               selchannel = ifport->out_channel;
+                               if (ifport->channel_force)
+                                       SCAT(response->am[num].u.i.out_channel, "force");
+                               while (selchannel) {
+                                       if (response->am[num].u.i.out_channel[0])
+                                               SCAT(response->am[num].u.i.out_channel, ",");
+                                       switch (selchannel->channel) {
+                                       case CHANNEL_NO:
+                                               SCAT(response->am[num].u.i.out_channel, "no");
+                                               break;
+                                       case CHANNEL_ANY:
+                                               SCAT(response->am[num].u.i.out_channel, "any");
+                                               break;
+                                       case CHANNEL_FREE:
+                                               SCAT(response->am[num].u.i.out_channel, "free");
+                                               break;
+                                       default:
+                                               SPRINT(strchr(response->am[num].u.i.out_channel, '\0'), "%d", selchannel->channel);
+                                       }
+                                       selchannel = selchannel->next;
+                               }
+                               selchannel = ifport->in_channel;
+                               while (selchannel) {
+                                       switch (selchannel->channel) {
+                                       case CHANNEL_FREE:
+                                               SCAT(response->am[num].u.i.in_channel, "free");
+                                               break;
+                                       default:
+                                               SPRINT(strchr(response->am[num].u.i.in_channel, '\0'), "%d", selchannel->channel);
+                                       }
+                                       selchannel = selchannel->next;
+                               }
+                               /* channel state */
                                i = 0;
                                anybusy = 0;
                                while(i < mISDNport->b_num) {