Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
* @author gvagenas@telestax.com
*/
public class B2BUAHelper {

public static final String B2BUA_CALL = "org.restcomm.connect.telephony.api.util.B2BUAHelper";
public static final String FROM_INET_URI = "fromInetURI";
public static final String TO_INET_URI = "toInetURI";
public static final String B2BUA_LAST_REQUEST = "lastRequest";
Expand Down Expand Up @@ -238,6 +238,8 @@ public static boolean redirectToB2BUA(final ActorSystem system, final SipServlet

sendCallInfoStreamEvent(system, request, CallStateChanged.State.QUEUED);

outgoingSession.getApplicationSession().setAttribute(B2BUA_CALL, "Client-To-Client");

return true; // successfully proxied the SIP request between two registered clients
}
} catch (Exception e) {
Expand Down Expand Up @@ -420,6 +422,8 @@ public static boolean redirectToB2BUA(final ActorSystem system, final SipServlet

sendCallInfoStreamEvent(system, request, CallStateChanged.State.QUEUED);

outgoingSession.getApplicationSession().setAttribute(B2BUA_CALL, "Client-To-Client");

return true; // successfully proxied the SIP request
} catch (IOException exception) {
if (logger.isInfoEnabled()) {
Expand Down Expand Up @@ -880,7 +884,7 @@ public static void dropB2BUA(SipApplicationSession application) {
logger.debug("sending BYE");
}
createRequest.send();
} catch (IOException ex) {
} catch (IOException | IllegalStateException ex) {
logger.debug("Unable to drop session.", ex);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2448,7 +2448,9 @@ public void timeout(final Object message) {
final SipApplicationSession application = event.getApplicationSession();
final ActorRef call = (ActorRef) application.getAttribute(Call.class.getName());
if (call == null) {
B2BUAHelper.dropB2BUA(application);
if (application.isValid()) {
B2BUAHelper.dropB2BUA(application);
}
}
//if there is Call actor, session was set to never expired, since Call
//Akka actor is handling its own call expiration. so, do nothing in that case
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.restcomm.connect.dao.DaoManager;
import org.restcomm.connect.mscontrol.api.MediaServerControllerFactory;
import org.restcomm.connect.sms.SmsService;
import org.restcomm.connect.telephony.api.util.B2BUAHelper;
import org.restcomm.connect.ussd.telephony.UssdCallManager;

import javax.servlet.ServletConfig;
Expand Down Expand Up @@ -227,7 +228,7 @@ public void sessionExpired(SipApplicationSessionEvent sase) {
//check attribute signlling Akka actor completed timeout processing
//if att is present, let the sesion just expire
logger.debug("Session expired");
if (sase.getApplicationSession().getAttribute(CallManager.TIMEOUT_ATT) == null) {
if (sase.getApplicationSession().getAttribute(B2BUAHelper.B2BUA_CALL) != null && sase.getApplicationSession().getAttribute(CallManager.TIMEOUT_ATT) == null) {
logger.debug("Session expired still not processed");
//extend expiration a bit,to let sessions be properly disconnected
sase.getApplicationSession().setExpires(EXPIRATION_GRACE_PERIOD);
Expand Down