Skip to content
Browse files

added more info within readme

  • Loading branch information...
1 parent 732a1c4 commit 209d1b745980bab986c835094c8945e950ed698d @pdeschen committed May 23, 2011
Showing with 64 additions and 2 deletions.
  1. +64 −2 readme.md
View
66 readme.md
@@ -2,6 +2,67 @@
nodast is (for now) an Asterisk FastAGI reverse proxy on [node](http://nodejs.org).
+## How It Works
+
+ nodast receives FastAGI requests from asterisk (or other nodast as a matter of fact), inspect incoming stream for AGI request details.
+ Looking more specifically at the agi_request parameter, the AGI URL is then matched against the config route definitions, where route definitions
+ values are either static or dynamic. Dynamic values are simply JavaScript closure blocks, with /this/ pointing to a variable context
+ containing all request parameters along with regexp match group items. The dynamic function is simply rewriting the AGI URL, changing
+ the destination hostname and port as necessary. The resulting route is NOT re-injected into
+
+ Once route has been resolved, nodast then look for upstream definitions and replace logical name with upstream equivalent.
+
+## Context Variables
+
+The follow list all available context variable for dynamic route definition.
+
+ $network_script
+ $request
+ $channel
+ $language
+ $type
+ $uniqueid
+ $version
+ $callerid
+ $calleridname
+ $callingpres
+ $callingani2
+ $callington
+ $callingtns
+ $dnid
+ $rdnis
+ $context
+ $extension
+ $priority
+ $enhanced
+ $accountcode
+ $threadid
+
+## Sample Configuration
+
+ var config = {
+ listen : 9090,
+ upstreams : {
+ test : 'localhost:4573',
+ foobar : 'foobar.com:4573'
+ },
+ routes : {
+ 'agi://(.*):([0-9]*)/(.*)' : function() {
+ if (this.$callerid === 'unknown') {
+ return ('agi://foobar/script/' + this.$3);
+ } else {
+ return ('agi://foobar/script/' + this.$3 + '?callerid' + this.$callerid);
+ }
+ },
+ '.*' : function() {
+ return ('agi://test/');
+ },
+ 'agi://192.168.129.170:9090/' : 'agi://test/'
+ }
+ };
+
+ exports.config = config;
+
## Features
* Basic config definition with location and upstream
@@ -16,8 +77,9 @@ Install from npm:
## Todo
- * Add load balancing support between upstream
- * Add failover
+ * Add to npm repository
+ * Add load balancing support between upstreams
+ * Add failover/backup upstream
* Add SSL/TLS support between node (asterisk -> node -> ssl -> node -> fastagi server
* Add support for AMI
* Scriptable?

0 comments on commit 209d1b7

Please sign in to comment.
Something went wrong with that request. Please try again.