Just giving my 2 cents in this matter, but by having the function set_advertised_address accepting variables instead of only pure strings would probably help solving this problem in the script logic. I asked about this possibility not too long ago and Daniel pointed me out some workaround which I couldn't implement (http://sip-router.1086192.n5.nabble.com/set-advertised-address-with-variable...). Anyway I just think that the set_advertised_address function would give a lot more flexibility for scenarios like this where there isn't only one IP to advertise on the same listening IP.