linphone chat example
来源:互联网 发布:数据库sql语句面试题 编辑:程序博客网 时间:2024/06/05 16:05
This program is a _very_ simple usage example of liblinphone, desmonstrating how to send/receive SIP MESSAGE from a sip uri identity passed from the command line.
Argument must be like sip:jehan@sip.linphone.org .
ex chatroom sip:jehan@sip.linphone.org
/*linphoneCopyright (C) 2010 Belledonne Communications SARL This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of 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 ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, 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;}void text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message) { printf(" Message [%s] received from [%s] \n",message,linphone_address_as_string (from));}LinphoneCore *lc;int main(int argc, char *argv[]){ LinphoneCoreVTable vtable={0}; char* dest_friend=NULL; /* takes sip uri identity from the command line arguments */ if (argc>1){ dest_friend=argv[1]; } signal(SIGINT,stop);//#define DEBUG#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 text_received callback in order to get notifications about incoming message. */ vtable.text_received=text_received; /* Instantiate a LinphoneCore object given the LinphoneCoreVTable */ lc=linphone_core_new(&vtable,NULL,NULL,NULL); /*Next step is to create a chat root*/ LinphoneChatRoom* chat_room = linphone_core_create_chat_room(lc,dest_friend); linphone_chat_room_send_message(chat_room,"Hello world"); /*sending message*/ /* main loop for receiving incoming messages and doing background linphone core work: */ while(running){ linphone_core_iterate(lc); ms_usleep(50000); } printf("Shutting down...\n"); linphone_chat_room_destroy(chat_room); linphone_core_destroy(lc); printf("Exited\n"); return 0;}
- linphone chat example
- linphone
- linphone
- linphone
- linphone
- CHAT
- CHAT
- chat
- chat
- chat
- chat
- chat
- [Linphone Android]Linphone介绍
- example
- example
- Example
- example
- Example
- RSA算法的数学原理
- hadoop如何分发本地的jar文件
- 由 ORA-04043:object does not exist 想到的
- 内部排序算法的比较和实现
- android与phonegap的相互交互
- linphone chat example
- 马无夜草不肥:程序员做业余项目的重要性
- servlet3.1规范翻译:附录A 变更历史
- C++中new的防错处理
- C++中数组的引用作为函数参数
- java map 排序
- java FileChannel File 临时文件 互相拷贝
- 把ci框架的控制器放入孙文件夹,ci控制器多层文件夹中,ci框架扩展路由
- streaming server