"The conditions needed to bring the spell into effect must be clear, although they can be general. In all cases, the contingency immediately brings into effect the companion spell, the latter being “cast” instantaneously when the prescribed circumstances occur."
I would go with scenario A based on the above sentence, but it's not limited to within the dungeon. If "outside" is within range, you can go outside!