本文整理汇总了C++中CoreSession类的典型用法代码示例。如果您正苦于以下问题:C++ CoreSession类的具体用法?C++ CoreSession怎么用?C++ CoreSession使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CoreSession类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SWITCH_DECLARE
SWITCH_DECLARE(void) bridge(CoreSession &session_a, CoreSession &session_b)
{
switch_input_callback_function_t dtmf_func = NULL;
switch_input_args_t args;
switch_channel_t *channel_a = NULL, *channel_b = NULL;
const char *err = "Channels not ready\n";
if (session_a.allocated && session_a.session && session_b.allocated && session_b.session) {
channel_a = switch_core_session_get_channel(session_a.session);
channel_b = switch_core_session_get_channel(session_b.session);
if (switch_channel_ready(channel_a) && switch_channel_ready(channel_b)) {
session_a.begin_allow_threads();
if (!switch_channel_test_flag(channel_a, CF_OUTBOUND) && !switch_channel_media_ready(channel_a)) {
switch_channel_pre_answer(channel_a);
}
if (switch_channel_ready(channel_a) && switch_channel_ready(channel_b)) {
args = session_a.get_cb_args(); // get the cb_args data structure for session a
dtmf_func = args.input_callback; // get the call back function
err = NULL;
switch_ivr_multi_threaded_bridge(session_a.session, session_b.session, dtmf_func, args.buf, args.buf);
}
session_a.end_allow_threads();
}
}
if (err) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a.session), SWITCH_LOG_ERROR, "%s", err);
}
}
示例2: qWarning
void CoreNetworkConfig::save()
{
CoreSession *session = qobject_cast<CoreSession *>(parent());
if (!session) {
qWarning() << Q_FUNC_INFO << "No CoreSession set, cannot save network configuration!";
return;
}
Core::setUserSetting(session->user(), objectName(), toVariantMap());
}
示例3: save
void CoreHighlightRuleManager::save() const
{
CoreSession *session = qobject_cast<CoreSession *>(parent());
if (!session) {
qWarning() << "CoreHighlightRuleManager: unable to save HighlightRuleList. Parent is not a Coresession!";
return;
}
Core::setUserSetting(session->user(), "HighlightRuleList", initHighlightRuleList());
}
示例4: save
void CoreAliasManager::save() const
{
CoreSession *session = qobject_cast<CoreSession *>(parent());
if (!session) {
qWarning() << "CoreAliasManager: unable to save Aliases. Parent is not a Coresession!";
return;
}
Core::setUserSetting(session->user(), "Aliases", initAliases());
}
示例5: python_hanguphook
static switch_status_t python_hanguphook(switch_core_session_t *session_hungup)
{
switch_channel_t *channel = switch_core_session_get_channel(session_hungup);
CoreSession *coresession = NULL;
switch_channel_state_t state = switch_channel_get_state(channel);
if ((coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession"))) {
if (coresession->hook_state != state) {
coresession->hook_state = state;
coresession->check_hangup_hook();
}
}
return SWITCH_STATUS_SUCCESS;
}
示例6: HighlightRuleManager
CoreHighlightRuleManager::CoreHighlightRuleManager(CoreSession *parent)
: HighlightRuleManager(parent)
{
CoreSession *session = qobject_cast<CoreSession*>(parent);
if (!session) {
qWarning() << "CoreHighlightRuleManager: unable to load HighlightRuleList. Parent is not a Coresession!";
//loadDefaults();
return;
}
initSetHighlightRuleList(Core::getUserSetting(session->user(), "HighlightRuleList").toMap());
// we store our settings whenever they change
connect(this, SIGNAL(updatedRemotely()), SLOT(save()));
}
示例7: SWITCH_DECLARE_NONSTD
SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *session_cb,
void *input,
switch_input_type_t itype,
void *buf,
unsigned int buflen) {
switch_channel_t *channel = switch_core_session_get_channel(session_cb);
CoreSession *coresession = NULL;
coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession");
if (!coresession) {
return SWITCH_STATUS_FALSE;
}
return coresession->run_dtmf_callback(input, itype);
}
示例8: AliasManager
CoreAliasManager::CoreAliasManager(CoreSession *parent)
: AliasManager(parent)
{
CoreSession *session = qobject_cast<CoreSession *>(parent);
if (!session) {
qWarning() << "CoreAliasManager: unable to load Aliases. Parent is not a Coresession!";
loadDefaults();
return;
}
initSetAliases(Core::getUserSetting(session->user(), "Aliases").toMap());
if (isEmpty())
loadDefaults();
// we store our settings whenever they change
connect(this, SIGNAL(updatedRemotely()), SLOT(save()));
}
示例9: SWITCH_DECLARE_NONSTD
SWITCH_DECLARE_NONSTD(switch_status_t) hanguphook(switch_core_session_t *session_hungup)
{
if (session_hungup) {
switch_channel_t *channel = switch_core_session_get_channel(session_hungup);
CoreSession *coresession = NULL;
switch_channel_state_t state = switch_channel_get_state(channel);
if ((coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession"))) {
if (coresession->hook_state != state) {
coresession->cause = switch_channel_get_cause(channel);
coresession->hook_state = state;
coresession->check_hangup_hook();
}
}
return SWITCH_STATUS_SUCCESS;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "hangup hook called with null session, something is horribly wrong\n");
return SWITCH_STATUS_FALSE;
}
}