Revision: af65eee31a2d
Author:   Jean Deruelle <[email protected]>
Date:     Fri Apr 25 15:33:09 2014 UTC
Log:      Update Issue 43

Fix added. Implemented it differently. Adding a new parameter to avoid performance issues or case where some dev don't want the popped route to be in the regex

(cherry picked from commit c669463d874b1df902a5e0a2b88fad8896040768)

http://code.google.com/p/sipservlets/source/detail?r=af65eee31a2d

Modified:
/sip-servlets-application-router/src/main/java/org/mobicents/servlet/sip/router/DefaultApplicationRouter.java

=======================================
--- /sip-servlets-application-router/src/main/java/org/mobicents/servlet/sip/router/DefaultApplicationRouter.java Thu Mar 21 23:11:18 2013 UTC +++ /sip-servlets-application-router/src/main/java/org/mobicents/servlet/sip/router/DefaultApplicationRouter.java Fri Apr 25 15:33:09 2014 UTC
@@ -176,6 +176,7 @@
public class DefaultApplicationRouter implements SipApplicationRouter, ManageableApplicationRouter{
        private static final String DIRECTION_PARAMETER = "DIRECTION";
        private static final String REGEX_PARAMETER = "REGEX";
+ private static final String REGEX_POPPED_ROUTE_PARAMETER = "REGEX_POPPED_ROUTE";
        private static final String DIRECTION_OUTBOUND = "OUTBOUND";
        private static final String DIRECTION_INBOUND = "INBOUND";
        //      the logger
@@ -355,6 +356,24 @@
                                                continue; // pattern not 
matching, just don't call the application
                                        }
                                }
+                               // 
https://code.google.com/p/sipservlets/issues/detail?id=43
+ String regExPoppedRoute = defaultSipApplicationRouterInfo.getOptionalParameters().get(REGEX_POPPED_ROUTE_PARAMETER);
+                if(regExPoppedRoute != null) {
+                    Pattern pattern = Pattern.compile(regExPoppedRoute);
+ Matcher matcher = pattern.matcher(initialRequest.getPoppedRoute().toString());
+                    if(matcher.find()) {
+                        if(log.isDebugEnabled()) {
+ log.debug("initialRequest Popped Route" + initialRequest.getPoppedRoute() + " matching regex pattern " + regExPoppedRoute + + "begin index " + matcher.start() + " and ending at index " + matcher.end() + " for application " + defaultSipApplicationRouterInfo.getApplicationName());
+                        }
+                    } else {
+                        if(log.isDebugEnabled()) {
+ log.debug("initialRequest Popped Route" + initialRequest.getPoppedRoute() + " matching regex pattern " + regExPoppedRoute + + " skipping application " + defaultSipApplicationRouterInfo.getApplicationName());
+                        }
+ continue; // pattern not matching, just don't call the application
+                    }
+                }

                                boolean isApplicationPresentInContainer = false;
                                synchronized 
(containerDeployedApplicationNames) {

--

--- You received this message because you are subscribed to the Google Groups "mobicents-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to