The request URI, that is the URI on the first line (the trunk number as you are calling it), is the extension that has been requested by the remote side. The To header isn’t supposed to be used for routing but some providers still do it anyway. There is no configuration option to support this, you’d have to get it from the dialplan and parse it there. I believe if you search on here there are examples.