星号:通过 AMI 使用模板创建用户 [英] Asterisk: create user with template via AMI

查看:28
本文介绍了星号:通过 AMI 使用模板创建用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用 AMI 修改 sip.conf,向其中添加一个新用户.一切正常,我可以毫无问题地创建这样的用户:

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

我不知道该怎么做.谷歌和 Digium 论坛都帮不了我.附言我使用 JavaScript asterisk-manager 与 Asterisk 交互,这里是我的代码,它添加了扩展:

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

推荐答案

var amiAction = {
    action: 'UpdateConfig',
    reload: 'chan_sip',
    srcfilename: 'sip.conf',
    dstfilename: 'sip.conf',
    'action-000000': 'newcat',
    'cat-000000': '1000',
    'options-000000': 'inherit=template-name'
};

这篇关于星号:通过 AMI 使用模板创建用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