From d1a445f0bb1d07b3ee273fd345a3d966fafd8f6b Mon Sep 17 00:00:00 2001 From: horse69 Date: Sun, 2 Sep 2012 21:37:50 +0000 Subject: [PATCH] git-svn-id: https://svn.code.sf.net/p/freetel/code@655 01035d8c-6547-0410-b346-abe4f91aad63 --- mini-asterisk-gui2/minicommon.js | 37 ++++++++++++++++++++------- mini-asterisk-gui2/phones.js | 44 ++++++++++++++++++++++++-------- 2 files changed, 62 insertions(+), 19 deletions(-) diff --git a/mini-asterisk-gui2/minicommon.js b/mini-asterisk-gui2/minicommon.js index e3fb4366..4c89e9a2 100644 --- a/mini-asterisk-gui2/minicommon.js +++ b/mini-asterisk-gui2/minicommon.js @@ -20,14 +20,23 @@ var ip_ext = []; var network = "no"; -// incomming calls are routed to these extensions ie (6003, ZAP/3) -var number=''; -var code=''; +// incomming calls are routed to these extensions ie (6003, Zap/3) +// this should be made dynamically from the reception line in extensions.conf +//testing +//var reception = [["6003","Zap/3"],["6004","Zap/4"],["6011","SIP/6011"],["6012","SIP/6012"]] ; -var reception[] = {number, code}; +//max 4 receptions +var reception = [["",""],["",""],["",""],["",""]] ; +var recept_num = []; +var ext_code =[]; +var recept_code =[]; +var recept_count = 0; +var ext_count = 0; +var iancount = 0; +var items = [[1,2],[3,4],[5,6]]; // these are the selections for the new reception numbers @@ -133,11 +142,18 @@ function loadExtensionsConf(doc,status) { if (zap[tech2] == undefined) analog_ext[tech2] = ""; else - analog_ext[tech2] = ext; + analog_ext[tech2] = ext; } if (tech1 == "SIP") { ip_ext[ext] = ""; } + + // save the codes for each extension + // need these for constructing the reception string + // using underscore instead of forward slash to avoid http managle + + ext_code[ext_count++] = tech1 +"_"+ tech2; + } // Save the reception numbers if they exist @@ -145,24 +161,27 @@ function loadExtensionsConf(doc,status) { // exten => s,1,Dial(Zap/4&SIP/6011) ;; mini-asterisk - don't remove this comment if(line.indexOf("exten => s,1,Dial") != -1) { + i=0; // for each Zap/ read in a single digit and convert to extension while((ret = line.indexOf("Zap/"))!=-1) { - reception[i].code = line.substr(ret,5); - reception[i].number = analog_ext[line.substr(ret+4,1)]; +// recept_code[i] = line.substr(ret,5); + recept_num[i] = analog_ext[line.substr(ret+4,1)]; line = line.substr(ret+6,line.length); i++; } // for each SIP/ read in four digits while ((ret = line.indexOf("SIP/")) != -1) { - reception[i].code = line.substr(ret,8); - reception[i].number = line.substr(ret+4,4); +// recept_code[i] = line.substr(ret,8); + recept_num[i] = line.substr(ret+4,4); line = line.substr(ret+9,line.length); i++; } + recept_count = i; + } } ); diff --git a/mini-asterisk-gui2/phones.js b/mini-asterisk-gui2/phones.js index 6a8b094f..390a28a3 100644 --- a/mini-asterisk-gui2/phones.js +++ b/mini-asterisk-gui2/phones.js @@ -54,12 +54,16 @@ function initialisePage() { html += "" + '1) + arg = arg+"&"; + + // got to make up new codes + arg = arg + recept_code[i]; + } + } + //downloadUrl("/cgi-bin/setring.cgi?"+arg,null); + } -- 2.25.1