edit - edited since it was first posted. Inexperienced users should never use the from-pstn-custom
context.
There may be other ways, but one way is to put lines like this in /etc/asterisk/extensions_custom.conf:
[from-pstn-limited]
exten => _.,1,noop(Limiting maximum call duration)
exten => _.,n,Set(TIMEOUT(absolute)=3600)
exten => _.,n,Goto(from-pstn,${EXTEN},1)
Then set the trunk context to from-pstn-limited
in the trunk peer details with the line:
context=from-pstn-limited