Hi,
I believe you would need a script for this as this functionality without one more pin is impossible in the current state of the FW.
With the script, you can grep incoming messages from gsmctl or logread and if it meets conditions you've set - it activates further script sequence that would change your output state for 5 seconds, and after those 5 seconds you can invert it back to the primary state - after which the scripts work in idle again.
To change the I/O state from SSH use ubus call ioman.gpio.dio1 update '{"value": "1"}'
To check the status of I/O ubus call ioman.gpio.dio1 status
EB.