Merge branch 'master' of ssh://jolly@www.misdn.org/var/git/lcr
authorAndreas Eversberg <jolly@eversberg.eu>
Sun, 28 Nov 2010 08:06:59 +0000 (09:06 +0100)
committerAndreas Eversberg <jolly@eversberg.eu>
Sun, 28 Nov 2010 08:06:59 +0000 (09:06 +0100)
interface.c
lcradmin.c
lcrsocket.h
socket_server.c

index 1495d3b..a312e4e 100644 (file)
@@ -1127,7 +1127,8 @@ struct interface_param interface_param[] = {
        "Channel selection list for all outgoing calls to the interface.\n"
        "A free channels is searched in order of appearance.\n"
        "This parameter must follow a 'port' parameter.\n"
-       " force - Forces the selected port with no acceptable alternative (see DSS1).\n"
+       " force - Forces the selected port with no acceptable alternative (see Q.931).\n"
+       "  -> this will be automatically set for multipoint (ptmp) NT-mode ports\n"
        " <number>[,...] - List of channels to search.\n"
        " free - Select any free channel\n"
        " any - On outgoing calls, signal 'any channel acceptable'. (see DSS1)\n"
@@ -1434,6 +1435,9 @@ static void set_defaults(struct interface_port *ifport)
                default_out_channel(ifport);
        if (!ifport->in_channel)
                default_in_channel(ifport);
+       /* must force the channel on PTMP/NT ports */
+       if (!ifport->mISDNport->ptp && ifport->mISDNport->ntmode)
+               ifport->channel_force = 1;
        /* default is_tones */
        if (ifport->interface->is_tones)
                ifport->mISDNport->tones = (ifport->interface->is_tones==IS_YES);
index 882105b..2483a9b 100644 (file)
@@ -1301,6 +1301,8 @@ const char *admin_portinfo(int sock, int argc, char *argv[])
                        else
                                printf("\t status = unblocked\n");
                        printf("\t mode = %s %s%s%s\n", (m[i].u.i.ntmode)?"NT-mode":"TE-mode", (m[i].u.i.ptp)?"ptp":"ptmp", (m[i].u.i.l1hold)?" l1hold":"", (m[i].u.i.l2hold)?" l2hold":"");
+                       printf("\t out-channel = %s\n", m[i].u.i.out_channel);
+                       printf("\t in-channel = %s\n", m[i].u.i.in_channel);
                        if (m[i].u.i.l1link < 0)
                                printf("\t l1 link = unknown\n");
                        else
index 7ecf7ad..931afb8 100644 (file)
@@ -83,6 +83,8 @@ struct admin_response_interface {
        char            busy[256]; /* if port is idle(0) busy(1) */
        unsigned int    port[256]; /* current port */
        int             mode[256];
+       char            out_channel[256];
+       char            in_channel[256];
 };
 
 struct admin_response_remote {
index 47626c4..e84fa5e 100644 (file)
@@ -740,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;
@@ -872,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) {