[asterisk-dev] Change RX Signalling Bits in Dahdi drivers

Optical Phoenix opticalphoenix at gmail.com
Thu Mar 7 16:45:58 CST 2013


On Thu, Mar 7, 2013 at 2:53 PM, Shaun Ruffell <sruffell at digium.com> wrote:

> On Thu, Mar 07, 2013 at 02:20:00PM -0500, Optical Phoenix wrote:
> > On Wed, Mar 6, 2013 at 2:57 PM, Optical Phoenix <
> opticalphoenix at gmail.com>wrote:
> >> On Wed, Mar 6, 2013 at 1:21 PM, Shaun Ruffell <sruffell at digium.com>
> wrote:
> >>> On Wed, Mar 06, 2013 at 11:42:54AM -0500, Optical Phoenix wrote:
> >>>>
> >>> > When I go to change the rx, its a bit more complex. I have
> >>> > learned from this list that dahdi_rbsbits() handles the rx
> >>> > bits, but my changes seem to have no effect. Does anyone have
> >>> > a good understanding of this function? I would appreciate any
> >>> > help you can provide.
> >>> >
> >>> > case DAHDI_SIG_FXSLS:
> >>> > if (!(cursig & DAHDI_BBIT)) {      /*Dennis RINGING  */  /*<----- I
> think
> >>> > this is checking if the state is different from a set value? needs
> >>> > clarification*/
> >>> >  /* Check for ringing first */
> >>> > __dahdi_hooksig_pvt(chan, DAHDI_RXSIG_RING);
> >>> > break;
> >>> >  }
> >>>
> >>> This is just checking if new BBIT is 0, which would indicate a
> >>> ring.  At the top of dahdi_rbsbits there was already a check to
> >>> see if cursig is different from the previously saved rxsig.
> >
> > Above Shaun was kind enough to point out that  "if (!(cursig &
> > DAHDI_BBIT))" was checking if the BBit is zero.  (thanks again!)
> > for what values is this statement not true? it seems that no
> > matter what I put in, it comes out as true.
>
> Just to be clear, If I'm following I don't think this is a DAHDI
> question but a C programming question? That statement is not true if
> the B bit is set in cursig.
>
> For example if you run the following program:
>
>   #include <stdio.h>
>   #include <stdbool.h>
>
>   #define DAHDI_ABIT              (1 << 3)
>   #define DAHDI_BBIT              (1 << 2)
>   #define DAHDI_CBIT              (1 << 1)
>   #define DAHDI_DBIT              (1 << 0)
>
>   static inline bool b_is_not_set(int cursig)
>   {
>       return !(cursig & DAHDI_BBIT);
>   }
>
>   static void print_set(int cursig)
>   {
>       if (b_is_not_set(cursig)) {
>           printf("B is not set\n");
>       } else {
>           printf("B is set\n");
>       }
>   }
>
>   int main(int argc, char *argv[])
>   {
>       print_set(DAHDI_ABIT);
>       print_set(DAHDI_ABIT | DAHDI_BBIT);
>       print_set(DAHDI_BBIT | DAHDI_CBIT);
>       print_set(DAHDI_ABIT | DAHDI_CBIT);
>   }
>
> The output is:
>
>   B is not set
>   B is set
>   B is set
>   B is not set
>
>
> --
> 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 --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev
>

Hello, and thank you. You are quite correct, it is a C programming
question. Apologies if that is a faux pas. I guess the DAHDI question is
"How would I create a PLAR signalling type in DAHDI" but I imagine that's
asking a little much. I am going through the code trying to understand the
structure, learning c along the way. I would eventually like to be able to
add a signalling type. Is it alright to post programming questions that
have to do with the Dahdi code base?

-Dennis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130307/598e2f9f/attachment.htm>


More information about the asterisk-dev mailing list