mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-05 23:18:16 +00:00
oops
This commit is contained in:
parent
457f98686c
commit
828a13733b
@ -66,56 +66,8 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
|
|||||||
|
|
||||||
profile->idx = ++mg_sap_id;
|
profile->idx = ++mg_sap_id;
|
||||||
|
|
||||||
/* we should break from here , profile name should be unique */
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (mg_peer = switch_xml_child(mg_peers, "mg_peer"); mg_peer; mg_peer = mg_peer->next) {
|
|
||||||
const char *name = switch_xml_attr_soft(mg_peer, "name");
|
|
||||||
for(idx=0; idx<profile->total_peers; idx++){
|
|
||||||
count = 0x00;
|
|
||||||
event = NULL;
|
|
||||||
peer_profile = NULL;
|
|
||||||
if (!strcmp(name, profile->peer_list[idx])) {
|
|
||||||
/* peer profile */
|
|
||||||
switch_core_new_memory_pool(&pool);
|
|
||||||
peer_profile = switch_core_alloc(pool, sizeof(*peer_profile));
|
|
||||||
peer_profile->pool = pool;
|
|
||||||
peer_profile->name = switch_core_strdup(peer_profile->pool, name);
|
|
||||||
switch_thread_rwlock_create(&peer_profile->rwlock, peer_profile->pool);
|
|
||||||
instructions1 = (peer_profile ? get_peer_instructions(peer_profile) : NULL);
|
|
||||||
|
|
||||||
count = switch_event_import_xml(switch_xml_child(mg_peer, "param"), "name", "value", &event);
|
|
||||||
if(SWITCH_STATUS_FALSE == (status = switch_xml_config_parse_event(event, count, reload, instructions1))){
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, " Peer XML Parsing failed \n");
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SWITCH_STATUS_FALSE == (status = modify_mid(&peer_profile->mid))) {
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,"peer_profile name[%s], ipaddr[%s] port[%s], mid[%s] transport_type[%s], encoding_type[%s] \n",
|
|
||||||
peer_profile->name, peer_profile->ipaddr, peer_profile->port,peer_profile->mid, peer_profile->transport_type, peer_profile->encoding_type);
|
|
||||||
|
|
||||||
switch_core_hash_insert_wrlock(megaco_globals.peer_profile_hash, peer_profile->name, peer_profile, megaco_globals.peer_profile_rwlock);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ((mg_phys_terms = switch_xml_child(cfg, "physical_terminations"))) {
|
|
||||||
|
|
||||||
|
if ((mg_phys_terms = switch_xml_child(mg_interface, "physical_terminations"))) {
|
||||||
for (mg_term = switch_xml_child(mg_phys_terms, "map"); mg_term; mg_term = mg_term->next) {
|
for (mg_term = switch_xml_child(mg_phys_terms, "map"); mg_term; mg_term = mg_term->next) {
|
||||||
switch_memory_pool_t *pool;
|
switch_memory_pool_t *pool;
|
||||||
mg_termination_t *term;
|
mg_termination_t *term;
|
||||||
@ -162,7 +114,54 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
|
|||||||
|
|
||||||
free(channel_map_dup);
|
free(channel_map_dup);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* we should break from here , profile name should be unique */
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (mg_peer = switch_xml_child(mg_peers, "mg_peer"); mg_peer; mg_peer = mg_peer->next) {
|
||||||
|
const char *name = switch_xml_attr_soft(mg_peer, "name");
|
||||||
|
for(idx=0; idx<profile->total_peers; idx++){
|
||||||
|
count = 0x00;
|
||||||
|
event = NULL;
|
||||||
|
peer_profile = NULL;
|
||||||
|
if (!strcmp(name, profile->peer_list[idx])) {
|
||||||
|
/* peer profile */
|
||||||
|
switch_core_new_memory_pool(&pool);
|
||||||
|
peer_profile = switch_core_alloc(pool, sizeof(*peer_profile));
|
||||||
|
peer_profile->pool = pool;
|
||||||
|
peer_profile->name = switch_core_strdup(peer_profile->pool, name);
|
||||||
|
switch_thread_rwlock_create(&peer_profile->rwlock, peer_profile->pool);
|
||||||
|
instructions1 = (peer_profile ? get_peer_instructions(peer_profile) : NULL);
|
||||||
|
|
||||||
|
count = switch_event_import_xml(switch_xml_child(mg_peer, "param"), "name", "value", &event);
|
||||||
|
if(SWITCH_STATUS_FALSE == (status = switch_xml_config_parse_event(event, count, reload, instructions1))){
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, " Peer XML Parsing failed \n");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SWITCH_STATUS_FALSE == (status = modify_mid(&peer_profile->mid))) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,"peer_profile name[%s], ipaddr[%s] port[%s], mid[%s] transport_type[%s], encoding_type[%s] \n",
|
||||||
|
peer_profile->name, peer_profile->ipaddr, peer_profile->port,peer_profile->mid, peer_profile->transport_type, peer_profile->encoding_type);
|
||||||
|
|
||||||
|
switch_core_hash_insert_wrlock(megaco_globals.peer_profile_hash, peer_profile->name, peer_profile, megaco_globals.peer_profile_rwlock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user