Install handler for using Yate's messages in Javascript
From Yate Documentation
(Difference between revisions)
(Created page with "To have access to specific messages from Javascript you have to install a handler.") |
|||
(2 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
To have access to specific messages from Javascript you have to install a handler. | To have access to specific messages from Javascript you have to install a handler. | ||
+ | |||
+ | ===How to install a handler=== | ||
+ | |||
+ | For example if you need to install a handler for a message this is the structure: | ||
+ | |||
+ | Message.install(callback, message, priority, filter_key, filter_value); | ||
+ | |||
+ | Parameters: | ||
+ | |||
+ | * callback - callback function that has to be written before the handler installed | ||
+ | * message - string with the name of the message | ||
+ | * priority - integer with the priority of the message | ||
+ | * filter_key - optional | ||
+ | * filter_value - optional | ||
+ | |||
+ | |||
+ | ===Example=== | ||
+ | |||
+ | Install handler for user.auth message and create the callback method: | ||
+ | |||
+ | function usrAuth(msg) | ||
+ | { | ||
+ | Engine.Debug(msg); | ||
+ | //your code | ||
+ | |||
+ | } | ||
+ | |||
+ | Message.install(usrAuth,"user.auth",80); | ||
+ | |||
+ | |||
+ | '''See also''' | ||
+ | |||
+ | * [[Javascript]] |
Latest revision as of 14:10, 27 February 2014
To have access to specific messages from Javascript you have to install a handler.
[edit] How to install a handler
For example if you need to install a handler for a message this is the structure:
Message.install(callback, message, priority, filter_key, filter_value);
Parameters:
- callback - callback function that has to be written before the handler installed
- message - string with the name of the message
- priority - integer with the priority of the message
- filter_key - optional
- filter_value - optional
[edit] Example
Install handler for user.auth message and create the callback method:
function usrAuth(msg) { Engine.Debug(msg); //your code } Message.install(usrAuth,"user.auth",80);
See also