On Thu, Jun 22, 2017 at 04:33:51PM +0200, Emanuele Gambaro wrote:
I need to change the FROM header for every invite and replace the caller username with another data taken from mysql database. Which is the best place in kamailio routes to do a uac_replace_from ?
It is correct to change the FROM header before the dialog creation, in “RELAY” route, just before the t_relay()?
You can call these function only once per branch, you might want to do it not in RELAY but in the t_on_branch route (if used used in your setup).
route[RELAY] { # enable additional event routes for forwarded requests # - serial forking, RTP relaying handling, a.s.o. if (is_method("INVITE|SUBSCRIBE")) { t_on_branch("MANAGE_BRANCH"); t_on_reply("MANAGE_REPLY"); } if (is_method("INVITE")) { t_on_failure("MANAGE_FAILURE"); }
if (!t_relay()) { sl_reply_error(); } exit; }
branch_route[MANAGE_BRANCH] {
uac_replace_from("$avp(uacfromdisplay)","$avp(uacfromuri)"); }