git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1499 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-05-24 16:10:05 +00:00
parent a4fc74c37e
commit 79dcf1969a
4 changed files with 103 additions and 83 deletions

View File

@ -106,6 +106,7 @@
<param name="dialplan" value="XML"/> <param name="dialplan" value="XML"/>
<param name="dtmf-duration" value="100"/> <param name="dtmf-duration" value="100"/>
<param name="codec-prefs" value="PCMU,PCMA"/> <param name="codec-prefs" value="PCMU,PCMA"/>
<param name="use-rtp-timer" value="true">
<!-- pick one (default if not specified is 'guess'); --> <!-- pick one (default if not specified is 'guess'); -->
<param name="rtp-ip" value="guess"/> <param name="rtp-ip" value="guess"/>
<!-- <param name-"rtp-ip" value="10.0.0.1"/> --> <!-- <param name-"rtp-ip" value="10.0.0.1"/> -->
@ -221,6 +222,7 @@
<param name="message" value="Jingle all the way"/> <param name="message" value="Jingle all the way"/>
<param name="rtp-ip" value="10.0.0.1"/> <param name="rtp-ip" value="10.0.0.1"/>
<param name="auto-login" value="true"/> <param name="auto-login" value="true"/>
<param name="use-rtp-timer" value="true">
<!-- or --> <!-- or -->
<!-- <param name="rtp-ip" value="my_lan_ip"/> --> <!-- <param name="rtp-ip" value="my_lan_ip"/> -->
<!-- <param name="ext-rtp-ip" value="stun:stun.server.com"/> --> <!-- <param name="ext-rtp-ip" value="stun:stun.server.com"/> -->

View File

