Simplest way:
1) create originate with
Channel: Local/1234@dialout
and
Set: id=1
Set: otherinfo="nice call"
2) create dialplan like this
[dialout]
exten =>_X.,1,UserEvent(CatchMe,number: ${EXTEN}, db_id: ${id}, otherinfo: ${otherinfo})
exten =>_X.,2,Dial(SIP/${EXTEN}@outtrunk,,)
Same will work for inbound!!!
But also you can check other events, not NewState(which is VERY common).