rbrindley: branch rbrindley/welcome_revamp r4153 - in /team/rbrindley/welcome...
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Wed Nov 19 16:18:42 CST 2008
Author: rbrindley
Date: Wed Nov 19 16:18:42 2008
New Revision: 4153
URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=4153
Log:
svn merged new branch/2.0
Added:
team/rbrindley/welcome_revamp/developer_info/CODING-GUIDELINES
- copied unchanged from r4152, branches/2.0/developer_info/CODING-GUIDELINES
Modified:
team/rbrindley/welcome_revamp/config/js/astman.js
team/rbrindley/welcome_revamp/config/js/index.js
team/rbrindley/welcome_revamp/config/js/pbx.js
team/rbrindley/welcome_revamp/config/js/tooltip.js
team/rbrindley/welcome_revamp/config/trunks_voip.html
Modified: team/rbrindley/welcome_revamp/config/js/astman.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/astman.js?view=diff&rev=4153&r1=4152&r2=4153
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/astman.js (original)
+++ team/rbrindley/welcome_revamp/config/js/astman.js Wed Nov 19 16:18:42 2008
@@ -1277,20 +1277,26 @@
},
isNull : function(a){
+ // ASTGUI.isNull(a) ;
return a===null
},
- isArray: function(a){ // ASTGUI.isArray(a) ;
+ isArray: function(a){
+ // ASTGUI.isArray(a) ;
return a instanceof Array || ( a!= null && typeof a=="object" && typeof a.push == "function" && typeof a.concat == "function" )
},
- loadHTML: function(u){ // loads URL 'u' in synchronus mode. note that url 'u' is restricted by same origin policy
+ loadHTML: function(u){
+ // ASTGUI.loadHTML(url)
+ // loads URL 'url' in synchronus mode. note that 'url' is restricted by same origin policy
var r = Math.round(10000*Math.random());
var s = $.ajax({ url: u + '?r=' + r , async: false });
return s.responseText;
},
listSystemFiles : function( dir , cb ){
+ // ASTGUI.listSystemFiles( dir , callBackFunction )
+ // list of files in 'dir' will be sent to callBackFunction as an array
try{
this.systemCmd( this.scripts.ListFiles + ' ' + dir , function(){
var op = ASTGUI.loadHTML( ASTGUI.paths.output_SysInfo );
@@ -1311,7 +1317,8 @@
},
miscFunctions: {
- getChunksFromManagerOutput : function( op , usf){ // ASTGUI.miscFunctions.getChunksFromManagerOutput( output_str ) ;
+ getChunksFromManagerOutput : function( op , usf){
+ // ASTGUI.miscFunctions.getChunksFromManagerOutput( output_str ) ;
try{
var tr_Array = [];
var tmp_chunk = (usf) ? {} : [] ;
@@ -1366,7 +1373,19 @@
return false;
},
- moveUpDown_In_context: function(context, line , updown , cbf ){ // ASTGUI.miscFunctions.moveUpDown_In_context( ct , line , bool , cbf ) // bool = 0 for Down , 1 for Up
+ moveUpDown_In_context: function(context, line , updown , cbf ){
+ // ASTGUI.miscFunctions.moveUpDown_In_context( ct , line , bool , cbf ) ; bool = true for Up, false for Down (default)
+ // Use this function when you want to move a line Up/Down with in a context
+ // Example:
+ //
+ // [somcontext]
+ // include=context2
+ // include=context1
+ //
+ // use:
+ // ASTGUI.miscFunctions.moveUpDown_In_context( 'somcontext' , 'include=context2' , false , someCallBackFunction ) ;
+ // to move the 'include=context2' below the 'include=context1'
+
try{
updown = Number(updown);
var t = context2json({ filename:'extensions.conf' , context : context , usf: 0 });
@@ -1379,7 +1398,7 @@
if( t[ti] == line ){
var tmp_a = (updown) ? t[ ti - 1 ] : t[ ti + 1 ] ;
t[ti] = tmp_a ;
- if( updown == 1 ){ // move up
+ if( updown ){ // move up
t[ti-1] = line ;
}else{ // move down
t[ti+1] = line ;
@@ -1427,6 +1446,8 @@
delete_LinesLike: function( ct ){
// ASTGUI.miscFunctions.delete_LinesLike({ context_name : 'voicemailgroups' , beginsWithArr: ['exten=6050,'] , filename: 'extensions.conf', hasThisString:'somestring', cb:function(){} });
+ // deletes all line in the context 'voicemailgroups' that beings with 'exten=6050,' and contains the string hasThisString (optional)
+
try{
var sel_cxt = context2json({ filename: ct.filename, context : ct.context_name , usf:0 });
if ( typeof ct.beginsWithArr == 'string' ){
@@ -2994,32 +3015,41 @@
// the update/delete/delcat commands fail in Asterisk 1.6.X/trunk if the corresponding category/variables are not found
// In Asterisk 1.4 we do not have to do this check
switch( action ){
- case 'update':
+ case 'append':
if( !this.FILE_CONTENT.hasOwnProperty(cat) ) return s;
- if( this.FILE_CONTENT[cat].indexOfLike(name+'=') == -1 ){
- action = 'append';
- }
- break;
- case 'delete':
- if( !this.FILE_CONTENT.hasOwnProperty(cat) || this.FILE_CONTENT[cat].indexOfLike(name+'=') == -1 ){
- return s;
- }
+ this.FILE_CONTENT[cat].push( name + "=" + value );
break;
case 'delcat':
if( !this.FILE_CONTENT.hasOwnProperty(cat) ){
return s;
}
+ delete this.FILE_CONTENT[cat] ;
+ break;
+ case 'delete':
+ if( !this.FILE_CONTENT.hasOwnProperty(cat) ) return s;
+ var tmp_index = this.FILE_CONTENT[cat].indexOfLike(name+'=') ;
+ if( tmp_index == -1 ) return s;
+ this.FILE_CONTENT[cat].splice(tmp_index,1);
+ break;
+ case 'newcat':
+ if( this.FILE_CONTENT.hasOwnProperty(cat) ) return s;
+ this.FILE_CONTENT[cat] = [] ;
+ break;
+ case 'update':
+ if( !this.FILE_CONTENT.hasOwnProperty(cat) ) return s;
+ var tmp_index = this.FILE_CONTENT[cat].indexOfLike(name+'=') ;
+ var tmp_line = name + "=" + value ;
+ if( tmp_index == -1 ){
+ action = 'append';
+ this.FILE_CONTENT[cat].push(tmp_line);
+ }else{
+ this.FILE_CONTENT[cat][tmp_index] = tmp_line ;
+ }
break;
default: break;
}
- // TODO : handle the case where , a new category is added in 'batch 1' and is deleted in 'batch 2'
- // the 'delcat' in 'batch 2' would fail cause the switch does not know that the file has been changed after 'batch 1',
- // and even if we update the FILE_CONTENT after each start_sqreqs() it would still fail cause the batches are already generated by then
- // we could possibly generate the batches during callActions() and read the file before generating each batch and move this switch inside the batch
-
- // This should not be a problem for the time being, but I will fix this issue once i get everything else working with 'asterisk 1.4/1.6.0/trunk'
- // Note: this is not an issue with listOfSynActions() as clearActions() will take care of updating the file changes
- }
+ }
+
var cnt = "" + count;
while(cnt.length < 6)
cnt = "0" + cnt;
Modified: team/rbrindley/welcome_revamp/config/js/index.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/index.js?view=diff&rev=4153&r1=4152&r2=4153
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/index.js (original)
+++ team/rbrindley/welcome_revamp/config/js/index.js Wed Nov 19 16:18:42 2008
@@ -787,7 +787,7 @@
y.each(function(user){
var f = new destination;
f.optionText = 'User Extension -- ' + user ;
- f.optionValue = (fortbr)? 'default|' + user + '|1' : 'Goto(default|' + user + '|1)' ;
+ f.optionValue = (fortbr)? 'default,' + user + ',1' : 'Goto(default,' + user + ',1)' ;
tmp.push(f);
if(!fortbr && sessionData.pbxinfo.users[user].getProperty('hasvoicemail').isAstTrue() ){
var p_Text = 'User VoiceMailBox ' + user ;
@@ -798,14 +798,14 @@
y.each(function(meetme){
var f = new destination;
f.optionText = 'Conference Room -- ' + meetme ;
- f.optionValue = (fortbr)? ASTGUI.contexts.CONFERENCES + '|' + meetme + '|1' : 'Goto('+ ASTGUI.contexts.CONFERENCES +'|'+ meetme + '|1)';
+ f.optionValue = (fortbr)? ASTGUI.contexts.CONFERENCES + ',' + meetme + ',1' : 'Goto('+ ASTGUI.contexts.CONFERENCES +','+ meetme + ',1)';
tmp.push(f);
});
var y = sessionData.pbxinfo.queues.getOwnProperties();
y.each(function(q){
var f = new destination;
f.optionText = 'Queue -- ' + q ;
- f.optionValue = (fortbr)? ASTGUI.contexts.QUEUES + '|' + q + '|1' : 'Goto('+ ASTGUI.contexts.QUEUES +'|'+ q + '|1)';
+ f.optionValue = (fortbr)? ASTGUI.contexts.QUEUES + ',' + q + ',1' : 'Goto('+ ASTGUI.contexts.QUEUES +','+ q + ',1)';
tmp.push(f);
});
var y = sessionData.pbxinfo.voicemenus.getOwnProperties();
@@ -813,7 +813,7 @@
var vm_name = sessionData.pbxinfo.voicemenus[vmenu].comment || vmenu ;
var f = new destination;
f.optionText = 'VoiceMenu -- ' + vm_name ;
- f.optionValue = (fortbr)? vmenu+ '|s|1' : 'Goto('+ vmenu +'|s|1)';
+ f.optionValue = (fortbr)? vmenu+ ',s,1' : 'Goto('+ vmenu +',s,1)';
tmp.push(f);
});
var y = sessionData.pbxinfo.timebasedRules.getOwnProperties();
@@ -821,7 +821,7 @@
var tbr_label = sessionData.pbxinfo.timebasedRules[tbr].label || tbr ;
var f = new destination;
f.optionText = 'Time Based Rule -- ' + tbr_label;
- f.optionValue = (fortbr)? tbr + '|s|1' : 'Goto('+ tbr +'|s|1)';
+ f.optionValue = (fortbr)? tbr + ',s,1' : 'Goto('+ tbr +',s,1)';
tmp.push(f);
});
var y = sessionData.pbxinfo.ringgroups.getOwnProperties();
@@ -829,14 +829,14 @@
var rg_name = sessionData.pbxinfo.ringgroups[rg].NAME || rg ;
var f = new destination;
f.optionText = 'Ring Group -- ' + rg_name ;
- f.optionValue = (fortbr)? rg + '|s|1' : 'Goto('+ rg +'|s|1)';
+ f.optionValue = (fortbr)? rg + ',s,1' : 'Goto('+ rg +',s,1)';
tmp.push(f);
});
var y = astgui_managePageGroups.getPGsList();
y.each(function(pge){
var f = new destination;
f.optionText = 'Page Group -- ' + pge ;
- f.optionValue = 'Goto('+ ASTGUI.contexts.PageGroups +'|'+ pge +'|1)';
+ f.optionValue = 'Goto('+ ASTGUI.contexts.PageGroups +','+ pge +',1)';
tmp.push(f);
});
@@ -844,7 +844,7 @@
y.each(function( this_vmg_exten ){
var f = new destination;
f.optionText = 'VoiceMail Group -- ' + (sessionData.pbxinfo.vmgroups[this_vmg_exten].getProperty('label') || this_vmg_exten ) ;
- f.optionValue = (fortbr) ? ASTGUI.contexts.VoiceMailGroups +'|' + this_vmg_exten + '|1' : 'Goto('+ ASTGUI.contexts.VoiceMailGroups +'|' + this_vmg_exten + '|1)' ;
+ f.optionValue = (fortbr) ? ASTGUI.contexts.VoiceMailGroups +',' + this_vmg_exten + ',1' : 'Goto('+ ASTGUI.contexts.VoiceMailGroups +',' + this_vmg_exten + ',1)' ;
tmp.push(f);
});
@@ -852,13 +852,13 @@
var nde = sessionData.pbxinfo['localextensions'].getProperty('defaultDirectory') ;
var f = new destination;
f.optionText = 'Names Directory -- ' + nde ;
- f.optionValue = (fortbr) ? ASTGUI.contexts.Directory + '|' + nde + '|1' : 'Goto('+ ASTGUI.contexts.Directory + '|' + nde + '|1)'; ;
+ f.optionValue = (fortbr) ? ASTGUI.contexts.Directory + ',' + nde + ',1' : 'Goto('+ ASTGUI.contexts.Directory + ',' + nde + ',1)'; ;
tmp.push(f);
}
var f = new destination; // we always point to default|o instead of to where defautl|o points to, so that if when a different user is selected as operator, we do not have to update the menus
f.optionText = 'Operator';
- f.optionValue = (fortbr)? 'default|o|1' : 'Goto(default|o|1)';
+ f.optionValue = (fortbr)? 'default,o,1' : 'Goto(default,o,1)';
tmp.push(f);
if(!fortbr){
@@ -871,6 +871,9 @@
ifExtensionAlreadyExists: function(a){ // miscFunctions.ifExtensionAlreadyExists() - returns true if an extension already exists, false Other wise
var tmp = [] ;
tmp = tmp.concat( astgui_manageusers.listOfUsers() );
+ if( sessionData.pbxinfo['localextensions'].hasOwnProperty('VoiceMailMain') ){
+ tmp.push( ASTGUI.parseContextLine.getExten(sessionData.pbxinfo['localextensions'].hasOwnProperty('VoiceMailMain')) ) ;
+ }
var y = sessionData.pbxinfo.voicemenus.getOwnProperties();
y.each( function( item ){
var tmp_thisVMenu = ASTGUI.cloneObject(sessionData.pbxinfo.voicemenus[item]);
Modified: team/rbrindley/welcome_revamp/config/js/pbx.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/pbx.js?view=diff&rev=4153&r1=4152&r2=4153
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/pbx.js (original)
+++ team/rbrindley/welcome_revamp/config/js/pbx.js Wed Nov 19 16:18:42 2008
@@ -154,6 +154,11 @@
}
}
+ if( EXN_CNF.hasOwnProperty('default') && EXN_CNF['default'].contains('include=demo') ){
+ UPDATES.new_action('delete', 'default', 'include', '', 'demo');
+ UPDATES.new_action('append', 'default', ';include', 'demo ; This line was commented by ASTERISK GUI');
+ }
+
if( UPDATES.current_batch == 1 && UPDATES.current_batch_actionnumber == 0 ){ // no updates to extensions.conf
}else{
@@ -401,7 +406,7 @@
df.each( function(line){
if( line.contains( ',1,Goto(ringroups-custom-' ) ){
var rg_ext = ASTGUI.parseContextLine.getExten(line) ;
- var rg_name = line.betweenXY('(', '|') ; //ringroups-custom-1
+ var rg_name = ASTGUI.parseContextLine.getArgs(line)[0] ; //ringroups-custom-1
if( !sessionData.pbxinfo.ringgroups.hasOwnProperty(rg_name) ){
var tmp = {
NAME : rg_name,
@@ -916,14 +921,17 @@
x.callActions(cb);
},
- addIAXTrunk: function( tr , cbf ){ //
- // usage:: astgui_managetrunks.addIAXTrunk( {'host':'iaxtel.com' , username:'my_username', secret:'my_secret', ....}, cbf ) ;
+ addIAXTrunk: function( tr , cbf, cxb ){ //
+ // usage:: astgui_managetrunks.addIAXTrunk( {'host':'iaxtel.com' , username:'my_username', secret:'my_secret', ....}, cbf, "context-basis" ) ;
if( !tr.hasOwnProperty('host') ){ return false; } //check for required parameters
// add some default values for any IAXTrunk
-// var trunk = astgui_managetrunks.misc.nextAvailableTrunk_x();
- var tmp_trunksList = astgui_managetrunks.listofAllTrunks();
- var trunk = ( !tr.username || tmp_trunksList.contains(tr.username) ) ? astgui_managetrunks.misc.nextAvailableTrunk_x() : tr.username ;
+
+ var trunk = tr.username ;
+ if (cxb == 'GUIAssigned') trunk = astgui_managetrunks.misc.nextAvailableTrunk_x();
+ else if (cxb == 'FromProvider') trunk = tr.trunkname;
+ else if (cxb == 'FromUser') trunk = tr.username;
+
sessionData.pbxinfo.trunks.iax[trunk] = new ASTGUI.customObject; // add new/reset iax trunk info in sessionData
@@ -974,8 +982,8 @@
x.callActions(cb);
},
- addSIPTrunk: function(tr,cbf){ //
- // usage:: astgui_managetrunks.addSIPTrunk( {'host':'sip_test.digium.com' , username:'my_username', secret:'my_secret',(required)fallback: '6001' ....}, cbf ) ;
+ addSIPTrunk: function(tr,cbf, cxb){ //
+ // usage:: astgui_managetrunks.addSIPTrunk( {'host':'sip_test.digium.com' , username:'my_username', secret:'my_secret',(required)fallback: '6001' ....}, cbf, "context-basis") ;
if( !tr.hasOwnProperty('host') ){ return false; } //check for required parameters
// add some default values for any SIPTrunk
@@ -991,9 +999,10 @@
tr.disallow ='all';
tr.allow = 'all';
- //var trunk = astgui_managetrunks.misc.nextAvailableTrunk_x();
- var tmp_trunksList = astgui_managetrunks.listofAllTrunks();
- var trunk = ( !tr.username || tmp_trunksList.contains(tr.username) ) ? astgui_managetrunks.misc.nextAvailableTrunk_x() : tr.username ;
+ var trunk = tr.username ; /* default */
+ if (cxb == 'GUIAssigned') trunk = astgui_managetrunks.misc.nextAvailableTrunk_x();
+ else if (cxb == 'FromProvider') trunk = tr.trunkname;
+ else if (cxb == 'FromUser') trunk = tr.username;
var ct = ASTGUI.contexts.TrunkDIDPrefix + trunk;
var x = new listOfActions();
@@ -1413,7 +1422,7 @@
});
if( new_menu.alias_exten ){ // add 'exten = 7000,1,Goto(voicemenu-custom-1|s|1)' in context 'voicemenus'
if( !new_menu.alias_exten.contains(',') || !new_menu.alias_exten.toLowerCase().contains('goto(') ){// if new_menu.alias_exten is '4444'
- new_menu.alias_exten = new_menu.alias_exten.lChop('exten=') + ',1,Goto(' + new_name + '|s|1)' ;
+ new_menu.alias_exten = new_menu.alias_exten.lChop('exten=') + ',1,Goto(' + new_name + ',s,1)' ;
}
x.new_action( 'append', ASTGUI.contexts.VoiceMenuExtensions , 'exten', new_menu.alias_exten );
}
@@ -1496,7 +1505,7 @@
var configOptions = line.afterChar('=');
var params = configOptions.betweenXY('|',')');
if( params.contains('a') && params.contains('A') ) { // if is a meetMe Admin Login
- b = configOptions.betweenXY('(','|');
+ b = ASTGUI.parseContextLine.getArgs(line)[0] ;
}
if( !sessionData.pbxinfo.conferences.hasOwnProperty(b) ){
sessionData.pbxinfo.conferences[b] = new ASTGUI.customObject ;
@@ -1653,7 +1662,7 @@
}
for(var u=0, v = rgextns.length; u < v ; u++ ){
- if( rgextns[u].contains(cxtname + '|') ){
+ if( rgextns[u].contains(cxtname + '|') || rgextns[u].contains(cxtname + ',') ){
rg.extension = ASTGUI.parseContextLine.getExten(rgextns[u]);
break;
}
@@ -1708,7 +1717,7 @@
var after = function() {
if( rg.extension ){
var u = new listOfSynActions('extensions.conf') ;
- u.new_action( 'append', ASTGUI.contexts.RingGroupExtensions , 'exten', rg.extension + ',1,Goto(' + newrg + '|s|1)' );
+ u.new_action( 'append', ASTGUI.contexts.RingGroupExtensions , 'exten', rg.extension + ',1,Goto(' + newrg + ',s,1)' );
u.callActions();
}
sessionData.pbxinfo.ringgroups[newrg] = rg ;
@@ -1723,13 +1732,8 @@
var u = new listOfSynActions('extensions.conf') ;
u.new_action('delcat', rgname , '', '');
if( sessionData.pbxinfo.ringgroups[rgname].extension ){
-
-
-
var f = sessionData.pbxinfo.ringgroups[rgname].extension ;
-
-
- u.new_action( 'delete', ASTGUI.contexts.RingGroupExtensions , 'exten', '', f + ',1,Goto(' + rgname + '|s|1)' ) ;
+ u.new_action( 'delete', ASTGUI.contexts.RingGroupExtensions , 'exten', '', f + ',1,Goto(' + rgname + ',s,1)' ) ;
if( sessionData.pbxinfo.ringgroups[rgname].hasOwnProperty('isOLDRG') && sessionData.pbxinfo.ringgroups[rgname].isOLDRG == true ){
u.new_action( 'delete', 'default' , 'exten', '', f + ',1,Goto(' + rgname + '|s|1)' ) ;
}
@@ -1844,112 +1848,6 @@
// return sessionData.pbxinfo.vmgroups.getOwnProperties();
// }
};
-
-
-
-// astgui_manageTimeBasedRules = {
-//
-// // // TimeBasedRule Type - by Day of Week
-// // [timebasedrule-custom-1] // 'timebasedrule-custom-' is time based rule prefix
-// // exten = s,1,NoOp(LabelForThisRule)
-// // exten = s,n,GotoIfTime(00:00-23:59|sun-sat|*|*?voicemenu-custom-1,s,1)
-// // OR
-// // exten = s,n,GotoIfTime(*|sun-sat|*|*?voicemenu-custom-1,s,1)
-// // exten = s,n,Goto(default,6000,1)
-// //
-// // // TimeBasedRule Type - by a set of Dates
-// // [timebasedrule-custom-2]
-// // exten = s,1,NoOp(LabelForThisRule)
-// // exten = s,n,GotoIfTime( 00:00-23:59|*|25|dec?voicemenu-custom-1,s,1 ) // christmas
-// // exten = s,n,GotoIfTime( 00:00-23:59|*|1|jan?voicemenu-custom-1,s,1 ) // Jan 1st
-// // exten = s,n,GotoIfTime( 00:00-23:59|*|4|jul?voicemenu-custom-1,s,1 ) // July 4rth
-// // OR
-// // exten = s,n,GotoIfTime( *|*|4|jul?voicemenu-custom-1,s,1 ) // July 4rth
-// // exten = s,n,Goto(default,6000,1)
-// //
-// //
-// // // data structure //
-// // sessionData.pbxinfo['timebasedRules'][timebasedrule-custom-2] = {
-// // label : 'LabelForThisRule',
-// // matches : [ '00:00-23:59|*|25|dec', '00:00-23:59|*|1|jan', '00:00-23:59|*|4|jul' ], // by a set of Dates
-// // OR
-// // matches : [ '00:00-23:59|sun-sat|*|*'], // - by Day of Week, matches.length == 1
-// // ifMatched : 'voicemenu-custom-1,s,1',
-// // ifNotMatched : 'default,6000,1'
-// // }
-// //
-//
-// parseContext : function(cxtname, cxt) { // parses a timebased rules context and returns a standard time based rules object
-// // sessionData.pbxinfo['timebasedRules'][d]
-// var tbr = { label : '', matches : [] , ifMatched : '', ifNotMatched : '' } ;
-//
-// if( cxt[0].contains('exten=s,1') && cxt[0].toLowerCase().contains('noop(') ){
-// tbr.label = cxt[0].betweenXY( '(' , ')' );
-// cxt.splice(0,1);
-// }else{
-// tbr.label = 'TimeBased Rule ' + cxtname.withOut(ASTGUI.contexts.TimeBasedRulePrefix);
-// }
-//
-// cxt.each( function(line) {
-// if( line.toLowerCase().contains('s,n,gotoiftime(') ){
-// tbr.matches.push( line.betweenXY('(','?') );
-// tbr.ifMatched = line.betweenXY('?',')') ;
-// return;
-// }
-// if( line.toLowerCase().contains('s,n,') ) {
-// tbr.ifNotMatched = line.afterStr( 's,n,' ) ;
-// }
-// });
-//
-// return tbr ;
-// },
-//
-// getTBRsList : function(){ // astgui_manageTimeBasedRules.getTBRsList
-// var tbrl = [] ;
-// var c = sessionData.pbxinfo['timebasedRules'];
-// for(var d in c){if(c.hasOwnProperty(d)){
-// tbrl.push(d);
-// }}
-// return tbrl;
-// },
-//
-// nextAvailableTBR_x: function(){ // astgui_manageTimeBasedRules.nextAvailableTBR_x
-// var x = [], y = astgui_manageTimeBasedRules.getTBRsList() ;
-// y.each( function( item ){
-// if( item.beginsWith(ASTGUI.contexts.TimeBasedRulePrefix) ){ x.push( item.split(ASTGUI.contexts.TimeBasedRulePrefix)[1] ); }
-// } );
-// if( !x.length ){ return ASTGUI.contexts.TimeBasedRulePrefix + '1' ; }
-// return ASTGUI.contexts.TimeBasedRulePrefix + x.firstAvailable() ;
-// },
-//
-// createNewTBR: function( tbr , callback, newtb_ctname ){ // astgui_manageTimeBasedRules.createNewTBR(tbr, cb, name(optional) )
-// // tbr is new timebased rule object, callback is callback function, newtb_ctname(Optional) if you want to create with a specific name
-// //
-// var newtb_cxt = newtb_ctname || this.nextAvailableTBR_x();
-// var x = new listOfActions();
-// x.filename('extensions.conf');
-// x.new_action('newcat', newtb_cxt , '', '');
-// x.new_action('append', newtb_cxt , 'exten', 's,1,NoOp(' + tbr.label + ')' );
-// tbr.matches.each(function(match_time){
-// x.new_action('append', newtb_cxt , 'exten', 's,n,GotoIfTime(' + match_time + '?' + tbr.ifMatched +')' );
-// });
-// x.new_action('append', newtb_cxt , 'exten', 's,n,' + tbr.ifNotMatched );
-// var after = function(){
-// sessionData.pbxinfo.timebasedRules[newtb_cxt] = tbr ;
-// callback();
-// };
-// x.callActions(after);
-// },
-//
-// deleteTBR : function(tbname){ // astgui_manageTimeBasedRules.deleteTBR(tbrname);
-// var u = new listOfSynActions('extensions.conf') ;
-// u.new_action('delcat', tbname , '', '');
-// u.callActions();
-// delete sessionData.pbxinfo.timebasedRules[tbname] ;
-// }
-//
-// };
-
astgui_updateConfigFromOldGui = function(){
@@ -2050,13 +1948,12 @@
if(!this_line.beginsWith('exten=') ){ return ; }
var match_str = this_line.afterChar('=');
- if ( this_line.contains('MeetMe(${EXTEN}|') ){
+ if ( this_line.contains('MeetMe(${EXTEN}') ){
// Move any conferences into [conferences]
// old
// [default]
// exten => 6000,1,MeetMe(${EXTEN}|MI) // delete this line
-
- sa.new_action('delete', 'default' , 'exten', '', match_str );
+ sa.new_action('delete', 'default' , 'exten', '', match_str );
// new
// [conferences]
// exten => 6000,1,MeetMe(${EXTEN}|MI)
@@ -2070,7 +1967,7 @@
// [voicemenu-custom-?]
// exten = ????,?,Goto(conferences|6000|1)
var tmp_exten = ASTGUI.parseContextLine.getExten(match_str);
- var tmp_oldMM_gotoStr = 'Goto(default|' + tmp_exten + '|1)' ;
+ var tmp_oldMM_gotoStr = 'Goto(default,' + tmp_exten + ',1)' ;
for ( var catname in ext_conf ){
if( !ext_conf.hasOwnProperty(catname) ) continue;
@@ -2086,7 +1983,7 @@
this_menu.each( function( this_menu_line ){
if( this_menu_line.contains( tmp_oldMM_gotoStr ) ){
var tmp_toReplace = this_menu_line.afterChar('=');
- var tmp_ReplaceWith = tmp_toReplace.replaceXY(tmp_oldMM_gotoStr, 'Goto(' + ASTGUI.contexts.CONFERENCES +'|' + tmp_exten + '|1)' );
+ var tmp_ReplaceWith = tmp_toReplace.replaceXY(tmp_oldMM_gotoStr, 'Goto(' + ASTGUI.contexts.CONFERENCES +',' + tmp_exten + ',1)' );
sa.new_action( 'update', catname , 'exten', tmp_ReplaceWith , tmp_toReplace );
}
});
@@ -2132,7 +2029,7 @@
this_menu.each( function( this_menu_line ){
if( this_menu_line.contains( tmp_oldRG_gotoStr ) ){
var tmp_toReplace = this_menu_line.afterChar('=');
- var tmp_ReplaceWith = tmp_toReplace.replaceXY( tmp_oldRG_gotoStr, 'Goto(' + THIS_RGNAME +'|s|1)' );
+ var tmp_ReplaceWith = tmp_toReplace.replaceXY( tmp_oldRG_gotoStr, 'Goto(' + THIS_RGNAME +',s,1)' );
sa.new_action( 'update', catname , 'exten', tmp_ReplaceWith , tmp_toReplace );
}
});
@@ -2181,7 +2078,7 @@
this_menu.each( function( this_menu_line ){
if( this_menu_line.contains( tmp_oldQ_gotoStr ) ){
var tmp_toReplace = this_menu_line.afterChar('=');
- var tmp_ReplaceWith = tmp_toReplace.replaceXY(tmp_oldQ_gotoStr, 'Goto(' + ASTGUI.contexts.QUEUES +'|' + tmp_exten + '|1)' );
+ var tmp_ReplaceWith = tmp_toReplace.replaceXY(tmp_oldQ_gotoStr, 'Goto(' + ASTGUI.contexts.QUEUES +',' + tmp_exten + ',1)' );
sa.new_action( 'update', catname , 'exten', tmp_ReplaceWith , tmp_toReplace );
}
});
Modified: team/rbrindley/welcome_revamp/config/js/tooltip.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/tooltip.js?view=diff&rev=4153&r1=4152&r2=4153
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/tooltip.js (original)
+++ team/rbrindley/welcome_revamp/config/js/tooltip.js Wed Nov 19 16:18:42 2008
@@ -444,6 +444,9 @@
"</UL>\n";
tooltips['trunks'].en[37] = "<B>Provider Name:</B> A unique label to help you identify this trunk when listed in outbound rules, incoming rules etc.";
tooltips['trunks'].en[38] = "<B>Trunk Name:</B> A unique label to help you identify this trunk when listed in outbound rules, incoming rules etc. Ex: 'Port 5' ";
+ tooltips['trunks'].en[39] = "<B>Username:</B> Username that you authenticate with at VoIP provider. Must be unique if <B>Context Naming</B> is based on Username.";
+ tooltips['trunks'].en[40] = "<B>Context Naming:</B> How should Asterisk GUI determine the context name in Asterisk's .conf files. Asterisk can assign a unique name itself, or you can base it upon the <B>Provider Name</B> or <B>Username</B> that you enter below. Let Asterisk assign a name unles your VoIP provider requires otherwise.";
+ tooltips['trunks'].en[41] = "<B>Hostname:</B> IP address or URL for your VoIP providers server.";
// END trunks_voip.html
Modified: team/rbrindley/welcome_revamp/config/trunks_voip.html
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/trunks_voip.html?view=diff&rev=4153&r1=4152&r2=4153
==============================================================================
--- team/rbrindley/welcome_revamp/config/trunks_voip.html (original)
+++ team/rbrindley/welcome_revamp/config/trunks_voip.html Wed Nov 19 16:18:42 2008
@@ -96,6 +96,7 @@
DOM_edit_VOIPTrunk_DIV = _$('edit_VOIPTrunk_DIV');
DOM_edit_VOIPTrunk_DIV_Title = _$('edit_VOIPTrunk_DIV_Title');
DOM_edit_VOIPTrunk_Type = _$('edit_VOIPTrunk_Type');
+ DOM_edit_VOIPTrunk_Context_Basis = _$('edit_VOIPTrunk_Context_Basis');
DOM_edit_VOIPTrunk_Hostname = _$('edit_VOIPTrunk_Hostname');
DOM_edit_VOIPTrunk_Username = _$('edit_VOIPTrunk_Username');
DOM_edit_VOIPTrunk_Password = _$('edit_VOIPTrunk_Password');
@@ -132,16 +133,20 @@
if( isNewTrunk == true ) {
DOM_edit_VOIPTrunk_DIV_Title.innerHTML = 'Create New SIP/IAX trunk';
- ASTGUI.resetTheseFields([ DOM_edit_VOIPTrunk_Type, DOM_edit_VOIPTrunk_Hostname , DOM_edit_VOIPTrunk_Username , DOM_edit_VOIPTrunk_Password , 'trunk_obcid' , 'edit_VOIPTrunk_Providername','trunk_fromdomain', 'trunk_fromuser', 'trunk_insecure' ]);
+ ASTGUI.resetTheseFields([ DOM_edit_VOIPTrunk_Type, DOM_edit_VOIPTrunk_Hostname , DOM_edit_VOIPTrunk_Username , DOM_edit_VOIPTrunk_Password , 'trunk_obcid' , 'edit_VOIPTrunk_Providername','trunk_fromdomain', 'trunk_fromuser','trunk_authuser', 'trunk_insecure' ]);
DOM_edit_VOIPTrunk_Type.disabled = false;
+ DOM_edit_VOIPTrunk_Context_Basis.disabled = false;
ASTGUI.feedback( { msg: 'Create New Trunk', showfor:2 });
$('#TR_trunktype').show();
+ $('#TR_contextbasis').show();
} else {
$('#TR_trunktype').hide();
+ $('#TR_contextbasis').hide();
var ttype = parent.astgui_managetrunks.misc.getTrunkType(EDIT_TRUNK) ;
var tinfo = parent.sessionData.pbxinfo.trunks[ttype][EDIT_TRUNK];
DOM_edit_VOIPTrunk_Type.disabled = true;
+ DOM_edit_VOIPTrunk_Context_Basis.disabled = true;
DOM_edit_VOIPTrunk_DIV_Title.innerHTML = 'Edit ' + ttype.toUpperCase() + ' trunk ' + EDIT_TRUNK;
ASTGUI.updateFieldToValue( DOM_edit_VOIPTrunk_Type, ttype.toUpperCase() );
ASTGUI.updateFieldToValue( DOM_edit_VOIPTrunk_Hostname , tinfo.getProperty('host') );
@@ -150,6 +155,7 @@
ASTGUI.updateFieldToValue( 'edit_VOIPTrunk_Providername' , tinfo.getProperty('trunkname') );
ASTGUI.updateFieldToValue( 'trunk_fromdomain' , tinfo.getProperty('fromdomain') );
ASTGUI.updateFieldToValue( 'trunk_fromuser' , tinfo.getProperty('fromuser') );
+ ASTGUI.updateFieldToValue( 'trunk_authuser' , tinfo.getProperty('authuser') );
ASTGUI.updateFieldToValue( 'trunk_insecure' , tinfo.getProperty('insecure') );
if( tinfo.getProperty('allow') == 'all'){
@@ -167,6 +173,12 @@
ASTGUI.updateFieldToValue( 'codec_fifth', (codecs_tmp[4] && codecs_tmp[4].trim()) || '' );
}
+ /* Don't allow editing field if the asterisk [context] is based on it. */
+ DOM_edit_VOIPTrunk_Username.disabled = false;
+ _$('edit_VOIPTrunk_Providername').disabled = false;
+ if (EDIT_TRUNK == tinfo.getProperty('username')) DOM_edit_VOIPTrunk_Username.disabled = true;
+ if (EDIT_TRUNK == tinfo.getProperty('trunkname')) _$('edit_VOIPTrunk_Providername').disabled = true;
+
var c = context2json({ filename:'extensions.conf', context: 'globals' , usf: 1 });
ASTGUI.updateFieldToValue( 'trunk_obcid', c.getProperty(ASTGUI.globals.obcidUsrPrefix + EDIT_TRUNK) );
@@ -209,13 +221,6 @@
};
-
-
-
-
-
-
-
var edit_VOIPTrunk_save_go = function(){
var topreload = false;
var tmp_username = ASTGUI.getFieldValue('edit_VOIPTrunk_Username');
@@ -224,35 +229,46 @@
if( !tmp_confirm ) return;
}
- if ( !ASTGUI.checkRequiredFields(['edit_VOIPTrunk_Providername', 'edit_VOIPTrunk_Type' , 'edit_VOIPTrunk_Hostname']) ){
+ if ( !ASTGUI.checkRequiredFields(['edit_VOIPTrunk_Providername', 'edit_VOIPTrunk_Type', 'edit_VOIPTrunk_Context_Basis', 'edit_VOIPTrunk_Hostname']) ) {
return ;
}
if( isNewTrunk == true ) {
// New Trunk
- var tmp_ttype = parent.astgui_managetrunks.misc.getTrunkType( DOM_edit_VOIPTrunk_Username.value );
- //if( tmp_ttype ){
- // ASTGUI.highlightField( DOM_edit_VOIPTrunk_Username , "Another trunk exists with this name !!" );
- // return;
- //}
+ var tcv = edit_VOIPTrunk_Context_Basis.value; /* How do we assign context name ? */
+ if (tcv == 'FromUser') {
+ var tmp_ttype = parent.astgui_managetrunks.misc.getTrunkType( DOM_edit_VOIPTrunk_Username.value );
+ if( tmp_ttype ){
+ ASTGUI.highlightField( DOM_edit_VOIPTrunk_Username , "Another trunk exists with this name !!" );
+ return;
+ }
+ }
+ else if (tcv == 'FromProvider') {
+ var tmp_ttype = parent.astgui_managetrunks.misc.getTrunkType( ASTGUI.getFieldValue('edit_VOIPTrunk_Providername') );
+ if( tmp_ttype ){
+ ASTGUI.highlightField( 'edit_VOIPTrunk_Providername' , "Another trunk exists with this name !!" );
+ return;
+ }
+ }
var ttv = DOM_edit_VOIPTrunk_Type.value;
+
var trp = {
- host: DOM_edit_VOIPTrunk_Hostname.value ,
+ host: DOM_edit_VOIPTrunk_Hostname.value ,
+ username: DOM_edit_VOIPTrunk_Username.value ,
+ secret: DOM_edit_VOIPTrunk_Password.value ,
trunkname: ASTGUI.getFieldValue('edit_VOIPTrunk_Providername')
};
-
- if( DOM_edit_VOIPTrunk_Username.value ){
- trp.username = ASTGUI.getFieldValue(DOM_edit_VOIPTrunk_Username) ;
- trp.secret = ASTGUI.getFieldValue(DOM_edit_VOIPTrunk_Password) ;
- }
var cbf = function(){
ASTGUI.feedback({msg:'Created New ' + ttv+ ' trunk !', showfor: 3 , color: 'green', bgcolor: '#FFFFFF'}) ;
window.location.reload();
};
- if(ttv =='SIP'){ parent.astgui_managetrunks.addSIPTrunk( trp , cbf ) ; }
- if(ttv =='IAX'){ parent.astgui_managetrunks.addIAXTrunk( trp , cbf ) ; }
+
+ if(ttv =='SIP'){ parent.astgui_managetrunks.addSIPTrunk( trp , cbf,
+ DOM_edit_VOIPTrunk_Context_Basis.value ) ; }
+ if(ttv =='IAX'){ parent.astgui_managetrunks.addIAXTrunk( trp , cbf,
+ DOM_edit_VOIPTrunk_Context_Basis.value ) ; }
}else if(isNewTrunk == false){
// Edit Existing Trunk
@@ -301,6 +317,17 @@
}
}
+ var tmp_authuser = ASTGUI.getFieldValue('trunk_authuser') ;
+ if( tmp_authuser ){
+ x.new_action('update', EDIT_TRUNK , 'authuser', tmp_authuser );
+ parent.sessionData.pbxinfo.trunks[ttype][EDIT_TRUNK]['authuser'] = tmp_authuser ;
+ }else{
+ if( parent.sessionData.pbxinfo.trunks[ttype][EDIT_TRUNK].hasOwnProperty('authuser') ){
+ delete parent.sessionData.pbxinfo.trunks[ttype][EDIT_TRUNK]['authuser'] ;
+ }
+ }
+
+
var tmp_insecure = ASTGUI.getFieldValue('trunk_insecure') ;
x.new_action('update', EDIT_TRUNK , 'insecure', tmp_insecure );
parent.sessionData.pbxinfo.trunks[ttype][EDIT_TRUNK]['insecure'] = tmp_insecure ;
@@ -353,43 +380,6 @@
}
// End of remote MWI
-
- var NEW_TRUNKNAME = ASTGUI.getFieldValue(DOM_edit_VOIPTrunk_Username) ;
- if( old_trunkUsername != NEW_TRUNKNAME ){
- var topreload = true;
- // if username is changed, change the trunk name, incoming context name and all timeinterval incoming context names
- v.new_action('delete', 'globals', EDIT_TRUNK, '','' );
- if( parent.sessionData.pbxinfo.trunks[ttype][EDIT_TRUNK]['hasiax'] == 'yes' ){
- v.new_action('append', 'globals', NEW_TRUNKNAME, 'IAX2/' + NEW_TRUNKNAME );
- }else if ( parent.sessionData.pbxinfo.trunks[ttype][EDIT_TRUNK]['hassip'] == 'yes' ){
- v.new_action('append', 'globals', NEW_TRUNKNAME, 'SIP/' + NEW_TRUNKNAME );
- }
-
- x.new_action( 'renamecat', EDIT_TRUNK , "", NEW_TRUNKNAME ) ; // rename in users.conf
-
- var EXT_CNF = config2json({ filename:'extensions.conf', usf:0 }) ;
- for( var ct in EXT_CNF){ if( EXT_CNF.hasOwnProperty(ct) ){
- if( ct == ASTGUI.contexts.TrunkDIDPrefix + EDIT_TRUNK ){
- var tmp_DIDnewContext = ct.replaceXY(EDIT_TRUNK, NEW_TRUNKNAME) ;
- v.new_action( 'renamecat', ct , "", tmp_DIDnewContext ) ;
- EXT_CNF[ct].each( function( this_DID_line ){
- if ( this_DID_line.contains( EDIT_TRUNK + '_' ) ){
- var tmp_DID_newline = this_DID_line.replaceXY(EDIT_TRUNK, NEW_TRUNKNAME) ;
- v.new_action( 'update', tmp_DIDnewContext, this_DID_line.beforeChar('=') , tmp_DID_newline.afterChar('=') , this_DID_line.afterChar('=') );
- }
- } );
- }
-
- if( ct == ASTGUI.contexts.TrunkDIDPrefix + EDIT_TRUNK || ct.beginsWith( ASTGUI.contexts.TrunkDIDPrefix + EDIT_TRUNK + '_' ) ){
- v.new_action( 'renamecat', ct , "", ct.replaceXY(EDIT_TRUNK, NEW_TRUNKNAME)) ;
- }
-
- }}
-
- var TMP_OBJ = parent.sessionData.pbxinfo.trunks[ttype][EDIT_TRUNK] ;
- delete parent.sessionData.pbxinfo.trunks[ttype][EDIT_TRUNK] ;
- parent.sessionData.pbxinfo.trunks[ttype][NEW_TRUNKNAME] = TMP_OBJ;
- }
var after = function(){
v.callActions( function(){
@@ -541,15 +531,25 @@
</select>
</TD>
</TR>
+
+ <TR id='TR_contextbasis'>
+ <TD align="right">Context Naming <img src="images/tooltip_info.gif" tip="en,trunks,40" class='tooltipinfo'>:</TD>
+ <TD> <select id='edit_VOIPTrunk_Context_Basis' required='yes'>
+ <option value='GUIAssigned' selected>Assigned by Asterisk GUI</option>
+ <option value='FromUser'>Based on Username</option>
+ <option value='FromProvider'>Based on Provider Name</option>
+ </select>
+ </TD>
+ </TR>
<TR> <TD align="right">Provider Name <img src="images/tooltip_info.gif" tip="en,trunks,37" class='tooltipinfo'>:</TD>
<TD> <input id='edit_VOIPTrunk_Providername' size=20 required='yes'></TD>
</TR>
- <TR> <TD align="right">Hostname :</TD>
+ <TR> <TD align="right">Hostname <img src="images/tooltip_info.gif" tip="en,trunks,41" class='tooltipinfo'>:</TD>
<TD> <input id='edit_VOIPTrunk_Hostname' size=30 required='yes'></TD>
</TR>
- <TR> <TD align="right">Username :</TD>
+ <TR> <TD align="right">Username <img src="images/tooltip_info.gif" tip="en,trunks,39" class='tooltipinfo'>:</TD>
<TD> <input id='edit_VOIPTrunk_Username' size=25 required='yes' validation='voipusername'></TD>
</TR>
<TR> <TD align="right">Password :</TD>
@@ -581,11 +581,15 @@
<TD align="right" valign=top>FromUser :</TD>
<TD align="left"> <input id="trunk_fromuser" size=16> </TD>
</TR>
-
+ <TR class='editTrunk_Field'>
+ <TD align="right" valign=top>AuthUser :</TD>
+ <TD align="left"> <input id="trunk_authuser" size=16> </TD>
+ </TR>
<TR class='editTrunk_Field'>
<TD align="right" valign=top>insecure :</TD>
<TD align="left"> <select id="trunk_insecure" dfalt='no' class="input8"><option value='port'>port</option><option value='port,invite'>very</option><option value='no'>no</option></select> </TD>
</TR>
+
<TR class='editTrunk_Field_ermwi'>
<TD align="right">
@@ -603,7 +607,7 @@
<TR> <TD colspan=2 align=center height=50 valign=middle>
<span class='guiButtonCancel' id="edit_VOIPTrunk_cancel" onclick='ASTGUI.hideDrag(event);'>Cancel</span>
- <span class='guiButtonEdit' id="edit_VOIPTrunk_save" onclick='edit_VOIPTrunk_save_go();'>Add</span>
+ <span class='guiButtonEdit' id="edit_VOIPTrunk_save" onclick='edit_VOIPTrunk_save_go();'>Save</span>
</TD>
</TR>
</TABLE>
More information about the asterisk-gui-commits
mailing list