This may be well known, but took me a while to figure out.
To make a phone originating a call use a particular codec (ulaw) when calling out via a trunk, I added this to extensions_custom.conf:
[from-internal-custom]
; Do not use an Answer() command
; It breaks it- at least it does in Asterisk 1.6.1.10
;Use ulaw when dialling via an outbound route with prefix 9
exten => _9.,1,Set(SIP_CODEC=ulaw)
exten => _9.,n,Dial(SIP/${EXTEN})
exten => _9.,n,Hangup()
To make a phone originating a call use a particular codec (ulaw) when calling out via a trunk, I added this to extensions_custom.conf:
[from-internal-custom]
; Do not use an Answer() command
; It breaks it- at least it does in Asterisk 1.6.1.10
;Use ulaw when dialling via an outbound route with prefix 9
exten => _9.,1,Set(SIP_CODEC=ulaw)
exten => _9.,n,Dial(SIP/${EXTEN})
exten => _9.,n,Hangup()