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.-
On Tue, Aug 22, 2017 at 04:28:35PM +0200, Nelson Migliaro wrote:
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");
Don't get what you are trying to do here, you are looking at the called "number" ($rU) to find a callerID for the caller!
But I am afraid of causing a bottheneck on the database.
Sure a database lookup would be the slowest/most time consuming part of handling the transaction, but you'd have to handle lots of calls before it will be the actual bottleneck. You could populate a $sht() variable ( http://kamailio.org/docs/modules/stable/modules/htable.html ) instead to keep this data in memory, or use an external key/value memory database like redis.