How to set different DIAL_OPTIONS for external and internal calls


Can somebody help me with the following. I need to set DIAL_OPTIONS=tr for any internal calls made between extensions and then set DIAL_OPTIONS=tm for any inbound external calls that the users receive.

All the extensions have voice mail so judging by the extensions_additional.conf I need to make a change in the [macro-exten-vm] just before the line

exten => s,n,Macro(dial,${RT},${DIAL_OPTIONS},${EXTTOCALL})

to set the DIAL_OPTIONS for internal or external calls. I would imagine it would be something like

if inbound call is from external source set DIAL_OPTIONS=tm
else set DIAL_OPTIONS=tr

but I’m not at all sure how to implement this. Please can someone help me out with this.

Many Thanks