pjsua直接控制voip网关拨打电话

本文档详细介绍了如何通过pjsua库进行VoIP拨号,包括创建PJSIP实例、初始化、设置回调函数、注册SIP账号、创建UDP传输端口、拨打指定号码以及处理媒体状态和呼叫状态变化。代码示例展示了完整的调用流程。
摘要由CSDN通过智能技术生成
官方的例子是向服务器注册之后发起请求,改了一下就可以直接向voip网关发起请求了。
只要不设置这个字段就不会注册 //        cfg.reg_uri = pj_str("sip:" SIP_DOMAIN);   具体可以跟进去看官方源码

官方解释如下:

 /** 

     * This is the URL to be put in the request URI for the registration,
     * and will look something like "sip:serviceprovider".
     *
     * This field should be specified if registration is desired. If the
     * value is empty, no account registration will be performed.
     */

    pj_str_t            reg_uri;

main.c



#include <pjsua-lib/pjsua.h>


#define SIP_DOMAIN "192.168.4.101"
#define SIP_USER "110"
#define SIP_PASSWD "secret"
#define

VoIPDemo is intended as a sample to show how to use the RTC API for Windows CE, but also as a working application for demonstration and use (taking note of the limitations described below). Limitiations ============= Currently supports 1 IM and/or 1 voice call at a time. 1 Voice call limitation due to RTC spec. 1 IM call simplifies event handling + need for multiple session windows Simultaneous voice and IM calls are only allowed from one source, currently identified by SIP URI. Callback functionality is currently not implemented. Component Requirements ====================== SYSGEN_VOIP will bring in all the components required by VoIPDemo. The target device needs to have audio capture and play capabilities and a network interface. Overview of program flow and source ==================================== VoIPDemo is separated into three main functional parts: User Interface, use of the RTC API (including RTC event handling), and the code to interface between RTC and the UI. The intent of this quasi- layering approach is to limit the direct hooks from the RTC backend to the UI and make it easier to re-use the RTC code in a different UI. The program goes through the following phases: Window Initialization RTC Initialization Main Message Loop RTC Termination Window Termination The main message loop manages all main window UI related messages and events. This includes contact list changes by the user, UI for call placement, etc. When the main window finishes its setup of an outgoing call, it calls the SessionWindow Callback to actually initiate the call. The SessionWindow is where all voice and IM session UI takes place. It is called directly by our RTC event handler to display call/IM status information, notify the user of incoming calls/messages, parse user input for outgoing messages, and calls the interface code to initi
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值