MT#56321 office-hours: catch the finish of the playback

If we get the 480 reply from the office-hours DSM application,
and there is a header 'P-DSM-App: office-hours' added, with
a parameter ';playback=finished', then it means the following:

- there was either AA or transfer involved into the call, before
  the call got to the DSM office-hours
- caller remains in the hold state (so there was 200/ACK)
- the office-hours playback has been finished, and now we mustn't
  forward 480 to the caller's leg, but just terminate it with BYE

Change-Id: I389c6993185008c51c61bacd8eb23ac1562871b8
mr11.3.1
Donat Zenichev 4 years ago
parent aec816dad7
commit cd233e18dd

@ -313,6 +313,29 @@ void AmB2BSession::onB2BEvent(B2BEvent* ev)
}
}
}
/* processing of the playback completion from DSM applications */
if (reply_ev->reply.code == 480 && dlg->getStatus() == AmSipDialog::Connected) {
string p_dsm_app = getHeader(reply_ev->reply.hdrs, SIP_HDR_P_DSM_APP, true);
/* TT#188800, if this is a completion of the playback of one of the DSM applications,
(office hours, play last caller, pre announce)
in the session, which has had AA or a transfer before going to this DSM application,
then a caller is now likely in the connected state, and requires BYE, not 480 */
if (p_dsm_app.find("office-hours") != std::string::npos ||
p_dsm_app.find("pre-announce") != std::string::npos ||
p_dsm_app.find("play-last-caller") != std::string::npos) {
/* check the ;playback= parameter */
string p_dsm_app_param = get_header_param(p_dsm_app, "playback");
if (p_dsm_app_param == "finished") {
DBG("This is the end of DSM playback, the caller is in the connected state.\n");
DBG("Terminating the original leg with BYE, instead of 480.\n");
terminateLeg();
}
}
}
}
}
return;

@ -55,6 +55,7 @@
#define SIP_HDR_SUBSCRIPTION_STATE "Subscription-State"
#define SIP_HDR_REPLACES "Replaces"
#define SIP_HDR_P_EARLY_ANNOUNCE "P-Early-Announce"
#define SIP_HDR_P_DSM_APP "P-DSM-App"
#define SIP_HDR_COL(_hdr) _hdr ":"
#define SIP_HDR_COLSP(_hdr) SIP_HDR_COL(_hdr) " "

Loading…
Cancel
Save