提交 cb076e6b authored 作者: Anthony Minessale's avatar Anthony Minessale

fucked

上级 5490cdf4
...@@ -40,6 +40,12 @@ SWITCH_BEGIN_EXTERN_C ...@@ -40,6 +40,12 @@ SWITCH_BEGIN_EXTERN_C
#define SWITCH_MAX_CAND_ACL 25 #define SWITCH_MAX_CAND_ACL 25
typedef enum {
ICE_GOOGLE_JINGLE = (1 << 0),
ICE_VANILLA = (1 << 1),
ICE_CONTROLLED = (1 << 2)
} switch_core_media_ice_type_t;
typedef enum { typedef enum {
DTMF_2833, DTMF_2833,
DTMF_INFO, DTMF_INFO,
......
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
#define SWITCH_RTP_H #define SWITCH_RTP_H
SWITCH_BEGIN_EXTERN_C SWITCH_BEGIN_EXTERN_C
#include <switch_core_media.h>
#define SWITCH_RTP_MAX_BUF_LEN 16384 #define SWITCH_RTP_MAX_BUF_LEN 16384
#define SWITCH_RTCP_MAX_BUF_LEN 16384 #define SWITCH_RTCP_MAX_BUF_LEN 16384
#define SWITCH_RTP_MAX_BUF_LEN_WORDS 4094 /* (max / 4) - 2 */ #define SWITCH_RTP_MAX_BUF_LEN_WORDS 4094 /* (max / 4) - 2 */
...@@ -216,8 +219,10 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session); ...@@ -216,8 +219,10 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session);
\brief Acvite ICE on an RTP session \brief Acvite ICE on an RTP session
\return SWITCH_STATUS_SUCCESS \return SWITCH_STATUS_SUCCESS
*/ */
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_session, char *login, char *rlogin, const char *password); SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_session, char *login, char *rlogin,
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp_ice(switch_rtp_t *rtp_session, char *login, char *rlogin, const char *password); const char *password, switch_core_media_ice_type_t type, uint32_t priority);
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp_ice(switch_rtp_t *rtp_session, char *login, char *rlogin,
const char *password, switch_core_media_ice_type_t type, uint32_t priority);
/*! /*!
\brief Activate sending RTCP Sender Reports (SR's) \brief Activate sending RTCP Sender Reports (SR's)
......
...@@ -81,6 +81,21 @@ typedef enum { ...@@ -81,6 +81,21 @@ typedef enum {
SWITCH_STUN_ATTR_DATA = 0x0013, /* ByteString */ SWITCH_STUN_ATTR_DATA = 0x0013, /* ByteString */
SWITCH_STUN_ATTR_OPTIONS = 0x8001, /* UInt32 */ SWITCH_STUN_ATTR_OPTIONS = 0x8001, /* UInt32 */
SWITCH_STUN_ATTR_XOR_MAPPED_ADDRESS = 0x0020, /* Address */ SWITCH_STUN_ATTR_XOR_MAPPED_ADDRESS = 0x0020, /* Address */
/* ice crap */
SWITCH_STUN_ATTR_PRIORITY = 0x0024,
SWITCH_STUN_ATTR_USE_CAND = 0x0025,
SWITCH_STUN_ATTR_PADDING = 0x0026,
SWITCH_STUN_ATTR_RESP_PORT = 0x0027,
SWITCH_STUN_ATTR_SOFTWARE = 0x8022,
SWITCH_STUN_ATTR_ALT_SERVER = 0x8023,
SWITCH_STUN_ATTR_FINGERPRINT = 0x8028,
SWITCH_STUN_ATTR_CONTROLLED = 0x8029,
SWITCH_STUN_ATTR_CONTROLLING = 0x802a,
SWITCH_STUN_ATTR_RESP_ORIGIN = 0x802b,
SWITCH_STUN_ATTR_OTHER_ADDR = 0x802c
} switch_stun_attribute_t; } switch_stun_attribute_t;
typedef enum { typedef enum {
...@@ -190,7 +205,7 @@ SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_build_header(switch_st ...@@ -190,7 +205,7 @@ SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_build_header(switch_st
*/ */
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_username(switch_stun_packet_t *packet, char *username, uint16_t ulen); SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_username(switch_stun_packet_t *packet, char *username, uint16_t ulen);
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_password(switch_stun_packet_t *packet, char *password, uint16_t ulen); SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_password(switch_stun_packet_t *packet, char *password, uint16_t ulen);
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_software(switch_stun_packet_t *packet, char *software, uint16_t ulen);
/*! /*!
\brief Add a binded address packet attribute \brief Add a binded address packet attribute
...@@ -202,6 +217,15 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_password(switch_stun_pa ...@@ -202,6 +217,15 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_password(switch_stun_pa
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_binded_address(switch_stun_packet_t *packet, char *ipstr, uint16_t port); SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_binded_address(switch_stun_packet_t *packet, char *ipstr, uint16_t port);
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_xor_binded_address(switch_stun_packet_t *packet, char *ipstr, uint16_t port); SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_xor_binded_address(switch_stun_packet_t *packet, char *ipstr, uint16_t port);
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_integrity(switch_stun_packet_t *packet, const char *pass);
SWITCH_DECLARE(uint32_t) switch_crc32_8bytes(const void* data, size_t length);
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_fingerprint(switch_stun_packet_t *packet);
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_use_candidate(switch_stun_packet_t *packet);
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_controlling(switch_stun_packet_t *packet);
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_controlled(switch_stun_packet_t *packet);
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_priority(switch_stun_packet_t *packet, uint32_t priority);
/*! /*!
\brief Perform a stun lookup \brief Perform a stun lookup
\param ip the local ip to use (replaced with stun results) \param ip the local ip to use (replaced with stun results)
...@@ -221,7 +245,9 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip, ...@@ -221,7 +245,9 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip,
\param attribute the attribute \param attribute the attribute
\return the padded size in bytes \return the padded size in bytes
*/ */
#define switch_stun_attribute_padded_length(attribute) ((uint16_t)(attribute->length + (sizeof(uint32_t)-1)) & ~sizeof(uint32_t)) #define switch_stun_attribute_padded_length(attribute) (int16_t)((attribute->length & 0x3) ? 0x4 + (attribute->length & ~0x3) : attribute->length)
#define switch_stun_attribute_padded_length_hbo(attribute) (int16_t)((ntohs(attribute->length) & 0x3) ? 0x4 + (ntohs(attribute->length) & ~0x3) : ntohs(attribute->length))
/*! /*!
\brief set a switch_stun_packet_attribute_t pointer to point at the first attribute in a packet \brief set a switch_stun_packet_attribute_t pointer to point at the first attribute in a packet
...@@ -236,7 +262,9 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip, ...@@ -236,7 +262,9 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip,
\param end pointer to the end of the buffer \param end pointer to the end of the buffer
\return true or false depending on if there are any more attributes \return true or false depending on if there are any more attributes
*/ */
#define switch_stun_packet_next_attribute(attribute, end) (attribute && (attribute = (switch_stun_packet_attribute_t *) (attribute->value + switch_stun_attribute_padded_length(attribute))) && ((void *)attribute < end) && attribute->length && ((void *)(attribute + switch_stun_attribute_padded_length(attribute)) < end)) #define switch_stun_packet_next_attribute(attribute, end) (attribute && (attribute = (switch_stun_packet_attribute_t *) (attribute->value + switch_stun_attribute_padded_length(attribute))) && ((void *)attribute < end) && attribute->type && ((void *)(attribute + switch_stun_attribute_padded_length(attribute)) < end))
#define switch_stun_packet_next_attribute_hbo(attribute, end) (attribute && (attribute = (switch_stun_packet_attribute_t *) (attribute->value + switch_stun_attribute_padded_length_hbo(attribute))) && ((void *)attribute < end) && attribute->type && ((void *)(attribute + switch_stun_attribute_padded_length_hbo(attribute)) < end))
/*! /*!
\brief Obtain the correct length in bytes of a stun packet \brief Obtain the correct length in bytes of a stun packet
......
...@@ -109,11 +109,68 @@ static switch_status_t do_config(switch_bool_t reload) ...@@ -109,11 +109,68 @@ static switch_status_t do_config(switch_bool_t reload)
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
#include "switch_stun.h"
#define _switch_stun_packet_next_attribute(attribute, end) (attribute && (attribute = (switch_stun_packet_attribute_t *) (attribute->value + ntohs(attribute->length))) && ((void *)attribute < end) && ntohs(attribute->length) && ((void *)(attribute + ntohs(attribute->length)) < end))
#define _switch_stun_attribute_padded_length(attribute) ((uint16_t)(ntohs(attribute->length) + (sizeof(uint32_t)-1)) & ~sizeof(uint32_t))
//#define _switch_stun_packet_next_attribute(attribute, end) (attribute && (attribute = (switch_stun_packet_attribute_t *) (attribute->value + _switch_stun_attribute_padded_length(attribute))) && ((void *)attribute < end) && ((void *)(attribute + _switch_stun_attribute_padded_length(attribute)) < end))
SWITCH_STANDARD_API(skel_function) SWITCH_STANDARD_API(skel_function)
{ {
switch_event_t *event; switch_event_t *event;
unsigned char frame_buffer[8192] = {0}; unsigned char frame_buffer[8192] = {0};
uint8_t buf[256] = { 0 };
switch_stun_packet_t *packet;
char user_name[] = "0000000000000000:1111111111111111";
//char user_name[] = "0000000000000000";
void *end_buf;
switch_stun_packet_attribute_t *attr;
int xlen = 0;
packet = switch_stun_packet_build_header(SWITCH_STUN_BINDING_REQUEST, NULL, buf);
printf("1len %d %d\n", ntohs(packet->header.length), xlen);
switch_stun_packet_attribute_add_username(packet, user_name, strlen(user_name));
printf("2len %d %d\n", ntohs(packet->header.length), xlen);
switch_stun_packet_attribute_add_controlled(packet);
//switch_stun_packet_attribute_add_password(packet, user_name, strlen(user_name));
//printf("3len %d %d\n", ntohs(packet->header.length), xlen);
//switch_stun_packet_attribute_add_use_candidate(packet);
switch_stun_packet_attribute_add_integrity(packet, "FUCK");
switch_stun_packet_attribute_add_fingerprint(packet);
end_buf = buf + ((sizeof(buf) > packet->header.length) ? packet->header.length : sizeof(buf));
switch_stun_packet_first_attribute(packet, attr);
xlen = sizeof(switch_stun_packet_header_t);
printf("len %d %d\n", ntohs(packet->header.length), xlen);
do {
printf("WTF %p %d %d:(%d)\n", (void *)attr, ntohs(attr->type), ntohs(attr->length), switch_stun_attribute_padded_length_hbo(attr));
if (!switch_stun_packet_next_attribute_hbo(attr, end_buf)) {
break;
}
xlen += 4+switch_stun_attribute_padded_length_hbo(attr);
} while (xlen <= ntohs(packet->header.length));
return SWITCH_STATUS_SUCCESS;
do_config(SWITCH_TRUE); do_config(SWITCH_TRUE);
......
...@@ -97,7 +97,7 @@ typedef struct ice_s { ...@@ -97,7 +97,7 @@ typedef struct ice_s {
char *foundation; char *foundation;
int component_id; int component_id;
char *transport; char *transport;
int priority; uint32_t priority;
char *con_addr; char *con_addr;
switch_port_t con_port; switch_port_t con_port;
char *cand_type; char *cand_type;
...@@ -774,7 +774,6 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio ...@@ -774,7 +774,6 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio
switch_rtp_add_crypto_key(engine->rtp_session, SWITCH_RTP_CRYPTO_SEND, atoi(crypto), engine->ssec.crypto_type, switch_rtp_add_crypto_key(engine->rtp_session, SWITCH_RTP_CRYPTO_SEND, atoi(crypto), engine->ssec.crypto_type,
engine->ssec.local_raw_key, SWITCH_RTP_KEY_LEN); engine->ssec.local_raw_key, SWITCH_RTP_KEY_LEN);
} else if (switch_stristr(SWITCH_RTP_CRYPTO_KEY_80, crypto)) { } else if (switch_stristr(SWITCH_RTP_CRYPTO_KEY_80, crypto)) {
switch_channel_set_variable(session->channel, varname, SWITCH_RTP_CRYPTO_KEY_80); switch_channel_set_variable(session->channel, varname, SWITCH_RTP_CRYPTO_KEY_80);
switch_core_media_build_crypto(session->media_handle, &engine->ssec, crypto_tag, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); switch_core_media_build_crypto(session->media_handle, &engine->ssec, crypto_tag, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND);
switch_rtp_add_crypto_key(engine->rtp_session, SWITCH_RTP_CRYPTO_SEND, atoi(crypto), engine->ssec.crypto_type, switch_rtp_add_crypto_key(engine->rtp_session, SWITCH_RTP_CRYPTO_SEND, atoi(crypto), engine->ssec.crypto_type,
...@@ -3196,13 +3195,17 @@ static void gen_ice(switch_core_session_t *session, switch_media_type_t type, co ...@@ -3196,13 +3195,17 @@ static void gen_ice(switch_core_session_t *session, switch_media_type_t type, co
} }
if (!engine->ice_out.foundation) { if (!engine->ice_out.foundation) {
tmp[10] = '\0';
switch_stun_random_string(tmp, 10, "0123456789"); switch_stun_random_string(tmp, 10, "0123456789");
engine->ice_out.foundation = switch_core_session_strdup(session, tmp); engine->ice_out.foundation = switch_core_session_strdup(session, tmp);
} }
engine->ice_out.component_id = 1;
engine->ice_out.transport = "udp"; engine->ice_out.transport = "udp";
engine->ice_out.priority = 100;
if (!engine->ice_out.component_id) {
engine->ice_out.component_id = 1;
engine->ice_out.priority = (2^24)*126 + (2^8)*65535 + (2^0)*(256 - engine->ice_out.component_id);
}
if (ip) { if (ip) {
engine->ice_out.con_addr = switch_core_session_strdup(session, ip); engine->ice_out.con_addr = switch_core_session_strdup(session, ip);
...@@ -3462,6 +3465,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi ...@@ -3462,6 +3465,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
if ((ssrc = switch_channel_get_variable(session->channel, "rtp_use_ssrc"))) { if ((ssrc = switch_channel_get_variable(session->channel, "rtp_use_ssrc"))) {
uint32_t ssrc_ul = (uint32_t) strtoul(ssrc, NULL, 10); uint32_t ssrc_ul = (uint32_t) strtoul(ssrc, NULL, 10);
switch_rtp_set_ssrc(a_engine->rtp_session, ssrc_ul); switch_rtp_set_ssrc(a_engine->rtp_session, ssrc_ul);
a_engine->ssrc = ssrc_ul;
} }
...@@ -3691,8 +3695,33 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi ...@@ -3691,8 +3695,33 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
switch_rtp_activate_ice(a_engine->rtp_session, switch_rtp_activate_ice(a_engine->rtp_session,
a_engine->ice_in.ufrag, a_engine->ice_in.ufrag,
a_engine->ice_out.ufrag, a_engine->ice_out.ufrag,
a_engine->ice_out.pwd); a_engine->ice_in.pwd,
} #ifdef GOOGLE_ICE
ICE_GOOGLE_JINGLE,
0
#else
ICE_VANILLA | ICE_CONTROLLED,
a_engine->ice_out.priority
#endif
);
switch_rtp_activate_rtcp_ice(a_engine->rtp_session,
a_engine->ice_in.ufrag,
a_engine->ice_out.ufrag,
a_engine->ice_in.pwd,
#ifdef GOOGLE_ICE
ICE_GOOGLE_JINGLE,
0
#else
ICE_VANILLA | ICE_CONTROLLED,
a_engine->ice_out.priority -1
#endif
);
}
...@@ -3854,6 +3883,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi ...@@ -3854,6 +3883,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
if ((ssrc = switch_channel_get_variable(session->channel, "rtp_use_video_ssrc"))) { if ((ssrc = switch_channel_get_variable(session->channel, "rtp_use_video_ssrc"))) {
uint32_t ssrc_ul = (uint32_t) strtoul(ssrc, NULL, 10); uint32_t ssrc_ul = (uint32_t) strtoul(ssrc, NULL, 10);
switch_rtp_set_ssrc(v_engine->rtp_session, ssrc_ul); switch_rtp_set_ssrc(v_engine->rtp_session, ssrc_ul);
v_engine->ssrc = ssrc_ul;
} }
...@@ -4383,27 +4413,56 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess ...@@ -4383,27 +4413,56 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "\n"); switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "\n");
if (switch_channel_test_flag(session->channel, CF_WEBRTC)) { // if (smh->mparams->rtcp_audio_interval_msec) {
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "c=IN %s %s\n", family, ip); // switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtcp:%d IN %s %s\n", port + 1, family, ip);
} //}
//switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u\n", a_engine->ssrc);
if (smh->mparams->rtcp_audio_interval_msec) { if (a_engine->ice_out.ready) {
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtcp:%d IN %s %s\n", port + 1, family, ip); char tmp1[11] = "";
} char tmp2[11] = "";
uint32_t c1 = (2^24)*126 + (2^8)*65535 + (2^0)*(256 - 1);
uint32_t c2 = (2^24)*126 + (2^8)*65535 + (2^0)*(256 - 2);
uint32_t c3 = (2^24)*126 + (2^8)*65534 + (2^0)*(256 - 1);
uint32_t c4 = (2^24)*126 + (2^8)*65534 + (2^0)*(256 - 2);
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ssrc:%u cname:abc1234\n", a_engine->ssrc);
tmp1[10] = '\0';
tmp2[10] = '\0';
switch_stun_random_string(tmp1, 10, "0123456789");
switch_stun_random_string(tmp2, 10, "0123456789");
if (a_engine->ice_out.ready) {
ice_out = &a_engine->ice_out; ice_out = &a_engine->ice_out;
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s %d %s %d %s %d typ host generation 0\n",
ice_out->foundation, ice_out->component_id, ice_out->transport, ice_out->priority, switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ host generation 0\n",
tmp1, ice_out->transport, c1,
ice_out->con_addr, ice_out->con_port ice_out->con_addr, ice_out->con_port
); );
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 1 %s %u %s %d typ srflx generation 0\n",
tmp2, ice_out->transport, c3,
ice_out->con_addr, ice_out->con_port
);
#if 1
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\n",
tmp1, ice_out->transport, c2,
ice_out->con_addr, ice_out->con_port + 1
);
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ srflx generation 0\n",
tmp2, ice_out->transport, c4,
ice_out->con_addr, ice_out->con_port + 1
);
#endif
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-ufrag:%s\n", ice_out->ufrag); switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-ufrag:%s\n", ice_out->ufrag);
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-pwd:%s\n", ice_out->pwd); switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-pwd:%s\n", ice_out->pwd);
//switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-options:google-ice\n"); #ifdef GOOGLE_ICE
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-options:google-ice\n");
#endif
} }
...@@ -4581,9 +4640,9 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess ...@@ -4581,9 +4640,9 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "\n"); switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "\n");
if (smh->mparams->rtcp_audio_interval_msec) { // if (smh->mparams->rtcp_audio_interval_msec) {
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtcp:%d IN %s %s\n", v_port + 1, family, ip); // switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtcp:%d IN %s %s\n", v_port + 1, family, ip);
} //}
if (v_engine->codec_params.rm_encoding) { if (v_engine->codec_params.rm_encoding) {
const char *of; const char *of;
...@@ -4591,14 +4650,16 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess ...@@ -4591,14 +4650,16 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
if (v_engine->ice_out.ready) { if (v_engine->ice_out.ready) {
ice_out = &v_engine->ice_out; ice_out = &v_engine->ice_out;
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s %d %s %d %s %d typ host generation 0\n", switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s %d %s %u %s %d typ host generation 0\n",
ice_out->foundation, ice_out->component_id, ice_out->transport, ice_out->priority, ice_out->foundation, ice_out->component_id, ice_out->transport, ice_out->priority,
ice_out->con_addr, ice_out->con_port ice_out->con_addr, ice_out->con_port
); );
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-ufrag:%s\n", ice_out->ufrag); switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-ufrag:%s\n", ice_out->ufrag);
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-pwd:%s\n", ice_out->pwd); switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-pwd:%s\n", ice_out->pwd);
#ifdef GOOGLE_ICE
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-options:google-ice\n"); switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=ice-options:google-ice\n");
#endif
} }
......
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论