add transfer command
This commit is contained in:
parent
bf197196a6
commit
997e921721
|
@ -20,6 +20,8 @@
|
|||
color: #eeeeee;
|
||||
background-color: #0000ae;
|
||||
font-face: arial;
|
||||
height:18px;
|
||||
font-size:7pt;
|
||||
}
|
||||
|
||||
.ctlbtn:hover {
|
||||
|
|
|
@ -172,16 +172,16 @@ dt.fnUpdate(args.data,index);dt.fnAdjustColumnSizing();break;case"del":dt.fnDele
|
|||
if(iserr){obj.errs++;if(obj.errs<3){obj.bootstrap(obj.user_obj);}}else{obj.errs=0;}};la.onChange(la,{action:"init"});};var CONFMAN_SERNO=1;$.verto.confMan=function(verto,params){var confMan=this;conf
|
||||
confMan.params=$.extend({tableID:null,statusID:null,mainModID:null,dialog:null,hasVid:false,laData:null,onBroadcast:null,onLaChange:null,onLaRow:null},params);confMan.verto=verto;confMan.serno=CONFMAN_SERNO++;function genMainMod(jq){var play_id="play_"+confMan.serno;var stop_id="stop_"+confMan.serno;var recording_id="recording_"+confMan.serno;var rec_stop_id="recording_stop"+confMan.serno;var div_id="confman_"+confMan.serno;var html="<div id='"+div_id+"'><br>"+"<button class='ctlbtn' id='"+play_id+"'>Play</button>"+"<button class='ctlbtn' id='"+stop_id+"'>Stop</button>"+"<button class='ctlbtn' id='"+recording_id+"'>Record</button>"+"<button class='ctlbtn' id='"+rec_stop_id+"'>Record Stop</button>"
|
||||
+"<br><br></div>";jq.html(html);$("#"+play_id).click(function(){var file=prompt("Please enter file name","");confMan.modCommand("play",null,file);});$("#"+stop_id).click(function(){confMan.modCommand("stop",null,"all");});$("#"+recording_id).click(function(){var file=prompt("Please enter file name","");confMan.modCommand("recording",null,["start",file]);});$("#"+rec_stop_id).click(function(){confMan.modCommand("recording",null,["stop","all"]);});}
|
||||
function genControls(jq,rowid){var x=parseInt(rowid);var kick_id="kick_"+x;var tmute_id="tmute_"+x;var box_id="box_"+x;var volup_id="volume_in_up"+x;var voldn_id="volume_in_dn"+x;var html="<div id='"+box_id+"'>"+"<button class='ctlbtn' id='"+kick_id+"'>KICK</button>"+"<button class='ctlbtn' id='"+tmute_id+"'>MUTE</button>"+"<button class='ctlbtn' id='"+voldn_id+"'>vol -</button>"+"<button class='ctlbtn' id='"+volup_id+"'>vol +</button>"+"</div>";jq.html(html);if(!jq.data("mouse")){$("#"+box_id).hide();}
|
||||
jq.mouseover(function(e){jq.data({"mouse":true});$("#"+box_id).show();});jq.mouseout(function(e){jq.data({"mouse":false});$("#"+box_id).hide();});$("#"+kick_id).click(function(){confMan.modCommand("kick",x);});$("#"+tmute_id).click(function(){confMan.modCommand("tmute",x);});$("#"+volup_id).click(function(){confMan.modCommand("volume_in",x,"up");});$("#"+voldn_id).click(function(){confMan.modCommand("volume_in",x,"down");});return html;}
|
||||
function genControls(jq,rowid){var x=parseInt(rowid);var kick_id="kick_"+x;var tmute_id="tmute_"+x;var box_id="box_"+x;var volup_id="volume_in_up"+x;var voldn_id="volume_in_dn"+x;var transfer_id="transfer"+x;var html="<div id='"+box_id+"'>"+"<button class='ctlbtn' id='"+kick_id+"'>Kick</button>"+"<button class='ctlbtn' id='"+tmute_id+"'>Mute</button>"+"<button class='ctlbtn' id='"+voldn_id+"'>Vol -</button>"+"<button class='ctlbtn' id='"+volup_id+"'>Vol +</button>"+"<button class='ctlbtn' id='"+transfer_id+"'>Transfer</button>"+"</div>";jq.html(html);if(!jq.data("mouse")){$("#"+box_id).hide();}
|
||||
jq.mouseover(function(e){jq.data({"mouse":true});$("#"+box_id).show();});jq.mouseout(function(e){jq.data({"mouse":false});$("#"+box_id).hide();});$("#"+transfer_id).click(function(){var xten=prompt("Enter Extension");confMan.modCommand("transfer",x,xten);});$("#"+kick_id).click(function(){confMan.modCommand("kick",x);});$("#"+tmute_id).click(function(){confMan.modCommand("tmute",x);});$("#"+volup_id).click(function(){confMan.modCommand("volume_in",x,"up");});$("#"+voldn_id).click(function(){confMan.modCommand("volume_in",x,"down");});return html;}
|
||||
var atitle="";var awidth=0;$(".jsDataTable").width(confMan.params.hasVid?"900px":"800px");if(confMan.params.laData.role==="moderator"){atitle="Action";awidth=200;if(confMan.params.mainModID){genMainMod($(confMan.params.mainModID));$(confMan.params.displayID).html("Moderator Controls Ready<br><br>")}else{$(confMan.params.mainModID).html("");}
|
||||
verto.subscribe(confMan.params.laData.modChannel,{handler:function(v,e){console.error("MODDATA:",e.data);if(confMan.params.onBroadcast){confMan.params.onBroadcast(verto,confMan,e.data);}
|
||||
if(confMan.params.displayID){$(confMan.params.displayID).html(e.data.response+"<br><br>");if(confMan.lastTimeout){clearTimeout(confMan.lastTimeout);confMan.lastTimeout=0;}
|
||||
confMan.lastTimeout=setTimeout(function(){$(confMan.params.displayID).html("Moderator Controls Ready<br><br>")},4000);}}});}
|
||||
if(!confMan.destroyed&&confMan.params.displayID){$(confMan.params.displayID).html(e.data.response+"<br><br>");if(confMan.lastTimeout){clearTimeout(confMan.lastTimeout);confMan.lastTimeout=0;}
|
||||
confMan.lastTimeout=setTimeout(function(){$(confMan.params.displayID).html(confMan.destroyed?"":"Moderator Controls Ready<br><br>")},4000);}}});}
|
||||
var row_callback=null;if(confMan.params.laData.role==="moderator"){row_callback=function(nRow,aData,iDisplayIndex,iDisplayIndexFull){if(!aData[5]){var $row=$('td:eq(5)',nRow);genControls($row,aData);if(confMan.params.onLaRow){confMan.params.onLaRow(verto,confMan,$row,aData);}}};}
|
||||
confMan.lt=new $.verto.liveTable(verto,confMan.params.laData.laChannel,confMan.params.laData.laName,$(confMan.params.tableID),{subParams:{callID:confMan.params.dialog?confMan.params.dialog.callID:null},"onChange":function(obj,args){$(confMan.params.statusID).text("Conference Members: "+" ("+obj.arrayLen()+" Total)");if(confMan.params.onLaChange){confMan.params.onLaChange(verto,confMan,$.verto.enum.confEvent.laChange,obj,args);}},"aaData":[],"aoColumns":[{"sTitle":"ID"},{"sTitle":"Number"},{"sTitle":"Name"},{"sTitle":"Codec"},{"sTitle":"Status","sWidth":confMan.params.hasVid?"300px":"150px"},{"sTitle":atitle,"sWidth":awidth,}],"bAutoWidth":true,"bDestroy":true,"bSort":false,"bInfo":false,"bFilter":false,"bLengthChange":false,"bPaginate":false,"iDisplayLength":1000,"oLanguage":{"sEmptyTable":"The Conference is Empty....."},"fnRowCallback":row_callback});}
|
||||
$.verto.confMan.prototype.modCommand=function(cmd,id,value){var confMan=this;confMan.verto.sendMethod("verto.broadcast",{"eventChannel":confMan.params.laData.modChannel,"data":{"application":"conf-control","command":cmd,"id":id,"value":value}});}
|
||||
$.verto.confMan.prototype.destroy=function(){var confMan=this;if(confMan.lt){confMan.lt.destroy();}
|
||||
$.verto.confMan.prototype.destroy=function(){var confMan=this;confMan.destroyed=true;if(confMan.lt){confMan.lt.destroy();}
|
||||
if(confMan.params.laData.modChannel){confMan.verto.unsubscribe(confMan.params.laData.modChannel);}
|
||||
if(confMan.params.mainModID){$(confMan.params.mainModID).html("");}}
|
||||
$.verto.dialog=function(direction,verto,params){var dialog=this;dialog.params=$.extend({useVideo:verto.options.useVideo,useStereo:verto.options.useStereo,tag:verto.options.tag},params);dialog.verto=verto;dialog.direction=direction;dialog.lastState=null;dialog.state=dialog.lastState=$.verto.enum.state.new;dialog.callbacks=verto.callbacks;dialog.answered=false;dialog.attach=params.attach||false;if(dialog.params.callID){dialog.callID=dialog.params.callID;}else{dialog.callID=dialog.params.callID=generateGUID();}
|
||||
|
|
|
@ -1192,13 +1192,15 @@
|
|||
var box_id = "box_" + x;
|
||||
var volup_id = "volume_in_up" + x;
|
||||
var voldn_id = "volume_in_dn" + x;
|
||||
var transfer_id = "transfer" + x;
|
||||
|
||||
|
||||
var html = "<div id='" + box_id + "'>" +
|
||||
"<button class='ctlbtn' id='" + kick_id + "'>KICK</button>" +
|
||||
"<button class='ctlbtn' id='" + tmute_id + "'>MUTE</button>" +
|
||||
"<button class='ctlbtn' id='" + voldn_id + "'>vol -</button>" +
|
||||
"<button class='ctlbtn' id='" + volup_id + "'>vol +</button>" +
|
||||
"<button class='ctlbtn' id='" + kick_id + "'>Kick</button>" +
|
||||
"<button class='ctlbtn' id='" + tmute_id + "'>Mute</button>" +
|
||||
"<button class='ctlbtn' id='" + voldn_id + "'>Vol -</button>" +
|
||||
"<button class='ctlbtn' id='" + volup_id + "'>Vol +</button>" +
|
||||
"<button class='ctlbtn' id='" + transfer_id + "'>Transfer</button>" +
|
||||
"</div>"
|
||||
;
|
||||
|
||||
|
@ -1218,6 +1220,11 @@
|
|||
$("#" + box_id).hide();
|
||||
});
|
||||
|
||||
$("#" + transfer_id).click(function() {
|
||||
var xten = prompt("Enter Extension");
|
||||
confMan.modCommand("transfer", x, xten);
|
||||
});
|
||||
|
||||
$("#" + kick_id).click(function() {
|
||||
confMan.modCommand("kick", x);
|
||||
});
|
||||
|
@ -1261,13 +1268,13 @@
|
|||
if (confMan.params.onBroadcast) {
|
||||
confMan.params.onBroadcast(verto, confMan, e.data);
|
||||
}
|
||||
if (confMan.params.displayID) {
|
||||
if (!confMan.destroyed && confMan.params.displayID) {
|
||||
$(confMan.params.displayID).html(e.data.response + "<br><br>");
|
||||
if (confMan.lastTimeout) {
|
||||
clearTimeout(confMan.lastTimeout);
|
||||
confMan.lastTimeout = 0;
|
||||
}
|
||||
confMan.lastTimeout = setTimeout(function() { $(confMan.params.displayID).html("Moderator Controls Ready<br><br>")}, 4000);
|
||||
confMan.lastTimeout = setTimeout(function() { $(confMan.params.displayID).html(confMan.destroyed ? "" : "Moderator Controls Ready<br><br>")}, 4000);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1361,6 +1368,8 @@
|
|||
$.verto.confMan.prototype.destroy = function() {
|
||||
var confMan = this;
|
||||
|
||||
confMan.destroyed = true;
|
||||
|
||||
if (confMan.lt) {
|
||||
confMan.lt.destroy();
|
||||
}
|
||||
|
|
|
@ -1590,6 +1590,22 @@ static void conference_mod_event_channel_handler(const char *event_channel, cJSO
|
|||
argv[1] = "all";
|
||||
}
|
||||
exec = switch_mprintf("%s %s %s %s", conf_name, action, argv[0], argv[1]);
|
||||
|
||||
} else if (!strcasecmp(action, "transfer") && cid) {
|
||||
conference_member_t *member;
|
||||
conference_obj_t *conference;
|
||||
|
||||
exec = switch_mprintf("%s %s %s", argv[0], switch_str_nil(argv[1]), switch_str_nil(argv[2]));
|
||||
stream.write_function(&stream, "+OK Call transferred to %s", argv[0]);
|
||||
|
||||
if ((conference = conference_find(conf_name, NULL))) {
|
||||
if ((member = conference_member_get(conference, cid))) {
|
||||
switch_ivr_session_transfer(member->session, argv[0], argv[1], argv[2]);
|
||||
switch_thread_rwlock_unlock(member->rwlock);
|
||||
}
|
||||
switch_thread_rwlock_unlock(conference->rwlock);
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (exec) {
|
||||
|
|
Loading…
Reference in New Issue