这篇教程C++ switch_core_session_rwunlock函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中switch_core_session_rwunlock函数的典型用法代码示例。如果您正苦于以下问题:C++ switch_core_session_rwunlock函数的具体用法?C++ switch_core_session_rwunlock怎么用?C++ switch_core_session_rwunlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了switch_core_session_rwunlock函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: loopback_bowout_on_execute_state_handlerstatic switch_status_t loopback_bowout_on_execute_state_handler(switch_core_session_t *session){ switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_state_t state = switch_channel_get_state(channel); private_t *tech_pvt = NULL; if (state == CS_EXECUTE) { const char *uuid; switch_core_session_t *other_session = NULL; switch_channel_t *b_channel = NULL; tech_pvt = switch_core_session_get_private(session); if (switch_core_session_read_lock(tech_pvt->other_session) == SWITCH_STATUS_SUCCESS) { b_channel = switch_core_session_get_channel(tech_pvt->other_session); /* Wait for b_channel to be fully bridged */ switch_channel_wait_for_flag(b_channel, CF_BRIDGED, SWITCH_TRUE, 5000, NULL); uuid = switch_channel_get_partner_uuid(b_channel); if (uuid && (other_session = switch_core_session_locate(uuid))) { switch_channel_t *other_channel = switch_core_session_get_channel(other_session); switch_caller_profile_t *cp, *clone; switch_channel_wait_for_state(other_channel, NULL, CS_EXCHANGE_MEDIA); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->other_session), SWITCH_LOG_INFO, "Replacing loopback channel: %s with real channel: %s/n", switch_channel_get_name(b_channel), switch_channel_get_name(other_channel)); if ((cp = switch_channel_get_caller_profile(channel))) { clone = switch_caller_profile_clone(other_session, cp); clone->originator_caller_profile = NULL; clone->originatee_caller_profile = NULL; switch_channel_set_caller_profile(other_channel, clone); } switch_channel_caller_extension_masquerade(channel, other_channel, 0); switch_channel_set_state(other_channel, CS_RESET); switch_channel_wait_for_state(other_channel, NULL, CS_RESET); switch_channel_set_variable(channel, "process_cdr", "false"); switch_channel_set_variable(b_channel, "process_cdr", "false"); switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); switch_channel_set_state(other_channel, CS_EXECUTE); switch_core_session_rwunlock(other_session); } switch_core_session_rwunlock(tech_pvt->other_session); } switch_core_event_hook_remove_state_change(session, loopback_bowout_on_execute_state_handler); } return SWITCH_STATUS_SUCCESS;}
开发者ID:hsaid,项目名称:FreeSWITCH,代码行数:56,
示例2: channel_on_hangupstatic switch_status_t channel_on_hangup(switch_core_session_t *session){ switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP/n", switch_channel_get_name(channel)); switch_clear_flag_locked(tech_pvt, TFLAG_LINKED); switch_mutex_lock(tech_pvt->mutex); if (tech_pvt->other_tech_pvt) { switch_clear_flag_locked(tech_pvt->other_tech_pvt, TFLAG_LINKED); tech_pvt->other_tech_pvt = NULL; } if (tech_pvt->other_session) { switch_channel_hangup(tech_pvt->other_channel, switch_channel_get_cause(channel)); switch_core_session_rwunlock(tech_pvt->other_session); tech_pvt->other_channel = NULL; tech_pvt->other_session = NULL; } switch_mutex_unlock(tech_pvt->mutex); return SWITCH_STATUS_SUCCESS;}
开发者ID:gujun,项目名称:sscore,代码行数:30,
示例3: fs_switch_ivr_originateint fs_switch_ivr_originate(switch_core_session_t *session, switch_core_session_t **bleg, char *bridgeto, uint32_t timelimit_sec)/*const switch_state_handler_table_t *table, char * cid_name_override, char * cid_num_override, switch_caller_profile_t *caller_profile_override) */{ switch_channel_t *caller_channel; switch_core_session_t *peer_session; unsigned int timelimit = 60; char *var; switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING; caller_channel = switch_core_session_get_channel(session); assert(caller_channel != NULL); if ((var = switch_channel_get_variable(caller_channel, "call_timeout"))) { timelimit = atoi(var); } if (switch_ivr_originate(session, &peer_session, &cause, bridgeto, timelimit, NULL, NULL, NULL, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Cannot Create Outgoing Channel!/n"); switch_channel_hangup(caller_channel, SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL); return; } else { switch_ivr_multi_threaded_bridge(session, peer_session, NULL, NULL, NULL); switch_core_session_rwunlock(peer_session); }}
开发者ID:PauloFer1,项目名称:FreeSWITCH,代码行数:29,
示例4: event_handlerstatic void event_handler(switch_event_t *event){ if (process_event(event) != SWITCH_STATUS_SUCCESS) { const char *peer_uuid = switch_event_get_header(event, "variable_signal_bond"); switch_core_session_t *peer_session = NULL; switch_channel_t *peer_channel = NULL; switch_event_t *peer_event = NULL; if (!peer_uuid) { return; } if (!(peer_session = switch_core_session_locate(peer_uuid))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cant locate peer session for uuid %s/n", peer_uuid); return; } peer_channel = switch_core_session_get_channel(peer_session); if (switch_event_create(&peer_event, SWITCH_EVENT_CHANNEL_BRIDGE) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cant create bridge event for peer channel %s/n", peer_uuid); goto end; } switch_channel_event_set_data(peer_channel, peer_event); end: switch_core_session_rwunlock(peer_session); if (peer_event) { process_event(peer_event); switch_event_destroy(&peer_event); } }}
开发者ID:Deepwalker,项目名称:FreeSWITCH,代码行数:35,
示例5: process_eventstatic switch_status_t process_event(switch_event_t *event){ switch_core_session_t *session = NULL; switch_channel_t *channel; char *username[3] = { 0 }; char *domain[3] = { 0 }; char key[512]; char *uuid = NULL, *my_uuid = NULL; int i; switch_thread_rwlock_rdlock(globals.spy_hash_lock); if (!globals.spy_count) { goto done; } username[0] = switch_event_get_header(event, "Caller-Username"); domain[0] = switch_event_get_header(event, "variable_domain_name"); domain[1] = switch_event_get_header(event, "variable_dialed_domain"); username[1] = switch_event_get_header(event, "variable_dialed_user"); username[2] = switch_event_get_header(event, "variable_user_name"); domain[2] = switch_event_get_header(event, "variable_domain_name"); for (i = 0; i < 3; i++) { if (username[i] && domain[i]) { switch_snprintf(key, sizeof(key), "%[email C++ switch_core_strdup函数代码示例 C++ switch_core_session_get_uuid函数代码示例
|