bkruse: branch 1.4 r1481 - in /branches/1.4/config: ./ scripts/

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Aug 29 16:33:05 CDT 2007


Author: bkruse
Date: Wed Aug 29 16:33:04 2007
New Revision: 1481

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1481
Log:
Dynamic codec implementation. No longer are they
hardcoded, but parsed from asterisk's cli command
module show like codec_.
(closes issue #10588)

Modified:
    branches/1.4/config/scripts/tooltip.js
    branches/1.4/config/users.html

Modified: branches/1.4/config/scripts/tooltip.js
URL: http://svn.digium.com/view/asterisk-gui/branches/1.4/config/scripts/tooltip.js?view=diff&rev=1481&r1=1480&r2=1481
==============================================================================
--- branches/1.4/config/scripts/tooltip.js (original)
+++ branches/1.4/config/scripts/tooltip.js Wed Aug 29 16:33:04 2007
@@ -41,6 +41,7 @@
 	tooltips['users'] .en[21] = "<B>Can Reinvite:</B> This option can be used to tell the Asterisk server whethere or not to issue a reinvite to the client. ";
 	tooltips['users'] .en[22] = "<B>NAT:</B> Try this setting when Asterisk is on a public IP, communicating with devices hidden behind a NAT device (broadband router). If you have one-way audio problems, you usually have problems with your NAT configuration or your firewall's support of SIP+RTP ports.";
 	tooltips['users'] .en[23] = "<B>DTMFMode:</B> Set default dtmfmode for sending DTMF. Default: rfc2833 <BR><B>Other options:</B><BR>info : SIP INFO messages<BR>inband : Inband audio (requires 64 kbit codec -alaw, ulaw)<BR>auto : Use rfc2833 if offered, inband otherwise";
+	tooltips['users'] .en[24] = "<B>Codecs:</B> Click to select the codecs that asterisk has to offer, for the particular user.";
 	tooltips['users'] .en[99] = "<B>Phone Serial:</B> Enter the serial number of a Polycom phone to enable phone provisioning." ;
 
 // Tooltips for Conferencing (meetme)

Modified: branches/1.4/config/users.html
URL: http://svn.digium.com/view/asterisk-gui/branches/1.4/config/users.html?view=diff&rev=1481&r1=1480&r2=1481
==============================================================================
--- branches/1.4/config/users.html (original)
+++ branches/1.4/config/users.html Wed Aug 29 16:33:04 2007
@@ -29,6 +29,7 @@
 var widgets = new Object;
 var callbacks = new Object;
 var extencallbacks = new Object;
+var allcodecs = new Array;
 var fieldnames = ['callwaiting' ,'cancel' ,'cid_number' ,'context' ,'delete' ,'email' ,'fullname' ,'group' ,'hasagent' ,'hasdirectory' ,'hasiax' ,'hasmanager' ,'hassip' ,'hasvoicemail' ,'host' ,'mailbox' ,'name' ,'new' ,'save' ,'secret' ,'threewaycalling' ,'vmsecret' ,'zapchan', 'registeriax', 'registersip','canreinvite','nat','dtmfmode', 'disallow','allow'];
 
 var localextenlength = 4;
@@ -264,12 +265,34 @@
 		widgets[fieldnames[x]] = _$(fieldnames[x]);
 		widgets[fieldnames[x]].disabled = true;
 	}
-
-	config2json('zapscan.conf', 1, analoglines_loaded ) ;
+	
+	load_codecs_fromast();
 	//parent.astmanEngine.config2list("zapscan.conf", _$('zapchan'), new Array(), phonecallbacks);
 }
 
-
+function load_codecs_fromast() {
+	
+	parent.astmanEngine.cliCommand('module show like codec_', function(resp) {
+		resp = resp.replace(/Response: Follows/, "");
+		resp = resp.replace(/Privilege: Command/, "");
+		resp = resp.replace(/--END COMMAND--/, "");
+		resp = resp.split("\n");
+		for(var i=0; resp[i] != undefined; i++) {
+			resp[i] = resp[i].split("_");
+			if(resp[i][1]) {
+				resp[i][1] = resp[i][1].split("."); 
+				if(resp[i][1][0]) {
+					if(resp[i][1][0] == "a") {
+						continue; /* codec is a_mu, alaw to mulaw direct codec/decoder, not a codec preference. */
+					}
+						allcodecs[i] = resp[i][1][0];
+				}
+			}
+		}
+		config2json('zapscan.conf', 1, analoglines_loaded ) ;
+		return true;
+	});
+}
 function free_mem(){
 	if( navigator.userAgent.indexOf("MSIE") == -1 ){ return true; }
 	try{
@@ -320,29 +343,21 @@
 		_$('disallowed').innerHTML=""; _$('allowed').innerHTML="";
 		if( _$('disallow').value == "all" && _$('allow').value =="all" ){ return true;}
 		if( _$('disallow').value == "all" ){
-			this.selectbox_add(_$("disallowed"), "ulaw");
-			this.selectbox_add(_$("disallowed"), "alaw");
-			this.selectbox_add(_$("disallowed"), "gsm");
-			this.selectbox_add(_$("disallowed"), "ilbc");
-			this.selectbox_add(_$("disallowed"), "speex");
-			this.selectbox_add(_$("disallowed"), "g726");
-			this.selectbox_add(_$("disallowed"), "adpcm");
-			this.selectbox_add(_$("disallowed"), "lpc10");
-			this.selectbox_add(_$("disallowed"), "g729");
+			for(var i=0; i < allcodecs.length; i++) { /* Add the codecs that we have installed. */
+				if(allcodecs[i]) {
+				this.selectbox_add(_$('disallowed'), allcodecs[i]);
+				}
+			}
 		}else{
 			var tmp = _$('disallow').value.split(",");
 			for(var x=0; x < tmp.length; x++){ this.selectbox_add(_$("disallowed"), tmp[x]); }
 		}
 		if(_$('allow').value =="all"){
-			this.selectbox_add(_$("allowed"), "ulaw");
-			this.selectbox_add(_$("allowed"), "alaw");
-			this.selectbox_add(_$("allowed"), "gsm");
-			this.selectbox_add(_$("allowed"), "ilbc");
-			this.selectbox_add(_$("allowed"), "speex");
-			this.selectbox_add(_$("allowed"), "g726");
-			this.selectbox_add(_$("allowed"), "adpcm");
-			this.selectbox_add(_$("allowed"), "lpc10");
-			this.selectbox_add(_$("allowed"), "g729");
+			for(var i=0; i < allcodecs.length; i++) { /* Add the codecs that we have installed. */
+				if(allcodecs[i]) {
+					this.selectbox_add(_$('allowed'), allcodecs[i]);
+				}
+			}
 		}else{
 			var tmp = _$('allow').value.split(",");
 			for(var x=0; x < tmp.length; x++){
@@ -503,7 +518,7 @@
 			</tr>
 			<tr>
 				<td onclick="CODECSETTINGS.show_codecs();" style="cursor: pointer"  class="field_text">
-					<div style="margin-left: 15px;"><I>Edit Codecs</I>
+					<div tip="en,users,24" style="margin-left: 15px;"><I>Edit Codecs</I>
 						<div style="margin-left: 15px;"><span id="codecs_text"></span></div>
 					</div>
 				</td>




More information about the asterisk-gui-commits mailing list