Run a php script when a call comes in

Welcome to the forum!

Referencing a block of custom dialplan can be done with a custom destination, like this example: Announce current time as part of call flow - #4 by lgaetz

If your ask is more complex, you might want to look at using a dialplan hook: Hooking for fun and income