tweak some cid display issues
This commit is contained in:
parent
eccf505a3b
commit
7bbdbadb42
|
@ -188,7 +188,8 @@ if(confMan.params.laData.modChannel){confMan.verto.unsubscribe(confMan.params.la
|
|||
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,login:verto.options.login},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();}
|
||||
if(dialog.params.tag){dialog.audioStream=document.getElementById(dialog.params.tag);if(dialog.params.useVideo){dialog.videoStream=dialog.audioStream;}}
|
||||
dialog.verto.dialogs[dialog.callID]=dialog;var RTCcallbacks={};if(dialog.direction==$.verto.enum.direction.inbound){dialog.params.remote_caller_id_name=dialog.params.caller_id_name;dialog.params.remote_caller_id_number=dialog.params.caller_id_number;if(!dialog.params.remote_caller_id_name){dialog.params.remote_caller_id_name="Nobody";}
|
||||
dialog.verto.dialogs[dialog.callID]=dialog;var RTCcallbacks={};if(dialog.direction==$.verto.enum.direction.inbound){if(dialog.params.display_direction==="outbound"){dialog.params.remote_caller_id_name=dialog.params.caller_id_name;dialog.params.remote_caller_id_number=dialog.params.caller_id_number;}else{dialog.params.remote_caller_id_name=dialog.params.callee_id_name;dialog.params.remote_caller_id_number=dialog.params.callee_id_number;}
|
||||
if(!dialog.params.remote_caller_id_name){dialog.params.remote_caller_id_name="Nobody";}
|
||||
if(!dialog.params.remote_caller_id_number){dialog.params.remote_caller_id_number="UNKNOWN";}
|
||||
RTCcallbacks.onMessage=function(rtc,msg){console.debug(msg);};RTCcallbacks.onAnswerSDP=function(rtc,sdp){console.error("answer sdp",sdp);};}else{dialog.params.remote_caller_id_name="Outbound Call";dialog.params.remote_caller_id_number=dialog.params.destination_number;}
|
||||
RTCcallbacks.onICESDP=function(rtc){if(rtc.type=="offer"){console.log("offer",rtc.mediaData.SDP);dialog.setState($.verto.enum.state.requesting);dialog.sendMethod("verto.invite",{sdp:rtc.mediaData.SDP});}else{dialog.setState($.verto.enum.state.answering);dialog.sendMethod(dialog.attach?"verto.attach":"verto.answer",{sdp:dialog.rtc.mediaData.SDP});}};RTCcallbacks.onICE=function(rtc){if(rtc.type=="offer"){console.log("offer",rtc.mediaData.candidate);return;}};RTCcallbacks.onError=function(e){console.error("ERROR:",e);dialog.hangup();};dialog.rtc=new $.FSRTC({callbacks:RTCcallbacks,useVideo:dialog.videoStream,useAudio:dialog.audioStream,useStereo:dialog.params.useStereo,videoParams:verto.options.videoParams,iceServers:verto.options.iceServers});dialog.rtc.verto=dialog.verto;if(dialog.direction==$.verto.enum.direction.inbound){if(dialog.attach){dialog.answer();}else{dialog.ring();}}};$.verto.dialog.prototype.invite=function(){var dialog=this;dialog.rtc.call();};$.verto.dialog.prototype.sendMethod=function(method,obj){var dialog=this;obj.dialogParams={};for(var i in dialog.params){if(i=="sdp"&&method!="verto.invite"&&method!="verto.attach"){continue;}
|
||||
|
|
|
@ -1430,9 +1430,13 @@
|
|||
var RTCcallbacks = {};
|
||||
|
||||
if (dialog.direction == $.verto.enum.direction.inbound) {
|
||||
|
||||
dialog.params.remote_caller_id_name = dialog.params.caller_id_name;
|
||||
dialog.params.remote_caller_id_number = dialog.params.caller_id_number;
|
||||
if (dialog.params.display_direction === "outbound") {
|
||||
dialog.params.remote_caller_id_name = dialog.params.caller_id_name;
|
||||
dialog.params.remote_caller_id_number = dialog.params.caller_id_number;
|
||||
} else {
|
||||
dialog.params.remote_caller_id_name = dialog.params.callee_id_name;
|
||||
dialog.params.remote_caller_id_number = dialog.params.callee_id_number;
|
||||
}
|
||||
|
||||
if (!dialog.params.remote_caller_id_name) {
|
||||
dialog.params.remote_caller_id_name = "Nobody";
|
||||
|
|
|
@ -963,33 +963,25 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char *
|
|||
static void set_call_params(cJSON *params, verto_pvt_t *tech_pvt) {
|
||||
const char *caller_id_name = NULL;
|
||||
const char *caller_id_number = NULL;
|
||||
const char *callee_id_name = NULL;
|
||||
const char *callee_id_number = NULL;
|
||||
|
||||
caller_id_name = switch_channel_get_variable(tech_pvt->channel, "caller_id_name");
|
||||
caller_id_number = switch_channel_get_variable(tech_pvt->channel, "caller_id_number");
|
||||
callee_id_name = switch_channel_get_variable(tech_pvt->channel, "callee_id_name");
|
||||
callee_id_number = switch_channel_get_variable(tech_pvt->channel, "callee_id_number");
|
||||
|
||||
if (caller_id_name) cJSON_AddItemToObject(params, "caller_id_name", cJSON_CreateString(caller_id_name));
|
||||
if (caller_id_number) cJSON_AddItemToObject(params, "caller_id_number", cJSON_CreateString(caller_id_number));
|
||||
|
||||
if (callee_id_name) cJSON_AddItemToObject(params, "callee_id_name", cJSON_CreateString(callee_id_name));
|
||||
if (callee_id_number) cJSON_AddItemToObject(params, "callee_id_number", cJSON_CreateString(callee_id_number));
|
||||
|
||||
if (switch_channel_outbound_display(tech_pvt->channel)) {
|
||||
caller_id_name = switch_channel_get_variable(tech_pvt->channel, "caller_id_name");
|
||||
caller_id_number = switch_channel_get_variable(tech_pvt->channel, "caller_id_number");
|
||||
} else {
|
||||
caller_id_name = switch_channel_get_variable(tech_pvt->channel, "verto_remote_caller_id_name");
|
||||
caller_id_number = switch_channel_get_variable(tech_pvt->channel, "verto_remote_caller_id_number");
|
||||
cJSON_AddItemToObject(params, "display_direction",
|
||||
cJSON_CreateString(switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound"));
|
||||
|
||||
if (!caller_id_name) {
|
||||
caller_id_name = switch_channel_get_variable(tech_pvt->channel, "callee_id_name");
|
||||
}
|
||||
|
||||
if (!caller_id_number) {
|
||||
caller_id_number = switch_channel_get_variable(tech_pvt->channel, "callee_id_number");
|
||||
}
|
||||
}
|
||||
|
||||
if (zstr(caller_id_name)) {
|
||||
caller_id_name = "Outbound Call";
|
||||
}
|
||||
|
||||
if (zstr(caller_id_number)) {
|
||||
caller_id_number = switch_channel_get_variable(tech_pvt->channel, "destination_number");
|
||||
}
|
||||
|
||||
cJSON_AddItemToObject(params, "caller_id_name", cJSON_CreateString(caller_id_name));
|
||||
cJSON_AddItemToObject(params, "caller_id_number", cJSON_CreateString(caller_id_number));
|
||||
}
|
||||
|
||||
static jsock_t *get_jsock(const char *uuid)
|
||||
|
@ -1655,10 +1647,10 @@ static switch_status_t verto_on_init(switch_core_session_t *session)
|
|||
{
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
verto_pvt_t *tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY);
|
||||
|
||||
|
||||
if (switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING_BRIDGE) || switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING)) {
|
||||
int tries = 120;
|
||||
|
||||
|
||||
switch_core_session_clear_crypto(session);
|
||||
|
||||
while(--tries > 0) {
|
||||
|
@ -1883,8 +1875,12 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_
|
|||
|
||||
if (name || number) {
|
||||
jmsg = jrpc_new_req("verto.display", tech_pvt->call_id, ¶ms);
|
||||
switch_ivr_eavesdrop_update_display(session, name, number);
|
||||
switch_channel_set_variable(tech_pvt->channel, "last_sent_display_name", name);
|
||||
switch_channel_set_variable(tech_pvt->channel, "last_sent_display_number", number);
|
||||
cJSON_AddItemToObject(params, "display_name", cJSON_CreateString(name));
|
||||
cJSON_AddItemToObject(params, "display_number", cJSON_CreateString(number));
|
||||
set_call_params(params, tech_pvt);
|
||||
jsock_queue_event(jsock, &jmsg, SWITCH_TRUE);
|
||||
}
|
||||
|
||||
|
|
|
@ -1691,7 +1691,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
|
|||
|
||||
|
||||
if (switch_channel_direction(originator_channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(originator_channel, CF_DIALPLAN)) {
|
||||
switch_channel_flip_cid(originator_channel);
|
||||
if (!switch_channel_test_flag(originator_channel, CF_RECOVERING_BRIDGE)) {
|
||||
switch_channel_flip_cid(originator_channel);
|
||||
}
|
||||
switch_channel_set_flag(originator_channel, CF_DIALPLAN);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue