rtpproxy.c
来自「简单的基于SIP的会话边界控制器」· C语言 代码 · 共 74 行
C
74 行
#include <sys/types.h>
#include <netinet/in.h>
#include <osipparser2/osip_parser.h>
#include "nsrsbc.h"
#include "rtpproxy.h"
#include "cmdline.h"
/* configuration storage */
extern struct gengetopt_args_info args_info;
/*
* initialize and create rtp_proxy
*
* RETURNS
* STS_SUCCESS on success
*/
int rtpproxy_init( void ) {
int sts=STS_FAILURE;
if (args_info.nat_flag == 0) {
sts = STS_SUCCESS;
} else if (args_info.nat_flag == 1) { // Relay
sts = rtp_relay_init ();
}
return sts;
}
/*
* start an rtp stream on the proxy
*
* RETURNS
* STS_SUCCESS on success
* STS_FAILURE on error
*/
int rtp_start_fwd (osip_call_id_t *callid, char *client_id,
int direction, int media_stream_no,
struct in_addr local_ipaddr, int *local_port,
struct in_addr remote_ipaddr, int remote_port) {
int sts=STS_FAILURE;
if (args_info.nat_flag == 0) {
sts = STS_SUCCESS;
} else if (args_info.nat_flag == 1) { // Relay
sts = rtp_relay_start_fwd (callid, client_id,
direction, media_stream_no,
local_ipaddr, local_port,
remote_ipaddr, remote_port);
}
return sts;
}
/*
* stop a rtp stream on the proxy
*
* RETURNS
* STS_SUCCESS on success
* STS_FAILURE on error
*/
int rtp_stop_fwd (osip_call_id_t *callid, int direction) {
int sts = STS_FAILURE;
if (args_info.nat_flag== 0) {
sts = STS_SUCCESS;
} else if (args_info.nat_flag== 1) { // Relay
sts = rtp_relay_stop_fwd(callid, direction, -1, 0);
}
return sts;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?