Sunday, 22 April 2018

Specifying multiple variables using node's asterisk-ami-client library




Big thank you to the authors of the asterisk-ami-client library, providing an easy hook into asterisk from node. I found that the asterisk-ami-client library restricted me to only one variable in a custom action. To specify multiple variables in an originate command I used the following:

  client.action({
            Action: 'Originate',
            ActionID: [id],
            Channel: 'SIP/PROVIDER/' + number,
            Context: [DialplanContext],
            Exten: [extension],
            Priority: '1',
            Variable: 'someVar=' + var1 + '\r\nVariable: someVar2=' + var2 + '\r\nVariable:someVar3=' + var4,            Async: 'yes'
        });