Config Script for Thirdlane?
-
I'm running FOP2 in a Thirdlane multi-tenant environment. We have been running it for some time now, and when I implemented it I had a config script for Thirdlane. But, I can't find that script. Is there any chance it is still floating around somewhere? Even if it isn't a complete script I would like to take a look to see if there is a way to automatically build configuration files from a Thirdlane environment.
Thanks!
Dan -
#!/usr/bin/perl $file = "/etc/asterisk/voicemail.conf"; open( CONFIG, "<$file" ) or die("Could not open $file"); while (<CONFIG>) { chomp; $_ =~ s/^\s+//g; $_ =~ s/([^;]*)[;](.*)/$1/g; $_ =~ s/\s+$//g; if ( /^#/ || /^;/ || /^$/ ) { next; } # Ignores comments and empty lines if (/^\Q[\E/) { s/\[(.*)\]/$1/g; $context = $_; if($context =~ /^default/) { $context =~ s/^default-//g; if($hubo>0) { print "buttonfile=automatic-thirdlane-buttons.cfg $oldcontext\n\n"; $hubo=0; } if($context ne "default") { print "[$context]\n"; } } } if (/=>/) { $_ =~ s/\s//g; @partes = split(/=>/,$_,2); $exten = $partes[0]; $resto = $partes[1]; @partes = split(/,/,$resto,2); $secret = $partes[0]; $oldcontext=$context; print "user=$exten:$secret:all\n"; $hubo++; } } close(CONFIG); print "buttonfile=automatic-thirdlane-buttons.cfg $oldcontext\n\n";automatic-thirdlane-buttons.cfg
#exec autoconfig-buttons-thirdlane.pl $1autoconfig-buttons-thirdlane.pl
#!/usr/bin/perl $file = "/etc/asterisk/users.txt"; $mycontext = $ARGV[0]; open( CONFIG, "<$file" ) or die("Could not open $file"); while (<CONFIG>) { chomp; $_ =~ s/^\s+//g; $_ =~ s/([^;]*)[;](.*)/$1/g; $_ =~ s/\s+$//g; if ( /^#/ || /^;/ || /^$/ ) { next; } # Ignores comments and empty lines if (/^\Q[\E/) { s/\[(.*)\]/$1/g; $context = $_; @partes = split (/-/,$context,2); $context= $partes[0]; $extension = $partes[1]; if($context eq $mycontext) { $dale=1; } else { $dale=0; } } else { if($dale==1) { my ($key,$val) = split(/=/,$_,2); $config->{$mycontext}{$extension}{$key}=$val; } } } close(CONFIG); while ( my ( $uno, $dos ) = each( %{ $config->{$mycontext} } ) ) { $label = $dos->{first_name}." ".$dos->{last_name}; $exten = $dos->{ext}; $ctx = "from-inside-$mycontext"; $mbox = $dos->{mailbox}; $chan = $dos->{phones}; print "[$chan]\n"; print "type=extension\n"; print "extension=$exten\n"; print "context=$ctx\n"; print "label=$label\n"; print "mailbox=$mbox\n\n"; } -
-
-
You execute scripts via the #exec setting in fop2.cfg
Look at the end of your fop2.cfg file, you probably have this:
#exec autoconfig-users-freepbx.sh
change that to
#exec autoconfig-buttons-thirdlane.pl
Also, do not forget to set execute permissions to all .pl scripts
chmod a+x *.pl
-
I don't mean to revive an old thread, but I cant seem to get this to work. Are there new scripts to use with thirdlane? and did you mean to #exec autoconfig-users-thirdlane.pl in fop2.cfg? or is autoconfig-buttons-thirdlane.pl correct? I have tried both.
-
You are right, the script to execute in fop2.cfg is autoconfig-users-thirdlane.pl
You also need to create a file named automatic-thirdlane-buttons.cfg with the contents:
#exec autoconfig-buttons-thirdlane.pl
Now, those are not fully features, they are to be used as a base to adapt to your system/requirements. Read the scripts , run them in the console, inspect their output.
They will create a basic multi tenant setup, with users for each tenant that is defined in a separate panel-context, so you have to login with ?context=tenant in the fop2 url.
Best regards,
-
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login