I am really puzzled by a problem I face. I got a SIP trunk with a SIP provider. If I let the context to context=from-trunk then the caller can’t make a transfer (*2 or ##). If I change the contect to context=add-9 then the caller can make transfers. I am refering solely to inbound calls.
The context is really simple
[add-9]
exten => _X!,1,Set(CALLERID(num)=9${CALLERID(num)})
include => from-trunk
It basicaly adds a 9 at the incoming number so phones can call back with redial.
In order to understand what you experienced, you have to know how Asterisk uses the include statement. In the normal from-trunk context, the very first line (i.e. priority = 1) sets a channel variable DIRECTION to a value of INBOUND, it is this channel variable that identifies the call as inbound, and blocks callers from accessing the in-call transfer feature codes.
With your modification, you have a different priority 1 line, which sets CALLERID, then the include. With this arrangement, your priority 1 gets run, then Asterisk proceeds to priority 2 of from-trunk, skipping over the critical priority 1 line in from-trunk.