diff options
author | mattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-05-20 19:09:21 +0000 |
---|---|---|
committer | mattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-05-20 19:09:21 +0000 |
commit | b264864204da612f7dc8a13e05c5cc960ded1c2d (patch) | |
tree | f2f9386079bf6fa79cea702a28b09a3ecfa1865b /channels/chan_zap.c | |
parent | cfd99de79e83b24f1f9aa407e194affbb1573dfc (diff) |
Mods for IMPLICIT/EXPLICIT channel id selection support
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5751 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_zap.c')
-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; |