Richard Mudgett has uploaded a new change for review. https://gerrit.asterisk.org/2425
Change subject: q931.c: Substitute PROGRESS for DISCONNECT with progress indicator #8 ...................................................................... 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 --- M q931.c 1 file changed, 34 insertions(+), 1 deletion(-) git pull ssh://gerrit.asterisk.org:29418/libpri refs/changes/25/2425/1 diff --git a/q931.c b/q931.c index 0e7ff79..69c210e 100644 --- a/q931.c +++ b/q931.c @@ -8726,6 +8726,7 @@ 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 @@ } } + 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; -- To view, visit https://gerrit.asterisk.org/2425 To unsubscribe, visit https://gerrit.asterisk.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I62313bf9cc1d2f3b0231f0c07a784717ddba0415 Gerrit-PatchSet: 1 Gerrit-Project: libpri Gerrit-Branch: 1.4 Gerrit-Owner: Richard Mudgett <rmudg...@digium.com> -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev