]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_callcenter: add cc_outbound_cid_name_prefix
authorTravis Cross <tc@traviscross.com>
Fri, 19 Aug 2011 05:28:39 +0000 (05:28 +0000)
committerTravis Cross <tc@traviscross.com>
Wed, 14 Mar 2012 05:08:23 +0000 (05:08 +0000)
Prefixes the displayed caller_id_name when calling outbound agents
without affecting the caller_id_name of the underlying member channel.

src/mod/applications/mod_callcenter/mod_callcenter.c

index 6942e1f61f4a26d4a65393a9548f51666bd843e5..277026a3c6eec16c39cd64142529bd57e332205c 100644 (file)
@@ -1445,6 +1445,14 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa
 
        /* CallBack Mode */
        if (!strcasecmp(h->agent_type, CC_AGENT_TYPE_CALLBACK)) {
+               switch_channel_t *member_channel = switch_core_session_get_channel(member_session);
+               char *cid_name = NULL;
+               const char *cid_name_prefix = NULL;
+               if ((cid_name_prefix = switch_channel_get_variable(member_channel, "cc_outbound_cid_name_prefix"))) {
+                       cid_name = switch_mprintf("%s%s", cid_name_prefix, h->member_cid_name);
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Setting outbound caller_id_name to: %s\n", cid_name);
+               }
+
                switch_event_create(&ovars, SWITCH_EVENT_REQUEST_PARAMS);
                switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_queue", "%s", h->queue_name);
                switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_member_uuid", "%s", h->member_uuid);
@@ -1460,9 +1468,9 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa
 
                t_agent_called = local_epoch_time_now(NULL);
                dialstr = switch_mprintf("%s", h->originate_string);
-               status = switch_ivr_originate(NULL, &agent_session, &cause, dialstr, 60, NULL, h->member_cid_name, h->member_cid_number, NULL, ovars, SOF_NONE, NULL);
-
+               status = switch_ivr_originate(NULL, &agent_session, &cause, dialstr, 60, NULL, cid_name ? cid_name : h->member_cid_name, h->member_cid_number, NULL, ovars, SOF_NONE, NULL);
                switch_safe_free(dialstr);
+               switch_safe_free(cid_name);
 
                switch_event_destroy(&ovars);
        /* UUID Standby Mode */