Asterisk: create user with template via AMI

2019-03-31 17:36发布

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);
});

2条回答
Luminary・发光体
2楼-- · 2019-03-31 18:07

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?

查看更多
看我几分像从前
3楼-- · 2019-03-31 18:22
var amiAction = {
    action: 'UpdateConfig',
    reload: 'chan_sip',
    srcfilename: 'sip.conf',
    dstfilename: 'sip.conf',
    'action-000000': 'newcat',
    'cat-000000': '1000',
    'options-000000': 'inherit=template-name'
};
查看更多
登录 后发表回答