首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >我无法在visual studio开发环境上构建linphone 3.8.5

我无法在visual studio开发环境上构建linphone 3.8.5
EN

Stack Overflow用户
提问于 2015-11-01 07:42:00
回答 1查看 1.7K关注 0票数 0

有人能告诉我如何在Visual上构建linphone 3.8.5吗?

我试着做了一个月,但失败了。我尝试了很多方法,读了很多答案,但都失败了。有人能帮我建它吗?

EN

回答 1

Stack Overflow用户

发布于 2016-02-20 14:12:28

创建一个项目

  1. 要创建一个项目,请转到“文件”菜单->新->项目.
  2. 在“VisualC++”-> "Win32“一节中选择”C++ Console Application“模板,并给您的项目命名。"Liblinphone教程“。下一次点击“确定”。
  3. 现在,Win32应用程序向导出来了。单击“下一步”,选中“空项目”框,然后单击“完成”。
  4. 现在,您应该有一个名为"Liblinphone教程“的项目和一个新的目标同名。您可以将此目标重命名为“基本调用”。

将项目配置为使用liblinphone

  1. 下载linphone SDK的ZIP存档并将其解压缩到Visual项目目录中。在我们的例子中,它放置在Document\Visual 2013\Projects\Liblinphone教程\Liblinphone教程中。请注意将提取的目录命名为"liblinphone“。
  2. 在Visual中,右键单击“基本调用”目标,然后单击“属性”
  3. 转到"C/C++“部分,然后转到"General”。使用编辑向导,在"Additonal Include Directory“字段中添加目录"liblinphone/include”。
  4. 转到"Linker“-> "General”部分,并将"liblinphone/lib“目录添加到”附加库目录“中。
  5. 转到"Linker“-> "Input”部分,并将折叠库添加到“附加依赖项”中: ortp.lib mediastreamer_base.lib mediastreamer_voip.lib linphone.lib

编撰

在目标的源文件中添加名为name.c的文件,并用基本调用教程的源代码填充它

代码语言:javascript
运行
复制
/*
linphone
Copyright (C) 2010  Belledonne Communications SARL 
 (simon.morlat@linphone.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
#ifdef IN_LINPHONE
#include "linphonecore.h"
#else
#include "linphone/linphonecore.h"
#endif
#include <signal.h>
static bool_t running=TRUE;
static void stop(int signum){
        running=FALSE;
}
/*
 * Call state notification callback
 */
static void call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg){
        switch(cstate){
                case LinphoneCallOutgoingRinging:
                        printf("It is now ringing remotely !\n");
                break;
                case LinphoneCallOutgoingEarlyMedia:
                        printf("Receiving some early media\n");
                break;
                case LinphoneCallConnected:
                        printf("We are connected !\n");
                break;
                case LinphoneCallStreamsRunning:
                        printf("Media streams established !\n");
                break;
                case LinphoneCallEnd:
                        printf("Call is terminated.\n");
                break;
                case LinphoneCallError:
                        printf("Call failure !");
                break;
                default:
                        printf("Unhandled notification %i\n",cstate);
        }
}
int main(int argc, char *argv[]){
        LinphoneCoreVTable vtable={0};
        LinphoneCore *lc;
        LinphoneCall *call=NULL;
        const char *dest=NULL;
        /* take the destination sip uri from the command line arguments */
        if (argc>1){
                dest=argv[1];
        }
        signal(SIGINT,stop);
#ifdef DEBUG
        linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
#endif
        /* 
         Fill the LinphoneCoreVTable with application callbacks.
         All are optional. Here we only use the call_state_changed callbacks
         in order to get notifications about the progress of the call.
         */
        vtable.call_state_changed=call_state_changed;
        /*
         Instanciate a LinphoneCore object given the LinphoneCoreVTable
        */
        lc=linphone_core_new(&vtable,NULL,NULL,NULL);
        if (dest){
                /*
                 Place an outgoing call
                */
                call=linphone_core_invite(lc,dest);
                if (call==NULL){
                        printf("Could not place call to %s\n",dest);
                        goto end;
                }else printf("Call to %s is in progress...",dest);
                linphone_call_ref(call);
        }
        /* main loop for receiving notifications and doing background linphonecore work: */
        while(running){
                linphone_core_iterate(lc);
                ms_usleep(50000);
        }
        if (call && linphone_call_get_state(call)!=LinphoneCallEnd){
                /* terminate the call */
                printf("Terminating the call...\n");
                linphone_core_terminate_call(lc,call);
                /*at this stage we don't need the call object */
                linphone_call_unref(call);
        }
end:
        printf("Shutting down...\n");
        linphone_core_destroy(lc);
        printf("Exited\n");
        return 0;
}

现在可以通过右键单击要构建的目标并单击" build“来构建您的项目。

执行和调试

要能够执行生成的二进制文件,需要设置PATH环境变量。转到目标的属性面板,然后在“调试器”部分。编辑环境字段并添加以下行:

代码语言:javascript
运行
复制
PATH=C:\Users\<user_name>\Documents\Visual Studio 2013\Projects\Liblinphone tutorial\Liblinphone tutorial\liblinphone\bin;%PATH%

“基本调用”程序需要一个SIP地址作为参数。您可以通过编辑“命令参数”字段来指定它。例如,您可以编写sip:bot.linphone.org.

现在您可以通过单击主界面中的“”来执行该程序。

注意事项:中介服务器相对于SDK的根加载它的插件。如果您需要这些插件提供的特性,例如OpenH264的支持,您可以将工作目录设置为SDK的位置。这可以通过进入项目属性中的“调试器”部分来完成。

参照系

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33460181

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档