Codecs again... outgoing call virtual server

Hi,

The whole asterisk server is configured to use G729 licensed codecs.
However to call some certain destinations I need other codecs to be available.
The dialplan does not have any capabilities to facilitate codec selection based on dialed destiny, so perhaps there is a posibility to overcome this by making an SIP server entry in sip.conf so in the dial plan I can make use of the right redirections:
exten => _X.,1,Dial(SIP/${EXTEN}@my_provider)

The my_provider in this case are just SIP URI calls to one ore more domains (e.g. <>@sipsorcery.com)
For this extensions I want to make use of G722 and G723 codecs, like it would usually been done in sip.conf:

[my_provider]
type=peer
fromuser=XXXX
fromdomain=YYYY.com
canreinvite=no
secret=AAAAA
insecure=very
host= IP
disallow=all
allow=gsm
allow=ulaw
allow=alaw
qualify=yes
nat=no

Any ideas around how to realize this?

Thanks

Maarten

Have you tried the SIP channel CODEC variables?

wiki.asterisk.org/wiki/display/ … +Variables

Malcom,

Thank for your reply.
Does this override the “general” settings in sip.conf?
Both the local extensions (sip and IAX) and the general settings of sip.conf only allow G729.
So this setting should override only the outgoing SIP call en start asterisk transcoding from external (g722) to internal (g729).

I will test this behaviour and report back here.

Thanks,

Maarten

Unfortunatly the suggested solution did not work.

my extensions.conf was adapted and reloaded with the following lines:

The debug trail shows that still another codec is offered:

Which results in:

The only reason I can find is that there still are codec issues.
However, it looks the the “not acceptable” messages comes my internal extension???

What to do?

Thanks,

Maarten

What codecs did you define for that peer in sip.conf?

All the internal extensions are G729 only, the normal outgoing SIP calls are also G729.
due to the fact that if I select another codec asterisk allways starts transcoding.
In sip.conf, the general part I only allow g729.

So wat I wanted was to create an escape for just some external destinations.
My idea was to create a sort of “peer” for it in which I can have the desired codec settings.
In this case G711.
Asterisk, will see the internal extensions are tight to G729 and will trancode the call from and towards G711.

Something like this:

Regards,

Maarten

just a thought, not tested… try to double declare in sip.conf your trunk - with 2 different names & 2 different sets of codecs. route your call on the proper trunk based on destination selection.

worth giving it a try !