01 November 2010

How to force G.711 for ephone with virtual voice gateway

NOTE! This is the second, updated version of this post. Some minor bugs still exist, but easy to fix. I do not recommend to deploy this configuration on production routers, only if it is your last option.

The best cisco-breeders state: use G.711 for local calls and some narrowband codec (like G.729) for remote calls. That is clear. But what if you have a free voice recording software that supports only G.711 (cause G.729 requires licensing) behind your router with CUCME? By default IP Phone will negotiate G.729 to avoid transcoding and save router DSP resources. So we have to force transcoding manually. But it is not so simple as it sounds (that's valid for IOS 12.4 and I don't expect significant change in nearest future).
The problem is clarified in CUCME System Administrator Guide: "Transcoding is enabled only if an H.323 call with a different codec from the remote phone tries to make a call to the remote phone. If a local phone on the same Cisco Unified CME as the remote phone makes a call to remote phone, the local phone is forced to change its codec to G.729 instead of using transcoding". The same is valid for SIP. It seems to be unsupported. But that doesn't mean it is not possible. There is one mad feature that can be useful in some cases. That is tunnel interface with source and destination on the same router. Yes, it works. And we'll use it to force transcoding by hair-pinning SIP and RTP sessions. Lets examine simple lab topology: