Yate Community Forum

General Category => Yate users hangout place => Topic started by: bigpaulie on February 12, 2015, 03:51:41 AM

Title: Callerid from database
Post by: bigpaulie on February 12, 2015, 03:51:41 AM
Hello guys ,

I have a database of phone numbers and each time someone calls I want to query the database and get the name of the person and send it as caller id to my extension .
Is it possible , if so how can I do it . Can somebody help me ?

Best Regards,
Paul.
Title: Re: Callerid from database
Post by: Monica Tepelus on February 12, 2015, 05:01:10 AM
Hi,

You can use the register module

http://docs.yate.ro/wiki/Register
Title: Re: Callerid from database
Post by: bigpaulie on February 12, 2015, 05:21:35 AM
Multumesc Monica ,

[call.preroute]
query=SELECT contact_name FROM contacts WHERE contact_phone_number = ${caller}
result=contact_name

callername=${contact_name}

?
Title: Re: Callerid from database
Post by: Monica Tepelus on February 12, 2015, 06:01:37 AM
Hi,

If you only want to change the callername parameter then you have to added in the query. If you don't route from the database it would be something like this:

[call.preroute]
query=SELECT contact_name as callername, null as location FROM contacts WHERE contact_phone_number = ${caller}
result=location

or

[call.route]
query=SELECT contact_name as callername, location FROM contacts WHERE contact_phone_number = ${caller}
result=location

id you also have the location in the database

This depends on how the routing is done and if you want to do it here or from another module/script