问题
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