On Wednesday 12 December 2012 04:19:48 Jon Morby wrote:
For legacy reasons Asterisk needs to be in the critical path on this particular build … what I'm looking for is a simple recipe and some helpful pointers on how to implement it that will allow enable me to swing (K) into the path between our end user SIP devices and the existing asterisk back ends without losing the ability to deliver hundreds of numbers down a single SIP trunk to a subscriber, and that doesn't require them to make any changes on their end as they will still see the equivalent of SIP:${DNID}@example.com arriving on their PBX
This should be simple, but I'm obviously missing something :)
Though it took me some time to figure this out, it really is very simple:
route[RELAY] { if(is_method("INVITE") && $avp(rewriterUtU)) { $rU=$tU; } ...
Seems to work perfectly for an Avaya IP Office:
INVITE sip:avayademo@172.16.0.4:5060;transport=udp SIP/2.0. ... To: sip:0123456789@172.16.32.42.
will be rewritten to
INVITE sip:0123456789@172.16.0.4:5060;transport=udp SIP/2.0. ... To: sip:0123456789@172.16.32.42.
The "hard part" it so set the avp for the legacy subscribers :)