Add SIP user programmatically


I am new to Asterisk and I was wondering how to add new SIP users (with name, secret, etc.) using AMI or CLI.

I know how to do it using realtime/mysql mode. However, I noticed that AMI allows adding/removing dialplan extensions but does not offer commands to add or remove SIP users.


There is no clean way to do such a thing. There are actions which can manipulate .conf files, but they will end up rewriting them.

There’s also this:


Thank you for the answers!

One more question please. Is it possible to access the mysql realtime database via AMI? I noticed there is are DBPut and DBGet commands but no help is available using ‘manager show command …’


Is access to config files via AMI serialized and guaranteed to be safe in case or concurrent remote access?


I don’t believe there are any commands for accessing the database through AMI, as really you’d want to go to the database directly. As for serializing config file access I don’t know - it’s not something I have ever done.