Commit 7da3366c authored by Richard Mudgett's avatar Richard Mudgett

q931.c: Substitute PROGRESS for DISCONNECT with progress indicator #8

When the pri_set_inbanddisconnect() option is enabled and the call has not
been answered when a DISCONNECT with progress indicator #8 (Inband audio
present) is received, then report the event as a PROGRESS with progress
indicator #8 (Inband audio present) instead.  Substituting a PROGRESS
event allows the upper layer to open the media path if it isn't already
open so the user can hear the inband audio message.

PRI-180
Reported by: Alexandr Dranchuk

Change-Id: I62313bf9cc1d2f3b0231f0c07a784717ddba0415
parent 734e9223
......@@ -8726,6 +8726,7 @@ static int post_handle_q931_message(struct pri *ctrl, struct q931_mh *mh, struct
int res;
int changed;
int mand_cause;
enum Q931_CALL_STATE ourcallstate_orig;
struct apdu_event *cur = NULL;
struct pri_subcommand *subcmd;
struct q931_call *master_call;
......@@ -9265,14 +9266,46 @@ static int post_handle_q931_message(struct pri *ctrl, struct q931_mh *mh, struct
}
}
ourcallstate_orig = c->ourcallstate;
UPDATE_OURCALLSTATE(ctrl, c, Q931_CALL_STATE_DISCONNECT_INDICATION);
c->peercallstate = Q931_CALL_STATE_DISCONNECT_REQUEST;
c->sendhangupack = 1;
/* wait for a RELEASE so that sufficient time has passed
for the inband audio to be heard */
if (ctrl->acceptinbanddisconnect && (c->progressmask & PRI_PROG_INBAND_AVAILABLE))
if (ctrl->acceptinbanddisconnect
&& (c->progressmask & PRI_PROG_INBAND_AVAILABLE)) {
switch (ourcallstate_orig) {
case Q931_CALL_STATE_CALL_INITIATED:
case Q931_CALL_STATE_OVERLAP_SENDING:
case Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING:
case Q931_CALL_STATE_CALL_DELIVERED:
/*
* Open the media path if it isn't already open so
* the user can hear the inband audio.
*/
if (ctrl->debug & PRI_DEBUG_Q931_STATE) {
pri_message(ctrl, "Report the DISCONNECT as a PROGRESS instead.\n");
}
ctrl->ev.e = PRI_EVENT_PROGRESS;
ctrl->ev.proceeding.cause = c->cause;
ctrl->ev.proceeding.subcmds = &ctrl->subcmds;
ctrl->ev.proceeding.channel = q931_encode_channel(c);
ctrl->ev.proceeding.progress = c->progress;
ctrl->ev.proceeding.progressmask = c->progressmask;
ctrl->ev.proceeding.cref = c->cr;
ctrl->ev.proceeding.call = c->master_call;
return Q931_RES_HAVEEVENT;
default:
break;
}
/*
* Suppress reporting DISCONNECT to the upper layer. The
* media path should already be open and we cannot report
* a PROGRESS at this time anyway.
*/
break;
}
/* Return such an event */
ctrl->ev.e = PRI_EVENT_HANGUP_REQ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment