Is there a way in Asterisk to force a codec for a specific incoming number? Or should I ask my provider to do this? (The provider offers both G.711 and G.729 in the INVITE.) We have a phone number for modems to dial into that we’d like to use G.711 for. This number will dial an ATA from within the dialplan. For all the other numbers, we want to use G.729. I’ve set the trunk to allow both but it seems like G.729 is chosen before it even gets to the dialplan.
Here is our codecs:
;sip.conf
[trunk]
allow=!all,g729,ulaw
context=inbound
[ata]
allow=!all,ulaw
;extensions.conf
[inbound]
exten => 1231234567,1,NoOp()
; No luck setting these, SIP/trunk still uses G.729.
same => n,Set(SIP_CODEC=ulaw)
same => n,Set(SIP_CODEC_INBOUND=ulaw)
same => n,Set(SIP_CODEC_OUTBOUND=ulaw)
same => n,Dial(SIP/ata,30)
The ata channel uses ulaw, but the trunk channel always wants to use G.729. Any ideas? Thanks as always!