I’m assuming that you are saying that “Unknown” is being passed as the Caller ID NUMBER, not the Caller ID NAME. Remember that the inbound route is triggered by the Caller ID NUMBER string, and doesn’t care what the name is.
So I suggest you study this page:
How to change incoming CallerID
I’m thinking you COULD perhaps do something like this (this won’t make sense unless you have studied the above page, and note this is UNTESTED):
[from-trunk-custom]
exten => _X!,1,GotoIf($["${CALLERID(num)}" != "Unknown"]?notunknown)
exten => _X!,n,NoOp(Changing Caller ID number from ${CALLERID(num)} to 9999999999})
exten => _X!,n,Set(CALLERID(num)=9999999999)
exten => _X!,n(notunknown),Goto(from-trunk,${EXTEN},1)
If the CALLERID(num) string really is “Unknown” this would change it to 999999999 (which you could then use as a trigger in your incoming route). If this doesn’t work because the condition never gets triggered, then something other than “Unknown” is being received as the CALLERID(num). In that case, temporarily try this test code instead:
[from-trunk-custom]
exten => _X!,1,NoOp(The number shown in the CALLERID NUMBER field is ${CALLERID(num)})
exten => _X!,n,Goto(from-trunk,${EXTEN},1)
Watch the CLI during an incoming call and when the above NoOp line is printed, it should tell you what’s really in the CALLERID(num) field. That’s what you need to use in your inbound route (or in place of “Unknown” in the first code block above). If you wind up doing it in the inbound route (which is the correct way, if it will work) then don’t forget to restore your trunk context back to from-trunk.
Hope this helps.