switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, kMEDIATYPE, mg_media_type2str(term->u.rtp.media_type));
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "fax_enable_t38", "true");
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "rtp_execute_on_image", "t38_gateway self nocng");
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s local_add[%s]\n",__FUNCTION__, term->u.rtp.local_addr);
} else if (term->type == MG_TERM_TDM) {
switch_snprintf(dialstring, sizeof dialstring, "tdm/%s", term->name);
if (termtype == MG_TERM_RTP) {
/* Fill in local address and reserve an rtp port */
- term->u.rtp.local_addr = profile->my_ipaddr;
+ //term->u.rtp.local_addr = profile->my_ipaddr;
+ term->u.rtp.local_addr = profile->rtp_ipaddr;
term->u.rtp.local_port = switch_rtp_request_port(term->u.rtp.local_addr);
term->u.rtp.codec = megaco_codec_str(profile->default_codec);
term->u.rtp.term_id = term_id;
profile->total_peers++;
}
+ /* If RTP-IP is not defined then default to local-ip */
+ if((!profile->rtp_ipaddr) ||
+ (profile->rtp_ipaddr && ('\0' == profile->rtp_ipaddr[0]))){
+ profile->rtp_ipaddr = switch_mprintf("%s", profile->my_ipaddr);
+ }
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"rtp_ipaddr[%s], local ip[%s]\n", profile->rtp_ipaddr, profile->my_ipaddr);
+
if(SWITCH_STATUS_FALSE == (status = modify_mg_profile_mid(profile, &profile->mid))){
goto done;
}
goto done;
}
+
/* go through the peer configuration and get the mg profile associated peers only */
if (!(mg_peers = switch_xml_child(cfg, "mg_peers"))) {
status = SWITCH_STATUS_FALSE;
//SWITCH_CONFIG_ITEM("tdm-pre-buffer-size", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &profile->tdm_pre_buffer_size, 0, &pre_buffer_len, "", "freetdm pre buffer size"),
SWITCH_CONFIG_ITEM("codec-prefs", SWITCH_CONFIG_STRING, 0, &profile->codec_prefs, "", &switch_config_string_strdup, "", "codec preferences, coma-separated"),
SWITCH_CONFIG_ITEM("license", SWITCH_CONFIG_STRING, 0, &profile->license, "/usr/local/nsg/conf/license.txt", &switch_config_string_strdup, "", "License file"),
+ SWITCH_CONFIG_ITEM("rtp-ip", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->rtp_ipaddr, "" , &switch_config_string_strdup, "", "rtp ip"),
SWITCH_CONFIG_ITEM_END()
};