diff options
author | Matthew Fredrickson <creslin@digium.com> | 2005-05-20 19:09:21 +0000 |
---|---|---|
committer | Matthew Fredrickson <creslin@digium.com> | 2005-05-20 19:09:21 +0000 |
commit | ed76520002f4422ebda083a17dd23f1ef9c02ece (patch) | |
tree | f2f9386079bf6fa79cea702a28b09a3ecfa1865b /channels | |
parent | 102c76a9c8365fe9cb1c61bdec65447585a77012 (diff) |
Mods for IMPLICIT/EXPLICIT channel id selection support
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5751 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_zap.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 496c9f069..8f439a062 100755 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -360,6 +360,7 @@ static int r2prot = -1; #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 @@ static char *pri_order(int level) } } +/* 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 @@ static int pri_find_principle(struct zt_pri *pri, int channel) { 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, ¶m); + } + for (x=0;x<pri->numchans;x++) { if (pri->pvts[x] && (pri->pvts[x]->prioffset == channel) && (pri->pvts[x]->logicalspan == span)) { principle = x; |