middleware for agi-middleware to match against an extension or an extension pattern