*/
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(_In_ switch_endpoint_interface_t *endpoint_interface,
_In_ switch_call_direction_t direction,
- _Inout_opt_ switch_memory_pool_t **pool, _In_opt_z_ const char *use_uuid);
-#define switch_core_session_request(_ep, _d, _p) switch_core_session_request_uuid(_ep, _d, _p, NULL)
+ switch_originate_flag_t originate_flags,
+ _Inout_opt_ switch_memory_pool_t **pool,
+ _In_opt_z_ const char *use_uuid);
+#define switch_core_session_request(_ep, _d, _f, _p) switch_core_session_request_uuid(_ep, _d, _f, _p, NULL)
SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(_In_ switch_core_session_t *session, _In_z_ const char *use_uuid);
SOF_NOBLOCK = (1 << 0),
SOF_FORKED_DIAL = (1 << 1),
SOF_NO_EFFECTIVE_CID_NUM = (1 << 2),
- SOF_NO_EFFECTIVE_CID_NAME = (1 << 3)
+ SOF_NO_EFFECTIVE_CID_NAME = (1 << 3),
+ SOF_NO_LIMITS = (1 << 4)
} switch_originate_flag_enum_t;
typedef uint32_t switch_originate_flag_t;
if (conference == NULL) {
char *dialstr = switch_mprintf("{ignore_early_media=true}%s", bridgeto);
- status = switch_ivr_originate(NULL, &peer_session, cause, dialstr, 60, NULL, cid_name, cid_num, NULL, NULL, SOF_NONE, NULL);
+ status = switch_ivr_originate(NULL, &peer_session, cause, dialstr, 60, NULL, cid_name, cid_num, NULL, NULL, SOF_NO_LIMITS, NULL);
switch_safe_free(dialstr);
if (status != SWITCH_STATUS_SUCCESS) {
/* establish an outbound call leg */
- if (switch_ivr_originate(session, &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num, NULL, NULL, SOF_NONE, NULL) !=
+ if (switch_ivr_originate(session, &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num, NULL, NULL, SOF_NO_LIMITS, NULL) !=
SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n",
switch_channel_cause2str(*cause));
switch_event_destroy(&event);
}
+ if ((flags & SOF_NO_LIMITS)) {
+ myflags |= SOF_NO_LIMITS;
+ }
+
if ((flags & SOF_FORKED_DIAL)) {
myflags |= SOF_NOBLOCK;
}
switch_call_cause_t *cancel_cause)
{
- if ((*new_session = switch_core_session_request(&channel_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
+ if ((*new_session = switch_core_session_request(&channel_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) {
private_t *tech_pvt;
switch_channel_t *channel;
switch_caller_profile_t *caller_profile;
}
dest = argv[0];
- if ((session = switch_core_session_request(&channel_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
+ if ((session = switch_core_session_request(&channel_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)) != 0) {
private_t *tech_pvt;
switch_channel_t *channel;
char *dialplan = globals.dialplan;
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
switch_call_cause_t *cancel_cause)
{
- if ((*new_session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
+ if ((*new_session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) {
struct private_object *tech_pvt;
switch_channel_t *channel;
switch_caller_profile_t *caller_profile = NULL;
goto done;
}
- if ((session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
+ if ((session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)) != 0) {
switch_core_session_add_stream(session, NULL);
if ((tech_pvt = (struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) {
switch_assert(tech_pvt != NULL);
tech_pvt->ib_calls++;
- if ((session = switch_core_session_request(gsmopen_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
+ if ((session = switch_core_session_request(gsmopen_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)) != 0) {
DEBUGA_GSMOPEN("2 SESSION_REQUEST %s\n", GSMOPEN_P_LOG, switch_core_session_get_uuid(session));
switch_core_session_add_stream(session, NULL);
channel = switch_core_session_get_channel(session);
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && !switch_test_flag(tech_pvt, TFLAG_BLEG)) {
- if (!(b_session = switch_core_session_request(loopback_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL))) {
+ if (!(b_session = switch_core_session_request(loopback_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Failure.\n");
goto end;
}
switch_channel_pre_answer(channel);
}
- if ((*new_session = switch_core_session_request(loopback_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
+ if ((*new_session = switch_core_session_request(loopback_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) {
private_t *tech_pvt;
switch_channel_t *channel;
switch_caller_profile_t *caller_profile;
switch_call_cause_t *cancel_cause)
{
- if ((*new_session = switch_core_session_request(portaudio_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
+ if ((*new_session = switch_core_session_request(portaudio_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) {
private_t *tech_pvt;
switch_channel_t *channel;
switch_caller_profile_t *caller_profile;
}
dest = argv[0];
- if ((session = switch_core_session_request(portaudio_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
+ if ((session = switch_core_session_request(portaudio_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)) != 0) {
private_t *tech_pvt;
switch_channel_t *channel;
char *dialplan = globals.dialplan;
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
switch_call_cause_t *cancel_cause)
{
- if ((*new_session = switch_core_session_request(reference_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
+ if ((*new_session = switch_core_session_request(reference_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) {
private_t *tech_pvt;
switch_channel_t *channel;
switch_caller_profile_t *caller_profile;
goto error;
}
- if (!(nsession = switch_core_session_request(skinny_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool))) {
+ if (!(nsession = switch_core_session_request(skinny_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n");
goto error;
}
switch_core_session_t *session = NULL;
switch_channel_t *channel = NULL;
- if ((session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
+ if ((session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)) != 0) {
switch_core_session_add_stream(session, NULL);
channel = switch_core_session_get_channel(session);
skypiax_tech_init(tech_pvt, session);
switch_call_cause_t *cancel_cause)
{
private_t *tech_pvt = NULL;
- if ((*new_session = switch_core_session_request(skypopen_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
+ if ((*new_session = switch_core_session_request(skypopen_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) {
switch_channel_t *channel = NULL;
switch_caller_profile_t *caller_profile;
char *rdest;
switch_core_session_t *session = NULL;
switch_channel_t *channel = NULL;
- if ((session = switch_core_session_request(skypopen_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
+ if ((session = switch_core_session_request(skypopen_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)) != 0) {
DEBUGA_SKYPE("2 SESSION_REQUEST %s\n", SKYPOPEN_P_LOG, switch_core_session_get_uuid(session));
switch_core_session_add_stream(session, NULL);
channel = switch_core_session_get_channel(session);
sofia_glue_recover(SWITCH_TRUE);
stream->write_function(stream, "Flushing recovery database.\n");
} else {
- int32_t old = 0, x = 0;
-
- switch_core_session_ctl(SCSC_SPS, &old);
-
- x = 10000000;
- switch_core_session_ctl(SCSC_SPS, &x);
-
x = sofia_glue_recover(SWITCH_FALSE);
if (x) {
} else {
stream->write_function(stream, "No calls to recover.\n");
}
-
- switch_core_session_ctl(SCSC_SPS, &old);
}
goto done;
goto error;
}
- if (!(nsession = switch_core_session_request(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool))) {
+ if (!(nsession = switch_core_session_request(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n");
goto error;
}
if (sofia_endpoint_interface) {
if (sofia_test_pflag(profile, PFLAG_CALLID_AS_UUID)) {
- session = switch_core_session_request_uuid(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL, sip->sip_call_id->i_id);
+ session = switch_core_session_request_uuid(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL, sip->sip_call_id->i_id);
} else {
- session = switch_core_session_request(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL);
+ session = switch_core_session_request(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL);
}
}
*sp = NULL;
- if (!(session = switch_core_session_request(openzap_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL))) {
+ if (!(session = switch_core_session_request(openzap_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Initialization Error!\n");
return ZAP_FAIL;
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "unicall_outgoing_channel(%p)\n", (void *) session);
- if ((*new_session = switch_core_session_request(unicall_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) == NULL) {
+ if ((*new_session = switch_core_session_request(unicall_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) == NULL) {
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
parse_array(flag_str, flags, CF_FLAG_MAX);
parse_array(cap_str, caps, CC_FLAG_MAX);
- if (!(session = switch_core_session_request_uuid(endpoint_interface, direction, pool, uuid))) {
+ if (!(session = switch_core_session_request_uuid(endpoint_interface, direction, SOF_NO_LIMITS, pool, uuid))) {
return NULL;
}
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_endpoint_interface_t
*endpoint_interface,
switch_call_direction_t direction,
+ switch_originate_flag_t originate_flags,
switch_memory_pool_t **pool, const char *use_uuid)
{
switch_memory_pool_t *usepool;
PROTECT_INTERFACE(endpoint_interface);
- switch_mutex_lock(runtime.throttle_mutex);
- count = session_manager.session_count;
- sps = --runtime.sps;
- switch_mutex_unlock(runtime.throttle_mutex);
+ if (!(originate_flags & SOF_NO_LIMITS)) {
+ switch_mutex_lock(runtime.throttle_mutex);
+ count = session_manager.session_count;
+ sps = --runtime.sps;
+ switch_mutex_unlock(runtime.throttle_mutex);
+
+ if (sps <= 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Throttle Error! %d\n", session_manager.session_count);
+ UNPROTECT_INTERFACE(endpoint_interface);
+ return NULL;
+ }
- if (sps <= 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Throttle Error! %d\n", session_manager.session_count);
- UNPROTECT_INTERFACE(endpoint_interface);
- return NULL;
+ if ((count + 1) > session_manager.session_limit) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Limit! %d\n", session_manager.session_limit);
+ UNPROTECT_INTERFACE(endpoint_interface);
+ return NULL;
+ }
}
- if ((count + 1) > session_manager.session_limit) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Limit! %d\n", session_manager.session_limit);
- UNPROTECT_INTERFACE(endpoint_interface);
- return NULL;
- }
if (pool && *pool) {
usepool = *pool;
return NULL;
}
- session = switch_core_session_request(endpoint_interface, direction, pool);
+ session = switch_core_session_request(endpoint_interface, direction, SOF_NONE, pool);
UNPROTECT_INTERFACE(endpoint_interface);
cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number");
}
+ if (flags & SOF_NO_LIMITS) {
+ dftflags |= SOF_NO_LIMITS;
+ }
+
if (cid_num_override) {
dftflags |= SOF_NO_EFFECTIVE_CID_NUM;
}
-
+
if (cid_name_override) {
dftflags |= SOF_NO_EFFECTIVE_CID_NAME;
}
if (and_argc > 1 || or_argc > 1) {
myflags |= SOF_FORKED_DIAL;
- } else if (var_event) {
+ }
+
+ if (var_event) {
const char *vvar;
if ((vvar = switch_event_get_header(var_event, "forked_dial")) && switch_true(vvar)) {
myflags |= SOF_FORKED_DIAL;
}
+ if ((vvar = switch_event_get_header(var_event, "no_throttle_limits")) && switch_true(vvar)) {
+ myflags |= SOF_NO_LIMITS;
+ }
}
/* only valid in [] since it's unique to each channel leg */