From 6fb4d0ee4a233807bc3fbdc28baaae8739ed026c Mon Sep 17 00:00:00 2001 From: Matthew Fredrickson Date: Thu, 6 Sep 2007 15:06:42 +0000 Subject: [PATCH] TBCT now works. It should work for NI2, 4E, and 5E. This code was tested on NI2. git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@460 2fbb986a-6c06-0410-b554-c9c1f0a7f128 --- pri.c | 26 ++++++++++++++++---------- pri_facility.c | 16 ++-------------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/pri.c b/pri.c index 74fa44b..05dfcfb 100644 --- a/pri.c +++ b/pri.c @@ -521,24 +521,30 @@ int pri_channel_bridge(q931_call *call1, q931_call *call2) if (!call1 || !call2) return -1; - /* Check switchtype compatibility */ - if (call1->pri->switchtype != PRI_SWITCH_LUCENT5E || - call2->pri->switchtype != PRI_SWITCH_LUCENT5E) + /* Make sure we have compatible switchtypes */ + if (call1->pri->switchtype != call2->pri->switchtype) return -1; /* Check for bearer capability */ if (call1->transcapability != call2->transcapability) return -1; - /* Check to see if calls are on the same PRI dchannel - * Currently only support calls on the same dchannel - */ + + /* Check to see if we're on the same PRI */ if (call1->pri != call2->pri) return -1; - if (eect_initiate_transfer(call1->pri, call1, call2)) - return -1; - - return 0; + switch (call1->pri->switchtype) { + case PRI_SWITCH_NI2: + case PRI_SWITCH_LUCENT5E: + case PRI_SWITCH_ATT4ESS: + if (eect_initiate_transfer(call1->pri, call1, call2)) + return -1; + else + return 0; + break; + default: + return -1; + } } int pri_hangup(struct pri *pri, q931_call *call, int cause) diff --git a/pri_facility.c b/pri_facility.c index dc5aedd..ae88816 100644 --- a/pri_facility.c +++ b/pri_facility.c @@ -859,13 +859,10 @@ extern int mwi_message_send(struct pri* pri, q931_call *call, struct pri_sr *req /* EECT functions */ extern int eect_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2) { - /* Did all the tests to see if we're on the same PRI and - * are on a compatible switchtype */ - /* TODO */ int i = 0; int res = 0; unsigned char buffer[255] = ""; - unsigned short call_reference = c2->cr; + short call_reference = c2->cr ^ 0x8000; /* Let's do the trickery to make sure the flag is correct */ struct rose_component *comp = NULL, *compstk[10]; int compsp = 0; static unsigned char op_tag[] = { @@ -878,16 +875,7 @@ extern int eect_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2) 0x08, }; - buffer[i++] = (ASN1_CONTEXT_SPECIFIC | Q932_PROTOCOL_EXTENSIONS); - /* Interpretation component */ - - ASN1_ADD_SIMPLE(comp, COMP_TYPE_NFE, buffer, i); - ASN1_PUSH(compstk, compsp, comp); - ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_0), buffer, i, 0); - ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_2), buffer, i, 0); - ASN1_FIXUP(compstk, compsp, buffer, i); - - ASN1_ADD_BYTECOMP(comp, COMP_TYPE_INTERPRETATION, buffer, i, 0); + buffer[i++] = (ASN1_CONTEXT_SPECIFIC | Q932_PROTOCOL_ROSE); ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, buffer, i); ASN1_PUSH(compstk, compsp, comp);