Blank extensions.conf

Hi,

I’m a total novice with Asterisk but as I like new things I took on the task of managing a churches phone system. Asterisk 1.8

Using WinSCP I was editing extensions.conf file to extend the ring time of a number.
I was saving the document but lost connection midway through. I left it for the day to continue the next morning but now the extensions.conf is 0kb - blank!

I need to somehow repopulate this file with what I had before.
The asterisk server hasn’t been restarted so running ‘dialplan show’ does give me a data which I’m expecting but I need to somehow translate it back into the conf file. Using ‘dialplan save’ doesn’t work and throws me an error saying ‘I can’t save dialplan now…’

This was the output of dialplan show.
I’m not sure what other bits I need in the file. I can’t restart until I know I’ve got a conf file that will work.

Any help would be appreciated.

[code][ Context ‘app_queue_gosub_virtual_context’ created by ‘app_queue’ ]
‘s’ => 1. NoOp() [app_queue]

[ Context ‘parkedcalls’ created by ‘features’ ]
‘700’ => 1. Park() [features]

[ Context ‘app_dial_gosub_virtual_context’ created by ‘app_dial’ ]
‘s’ => 1. NoOp() [app_dial]

[ Context ‘night’ created by ‘pbx_config’ ]
‘585040’ => 1. dial(sip/711&sip/708,20) [pbx_config]
2. voicemail(5040@stmarys,u) [pbx_config]

[ Context ‘mondaylunch’ created by ‘pbx_config’ ]
‘585040’ => 1. dial(sip/711&sip/708,10) [pbx_config]
2. dial(sip/713&sip/708,10) [pbx_config]
3. dial(sip/710,10) [pbx_config]
4. dial(sip/712,10) [pbx_config]
5. voicemail(5040@stmarys,u) [pbx_config]

[ Context ‘normallunch’ created by ‘pbx_config’ ]
‘585040’ => 1. dial(sip/707&sip/708,10) [pbx_config]
2. dial(sip/711&sip/708,10) [pbx_config]
3. dial(sip/713,10) [pbx_config]
4. dial(sip/710,10) [pbx_config]
5. voicemail(5040@stmarys,u) [pbx_config]

[ Context ‘monday’ created by ‘pbx_config’ ]
‘585040’ => 1. dial(sip/711,10) [pbx_config]
2. dial(sip/710,10) [pbx_config]
3. dial(sip/713,10) [pbx_config]
4. dial(sip/712,10) [pbx_config]
5. voicemail(5040@stmarys,u) [pbx_config]

[ Context ‘normal’ created by ‘pbx_config’ ]
‘585040’ => 1. dial(sip/707,10) [pbx_config]
2. dial(sip/711,10) [pbx_config]
3. dial(sip/714,10) [pbx_config]
4. dial(sip/710,10) [pbx_config]
5. voicemail(5040@stmarys,u) [pbx_config]

[ Context ‘stmarys’ created by ‘pbx_config’ ]
‘00’ => 1. VoiceMailMain(5040@stmarys) [pbx_config]
2. Hangup() [pbx_config]
‘000’ => 1. dial(sip/707&sip/710&sip/711) [pbx_config]
‘01’ => 1. VoiceMailMain(700@stmarys) [pbx_config]
2. Hangup() [pbx_config]
‘02’ => 1. VoiceMailMain(704@stmarys) [pbx_config]
2. Hangup() [pbx_config]
‘112.’ => 1. Dial(SIP/999@patton,r) [pbx_config]
‘5555’ => 1. voicemail(5040@stmarys,u) [pbx_config]
‘585042’ => 1. dial(sip/700,20) [pbx_config]
2. voicemail(700@stmarys,u) [pbx_config]
‘585043’ => 1. Goto(585040,1) [pbx_config]
‘585044’ => 1. Goto(585040,1) [pbx_config]
‘585045’ => 1. Goto(585040,1) [pbx_config]
‘585046’ => 1. Goto(585040,1) [pbx_config]
‘585047’ => 1. dial(sip/704,20) [pbx_config]
2. voicemail(704@stmarys,u) [pbx_config]
‘585048’ => 1. Goto(585040,1) [pbx_config]
‘585049’ => 1. Goto(585040,1) [pbx_config]
‘911.’ => 1. Dial(SIP/999@patton,r) [pbx_config]
‘999.’ => 1. Dial(SIP/999@patton,r) [pbx_config]
’_7XX’ => 1. dial(sip/${EXTEN},20) [pbx_config]
2. voicemail(5040@stmarys,u) [pbx_config]
’_9.’ => 1. Dial(SIP/${EXTEN:1}@patton,r) [pbx_config]
Include => ‘monday,09:30-12:29,mon,,’ [pbx_config]
Include => ‘mondaylunch,12:30-14:29,mon,,’ [pbx_config]
Include => ‘monday,14:30-17:29,mon,,’ [pbx_config]
Include => ‘normal,09:30-12:29,tue-fri,,’ [pbx_config]
Include => ‘normallunch,12:30-14:29,tue-fri,,’ [pbx_config]
Include => ‘normal,14:30-17:29,tue-fri,,’ [pbx_config]
Include => ‘night,09:30-17:29,sat-sun,,’ [pbx_config]
Include => ‘night,17:30-09:29,,,*’ [pbx_config]
[/code]

Thanks for any help provided or pointers!

You should be able to use the ‘dialplan save’ command to save the current dialplan from memory to disk.

www*CLI> help dialplan save
Usage: dialplan save [/path/to/extension/file]
Save dialplan created by pbx_config module.

Example: dialplan save (/etc/asterisk/extensions.conf)
dialplan save /home/markster (/home/markster/extensions.conf)

The correct answer is to use the backup copy that was created when the system was configured, but see “save dialplan” in voip-info.org/wiki/view/Asterisk+CLI

Thanks for the replies.
Dialplan Save doesn’t want to work for some reason.

server*CLI> dialplan save I can't save dialplan now, see 'extensions.conf' example file. Command 'dialplan save' failed.

I’m in the process of rewriting the extensions.conf
Can you tell me if this looks right based on my dialplan show?

[code][general]
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no
extenpatternmatchnew=no

[global]

[night]
exten => 585040,1,dial(sip/711&sip/708,20)
exten => 585040,2,voicemail(5040@stmarys,u)

[mondaylunch]
exten => 585040,1,dial(sip/711&sip708,20)
exten => 585040,2,dial(sip/713&sip708,20)
exten => 585040,3,dial(sip/710,10)
exten => 585040,4,dial(sip/712,10)
exten => 585040,5,voicemail(5040@stmarys,u)

[normallunch]
exten => 585040,1,dial(sip/707&sip708,20)
exten => 585040,2,dial(sip/711&sip708,20)
exten => 585040,3,dial(sip/713,10)
exten => 585040,4,dial(sip/710,10)
exten => 585040,5,voicemail(5040@stmarys,u)

[monday]
exten => 585040,1,dial(sip/711,20)
exten => 585040,2,dial(sip/710,10)
exten => 585040,3,dial(sip/713,10)
exten => 585040,4,dial(sip/712,10)

[normal]
exten => 585040,1,dial(sip/707,20)
exten => 585040,2,dial(sip/711,20)
exten => 585040,3,dial(sip/714,10)
exten => 585040,4,dial(sip/710,10)
exten => 585040,5,voicemail(5040@stmarys,u)

[stmarys]
exten => 00,1,VoiceMailMain(5040@stmarys)
exten => 00,2,Hangup()
exten => 000,1,dial(sip/707&sip/710&sip/711)
exten => 01,1,VoiceMailMain(704@stmarys)
exten => 01,2,HangUp()
exten => 02,1,VoiceMailMain(704@stmarys)
exten => 02,2,HangUp()
exten => 5555,1,voicemail(700@stmarys,u)
exten => 585042,1,dial(sip/700,20)
exten => 585042,2,voicemail(700@stmarys,u)
exten => 585043,1,Goto(585040,1)
exten => 585044,1,Goto(585040,1)
exten => 585045,1,Goto(585040,1)
exten => 585046,1,Goto(585040,1)
exten => 585047,1,dial(sip/704,20)
exten => 585047,2,voicemail(704@stmarys,u)
exten => 585048,1,Goto(585040,1)
exten => 585049,1,Goto(585040,1)
exten => _7XX,1,dial(sip/${EXTEN},20}
exten => _7XX,2,voicemail(5040@stmarys,u)
exten => _9.,1,Dial(SIP/${EXTEN:1}@patton,r)

include => 'monday,09:30-12:29,mon,,'
include => 'mondaylunch,12:30-14:29,mon,,'
include => 'monday,14:30-17:29,mon,,'
include => 'normal,09:30-12:29,tue-fri,,'
include => 'normallunch,12:30-14:29,tue-fri,,'
include => 'normal,14:30-17:29,tue-fri,,'
include => 'night,09:30-17:29,sat-sun,,'
include => ‘night,17:30-09:29,,,*’[/code]