Hello,

I have several Asterisk sending calls to a centralizad Kamailio.
I would like this Kamailio to set up the caller id number of the calls.

I am using the uac_replace_from function but I would like to pull the caller id from a database to set up the number based on the sip vendor the call is forwarded

What would be the correct way to do that?

I was thinking of: 

sql_query("ca", "select ddi from ddi_table where xxx= $rU limit 1", "ra");
$avp(dnis) = $dbr(ra=>[0,0]);
sql_result_free("ra");  

But I am afraid of causing a bottheneck on the database.

As usual, thank you for the help.

Regards,

Nelson.-