/** Callback prototype */ void theShowInterfaceCb(struct _LinphoneCore *lc) { CVideoConfClientDlg *the_ui = (CVideoConfClientDlg *)linphone_core_get_user_data(lc); if(the_ui) the_ui->ShowWindow(SW_SHOW); }
// Messages Received (with attachments) static void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *msg) { qDebug() << "Unread:" << linphone_chat_room_get_unread_messages_count(room); linphone_chat_room_mark_as_read(room); QLinPhoneCore *lcc = static_cast<QLinPhoneCore *>(linphone_core_get_user_data(lc)); lcc->messageReceivedCb(msg); }
/** Callback prototype */ void theDtmfReceived(struct _LinphoneCore* lc, LinphoneCall *call, int dtmf) { CVideoConfClientDlg *the_ui = (CVideoConfClientDlg *)linphone_core_get_user_data(lc); CString tmp; tmp.Format("收到 %s, DTMF 按键 %c",linphone_call_get_remote_address_as_string(call),dtmf); if(the_ui) the_ui->mStatus.SetWindowText(tmp); }
/** Callback prototype */ void theDisplayStatusCb(struct _LinphoneCore *lc, const char *message) { CVideoConfClientDlg *the_ui = (CVideoConfClientDlg *)linphone_core_get_user_data(lc); #ifdef _MSC_VER OutputDebugString(message); #endif if(the_ui) the_ui->mStatus.SetWindowText(CString(message)); }
static void qlinphone_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username, const char *domain){ QString message = "Please enter password for user " + QString(username) + "@" + QString(domain); bool ok; QLinphoneCore* c = (QLinphoneCore*) linphone_core_get_user_data(lc); QString password = QInputDialog::getText(NULL, "Authentication required", message, QLineEdit::Password, "", &ok); if( ok && !password.isEmpty() ){ auto cstringArray = password.toUtf8(); LinphoneAuthInfo* info = linphone_auth_info_new(username, NULL, cstringArray.data(), NULL, realm, domain); linphone_core_add_auth_info(lc, info); } }
/* [DEPRECATED] ONLY for Text messages */ static void text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *msg) { Q_UNUSED(room) qDebug() << __PRETTY_FUNCTION__ << "Message:" << msg << "from:" << linphone_address_as_string(from); QLinPhoneCore *lcc = static_cast<QLinPhoneCore *>(linphone_core_get_user_data(lc)); lcc->messageReceivedCb(QString(msg), QString(linphone_address_as_string(from))); }
static void account_created_on_server_cb(LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const char *info){ Account *account=(Account*)linphone_core_get_user_data(lc); switch(state){ case LinphoneRegistrationOk: account->created=1; break; case LinphoneRegistrationCleared: account->done=1; break; default: break; } }
static void registration_state_changed(struct _LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message) { // Q_UNUSED(message) qDebug() << __func__ << "New registration state:" << linphone_registration_state_to_string(cstate) << "User:"******"Proxy:" << linphone_proxy_config_get_addr(cfg) << "Message:" << message; QLinPhoneCore *lcc = static_cast<QLinPhoneCore *>(linphone_core_get_user_data(lc)); lcc->setRegistrationState(static_cast<enum QLinPhoneCore::RegistrationState>(cstate)); }
/**Call state notification callback prototype*/ void theCallStateCb(struct _LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message,int code) { CVideoConfClientDlg *the_ui = (CVideoConfClientDlg *)linphone_core_get_user_data(lc); if(cstate ==LinphoneCallIncomingReceived) { linphone_core_accept_call(the_core,linphone_core_get_current_call(the_core)); //linphone_core_call_enable_udt_video(the_core,linphone_core_get_current_call(the_core),TRUE); } if(the_ui) { //通话列表操作 } }
static void subscription_state_changed(LinphoneCore *lc, LinphoneEvent *ev, LinphoneSubscriptionState state){ MyAppData *data=(MyAppData*)linphone_core_get_user_data(lc); if (state==LinphoneSubscriptionIncomingReceived){ printf("Receiving new subscription for event %s\n",linphone_event_get_name(ev)); if (data->ev==NULL) { linphone_event_accept_subscription(ev); data->ev=linphone_event_ref(ev); }else{ linphone_event_deny_subscription(ev,LinphoneReasonBusy); } }else if (state==LinphoneSubscriptionTerminated){ if (data->ev==ev){ linphone_event_unref(data->ev); data->ev=NULL; } } }
static void account_created_on_server_cb(LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const char *info){ Account *account=(Account*)linphone_core_get_user_data(lc); switch(state){ case LinphoneRegistrationOk: { char * phrase = sal_op_get_error_info((SalOp*)cfg->op)->full_string; if (phrase && strcasecmp("Test account created", phrase) == 0) { account->created=1; } else { account->registered=1; } break; } case LinphoneRegistrationCleared: account->done=1; break; default: break; } }
static void qlinphone_registration_state_changed(LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message) { qDebug() << "Registration state changed:" << message; QLinphoneCore* c = (QLinphoneCore*) linphone_core_get_user_data(lc); c->onRegistrationStateChanged(cfg, cstate); }
static void qlinphone_message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message){ QLinphoneCore* c = (QLinphoneCore*) linphone_core_get_user_data(lc); c->onMessageReceived(room, message); }
LinphoneCoreManager *get_manager(LinphoneCore *lc){ LinphoneCoreManager *manager=(LinphoneCoreManager *)linphone_core_get_user_data(lc); return manager; }
stats * get_stats(LinphoneCore *lc){ LinphoneCoreManager *manager=(LinphoneCoreManager *)linphone_core_get_user_data(lc); return &manager->stat; }
static void account_created_auth_requested_cb(LinphoneCore *lc, const char *username, const char *realm, const char *domain){ Account *account=(Account*)linphone_core_get_user_data(lc); account->auth_requested=1; }