switch_xml_t cfg, xml, param, mg_interfaces, mg_interface, mg_peers, mg_peer, peer_interfaces ;
switch_status_t status = SWITCH_STATUS_FALSE;
switch_event_t *event = NULL;
- const char *file = "megaco.conf";
+ const char *file = "media_gateway.conf";
switch_xml_config_item_t *instructions = (profile ? get_instructions(profile) : NULL);
int count;
int idx;
break;
}
+ if (!mg_interface) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error profile %s not found\n", profile->name);
+ return SWITCH_STATUS_FALSE;
+ }
+
/* go through the peer configuration and get the mg profile associated peers only */
if (!(mg_peers = switch_xml_child(cfg, "mg_peers"))) {
goto done;
static switch_xml_config_int_options_t opt_version = {
SWITCH_TRUE, /* enforce min */
1,
- SWITCH_TRUE, /* Enforce Max */
+ SWITCH_TRUE, /* enforce Max */
3
};
+ static switch_xml_config_int_options_t opt_termination_id_len = {
+ SWITCH_TRUE, /* enforce min */
+ 1,
+ SWITCH_TRUE, /* enforce Max */
+ 9
+ };
+
+ static switch_xml_config_enum_item_t opt_default_codec_enum[] = {
+ { "PCMA", MEGACO_CODEC_PCMA},
+ { "PCMU", MEGACO_CODEC_PCMU},
+ { "G.729", MEGACO_CODEC_G729},
+ { "G.723.1", MEGACO_CODEC_G723_1},
+ { "ILBC", MEGACO_CODEC_ILBC },
+ };
+
switch_xml_config_item_t instructions[] = {
/* parameter name type reloadable pointer default value options structure */
SWITCH_CONFIG_ITEM("protocol", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->protocol_type, "MEGACO", &switch_config_string_strdup, "", "MG Protocol type"),
SWITCH_CONFIG_ITEM("port", SWITCH_CONFIG_STRING, 0, &profile->port, "2944", &switch_config_string_strdup, "", "port"),
SWITCH_CONFIG_ITEM("domain-name", SWITCH_CONFIG_STRING, 0, &profile->my_domain, "", &switch_config_string_strdup, "", "domain name"),
SWITCH_CONFIG_ITEM("message-identifier", SWITCH_CONFIG_STRING, 0, &profile->mid, "", &switch_config_string_strdup, "", "message identifier "),
+
+ SWITCH_CONFIG_ITEM("default-codec", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE, &profile->default_codec, "PCMU", &opt_default_codec_enum, "", "default codec"),
+ SWITCH_CONFIG_ITEM("rtp-port-range", SWITCH_CONFIG_STRING, CONFIG_REQUIRED, &profile->rtp_port_range, "1-65535", &switch_config_string_strdup, "", "rtp port range"),
+ SWITCH_CONFIG_ITEM("rtp-termination-id-prefix", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->rtp_termination_id_prefix, "", &switch_config_string_strdup, "", "rtp termination prefix"),
+ SWITCH_CONFIG_ITEM("rtp-termination-id-len", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &profile->rtp_termination_id_len, "", &opt_termination_id_len, "", "rtp termination id"),
SWITCH_CONFIG_ITEM_END()
};
PF_RUNNING = (1 << 0)
} megaco_profile_flags_t;
+typedef enum {
+ MEGACO_CODEC_PCMA,
+ MEGACO_CODEC_PCMU,
+ MEGACO_CODEC_G729,
+ MEGACO_CODEC_G723_1,
+ MEGACO_CODEC_ILBC,
+} megaco_codec_t;
+
typedef struct mg_peer_profile_s{
char *name;
switch_memory_pool_t *pool;
typedef struct megaco_profile_s {
char *name;
- switch_memory_pool_t *pool;
- switch_thread_rwlock_t *rwlock; /* < Reference counting rwlock */
- megaco_profile_flags_t flags;
- int idx; /* Trillium MEGACO SAP identification*/
- char* mid; /* MG H.248 MID */
- char* my_domain; /* local domain name */
- char* my_ipaddr; /* local domain name */
- char* port; /* port */
- char* protocol_type; /* MEGACO/MGCP */
- int protocol_version; /* Protocol supported version */
- int total_peers;
- char* peer_list[MG_MAX_PEERS]; /* MGC Peer ID LIST */
+ switch_memory_pool_t *pool;
+ switch_thread_rwlock_t *rwlock; /* < Reference counting rwlock */
+ megaco_profile_flags_t flags;
+ int idx; /* Trillium MEGACO SAP identification*/
+ char* mid; /* MG H.248 MID */
+ char* my_domain; /* local domain name */
+ char* my_ipaddr; /* local domain name */
+ char* port; /* port */
+ char* protocol_type; /* MEGACO/MGCP */
+ int protocol_version; /* Protocol supported version */
+ int total_peers;
+ megaco_codec_t default_codec;
+ char* rtp_port_range;
+ char* rtp_termination_id_prefix;
+ int rtp_termination_id_len;
+ char* peer_list[MG_MAX_PEERS]; /* MGC Peer ID LIST */
} megaco_profile_t;