[asterisk-dev] Libpri - Wrong answer on Status Enquiry with global call reference

Richard Mudgett rmudgett at digium.com
Tue Jul 27 09:55:23 CDT 2010


----- Original Message -----
> Richard Mudgett ha scritto:
> >> The problem is:
> >> When asterisk receive a STATUS ENQUIRY with global call reference
> >> it
> >> answers with a RELEASE COMPLETE, and this is wrong because we have
> >> to
> >> answer with a STATUS message with invalid call reference: in this
> >> case
> >> i
> >> wanted to show a possible solution in file q931.c at line 7169
> >> instead
> >> of
> >> case Q931_STATUS_ENQUIRY:
> >> if (c->newcall) {
> >> q931_release_complete(ctrl,
> >> c,PRI_CAUSE_INVALID_CALL_REFERENCE);
> >> } else
> >>
> >> q931_status(ctrl,c,PRI_CAUSE_RESPONSE_TO_STATUS_ENQUIRY);
> >> break;
> >> we could use:
> >> case Q931_STATUS_ENQUIRY:
> >> if (c->newcall) {
> >> if(c->cr == Q931_DUMMY_CALL_REFERENCE){
> >>
> >> q931_status(ctrl,c,PRI_CAUSE_INVALID_CALL_REFERENCE);
> >> }
> >> else{
> >> q931_release_complete(ctrl,
> >> c,PRI_CAUSE_INVALID_CALL_REFERENCE);
> >> }
> >>
> >> } else
> >>
> >> q931_status(ctrl,c,PRI_CAUSE_RESPONSE_TO_STATUS_ENQUIRY);
> >> break;
> >>
> >>
> >> what do you think about it?
> >>
> >>
> > There are three kinds of call references: dummy, global, and normal.
> > This change will not do what you have stated. It is checking for the
> > wrong type of call reference.
> >
> I supposed to use Q931_DUMMY_CALL_REFERENCE because i found only this
> defined in pri_internal.h.
> Anyway have you some idea to change it?
> 
Change the test to:
if (!(c->cr & ~Q931_CALL_REFERENCE_FLAG)) {
    /* status: invalid call reference */
} else {
    /* release complete: invalid call reference */
}

The global call reference is zero.  There are two of them.  One originated from each side.  That is why you need to mask out the Q931_CALL_REFERENCE_FLAG bit.

Richard



More information about the asterisk-dev mailing list