<div>To get outgoing caller id to work I have to change my FROM header to a trunk-specific format. While this is ugly, it works, unless I try to do it more then once. Using gateway lists in drouting this scenario can happen as the routing script is run for each gateway on failure.</div>
<div><br></div><div>Is there another way for me to do this? Either by only using uac_replace_from once, or by alternating the FROM header in another way?</div><div><br></div><div>With the below script I end up with duplicates:</div>
<div>From: "123456789""34123456789" <sip:123456789@4.4.4.4sip:<a href="mailto:34123456789@4.4.4.4">34123456789@4.4.4.4</a>>;tag=as0ab5e31d.</div><div><br></div><div>if(do_routing()) {</div><div>
route(111);</div>
<div> exit;</div><div>}</div><div><br></div><div>#...</div><div><br></div><div>route[111] {</div><div> # Do gateway-specific processing</div><div> switch($rd) {</div><div> case "1.1.1.1":</div><div>
route(callid1);</div><div> break;</div><div> case "2.2.2.2":</div><div> route(callid2);</div><div> break;</div><div> case "3.3.3.3":</div><div>
route(callid3);</div><div> break;</div><div> default:</div><div> route(callid1);</div><div> }</div><div> t_on_failure("1");</div><div> if (!t_relay()) {</div><div>
sl_reply_error();</div><div> };</div><div> exit;</div><div>}</div><div><br></div><div>route[callid1] {</div><div> if(avp_db_query("select call_id from subscriber_extras where username = '$fU'", "$avp(s:cid)")) {</div>
<div> uac_replace_from("34$avp(s:cid)", "sip:34$avp(s:cid)@$td");</div><div> }</div><div>}</div><div><br></div><div>route[callid2] {</div><div> if(avp_db_query("select call_id from subscriber_extras where username = '$fU'", "$avp(s:cid)")) {</div>
<div> uac_replace_from("+34$avp(s:cid)", "sip:+34$avp(s:cid)@$td");</div><div> }</div><div>}</div><div><br></div><div>route[callid3] {</div><div> if(avp_db_query("select call_id from subscriber_extras where username = '$fU'", "$avp(s:cid)")) {</div>
<div> uac_replace_from("$avp(s:cid)", "sip:$avp(s:cid)@$td");</div><div> }</div><div>}</div><div><br></div><div>failure_route[1] {</div><div> if(use_next_gw()) {</div><div> t_on_failure("1");</div>
<div> route(111);</div><div> exit;</div><div> }</div><div>}</div>