@ -63,7 +63,8 @@ typedef enum {
TFLAG_DO_DESC = (1 << 15), TFLAG_DO_DESC = (1 << 15),
TFLAG_LANADDR = (1 << 16), TFLAG_LANADDR = (1 << 16),
TFLAG_AUTO = (1 << 17), TFLAG_AUTO = (1 << 17),
TFLAG_DTMF = (1 << 18) TFLAG_DTMF = (1 << 18),
TFLAG_TIMER = ( 1 << 19)
} TFLAGS; } TFLAGS;
typedef enum { typedef enum {
@ -236,6 +237,7 @@ static int activate_rtp(struct private_object *tech_pvt)
switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session); switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session);
const char *err; const char *err;
int ms = 20; int ms = 20;
switch_rtp_flag_t flags;
if (tech_pvt->rtp_session) { if (tech_pvt->rtp_session) {
return 0; return 0;
@ -280,6 +282,12 @@ static int activate_rtp(struct private_object *tech_pvt)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SETUP RTP %s:%d -> %s:%d\n", tech_pvt->profile->ip, tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SETUP RTP %s:%d -> %s:%d\n", tech_pvt->profile->ip, tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port);
flags = SWITCH_RTP_FLAG_GOOGLEHACK | SWITCH_RTP_FLAG_AUTOADJ;
if (switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
flags |= SWITCH_RTP_FLAG_USE_TIMER;
}
if (!(tech_pvt->rtp_session = switch_rtp_new(tech_pvt->profile->ip, if (!(tech_pvt->rtp_session = switch_rtp_new(tech_pvt->profile->ip,
tech_pvt->local_port, tech_pvt->local_port,
tech_pvt->remote_ip, tech_pvt->remote_ip,
@ -287,7 +295,7 @@ static int activate_rtp(struct private_object *tech_pvt)
tech_pvt->codec_num, tech_pvt->codec_num,
tech_pvt->read_codec.implementation->encoded_bytes_per_frame, tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
tech_pvt->read_codec.implementation->microseconds_per_frame, tech_pvt->read_codec.implementation->microseconds_per_frame,
SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_GOOGLEHACK, flags,
NULL, NULL,
&err, switch_core_session_get_pool(tech_pvt->session)))) { &err, switch_core_session_get_pool(tech_pvt->session)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err);
@ -881,14 +889,14 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
switch (msg->message_id) { switch (msg->message_id) {
case SWITCH_MESSAGE_INDICATE_BRIDGE: case SWITCH_MESSAGE_INDICATE_BRIDGE:
if (tech_pvt->rtp_session) { if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER); switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n");
//switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK); //switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
} }
break; break;
case SWITCH_MESSAGE_INDICATE_UNBRIDGE: case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
if (tech_pvt->rtp_session) { if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER); switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
//switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK); //switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
@ -1188,6 +1196,8 @@ static void set_profile_val(struct mdl_profile *profile, char *var, char *val)
profile->login = switch_core_strdup(module_pool, val); profile->login = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "password")) { } else if (!strcasecmp(var, "password")) {
profile->password = switch_core_strdup(module_pool, val); profile->password = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "use-rtp-timer") && switch_true(val)) {
switch_set_flag(profile, TFLAG_TIMER);
} else if (!strcasecmp(var, "dialplan")) { } else if (!strcasecmp(var, "dialplan")) {
profile->dialplan = switch_core_strdup(module_pool, val); profile->dialplan = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "name")) { } else if (!strcasecmp(var, "name")) {

View File

@ -75,7 +75,8 @@ typedef enum {
TFLAG_SECURE = (1 << 11), TFLAG_SECURE = (1 << 11),
TFLAG_VAD_IN = ( 1 << 12), TFLAG_VAD_IN = ( 1 << 12),
TFLAG_VAD_OUT = ( 1 << 13), TFLAG_VAD_OUT = ( 1 << 13),
TFLAG_VAD = ( 1 << 14) TFLAG_VAD = ( 1 << 14),
TFLAG_TIMER = ( 1 << 15)
} TFLAGS; } TFLAGS;
@ -475,6 +476,7 @@ static switch_status_t activate_rtp(struct private_object *tech_pvt)
switch_channel_t *channel; switch_channel_t *channel;
const char *err; const char *err;
char *key = NULL; char *key = NULL;
switch_rtp_flag_t flags;
assert(tech_pvt != NULL); assert(tech_pvt != NULL);
@ -511,6 +513,10 @@ static switch_status_t activate_rtp(struct private_object *tech_pvt)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "using Realm %s\n", tech_pvt->realm); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "using Realm %s\n", tech_pvt->realm);
} }
} }
flags = SWITCH_RTP_FLAG_MINI | SWITCH_RTP_FLAG_RAW_WRITE;
if (switch_test_flag(tech_pvt, TFLAG_TIMER)) {
flags |= SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_TIMER_RECLOCK;
}
tech_pvt->rtp_session = switch_rtp_new(tech_pvt->local_sdp_audio_ip, tech_pvt->rtp_session = switch_rtp_new(tech_pvt->local_sdp_audio_ip,
tech_pvt->local_sdp_audio_port, tech_pvt->local_sdp_audio_port,
@ -519,7 +525,7 @@ static switch_status_t activate_rtp(struct private_object *tech_pvt)
tech_pvt->read_codec.codec_interface->ianacode, tech_pvt->read_codec.codec_interface->ianacode,
tech_pvt->read_codec.implementation->encoded_bytes_per_frame, tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
ms, ms,
SWITCH_RTP_FLAG_MINI | SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_TIMER_RECLOCK | SWITCH_RTP_FLAG_RAW_WRITE, flags,
key, key,
&err, switch_core_session_get_pool(tech_pvt->session)); &err, switch_core_session_get_pool(tech_pvt->session));
@ -819,13 +825,13 @@ static switch_status_t exosip_receive_message(switch_core_session_t *session, sw
switch (msg->message_id) { switch (msg->message_id) {
case SWITCH_MESSAGE_INDICATE_BRIDGE: case SWITCH_MESSAGE_INDICATE_BRIDGE:
if (tech_pvt->rtp_session) { if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_TIMER)) {
switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER); switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n");
} }
break; break;
case SWITCH_MESSAGE_INDICATE_UNBRIDGE: case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
if (tech_pvt->rtp_session) { if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_TIMER)) {
switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER); switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
} }
@ -1885,6 +1891,8 @@ static int config_exosip(int reload)
if (!strcmp(var, "debug")) { if (!strcmp(var, "debug")) {
globals.debug = atoi(val); globals.debug = atoi(val);
} else if (!strcmp(var, "use-rtp-timer") && switch_true(val)) {
switch_set_flag(&globals, TFLAG_TIMER);
} else if (!strcmp(var, "port")) { } else if (!strcmp(var, "port")) {
globals.port = atoi(val); globals.port = atoi(val);
} else if (!strcmp(var, "vad")) { } else if (!strcmp(var, "vad")) {