4

I need to modify sip.conf with AMI, adding a new user to it. Everything works fine, and I can create a user like this without problems:

[1000]
secret=pass12

But I have to create user with template like

[1000](mytemp)
secret=pass12

and I don't know how to do this. Neither Google, nor Digium forum can't help me. P.S. I use JavaScript asterisk-manager to interact with Asterisk, and here is my code, which adds extension:

var amiAction = {
        action: 'UpdateConfig',
        reload: 'yes',
        srcfilename: 'sip.conf',
        dstfilename: 'sip.conf',
        'action-000000': 'newcat',
        'cat-000000': '1000',
        'action-000001': 'append',
        'cat-000001': '1000',
        'var-000001': 'secret',
        'value-000001': 'pass12'
    };

ami.action(amiAction, function(err, resp) {
    console.log(err, resp);
});
JustLogin
  • 1,822
  • 5
  • 28
  • 50

2 Answers2

1
var amiAction = {
    action: 'UpdateConfig',
    reload: 'chan_sip',
    srcfilename: 'sip.conf',
    dstfilename: 'sip.conf',
    'action-000000': 'newcat',
    'cat-000000': '1000',
    'options-000000': 'inherit=template-name'
};
Tiger-222
  • 6,677
  • 3
  • 47
  • 60
0

I'm sure you've tried this, but:

'cat-000000': '1000 [(mytemp)]',

... should work just fine. If it does not, what error message does it throw?

MichelV69
  • 1,247
  • 6
  • 18
  • 1
    It's not works. No error is throwing, but it creates a line like this: [1000 [(mytemp)]], not like [1000] (mytemp) – JustLogin Aug 13 '13 at 05:32