linphone初始化

memset(&vTable, 0, sizeof(vTable));
vTable.global_state_changed = CLinphoneProxyConfig::global_state_changed;
vTable.registration_state_changed = CLinphoneProxyConfig::registration_state_changed;
vTable.call_state_changed = CLinphoneProxyConfig::call_state_changed;
vTable.auth_info_requested = CLinphoneProxyConfig::auth_info_requested;
vTable.dtmf_received = CLinphoneProxyConfig::dtmf_received;
vTable.call_encryption_changed = CLinphoneProxyConfig::call_encryption_changed;
vTable.call_stats_updated = CLinphoneProxyConfig::call_stats_updated;
vTable.message_received = CLinphoneProxyConfig::message_received;
vTable.is_composing_received = CLinphoneProxyConfig::composing_received;
vTable.file_transfer_progress_indication = CLinphoneProxyConfig::file_transfer_progress_indication;
vTable.log_collection_upload_progress_indication = CLinphoneProxyConfig::log_collection_upload_progress_indication;
vTable.log_collection_upload_state_changed = CLinphoneProxyConfig::log_collection_upload_state_changed;
vTable.text_received = CLinphoneProxyConfig::MessageReach;

CString path;
GetModuleFileName(NULL, path.GetBufferSetLength(MAX_PATH + 1), MAX_PATH);
path.ReleaseBuffer();
int nPos;
nPos = path.ReverseFind('\\');
path = path.Left(nPos);
path += "\\ini\\libsipua2.ini";

 

config_file = (char*)path.GetString();
factoryConfig = (char*)path.GetString();

the_core = linphone_core_new(&vTable
, config_file
, factoryConfig
, NULL);

linphone_core_set_playback_gain_db(the_core, 1.0);

{//摄像头列表
const char **video_devices = linphone_core_get_video_devices(the_core);
const char *curdev = linphone_core_get_video_device(the_core);
const char *dev = NULL;

int i = 0;
int selected = -1;
CString strCurdev(curdev);
for (; dev = video_devices[i]; i++) {
CString tmp = CString(dev);
//mCamera.AddString(tmp);
if (curdev && strlen(curdev) && strCurdev == tmp)
{
selected = i;
linphone_core_set_video_device(the_core, dev);
}
}

//mCamera.SetCurSel(selected);
}

//设置本地视频窗口
int i = 1;
linphone_core_set_native_video_window_id(the_core, &i);
m_running = true;
DWORD dwThread;
if (the_core)
{

HANDLE hThread = CreateThread(NULL, 0, IterateThreadProc, NULL, 0, &dwThread);
if (hThread == INVALID_HANDLE_VALUE)
{
CloseHandle(hThread);
return;
}
CloseHandle(hThread);
}

 

/****************************/

while (run)
{

//该处在挂电话时,可能会挂掉;原因是linphone内部已经释放了core ;再次释放挂掉,

//可以修改 内部代码;/sleep > 300 毫秒
linphone_core_iterate(the_core);
Sleep(30);
}
return 0;

转载于:https://www.cnblogs.com/huyupei/p/8136579.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值