From 307264f7c6a95b794c28157f196699721c43450c Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Thu, 11 Feb 2010 21:47:24 +0000 Subject: [PATCH] Must send DISCONNECT if we have sent a response to a SETUP message. Q.931 Section 5.3.2 a) says we send a RELEASE_COMPLETE to reject a call SETUP if we have not already sent a message in response to the SETUP message. git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1489 2fbb986a-6c06-0410-b554-c9c1f0a7f128 --- q931.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/q931.c b/q931.c index 9f183af..5e9c426 100644 --- a/q931.c +++ b/q931.c @@ -5290,6 +5290,26 @@ 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: + /* See Q.931 Section 5.3.2 a) */ + switch (c->ourcallstate) { + case Q931_CALL_STATE_NULL: + case Q931_CALL_STATE_CALL_INITIATED: + case Q931_CALL_STATE_CALL_PRESENT: + /* + * Send RELEASE_COMPLETE because some other message + * has not been sent previously. + */ + disconnect = 0; + release_compl = 1; + break; + default: + /* + * Send DISCONNECT because some other message + * has been sent previously. + */ + break; + } + break; case PRI_CAUSE_INVALID_CALL_REFERENCE: /* We'll send RELEASE_COMPLETE with these causes */ disconnect = 0;