]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
tweak some cid display issues
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 18 Aug 2014 22:25:24 +0000 (03:25 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 18 Aug 2014 22:25:28 +0000 (03:25 +0500)
html5/verto/demo/js/verto-min.js
html5/verto/js/src/jquery.verto.js
src/mod/endpoints/mod_verto/mod_verto.c
src/switch_ivr_bridge.c

index c42c4c88c17ebddaa0c759c5247be8b4f2922589..01ee8b57a4ca251ec554ea47bd87e662bca849a4 100644 (file)
@@ -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;}
index 45307032576c2285663cd0f04f2aedd70d9f641e..c09d4f5756a0a6164392665206f5e582e0fcacac 100644 (file)
         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";
index 0850cce94860016ea50a89d449447cf62046df3f..2782380ba7e424acb731c437e1b9eb5e2c536618 100644 (file)
@@ -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;
-       
-       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");
+       const char *callee_id_name = NULL;
+       const char *callee_id_number = NULL;
 
-               if (!caller_id_name) {
-                       caller_id_name = switch_channel_get_variable(tech_pvt->channel, "callee_id_name");
-               }
+       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_number) {
-                       caller_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));
+       
+       cJSON_AddItemToObject(params, "display_direction", 
+                                                 cJSON_CreateString(switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound"));
 
-       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, &params);
+                                       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);
                                }
 
index 9c238ff16abac73bc237d87d3e001e5f8994a4f8..360223c30fdb08d3f470e41e5bdabc0726d80b4d 100644 (file)
@@ -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);
                        }