VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
asterisk-03 at jeremyk... Guest
|
Posted: Wed Apr 13, 2016 10:19 am Post subject: [asterisk-users] recreating extensions.conf from live dialpl |
|
|
with the slip of a finger, i destroyed by extensions.conf (grep -i >
extensions.conf)
I have a backup that is dozens of hours of code old.
is there a way i can use the asterisk cli (or some other asterisky
method) to recreate that extensions.conf ?
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
asterisk.org at sedwar... Guest
|
|
Back to top |
|
|
asterisk.org at sedwar... Guest
|
Posted: Wed Apr 13, 2016 10:38 am Post subject: [asterisk-users] recreating extensions.conf from live dialpl |
|
|
On Wed, 13 Apr 2016, Steve Edwards wrote:
Quote: | On Wed, 13 Apr 2016, Jeremy Kister wrote:
Quote: | is there a way i can use the asterisk cli (or some other asterisky method)
to recreate that extensions.conf ?
|
Will 'dialplan save' help?
|
I just tried this one. It writes the dialplan, but without the application
arguements. Worthless.
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards@sedwards.com Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
asterisk.org at sedwar... Guest
|
Posted: Wed Apr 13, 2016 10:57 am Post subject: [asterisk-users] recreating extensions.conf from live dialpl |
|
|
On Wed, 13 Apr 2016, Jeremy Kister wrote:
Quote: | is there a way i can use the asterisk cli (or some other asterisky method) to
recreate that extensions.conf ?
|
sudo asterisk -r -x 'dialplan show' >extensions.wip
And then start cobbling up a script to parse and re-write into a usable
format.
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards@sedwards.com Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
asterisk_list at earth... Guest
|
Posted: Wed Apr 13, 2016 10:58 am Post subject: [asterisk-users] recreating extensions.conf from live dialpl |
|
|
On Wednesday 13 Apr 2016, Jeremy Kister wrote:
Quote: | with the slip of a finger, i destroyed by extensions.conf (grep -i >
extensions.conf)
I have a backup that is dozens of hours of code old.
is there a way i can use the asterisk cli (or some other asterisky
method) to recreate that extensions.conf ?
|
You could try
*CLI> dialplan show
The output from this is not the same format as an extensions.conf file, but it
will have all the relevant information in it; and it seems to include all the
relevant infiormation. So it could be made to look like an extensions.conf
file, if you really have nothing else -- desperate situations call for
desperate remedies, and all that .....
--
AJS
Note: Originating address only accepts e-mail from list! If replying off-
list, change address to asterisk1list at earthshod dot co dot uk .
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
asterisk-03 at jeremyk... Guest
|
Posted: Wed Apr 13, 2016 10:59 am Post subject: [asterisk-users] recreating extensions.conf from live dialpl |
|
|
On 4/13/16 11:37 AM, Steve Edwards wrote:
Quote: | Quote: | Will 'dialplan save' help?
|
I just tried this one. It writes the dialplan, but without the
application arguements. Worthless.
|
right, was a good shot. in my case I have writeprotect=yes in general,
so that would have been the first hurdle. but asterisk does have my
latest-and-greatest code in memory and active in it's dialplan. hoping
for something similar...
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
asterisk-03 at jeremyk... Guest
|
Posted: Wed Apr 13, 2016 11:21 am Post subject: [asterisk-users] recreating extensions.conf from live dialpl |
|
|
On 4/13/16 11:57 AM, A J Stiles wrote:
Quote: | You could try
*CLI> dialplan show
|
Between my older backup and dialplan show, I guess that's my best shot.
Thanks
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
asterisk.org at sedwar... Guest
|
Posted: Wed Apr 13, 2016 12:17 pm Post subject: [asterisk-users] recreating extensions.conf from live dialpl |
|
|
On Wed, 13 Apr 2016, Steve Edwards wrote:
Quote: | Quote: | Will 'dialplan save' help?
|
I just tried this one. It writes the dialplan, but without the application
arguements. Worthless.
|
Aside from just a great way to eff up your day, does 'dialplan save' have
any value?
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards@sedwards.com Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
asterisk.org at sedwar... Guest
|
Posted: Wed Apr 13, 2016 12:27 pm Post subject: [asterisk-users] recreating extensions.conf from live dialpl |
|
|
On Wed, 13 Apr 2016, Jeremy Kister wrote:
Quote: | Between my older backup and dialplan show, I guess that's my best shot.
|
This should get you close:
sudo asterisk -r -x 'dialplan show' >extensions.wip
and then feed extensions.wip through:
#!/usr/bin/env php
<?php
// declare variables
$tokens = array();
// loop through stdin
while ($line = fgets(STDIN))
{
// blank line
if ("\n" == $line)
{
printf("\n");
continue;
}
// remove 'features'
$line = str_replace('[features]', '', $line);
// remove 'pbx_config'
$line = str_replace('[pbx_config]', '', $line);
// context
if ('[' == substr($line, 0, 1))
{
$tokens = explode("'", $line);
printf("[%s]\n", $tokens[1]);
continue;
}
// extension
if ("'" == substr($line, 2, 1))
{
$tokens = explode("'", $line);
$line = substr($line, strpos($line, ' ', 20) + 1, 255);
printf("\texten = %s,1,\t\t\t%s", $tokens[1], $line);
continue;
}
// label
if ('[' == substr($line, 5, 1))
{
$line = str_replace(']', '[', $line);
$tokens = explode('[', $line);
printf("\tsame = n(%s),\t\t\t%s", $tokens[1], $line);
continue;
}
// anything else
$line = substr($line, strpos($line, ' ', 20) + 1, 255);
printf("\tsame = n,\t\t\t%s", $line);
}
// (end)?>
(I'm not all that hot of a PHP programmer, so if anybody has some
constructive criticism, please jump it.)
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards@sedwards.com Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
asterisk.org at sedwar... Guest
|
Posted: Wed Apr 13, 2016 12:33 pm Post subject: [asterisk-users] recreating extensions.conf from live dialpl |
|
|
On Wed, 13 Apr 2016, Steve Edwards wrote:
Quote: | // label
if ('[' == substr($line, 5, 1))
{
$line = str_replace(']', '[', $line);
$tokens = explode('[', $line);
printf("\tsame = n(%s),\t\t\t%s", $tokens[1], $line);
continue;
}
|
Damn. Missed a line of code.
Should be:
// label
if ('[' == substr($line, 5, 1))
{
$line = str_replace(']', '[', $line);
$tokens = explode('[', $line);
$line = substr($line, strpos($line, ' ', 20) + 1, 255);
printf("\tsame = n(%s),\t\t\t%s", $tokens[1], $line);
continue;
}
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards@sedwards.com Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
asterisk-03 at jeremyk... Guest
|
Posted: Wed Apr 13, 2016 11:54 pm Post subject: [asterisk-users] recreating extensions.conf from live dialpl |
|
|
On 4/13/2016 1:26 PM, Steve Edwards wrote:
Quote: | This should get you close:
sudo asterisk -r -x 'dialplan show' >extensions.wip
and then feed extensions.wip through:
|
Ya, that's pretty good! besides the fact that I've never used "same" (i
understand where it's coming from) and a few contexts confuzzled
(missing general/globals and extra parkedcalls - but again I get it) -
it seems to be perfect.
One for a wiki, somewhere.
thanks,
--
Jeremy Kister
http://jeremy.kister.net/
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
asterisk_list at earth... Guest
|
Posted: Thu Apr 14, 2016 4:08 am Post subject: [asterisk-users] recreating extensions.conf from live dialpl |
|
|
On Wednesday 13 Apr 2016, Jeremy Kister wrote:
Quote: | On 4/13/16 11:57 AM, A J Stiles wrote:
Quote: | You could try
*CLI> dialplan show
|
Between my older backup and dialplan show, I guess that's my best shot.
Thanks
|
I'll have a go this lunchtime at knocking up a Perl script {for that is my
language of choice} to try to recreate an extensions.conf file from the
`dialplan show` CLI output. All the necessary stuff seems to be there, even
labels for GoTo statements .....
--
AJS
Note: Originating address only accepts e-mail from list! If replying off-
list, change address to asterisk1list at earthshod dot co dot uk .
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|