Inbound route to Trunk

You would need to use write some custom code to accomplish this. You can put pretty much put anything into a variable, and build off of it (display, if, etc.).

http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/asterisk-CHP-6-SECT-1.html