More magic to make BRI CPE PTMP work
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@491 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
20
q921.c
20
q921.c
@@ -438,6 +438,11 @@ static void t200_expire(void *vpri)
|
||||
int q921_transmit_iframe(struct pri *pri, void *buf, int len, int cr)
|
||||
{
|
||||
q921_frame *f, *prev=NULL;
|
||||
|
||||
/* Exception for BRI CPE PTMP */
|
||||
if (pri->bri && (pri->localtype == PRI_CPE) && pri->subchannel)
|
||||
return q921_transmit_iframe(pri->subchannel, buf, len, cr);
|
||||
|
||||
for (f=pri->txqueue; f; f = f->next) prev = f;
|
||||
f = malloc(sizeof(q921_frame) + len + 2);
|
||||
if (f) {
|
||||
@@ -968,8 +973,16 @@ static pri_event *__q921_receive_qualified(struct pri *pri, q921_h *h, int len)
|
||||
} else if (!h->u.m2) {
|
||||
if ((pri->sapi == Q921_SAPI_LAYER2_MANAGEMENT) && (pri->tei == Q921_TEI_GROUP))
|
||||
q921_receive_MDL(pri, (q921_u *)h, len);
|
||||
else
|
||||
pri_message(pri, "XXX Unnumbered Information not implemented XXX\n");
|
||||
else {
|
||||
int res;
|
||||
|
||||
res = q931_receive(pri, (q931_h *) h->u.data, len - 3);
|
||||
if (res == -1) {
|
||||
return NULL;
|
||||
}
|
||||
if (res & Q931_RES_HAVEEVENT)
|
||||
return &pri->ev;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@@ -1048,8 +1061,9 @@ static pri_event *__q921_receive(struct pri *pri, q921_h *h, int len)
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
if (!((h->h.sapi == pri->sapi) && ((h->h.tei == pri->tei) || (h->h.tei == Q921_TEI_GROUP)))) {
|
||||
/* Check for SAPIs we don't yet handle */
|
||||
if ((h->h.sapi != pri->sapi) || (h->h.tei != pri->tei)) {
|
||||
//if ((h->h.sapi != pri->sapi) || ((h->h.tei != pri->tei) && (h->h.tei != Q921_TEI_GROUP))) {
|
||||
//#ifdef PROCESS_SUBCHANNELS
|
||||
/* If it's not us, try any subchannels we have */
|
||||
if (pri->subchannel)
|
||||
|
||||
19
q931.c
19
q931.c
@@ -657,7 +657,7 @@ static FUNC_SEND(transmit_bearer_capability)
|
||||
return 0;
|
||||
|
||||
tc = call->transcapability;
|
||||
if (pri->subchannel) {
|
||||
if (pri->subchannel && !pri->bri) {
|
||||
/* Bearer capability is *hard coded* in GR-303 */
|
||||
ie->data[0] = 0x88;
|
||||
ie->data[1] = 0x90;
|
||||
@@ -1285,7 +1285,7 @@ static FUNC_SEND(transmit_progress_indicator)
|
||||
{
|
||||
int code, mask;
|
||||
/* Can't send progress indicator on GR-303 -- EVER! */
|
||||
if (pri->subchannel)
|
||||
if (pri->subchannel && !pri->bri)
|
||||
return 0;
|
||||
if (call->progressmask > 0) {
|
||||
if (call->progressmask & (mask = PRI_PROG_CALL_NOT_E2E_ISDN))
|
||||
@@ -2231,6 +2231,11 @@ q931_call *q931_new_call(struct pri *pri)
|
||||
static void q931_destroy(struct pri *pri, int cr, q931_call *c)
|
||||
{
|
||||
q931_call *cur, *prev;
|
||||
|
||||
/* Magic for BRI PTMP CPE */
|
||||
if (pri->subchannel && (pri->localtype == PRI_CPE) && pri->bri)
|
||||
return q931_destroy(pri->subchannel, cr, c);
|
||||
|
||||
prev = NULL;
|
||||
cur = *pri->callpool;
|
||||
while(cur) {
|
||||
@@ -2408,7 +2413,7 @@ static void init_header(struct pri *pri, q931_call *call, unsigned char *buf, q9
|
||||
h->crv[0] = 0;
|
||||
h->crv[1] = 0;
|
||||
}
|
||||
if (pri->subchannel) {
|
||||
if (pri->subchannel && !pri->bri) {
|
||||
/* On GR-303, top bit is always 0 */
|
||||
h->crv[0] &= 0x7f;
|
||||
}
|
||||
@@ -2744,7 +2749,7 @@ int q931_connect(struct pri *pri, q931_call *c, int channel, int nonisdn)
|
||||
if (c->retranstimer)
|
||||
pri_schedule_del(pri, c->retranstimer);
|
||||
c->retranstimer = 0;
|
||||
if ((c->ourcallstate == Q931_CALL_STATE_CONNECT_REQUEST) && (!pri->subchannel))
|
||||
if ((c->ourcallstate == Q931_CALL_STATE_CONNECT_REQUEST) && (pri->bri || (!pri->subchannel)))
|
||||
c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T313], pri_connect_timeout, c);
|
||||
return send_message(pri, c, Q931_CONNECT, connect_ies);
|
||||
}
|
||||
@@ -2838,7 +2843,7 @@ int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req)
|
||||
c->ds1no = (req->channel & 0xff00) >> 8;
|
||||
c->ds1explicit = (req->channel & 0x10000) >> 16;
|
||||
req->channel &= 0xff;
|
||||
if ((pri->localtype == PRI_CPE) && pri->subchannel) {
|
||||
if ((pri->localtype == PRI_CPE) && pri->subchannel && !pri->bri) {
|
||||
req->channel = 0;
|
||||
req->exclusive = 0;
|
||||
}
|
||||
@@ -2908,7 +2913,7 @@ int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req)
|
||||
|
||||
pri_call_add_standard_apdus(pri, c);
|
||||
|
||||
if (pri->subchannel)
|
||||
if (pri->subchannel && !pri->bri)
|
||||
res = send_message(pri, c, Q931_SETUP, gr303_setup_ies);
|
||||
else if (c->justsignalling)
|
||||
res = send_message(pri, c, Q931_SETUP, cis_setup_ies);
|
||||
@@ -2952,7 +2957,7 @@ static int gr303_connect_acknowledge_ies[] = { Q931_CHANNEL_IDENT, -1 };
|
||||
|
||||
static int q931_connect_acknowledge(struct pri *pri, q931_call *c)
|
||||
{
|
||||
if (pri->subchannel) {
|
||||
if (pri->subchannel && !pri->bri) {
|
||||
if (pri->localtype == PRI_CPE)
|
||||
return send_message(pri, c, Q931_CONNECT_ACKNOWLEDGE, gr303_connect_acknowledge_ies);
|
||||
} else
|
||||
|
||||
@@ -254,7 +254,7 @@ int main(int argc, char *argv[])
|
||||
perror("socketpair");
|
||||
exit(1);
|
||||
}
|
||||
if (!(pri = pri_new_bri(pair[0], PRI_NETWORK, PRI_DEF_SWITCHTYPE))) {
|
||||
if (!(pri = pri_new_bri(pair[0], 0, PRI_NETWORK, PRI_DEF_SWITCHTYPE))) {
|
||||
perror("pri(0)");
|
||||
exit(1);
|
||||
}
|
||||
@@ -265,7 +265,7 @@ int main(int argc, char *argv[])
|
||||
perror("thread(0)");
|
||||
exit(1);
|
||||
}
|
||||
if (!(pri = pri_new_bri(pair[1], PRI_CPE, PRI_DEF_SWITCHTYPE))) {
|
||||
if (!(pri = pri_new_bri(pair[1], 0, PRI_CPE, PRI_DEF_SWITCHTYPE))) {
|
||||
perror("pri(1)");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user