Update q931_hangup routine

git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@51 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
Martin Pycko 2003-08-05 20:37:32 +00:00
parent 110062aef6
commit 45efb97ebd

7
q931.c
View File

@ -1743,12 +1743,15 @@ int q931_hangup(struct pri *pri, q931_call *c, int cause)
if (!pri || !c) if (!pri || !c)
return -1; return -1;
if (cause == 34 || cause == 44 || cause == 82 || cause == 1) { if (cause == 34 || cause == 44 || cause == 82 || cause == 1) {
/* We'll send RELEASE_COMPLETE with these causes */
disconnect = 0; disconnect = 0;
release_compl = 1; release_compl = 1;
} }
if (cause == 6) { if (cause == 6 || cause == 7 || cause == 26) {
/* We'll send RELEASE with these causes */
disconnect = 0; disconnect = 0;
} }
/* All other causes we send with DISCONNECT */
switch(c->ourcallstate) { switch(c->ourcallstate) {
case Q931_CALL_STATE_NULL: case Q931_CALL_STATE_NULL:
if (c->peercallstate == Q931_CALL_STATE_NULL) if (c->peercallstate == Q931_CALL_STATE_NULL)
@ -1778,7 +1781,7 @@ int q931_hangup(struct pri *pri, q931_call *c, int cause)
case Q931_CALL_STATE_OVERLAP_RECEIVING: case Q931_CALL_STATE_OVERLAP_RECEIVING:
/* received SETUP_ACKNOWLEDGE */ /* received SETUP_ACKNOWLEDGE */
/* send DISCONNECT in general */ /* send DISCONNECT in general */
if (disconnect && (c->peercallstate == Q931_CALL_STATE_DISCONNECT_REQUEST || c->peercallstate <= 11)) if (disconnect && c->peercallstate != Q931_CALL_STATE_NULL && c->peercallstate != Q931_CALL_STATE_DISCONNECT_REQUEST && c->peercallstate != Q931_CALL_STATE_DISCONNECT_INDICATION && c->peercallstate != Q931_CALL_STATE_RELEASE_REQUEST && c->peercallstate != Q931_CALL_STATE_RESTART_REQUEST && c->peercallstate != Q931_CALL_STATE_RESTART)
q931_disconnect(pri,c,cause); q931_disconnect(pri,c,cause);
else if (release_compl && c->peercallstate == Q931_CALL_STATE_CALL_INITIATED) else if (release_compl && c->peercallstate == Q931_CALL_STATE_CALL_INITIATED)
q931_release_complete(pri,c,cause); q931_release_complete(pri,c,cause);