Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv20922/channels

Modified Files:
        chan_zap.c 
Log Message:
Mods for IMPLICIT/EXPLICIT channel id selection support


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.447
retrieving revision 1.448
diff -u -d -r1.447 -r1.448
--- chan_zap.c  16 May 2005 19:15:56 -0000      1.447
+++ chan_zap.c  20 May 2005 19:09:21 -0000      1.448
@@ -360,6 +360,7 @@
 #define PVT_TO_CHANNEL(p) (((p)->prioffset) | ((p)->logicalspan << 8))
 #define PRI_CHANNEL(p) ((p) & 0xff)
 #define PRI_SPAN(p) (((p) >> 8) & 0xff)
+#define PRI_EXPLICIT(p) (((p) >> 16) & 0x01)
 
 struct zt_pri {
        pthread_t master;                                               /* 
Thread of master */
@@ -2077,6 +2078,18 @@
        }               
 }
 
+/* Returns fd of the active dchan */
+int pri_active_dchan_fd(struct zt_pri *pri)
+{
+       int x = -1;
+
+       for (x = 0; x < NUM_DCHANS; x++)
+               if ((pri->dchans[x] == pri->pri))
+                       break;
+
+       return pri->fds[x];
+}
+
 int pri_find_dchan(struct zt_pri *pri)
 {
        int oldslot = -1;
@@ -7316,10 +7329,17 @@
 {
        int x;
        int span;
+       int spanfd;
+       struct zt_params param;
        int principle = -1;
        span = PRI_SPAN(channel);
        channel = PRI_CHANNEL(channel);
        
+       if (!PRI_EXPLICIT(channel)) {
+               spanfd = pri_active_dchan_fd(pri);
+               span = ioctl(spanfd, ZT_GET_PARAMS, &param);
+       }
+
        for (x=0;x<pri->numchans;x++) {
                if (pri->pvts[x] && (pri->pvts[x]->prioffset == channel) && 
(pri->pvts[x]->logicalspan == span)) {
                        principle = x;

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to