From db0382894abb1e9da88a03f678b59fca6636b46d Mon Sep 17 00:00:00 2001 From: MelwareDE Date: Sun, 12 Feb 2006 21:04:54 +0000 Subject: [PATCH] Set hangupcause in case there is no 'cause' information element. --- chan_capi.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/chan_capi.c b/chan_capi.c index 5ff99c3..a1f290a 100644 --- a/chan_capi.c +++ b/chan_capi.c @@ -3290,7 +3290,17 @@ static void capi_handle_disconnect_indication(_cmsg *CMSG, unsigned int PLCI, un i->state = CAPI_STATE_DISCONNECTED; i->reason = DISCONNECT_IND_REASON(CMSG); - + + if (i->owner && (i->owner->hangupcause == 0)) { + + /* set hangupcause, in case there is no + * "cause" information element: + */ + i->owner->hangupcause = + ((i->reason & 0xFF00) == 0x3400) ? + i->reason & 0x7F : AST_CAUSE_NORMAL_CLEARING; + } + if (i->FaxState == 1) { /* in capiFax */ switch (i->reason) {