Asterisk: create user with template via AMI

别来无恙 提交于 2019-12-05 02:06:30

问题


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

回答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'
};



回答2:


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?



来源:https://stackoverflow.com/questions/18149360/asterisk-create-user-with-template-via-ami

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!