Dialing an invalid extension causes incomplete hangup sequence.

Revision -r1489 corrected a deviation from Q.931 Section 5.3.2.  However,
this resulted in an unexpected behaviour change to the upper layer
(Asterisk).

This change restores the legacy hangup behaviour if the new API call is
not used.  Use pri_hangup_fix_enable() to follow Q.931 Section 5.3.2 call
hangup better.

(closes issue #17104)
Reported by: shawkris
Tested by: rmudgett


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1688 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
Richard Mudgett 2010-05-11 22:14:15 +00:00
parent 14c3616e02
commit d808143f8f
4 changed files with 26 additions and 0 deletions

View File

@ -915,6 +915,17 @@ int pri_redirecting_update(struct pri *pri, q931_call *call, const struct pri_pa
#define PRI_HANGUP
int pri_hangup(struct pri *pri, q931_call *call, int cause);
/*!
* \brief Set the call hangup fix enable flag.
*
* \param ctrl D channel controller.
* \param enable TRUE to follow Q.931 Section 5.3.2 call hangup better.
* FALSE for legacy behaviour. (Default FALSE if not called.)
*
* \return Nothing
*/
void pri_hangup_fix_enable(struct pri *ctrl, int enable);
#define PRI_DESTROYCALL
void pri_destroycall(struct pri *pri, q931_call *call);

8
pri.c
View File

@ -965,6 +965,14 @@ int pri_channel_bridge(q931_call *call1, q931_call *call2)
}
}
void pri_hangup_fix_enable(struct pri *ctrl, int enable)
{
if (ctrl) {
ctrl = PRI_MASTER(ctrl);
ctrl->hangup_fix_enabled = enable ? 1 : 0;
}
}
int pri_hangup(struct pri *pri, q931_call *call, int cause)
{
if (!pri || !call)

View File

@ -92,6 +92,7 @@ struct pri {
unsigned int service_message_support:1;/* TRUE if upper layer supports SERVICE messages */
unsigned int hold_support:1;/* TRUE if upper layer supports call hold. */
unsigned int deflection_support:1;/* TRUE if upper layer supports call deflection/rerouting. */
unsigned int hangup_fix_enabled:1;/* TRUE if should follow Q.931 Section 5.3.2 instead of blindly sending RELEASE_COMPLETE for certain causes */
/* MDL variables */
int mdl_error;

6
q931.c
View File

@ -5397,6 +5397,12 @@ static int __q931_hangup(struct pri *ctrl, q931_call *c, int cause)
case PRI_CAUSE_REQUESTED_CHAN_UNAVAIL:
case PRI_CAUSE_IDENTIFIED_CHANNEL_NOTEXIST:
case PRI_CAUSE_UNALLOCATED:
if (!PRI_MASTER(ctrl)->hangup_fix_enabled) {
/* Legacy: We'll send RELEASE_COMPLETE with these causes */
disconnect = 0;
release_compl = 1;
break;
}
/* See Q.931 Section 5.3.2 a) */
switch (c->ourcallstate) {
case Q931_CALL_STATE_NULL: