Channel specific codec priority application

Hi,

I was wondering if changing codec priority and reInviting to the involved party is possible. My sip.conf is like this…

[general]
register => 1234:pass:auth@this.com/1234

[this.com]

context=thisctx
disallow=all
allow=gsm

so when 1234@this.com call is established using gsm. Now in my dialplan —

[thisctx]
exten => 1234,1,Answer()
exten => 1234,n,Playback(welcome)
exten => 1234,n,MyImaginaryApp(ulaw,gsm)
exten => 1234,n,Dial(SIP/5678@other.com)

Before dialing can i set ulaw,gsm as the preferred codec? Is there any application to do that?

Thanx.