Asterisk CLI command for add extension and registry sip

Dear All,

Now i’m trying to add new extension to asterisk server by asterisk CLI command.
i try to send the command to server by the following format:
[color=#0000BF]asterisk -rx "dialplan add extension ,,, into "[/color]
asterisk -rx "dialplan add extension 1111,1,Dial,SIP/ into local"
After sending this command to server, it reply , this extension added to local.
And then, i gave “dialplan reload” command.But i can’t see this extension no in extension.conf and sip.conf files in asterisk server and can’t make a call.

That why,Please let me know and share the knowledge. is there anyone who know how to send add extension and registry sip CLI command to asterisk server?

The command “Dialplan add extension” is temporal, if you send your command:

You will see, a response like:

Then just enter in your cli and type dialplan show local, you will see the extension 1111. Now, execute the command Dialplan reload, followed by dialplan show local and your extension 1111 will disappear.

if you wish to add extension or new sip devices you need to write the confs files. to prevers the changes

Thanks a lot navaismo,

Yes, i’ve used the dialplan add extension into local and checked this extension in local.
But, i can’t see the added extension number when i find at the trixbox page by clicking extension side menu.
You mentioned in the reply post, if i want to add new extension and new sip no to the server, how can i do that, how to give command to the config file and which config do i need to make changes?
If u have any idea or advice , plzs let me know as soon as possible.
Because i need do add extension form and this extension no. is kept to the server in my project.

Thanks and Regards,

I see, you are using TRIXBOX, for trixbox you need to use the GUI to see all the extension in the web page, but when you use the GUI, if you have edited the sip?additionals.conf all of extension will be removed by GUI. So if you want to see in the GUI your extensions you need to use them -the GUI-.

You can add extension in the file sip_custom.conf but these sip not show in the gui neither. Every file with custom legend are for edit via console or manually. The others are for the GUI.

Sorry mi english

Thanks navaismo,

I haven’t solve yet this problem.
I try to add extension to server by manually by using “dialplan addd extension” CLI command.
[color=#0000BF]asterisk -rx "dialplan add extension ,,, into "[/color]
But i can’t use this extension number and can’t make a call to and from this extension number.
And also i can’t see any additional line in the sip_custom.conf.
How can i do that ? If u have any idea or advice , please share me.

Thanks and Regards,


Well, first of all we need to define two things:

1.- when you use the command dialplan add extension this command will create an extension in the dialplan. Note: a extension and device are two different thing in asterisk. An extension is this:

exten => 1234,1,playback(tt-monkeys) This is a extension number 1234, when you dial 1234 in your phones asterisk will run the application Playback with the sounds of a weird monkeys screaming. Every extension are configured in extension.conf -in asterisk-

A device in asterisk is a peer, or user or friend, normally attached to hard-phones, soft-phones or fax, these devices are configured in sip.conf -in asterisk-.

2.- Trixbox differs a little in the configurations files against asterisk from scratch build. In the directory /etc/asterisk/ you will see many archives with _custom and _additional per example you will see:


Trixbox use sip_additional to generate all device from the web page. The file called sip_custom.conf, is the file that you can use to create your devices from console, or other program, but this extensions aren’t showed in the web page, if you can to view in the web page you can add or edit the php code to view your custom extension.

I think you want to create devices, not extensions, to create devices you can make an script that send the values to your sip_custom.conf, in linux is easy from console even using cat and >> to append the content.

In linux i cant use this for append data in sip_custom.conf:


echo nombre
read name
echo “[$name]” >> sip_custom.conf

echo usuario
read username
echo “username=$username” >> sip_custom.conf

echo tipo
read type
echo “type=$type” >> sip_custom.conf[/code]

an so on for each parameter.

Thanks ,

Yes, i need to add both extension and sip in extension.conf and sip_custom.conf.
I will try the way u advise me.

Thanks and Regards.

For registry custom extension you will need to write in the file extensions_custom.conf and include your context in extensions.conf


[from-internal-custom] ;exten => 0912,1,ChanSpy(|q) exten => _*1827XXXX,1,ChanSpy(SIP/${EXTEN:5}|qb) exten => _*2938XXXX,1,ChanSpy(SIP/${EXTEN:5}|wb)

extensions.conf at line like:

; [from-internal-custom] for example, place these in this file or they will get overwritten. include => from-internal-custom

Thanks a lot,

I do appreciate for your advice/help.
Now, i could add new sip no/devices to sip-custom.conf file successfully by manually not Linux command.
However, i can’t make a call [color=#0000FF]to [/color]this added extension number(added by manually in sip-custom.conf)-[color=#0000BF]i mean incoming call[/color].
I think i need to add something to extension-custom.conf for the new added sip numbers, is it right?
I’ve already try as the mentioned in previous reply post.
But it still can’t , I’m not very clear for adding new extension to extension-custom.conf file.
Could you please some more detailed explanation about that?

Thanks and Regards.

from -internal-custom is only available from sip internal calls, if you wan to add and inbound route or to IVR group you will need to edit more contexts. Maybe this help to understand a little. I think is better if you install asterisk from scratch, and you will edit only two files extensions.conf and sip.conf.

Its necessary use trixbox?

Dear navaismo,
Thank you so much.
I think i need to edit only these two files(extension and sip conf).I used trixbox CE (

Thanks and Regards.