Yate Community Forum

Yate server => Other Yate server issues => Topic started by: billsimon on March 16, 2015, 08:56:02 PM

Title: dispatching a database message and using the results
Post by: billsimon on March 16, 2015, 08:56:02 PM
If I dispatch a database message from regexroute, e.g.

^1$=dispatch database;account=something;query=SELECT ...;results=true

how do I get the SELECT results out of the message answer?
Title: Re: dispatching a database message and using the results
Post by: Monica Tepelus on March 17, 2015, 02:40:51 AM
Hi,

You can't do that from regexroute. Try using Javascript instead:

http://docs.yate.ro/wiki/How_to_access_a_database_from_Yate%27s_Javascript_module
Title: Re: dispatching a database message and using the results
Post by: billsimon on March 17, 2015, 06:01:03 AM
Thank you Monica. I am doing everything else with register.conf and regexroute and hate to load Javascript just for this. Does Javascript perform better than register or regexroute? If so I may try to convert my logic.
Title: Re: dispatching a database message and using the results
Post by: Monica Tepelus on March 18, 2015, 05:54:39 AM
It's not about what performs better it's about finding the right tool for a specific action :).
Getting results from a SELECT implies a very custom feature and this is usually implemented in javascript or from an external module.

If you can do this from register.conf then use it, otherwise you will need a piece of scripting. The power of Yate lies in the fact that you can mix existing modules and custom scripting.
Title: Re: dispatching a database message and using the results
Post by: billsimon on March 18, 2015, 08:03:08 AM
Thanks for your advice. For this specific routing need I was not able to do it with the register module but accomplished it fine with Javascript.