]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
endless cid fun
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 5 Apr 2013 13:28:49 +0000 (08:28 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 5 Apr 2013 13:28:49 +0000 (08:28 -0500)
src/include/switch_channel.h
src/include/switch_types.h
src/mod/applications/mod_fifo/mod_fifo.c
src/switch_channel.c
src/switch_ivr_bridge.c

index 4eac1643b8506cb26ae0ace07763c2cb7eb30189..0fe6bdda9e0047cd9ba76367db3a40f36f106695 100644 (file)
@@ -335,7 +335,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_caller_extension_masquerade(switc
 SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension);
 
 SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel);
-SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel, switch_bool_t in);
+SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel);
 
 /*!
   \brief Retrieve caller extension from a given channel
index 903d083ccb091075751578f83027653d8d5bf253..51a9621142a417a4691fefafb1a78c4a61d0eeb1 100644 (file)
@@ -1251,6 +1251,7 @@ typedef enum {
        CF_JITTERBUFFER,
        CF_JITTERBUFFER_PLC,
        CF_DIALPLAN,
+       CF_BLEG,
        CF_BLOCK_BROADCAST_UNTIL_MEDIA,
        CF_CNG_PLC,
        CF_ATTENDED_TRANSFER,
index 87b4d14da21e215d0ccf83bf77b9ad9790c52767..084f16cfcbb85c426d8a115e92daff86579e85e7 100644 (file)
@@ -2997,6 +2997,10 @@ SWITCH_STANDARD_APP(fifo_function)
                                        
                                        originatee_cp->callee_id_name = tname;
                                        originatee_cp->callee_id_number = tnum;
+
+                                       if (switch_channel_direction(other_channel) == SWITCH_CALL_DIRECTION_INBOUND) {
+                                               switch_channel_set_flag(other_channel, CF_BLEG);
+                                       }
                                }
 
 
index 64e58d0cfeee005c235e6a7b2cf97bb0fc66c59f..0a664994ea40daccc5659e27b8573c9a6a26777d 100644 (file)
@@ -2891,26 +2891,16 @@ SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel)
 
 }
 
-SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel, switch_bool_t in)
+SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel)
 {
 
-       if (in) {
-               if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(channel, CF_DIALPLAN)) {
-                       switch_channel_set_flag(channel, CF_DIALPLAN);
-                       switch_channel_flip_cid(channel);
-               }
-
-               return;
-       }
-
-       if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND && switch_channel_test_flag(channel, CF_DIALPLAN)) {
-               switch_channel_clear_flag(channel, CF_DIALPLAN);
-               switch_mutex_lock(channel->profile_mutex);
-               channel->caller_profile->callee_id_name = SWITCH_BLANK_STRING;
-               channel->caller_profile->callee_id_number = SWITCH_BLANK_STRING;
-               switch_mutex_unlock(channel->profile_mutex);
+       if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND && switch_channel_test_flag(channel, CF_BLEG)) {
+               switch_channel_flip_cid(channel);
+               switch_channel_clear_flag(channel, CF_BLEG);
+       } else if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(channel, CF_DIALPLAN)) {
+               switch_channel_set_flag(channel, CF_DIALPLAN);
+               switch_channel_flip_cid(channel);
        }
-       
 }
 
 SWITCH_DECLARE(switch_caller_extension_t *) switch_channel_get_queued_extension(switch_channel_t *channel)
@@ -2939,7 +2929,7 @@ SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *chann
 {
        switch_assert(channel != NULL);
 
-       switch_channel_sort_cid(channel, SWITCH_TRUE);
+       switch_channel_sort_cid(channel);
        
        switch_mutex_lock(channel->profile_mutex);
        caller_extension->next = channel->caller_profile->caller_extension;
index 09a2140ec2a4b39acfea2fd1a11d1099d5d8131c..97364b14c05fd580b3cc7eb05311476f8174ec55 100644 (file)
@@ -1124,6 +1124,15 @@ static const switch_state_handler_table_t signal_bridge_state_handlers = {
 
 static void check_bridge_export(switch_channel_t *channel, switch_channel_t *peer_channel)
 {
+       switch_caller_profile_t *originator_cp, *originatee_cp;
+
+       originator_cp = switch_channel_get_caller_profile(channel);
+       originatee_cp = switch_channel_get_caller_profile(peer_channel);
+
+       originator_cp->callee_id_name = switch_core_strdup(originator_cp->pool, originatee_cp->callee_id_name);
+       originator_cp->callee_id_number = switch_core_strdup(originator_cp->pool, originatee_cp->callee_id_number);
+       
+
        switch_channel_process_export(peer_channel, channel, NULL, SWITCH_BRIDGE_EXPORT_VARS_VARIABLE);
        switch_channel_process_export(channel, peer_channel, NULL, SWITCH_BRIDGE_EXPORT_VARS_VARIABLE);
 }
@@ -1656,6 +1665,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
 
                                originatee_cp->callee_id_name = tname;
                                originatee_cp->callee_id_number = tnum;
+
+                               if (switch_channel_direction(originatee_channel) == SWITCH_CALL_DIRECTION_INBOUND) {
+                                       switch_channel_set_flag(originatee_channel, CF_BLEG);
+                               }
+
                        }