Handle DISC and REL with missing mandatory information elements

git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@118 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
Mark Spencer 2004-06-16 22:19:11 +00:00
parent 20e146406b
commit 97648bb1b4

11
q931.c
View File

@ -2223,6 +2223,9 @@ int q931_hangup(struct pri *pri, q931_call *c, int cause)
pri_message("NEW_HANGUP DEBUG: Calling q931_hangup, ourstate %s, peerstate %s\n",callstate2str(c->ourcallstate),callstate2str(c->peercallstate)); pri_message("NEW_HANGUP DEBUG: Calling q931_hangup, ourstate %s, peerstate %s\n",callstate2str(c->ourcallstate),callstate2str(c->peercallstate));
if (!pri || !c) if (!pri || !c)
return -1; return -1;
/* If mandatory IE was missing, insist upon that cause code */
if (c->cause == PRI_CAUSE_MANDATORY_IE_MISSING)
cause = c->cause;
if (cause == 34 || cause == 44 || cause == 82 || cause == 1 || cause == 81) { if (cause == 34 || cause == 44 || cause == 82 || cause == 1 || cause == 81) {
/* We'll send RELEASE_COMPLETE with these causes */ /* We'll send RELEASE_COMPLETE with these causes */
disconnect = 0; disconnect = 0;
@ -2731,8 +2734,8 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
break; break;
case Q931_RELEASE: case Q931_RELEASE:
if (missingmand) { if (missingmand) {
q931_release_complete(pri, c, PRI_CAUSE_MANDATORY_IE_MISSING); /* Force cause to be mandatory IE missing */
break; c->cause = PRI_CAUSE_MANDATORY_IE_MISSING;
} }
if (c->ourcallstate == Q931_CALL_STATE_RELEASE_REQUEST) if (c->ourcallstate == Q931_CALL_STATE_RELEASE_REQUEST)
c->peercallstate = Q931_CALL_STATE_NULL; c->peercallstate = Q931_CALL_STATE_NULL;
@ -2754,8 +2757,8 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
break; break;
case Q931_DISCONNECT: case Q931_DISCONNECT:
if (missingmand) { if (missingmand) {
q931_release(pri, c, PRI_CAUSE_MANDATORY_IE_MISSING); /* Still let user call release */
break; c->cause = PRI_CAUSE_MANDATORY_IE_MISSING;
} }
if (c->newcall) { if (c->newcall) {
q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE); q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE);