⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtpproxy.c

📁 简单的基于SIP的会话边界控制器
💻 C
字号:

 
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -