pipobscure/NodeJS-AsteriskManager — pull request #13 by igorescobar (2014-02-04 19:52:27+00:00)
Title: Fixing action command when using object with Regex values

As you can see: https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+ManagerAction_Hangup
The hangup action has regex support on "channel" attribute so instead of pass the entire channel name I can just pass a regex that matches the channel name like this:
```javascript
AMI.action({
'action':'hangup',
'channel': /^SIP\/9138-.*$/,
'cause': '1'
}, function(err, res) {
console.log(err, res);
});
```
Looking at your original implementation you're handling regex values assuming that is a object like a key -> value object. A ```typeof /regex/``` is object but it holds an different constructor (RegExp). So what I did was... inside of your object check I also check if ```nval``` has an instance of RegExp and now the hangup command works like a charm.