linphone win32 SDK在桌面运用(Qt5、C#等)使用教程

qml测试地址https://github.com/yuexiajiayan/qt-linphone

环境:

本文用qt5、 LIBLINPHONE-SDK-4.1.1-WIN32.ZIP (下载地址http://www.linphone.org/technical-corner/liblinphone

自己去编译个也行  下载地址 https://gitlab.linphone.org/BC/public/linphone-sdk

git clone https://gitlab.linphone.org/BC/public/linphone-sdk.git --recursive

创建一个vs qt 项目在项目种导入头文件和lib   dll考到exe 运行目录下

你要觉得麻烦或难解决错误可到https://item.taobao.com/item.htm?id=592349919838获取源码。源码功能性更好、更完善。群q群:261074724)

在sdk文件夹share下有文档  文档很重要  

另外的参考https://www.linphone.org/snapshots/docs/liblinphone/multilang/index.html 写

1.初始化的时候:

    //linphone
    LinphoneFactory *factory = linphone_factory_get();
    LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(factory);
    linphone_core_cbs_set_call_state_changed(cbs, call_state_changed);
    linphone_core_cbs_set_registration_state_changed(cbs, registration_state_changed);
    linphone_core_cbs_set_user_data(cbs, &ui ); 
    LinphoneConfig*config = linphone_config_new_with_factory("linphonerc", "linphonerc-factory");
    lc = linphone_factory_create_core_with_config(factory, cbs, config);
    linphone_core_cbs_ref(cbs);
    linphone_core_reload_ms_plugins(lc, NULL);
    linphone_core_set_user_agent(lc, "mylinphone", linphone_core_get_version());

上面的两个文件可以到源码种去找

2.

LinphoneProxyConfig* proxy_cfg;
    LinphoneAddress *from;
    const char* identity = "sip:1010@ip";/* takes   sip uri  identity from the command line arguments */
    const char* password = "h12345"; 
    //
    
    //remove all 

    proxy_cfg = linphone_core_create_proxy_config(lc);
    from = linphone_address_new(identity);

    LinphoneAuthInfo *authinfo = linphone_auth_info_new("1010", "1010", password, NULL, NULL, "ip");
    linphone_core_add_auth_info(lc, authinfo);
    linphone_auth_info_unref(authinfo);    //sifang

    linphone_proxy_config_set_identity_address(proxy_cfg, from);
    linphone_proxy_config_set_server_addr(proxy_cfg, identity);

    linphone_proxy_config_edit(proxy_cfg);
    linphone_proxy_config_enable_publish(proxy_cfg, TRUE);
    linphone_proxy_config_enable_register(proxy_cfg, TRUE); 
    linphone_proxy_config_done(proxy_cfg);

    linphone_address_unref(from);    //sifang

    linphone_core_add_proxy_config(lc, proxy_cfg);
    linphone_core_set_default_proxy_config(lc, proxy_cfg);

    linphone_proxy_config_unref(proxy_cfg);    //sifang

3.创建一个线程一直while运行 注册成功后回有信息返回

    linphone_core_iterate(lc); 
    ms_usleep(50000);//

4.呼叫

num = "sip:" +num+"@ip"; 
    const char* url = str.c_str();
    LinphoneCall *curentcall = linphone_core_get_current_call(lc);
    if (NULL == curentcall) {
        LinphoneCall *call=linphone_core_invite(lc, url);
        linphone_call_ref(call);
 }

5。接听

 LinphoneCall *curentcall = linphone_core_get_current_call(lc);
if (NULL != curentcall) { 

    linphone_call_accept(curentcall);

}

c# 使用参考https://blog.csdn.net/Java_lilin/article/details/106311843

交流群:261074724 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值