To solve this optimization problem, we first need to identify the decision variables, constraints, and the objective function. 

- Decision Variables: Let \(R\) be the number of regular speakers made and \(P\) be the number of portable speakers made.
- Constraints:
  - Team A can make at most 120 regular speakers per day: \(R \leq 120\)
  - Team B can make at most 200 portable speakers per day: \(P \leq 200\)
  - The shared testing machine can be used to make a maximum of 300 total speakers per day: \(R + P \leq 300\)
- Objective Function: Maximize profit. Given that the profit per regular speaker is $40 and the profit per portable speaker is $60, the objective function can be written as: Maximize \(40R + 60P\).

Given these elements, we can formulate this problem as a linear programming problem and solve it using Gurobi in Python.

```python
from gurobipy import *

# Create a model
m = Model("Speaker_Production")

# Define decision variables
R = m.addVar(lb=0, vtype=GRB.INTEGER, name="Regular_Speakers")
P = m.addVar(lb=0, vtype=GRB.INTEGER, name="Portable_Speakers")

# Add constraints
m.addConstr(R <= 120, "Team_A_Constraint")
m.addConstr(P <= 200, "Team_B_Constraint")
m.addConstr(R + P <= 300, "Testing_Machine_Constraint")

# Set objective function
m.setObjective(40*R + 60*P, GRB.MAXIMIZE)

# Optimize the model
m.optimize()

# Print results
if m.status == GRB.OPTIMAL:
    print("Optimal solution found:")
    print(f"Regular Speakers: {R.x}")
    print(f"Portable Speakers: {P.x}")
    print(f"Maximum Profit: ${40*R.x + 60*P.x}")
else:
    print("No optimal solution found")

```