/* $Id: pjsua_app.c 4358 2013-02-20 21:00:42Z nanang $ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.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
*/
#include <pjsua-lib/pjsua.h>
#include "gui.h"
#define THIS_FILE "pjsua_app.c"
#define NO_LIMIT (int)0x7FFFFFFF
//#define STEREO_DEMO
//#define TRANSPORT_ADAPTER_SAMPLE
//#define HAVE_MULTIPART_TEST
/* Ringtones US UK */
#define RINGBACK_FREQ1 440 /* 400 */
#define RINGBACK_FREQ2 480 /* 450 */
#define RINGBACK_ON 2000 /* 400 */
#define RINGBACK_OFF 4000 /* 200 */
#define RINGBACK_CNT 1 /* 2 */
#define RINGBACK_INTERVAL 4000 /* 2000 */
#define RING_FREQ1 800
#define RING_FREQ2 640
#define RING_ON 200
#define RING_OFF 100
#define RING_CNT 3
#define RING_INTERVAL 3000
#define MAX_AVI 4
/* Call specific data */
struct call_data
{
pj_timer_entry timer;
pj_bool_t ringback_on;
pj_bool_t ring_on;
};
/* Video settings */
struct app_vid
{
unsigned vid_cnt;
int vcapture_dev;
int vrender_dev;
pj_bool_t in_auto_show;
pj_bool_t out_auto_transmit;
};
/* Pjsua application data */
static struct app_config
{
pjsua_config cfg;
pjsua_logging_config log_cfg;
pjsua_media_config media_cfg;
pj_bool_t no_refersub;
pj_bool_t ipv6;
pj_bool_t enable_qos;
pj_bool_t no_tcp;
pj_bool_t no_udp;
pj_bool_t use_tls;
pjsua_transport_config udp_cfg;
pjsua_transport_config rtp_cfg;
pjsip_redirect_op redir_op;
unsigned acc_cnt;
pjsua_acc_config acc_cfg[PJSUA_MAX_ACC];
unsigned buddy_cnt;
pjsua_buddy_config buddy_cfg[PJSUA_MAX_BUDDIES];
struct call_data call_data[PJSUA_MAX_CALLS];
pj_pool_t *pool;
/* Compatibility with older pjsua */
unsigned codec_cnt;
pj_str_t codec_arg[32];
unsigned codec_dis_cnt;
pj_str_t codec_dis[32];
pj_bool_t null_audio;
unsigned wav_count;
pj_str_t wav_files[32];
unsigned tone_count;
pjmedia_tone_desc tones[32];
pjsua_conf_port_id tone_slots[32];
pjsua_player_id wav_id;
pjsua_conf_port_id wav_port;
pj_bool_t auto_play;
pj_bool_t auto_play_hangup;
pj_timer_entry auto_hangup_timer;
pj_bool_t auto_loop;
pj_bool_t auto_conf;
pj_str_t rec_file;
pj_bool_t auto_rec;
pjsua_recorder_id rec_id;
pjsua_conf_port_id rec_port;
unsigned auto_answer;
unsigned duration;
#ifdef STEREO_DEMO
pjmedia_snd_port *snd;
pjmedia_port *sc, *sc_ch1;
pjsua_conf_port_id sc_ch1_slot;
#endif
float mic_level,
speaker_level;
int capture_dev, playback_dev;
unsigned capture_lat, playback_lat;
pj_bool_t no_tones;
int ringback_slot;
int ringback_cnt;
pjmedia_port *ringback_port;
int ring_slot;
int ring_cnt;
pjmedia_port *ring_port;
struct app_vid vid;
unsigned aud_cnt;
/* AVI to play */
unsigned avi_cnt;
struct {
pj_str_t path;
pjmedia_vid_dev_index dev_id;
pjsua_conf_port_id slot;
} avi[MAX_AVI];
pj_bool_t avi_auto_play;
int avi_def_idx;
} app_config;
//static pjsua_acc_id current_acc;
#define current_acc pjsua_acc_get_default()
static pjsua_call_id current_call = PJSUA_INVALID_ID;
static pj_bool_t cmd_echo;
static int stdout_refresh = -1;
static const char *stdout_refresh_text = "STDOUT_REFRESH";
static pj_bool_t stdout_refresh_quit = PJ_FALSE;
static pj_str_t uri_arg;
#if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
# define SOME_BUF_SIZE (1024 * 10)
#else
# define SOME_BUF_SIZE (1024 * 3)
#endif
static char some_buf[SOME_BUF_SIZE];
#ifdef STEREO_DEMO
static void stereo_demo();
#endif
pj_status_t app_destroy(void);
static void ringback_start(pjsua_call_id call_id);
static void ring_start(pjsua_call_id call_id);
static void ring_stop(pjsua_call_id call_id);
pj_bool_t app_restart;
pj_log_func *log_cb = NULL;
/*****************************************************************************
* Configuration manipulation
*/
#if (defined(PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT) && \
PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT!=0) || \
defined(__IPHONE_4_0)
void keepAliveFunction(int timeout)
{
int i;
for (i=0; i<(int)pjsua_acc_get_count(); ++i) {
if (!pjsua_acc_is_valid(i))
continue;
if (app_config.acc_cfg[i].reg_timeout < timeout) {
pjsua_acc_get_config(i, &app_config.acc_cfg[i]);
app_config.acc_cfg[i].reg_timeout = timeout;
pjsua_acc_modify(i, &app_config.acc_cfg[i]);
} else {
pjsua_acc_set_registration(i, PJ_TRUE);
}
}
}
#endif
/* Show usage */
static void usage(void)
{
puts ("Usage:");
puts (" pjsua [options] [SIP URL to call]");
puts ("");
puts ("General options:");
puts (" --config-file=file Read the config/arguments from file.");
puts (" --help Display this help screen");
puts (" --version Display version info");
puts ("");
puts ("Logging options:");
puts (" --log-file=fname Log to filename (default stderr)");
puts (" --log-level=N Set log max level to N (0(none) to 6(trace)) (default=5)");
puts (" --app-log-level=N Set log max level for stdout display (default=4)");
puts (" --log-append Append instead of overwrite existing log file.\n");
puts (" --color Use colorful logging (default yes on Win32)");
puts (" --no-color Disable colorful logging");
puts (" --light-bg Use dark colors for light background (default is dark bg)");
puts (" --no-stderr Disable stderr");
puts ("");
puts ("SIP Account options:");
puts (" --registrar=url Set the URL of registrar server");
puts (" --id=url Set the URL of local ID (used in From header)");
puts (" --realm=string Set realm");
puts (" --username=string Set authentication username");
puts (" --password=string Set authentication password");
puts (" --contact=url Optionally override the Contact information");
puts (" --contact-params=S Append the specified parameters S in Contact header");
puts (" --contact-uri-params=S Append the specified parameters S in Contact URI");
puts (" --proxy=url Optional URL of proxy server to visit");
puts (" May be specified multiple times");
printf(" --reg-timeout=SEC Optional registration interval (default %d)\n",
PJSUA_REG_INTERVAL);
printf(" --rereg-delay=SEC Optional auto retry registration interval (default %d)\n",
PJSUA_REG_RETRY_INTERVAL);
puts (" --reg-use-proxy=N Control the use of proxy settings in REGISTER.");
puts (" 0=no proxy, 1=outbound only, 2=acc only, 3=all (default)");
puts (" --publish Send presence PUBLISH f
没有合适的资源?快使用搜索试试~ 我知道了~
pjsip ios demo
共80个文件
a:42个
h:8个
ds_store:6个
3星 · 超过75%的资源 需积分: 22 145 下载量 152 浏览量
2013-09-18
10:46:22
上传
评论 5
收藏 5.38MB ZIP 举报
温馨提示
实现了打电话 注册 登录等基本功能,交流研究
资源推荐
资源详情
资源评论
收起资源包目录
PJSIPDemo.zip (80个子文件)
PJSIPDemo
libpjsua-arm-apple-darwin9.a 262KB
PJSIPDemo.xcodeproj
project.xcworkspace
contents.xcworkspacedata 154B
xcuserdata
sunyong.xcuserdatad
UserInterfaceState.xcuserstate 32KB
simayi.xcuserdatad
UserInterfaceState.xcuserstate 52KB
Lance.xcuserdatad
UserInterfaceState.xcuserstate 112KB
project.pbxproj 30KB
xcuserdata
sunyong.xcuserdatad
xcschemes
xcschememanagement.plist 588B
PJSIPDemo.xcscheme 3KB
Copy of PJSIPDemo.xcscheme 3KB
simayi.xcuserdatad
xcschemes
xcschememanagement.plist 481B
PJSIPDemo.xcscheme 3KB
Lance.xcuserdatad
xcschemes
xcschememanagement.plist 481B
PJSIPDemo.xcscheme 3KB
xcdebugger
Breakpoints.xcbkptlist 91B
libsrtp-arm-apple-darwin9.a 97KB
libcrypto.a 2.29MB
libpjsip-arm-apple-darwin9.a 335KB
libgsmcodec-arm-apple-darwin9.a 42KB
libmilenage-arm-apple-darwin9.a 18KB
PJSIPDemo
gui.h 1KB
main.m 339B
Default.png 6KB
voip_api.h 25KB
PJSIPDemo-Prefix.pch 321B
sip_api.h 1KB
Header
pjsip-ua
pjsip
.DS_Store 6KB
pjsip-simple
.DS_Store 15KB
pjnath
pjmedia-videodev
pjmedia-audiodev
pjmedia
.DS_Store 6KB
pjmedia-codec
.DS_Store 6KB
pjsua-lib
pjsua_app.c 174KB
Default-568h@2x.png 18KB
lanceViewController.h 392B
.DS_Store 12KB
core_api.h 1KB
types.h 191B
mac_def.h 2KB
Default@2x.png 16KB
lib
libpjsua-arm-apple-darwin9.a 262KB
libsrtp-arm-apple-darwin9.a 97KB
libcrypto.a 2.29MB
libpjsip-arm-apple-darwin9.a 335KB
libgsmcodec-arm-apple-darwin9.a 42KB
libmilenage-arm-apple-darwin9.a 18KB
libSKP_SILK_SDK.a 1.02MB
libpjmedia-arm-apple-darwin9.a 410KB
libpj-arm-apple-darwin9.a 203KB
libpjnath-arm-apple-darwin9.a 177KB
libpjsip-simple-arm-apple-darwin9.a 92KB
libpjlib-util-arm-apple-darwin9.a 116KB
libssl.a 409KB
libspeex-arm-apple-darwin9.a 171KB
libg7221codec-arm-apple-darwin9.a 67KB
libresample-arm-apple-darwin9.a 44KB
libpjsua-api-arm-apple-darwin9.a 45KB
libpjmedia-codec-arm-apple-darwin9.a 51KB
libilbccodec-arm-apple-darwin9.a 63KB
libpjmedia-audiodev-arm-apple-darwin9.a 38KB
libpjsip-ua-arm-apple-darwin9.a 113KB
lanceAppDelegate.m 3KB
PJSIPDemo-Info.plist 1KB
lanceAppDelegate.h 377B
en.lproj
lanceViewController.xib 139KB
InfoPlist.strings 45B
lanceViewController.m 7KB
libSKP_SILK_SDK.a 1.02MB
libpjmedia-arm-apple-darwin9.a 410KB
libpj-arm-apple-darwin9.a 203KB
libpjnath-arm-apple-darwin9.a 177KB
libpjsip-simple-arm-apple-darwin9.a 92KB
libpjlib-util-arm-apple-darwin9.a 116KB
.DS_Store 15KB
libssl.a 409KB
libspeex-arm-apple-darwin9.a 171KB
libg7221codec-arm-apple-darwin9.a 67KB
libresample-arm-apple-darwin9.a 44KB
libpjsua-api-arm-apple-darwin9.a 45KB
libpjmedia-codec-arm-apple-darwin9.a 51KB
libilbccodec-arm-apple-darwin9.a 63KB
libpjmedia-audiodev-arm-apple-darwin9.a 38KB
libpjsip-ua-arm-apple-darwin9.a 113KB
共 80 条
- 1
点对点11
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
前往页