]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9894 [mod_callcenger] fix call timeout if agent contact as leg_timeout to higger...
authorAntónio Silva <asilva@wirelessmundi.com>
Mon, 15 Apr 2019 14:15:43 +0000 (16:15 +0200)
committerAntónio Silva <asilva@wirelessmundi.com>
Mon, 15 Apr 2019 14:15:43 +0000 (16:15 +0200)
src/mod/applications/mod_callcenter/mod_callcenter.c

index bc320eb0d2766be2370645912cc04009efd4a108..b3f5ca6fee90dabdf4956ded764071c9607a2a0a 100644 (file)
@@ -435,6 +435,7 @@ static struct {
        switch_mutex_t *mutex;
        switch_memory_pool_t *pool;
        switch_event_node_t *node;
+       int agent_originate_timeout;
 } globals;
 
 #define CC_QUEUE_CONFIGITEM_COUNT 100
@@ -1495,6 +1496,8 @@ static switch_status_t load_config(void)
                                globals.global_database_lock = switch_true(val);
                        } else if (!strcasecmp(var, "cc-instance-id")) {
                                globals.cc_instance_id = strdup(val);
+                       } else if (!strcasecmp(var, "agent-originate-timeout")) {
+                               globals.agent_originate_timeout = atoi(val);
                        }
                }
        }
@@ -1511,9 +1514,11 @@ static switch_status_t load_config(void)
        }
 
        if (!globals.global_database_lock) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disabling global database lock\n");
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disabling global database lock\n");
        }
 
+       if (!globals.agent_originate_timeout) globals.agent_originate_timeout = 60;
+
        /* Initialize database */
        if (!(dbh = cc_get_db_handle())) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot open DB!\n");
@@ -1707,7 +1712,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa
 
                dialstr = switch_channel_expand_variables(member_channel, h->originate_string);
                switch_channel_set_app_flag_key(CC_APP_KEY, member_channel, CC_APP_AGENT_CONNECTING);
-               status = switch_ivr_originate(NULL, &agent_session, &cause, dialstr, 60, NULL, cid_name ? cid_name : h->member_cid_name, cid_number ? cid_number : h->member_cid_number, NULL, ovars, SOF_NONE, NULL, NULL);
+               status = switch_ivr_originate(NULL, &agent_session, &cause, dialstr, globals.agent_originate_timeout, NULL, cid_name ? cid_name : h->member_cid_name, cid_number ? cid_number : h->member_cid_number, NULL, ovars, SOF_NONE, NULL, NULL);
 
                /* Search for loopback agent */
                if (status == SWITCH_STATUS_SUCCESS) {