[asterisk-users] DAHDI help please

Pat Collins drdialtone at optonline.net
Tue Oct 2 13:48:20 CDT 2012


Thank you for the reply!
So far, I've managed to get the on off hook to work properly!
My next problem is the incoming ring. I've changed the /include/dahdi/user.h
file:
#define DAHDI_ABIT		(1 << 3)
#define DAHDI_BBIT		(1 << 2)
#define DAHDI_CBIT		(1 << 1)
#define DAHDI_DBIT		(1 << 0)
#define DAHDI_XBIT		(3 >> 2)  ADDED THIS!!

#define DAHDI_BITS_ABCD (DAHDI_ABIT | DAHDI_BBIT | DAHDI_CBIT | DAHDI_DBIT)
#define DAHDI_BITS_ABD (DAHDI_ABIT | DAHDI_BBIT | DAHDI_DBIT)
#define DAHDI_BITS_ACD (DAHDI_ABIT | DAHDI_CBIT | DAHDI_DBIT)
#define DAHDI_BITS_BCD (DAHDI_BBIT | DAHDI_CBIT | DAHDI_DBIT)
#define DAHDI_BITS_AC (DAHDI_ABIT | DAHDI_CBIT)
#define DAHDI_BITS_BD (DAHDI_BBIT | DAHDI_DBIT)
#define DAHDI_BITS_X   (DAHDI_XBIT) AND THIS!!

Then in /driver/dahdi/dahdi-base.c I changed:
static void dahdi_rbs_sethook(struct dahdi_chan *chan, int txsig, int
txstate,
                int timeout)
{
        static const struct {
                unsigned int sig_type;
                /* Index is dahdi_txsig enum */
                unsigned int bits[DAHDI_TXSIG_TOTAL];
        } outs[NUM_SIGS] = {
                {
                        /*
                         * We set the idle case of the DAHDI_SIG_NONE to
this pattern to make idle E1 CAS
                         * channels happy. Should not matter with T1, since
on an un-configured channel,
                         * who cares what the sig bits are as long as they
are stable
                         */
                        .sig_type = DAHDI_SIG_NONE,
                        .bits[DAHDI_TXSIG_ONHOOK]  = DAHDI_BITS_ABCD,
                }, {
                        .sig_type = DAHDI_SIG_EM,
                        .bits[DAHDI_TXSIG_OFFHOOK] = DAHDI_SIG_NONE,   /*
changed from ACD */
                        .bits[DAHDI_TXSIG_START]   = DAHDI_SIG_NONE,   /*
changed from ACD */
                        .bits[DAHDI_TXSIG_ONHOOK]  = DAHDI_BITS_ABCD, /*
added this !! */
                        .bits[DAHDI_RXSIG_START]    = DAHDI_BITS_X,  /*
start.. xbit */
                        .bits[DAHDI_RXSIG_RING]    = DAHDI_BITS_X,  /*
ring.. xbit */
                }, {	

And this:
void dahdi_rbsbits(struct dahdi_chan *chan, int cursig)
{
        unsigned long flags;
        if (cursig == chan->rxsig)
                return;

        if ((chan->flags & DAHDI_FLAG_SIGFREEZE)) return;
        spin_lock_irqsave(&chan->lock, flags);
        switch(chan->sig) {
            case DAHDI_SIG_EM: /* was FXO Groundstart */
                /* B-bit only matters for FXO GS !!!!changed BBIT to
XBIT!!!! */
                if (!(cursig & DAHDI_XBIT)) {
                        __dahdi_hooksig_pvt(chan, DAHDI_RXSIG_START);
                        break;
                }
                /* Fall through */
            case DAHDI_SIG_FXOGS:  /* changed from E and M */
            case DAHDI_SIG_EM_E1:
            case DAHDI_SIG_FXOLS: /* FXO Loopstart */
            case DAHDI_SIG_FXOKS: /* FXO Kewlstart */
                if (cursig & DAHDI_ABIT)  /* off hook */
                        __dahdi_hooksig_pvt(chan,DAHDI_RXSIG_OFFHOOK);
                else /* on hook */
                        __dahdi_hooksig_pvt(chan,DAHDI_RXSIG_ONHOOK);
                break;

Thank you for your help Shaun!!!

-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Shaun Ruffell
Sent: Tuesday, October 02, 2012 2:17 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] DAHDI help please

On Mon, Oct 01, 2012 at 06:44:22PM -0400, Pat Collins wrote:
> Can anyone tell me if it is possible to invert the signaling bits on a 
> T1 channel?
>
> I need to emulate PLAR signaling in asterisk.  E&M seems to be an 
> exact match if reversed.
>
> I need idle bits 1111 and seized 0000

Perhaps you could edit dahdi_rbs_sethook() and dahdi_q_sig()?  Those
function map state to RBS states.

--
Shaun Ruffell
Digium, Inc. | Linux Kernel Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA Check us out at:
www.digium.com & www.asterisk.org

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to
Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list