pari: branch asterisknow r2238 - /branches/asterisknow/config/numberplan.html
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Fri Feb 1 11:54:26 CST 2008
Author: pari
Date: Fri Feb 1 11:54:25 2008
New Revision: 2238
URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=2238
Log:
Fix for BE-377: Calling Rules fixes that went into AA50 for Service Providers are missing from AsteriskNOW gui
Modified:
branches/asterisknow/config/numberplan.html
Modified: branches/asterisknow/config/numberplan.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/numberplan.html?view=diff&rev=2238&r1=2237&r2=2238
==============================================================================
--- branches/asterisknow/config/numberplan.html (original)
+++ branches/asterisknow/config/numberplan.html Fri Feb 1 11:54:25 2008
@@ -152,7 +152,14 @@
var _tv = _$('trunks').value ;
var _sv = _$('strip').value ;
var _pv = _$('prepend').value ;
- var rule_string = _ptv + ',' + this_priority + ',Macro(trunkdial,${' + _tv + '}/'+ _pv +'${EXTEN:' + _sv + '})' ;
+ var provider_name;
+ config2json('users.conf', 1, function(b) {
+ var c = b ;
+ provider_name = (c[_tv]['provider']) ? unescape(c[_tv]['provider']) : _tv;
+
+ if( provider_name == 'bandwidth' && _pv.indexOf('+') != 0 ){ _pv = "+" + _pv ; }
+ var rule_string = _ptv + ',' + this_priority + ',Macro(trunkdial,${' + _tv + '}/'+ _pv +'${EXTEN:' + _sv + '},${'+_tv +"_cid})";
+
var uri = build_action('append', 0 , _extv ,"exten", rule_string );
commentstring = _ptv + ',' + this_priority + ',' + _rnv + "," + commentstring ;
uri += build_action('append', 1 , _extv ,"comment", commentstring );
@@ -172,6 +179,7 @@
oncomplete();
}
);
+ });
}
function saverule(){
@@ -232,6 +240,7 @@
if ( typeof y[temp[0]] == 'undefined' ) {
y[temp[0]] = { };
}
+
y[temp[0]][temp[1]] = new ruleinanpdata(temp[4], temp[5],temp1c[0]);
}
for ( k =0 ; k < z['npcomments'].length ; k++ ){
@@ -388,7 +397,17 @@
var _extv = $('extensions').value ;
var m = numberplansdata[_extv]['npdata'];
var commentstring = (m[a][b].ruledesc == 'custom') ? "custom" : "standard" ;
- var rule_string = a + ',' + b + ',Macro(trunkdial,${' + m[a][b].trunk + '}/'+ m[a][b].prepend + '${EXTEN:' + m[a][b].digits2strip + '})' ;
+
+ var foo = m[a][b].prepend;
+ if(m[a][b].trunk && trunks_desc[m[a][b].trunk] && trunks_desc[m[a][b].trunk].provider.toLowerCase() == "bandwidth" && foo.indexOf('+') != 0 ) {
+ foo = "+" + foo;
+ }
+
+ if( m[a][b].trunk ){
+ var rule_string = a + ',' + b + ',Macro(trunkdial,${' + m[a][b].trunk + '}/'+ foo + '${EXTEN:' + m[a][b].digits2strip + '},${' + m[a][b].trunk + '_cid})';
+ }else{
+ var rule_string = a + ',' + b + ',Macro(trunkdial,${}/' + foo + '${EXTEN:' + m[a][b].digits2strip + '})';
+ }
var uri = build_action('delete', 0, _extv ,"exten", "", rule_string );
commentstring = a + ',' + b + ',' + m[a][b].rulename + ',' + commentstring ;
uri += build_action('delete', 1 , _extv ,"comment","", commentstring );
@@ -424,7 +443,12 @@
}
_$('pattern').value = a;
_$('strip').value = m[a][b].digits2strip;
- _$('prepend').value = m[a][b].prepend;
+ if( m[a][b].trunk && trunks_desc[m[a][b].trunk] && trunks_desc[m[a][b].trunk].provider.toLowerCase() == "bandwidth" ){
+ if( m[a][b].prepend.indexOf("+") ==0 ) { _$('prepend').value = m[a][b].prepend.substr(1); }else{ _$('prepend').value = m[a][b].prepend; }
+ }else{
+ _$('prepend').value = m[a][b].prepend;
+ }
+
_$('save_a').disabled = 1;
if( m[a][b].ruledesc == 'custom' || !m[a][b].ruledesc ){
// if this is a custom pattern then donot try to parse the pattern
@@ -502,11 +526,18 @@
np_oldselect = _extns.selectedIndex ;
_$('include').value = "default";
var c = 1 ;
+ var sortNumbers =function(a,b){return a - b};
+ var tmp_arr = [];
for(var u =0 ; u < _extns.length ; u++ ){
- var tmp = _extns.options[u].value.split("-") ;
- if( c < tmp[2] ){ break; }
+ tmp_arr.push( Number(_extns.options[u].value.split("-")[2]) );
+ }
+ tmp_arr.sort(sortNumbers);
+
+ for(var u =0 ; u < tmp_arr.length ; u++ ){
+ if( c < tmp_arr[u] ){ break; }
c++ ;
}
+
var nnp = {};
nnp.name = "numberplan-custom-" + c ;
nnp.fieldbyname = {};
@@ -554,7 +585,7 @@
widgets[fieldnames[x]].disabled = true;
}
- _$('message_text').innerHTML ="Saving Changes...";
+ _$('message_text').innerHTML ="Applying Changes...";
config2json('users.conf', 1, trunks_loaded ) ;
//parent.astmanEngine.config2list("users.conf", $('trunks'), new Array(), trunkcallbacks);
@@ -566,6 +597,7 @@
if ( c.hasOwnProperty(d) && c[d]['context'] && (c[d]['context'] == asterisk_guiTDPrefix + d ) ) {
trunks_desc[d] = new Object();
trunks_desc[d].comment = (c[d]['trunkname']) ? unescape(c[d]['trunkname']) : d ;
+ trunks_desc[d].provider = (c[d]['provider']) ? unescape(c[d]['provider']) : '' ;
ASTGUI.selectbox.append(_$('trunks'), unescape(trunks_desc[d].comment) , d);
}
}
@@ -594,7 +626,6 @@
};
config2json("misdn.conf", 1, parseUsersConf);
}
-
function select_differentplan(){
var _extns = _$('extensions').value ;
More information about the asterisk-gui-commits
mailing list