mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-05-03 22:57:16 +00:00
mod_freetdm: Coding style and whitespace clean up.
No functional changes. Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
This commit is contained in:
parent
b9a45c75f4
commit
42c76fa81b
@ -121,7 +121,6 @@ struct private_object {
|
|||||||
uint32_t write_error;
|
uint32_t write_error;
|
||||||
uint32_t read_error;
|
uint32_t read_error;
|
||||||
char network_peer_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
|
char network_peer_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* private data attached to FTDM channels (only FXS for now) */
|
/* private data attached to FTDM channels (only FXS for now) */
|
||||||
@ -1188,6 +1187,7 @@ switch_io_routines_t freetdm_io_routines = {
|
|||||||
static const char* channel_get_variable(switch_core_session_t *session, switch_event_t *var_event, const char *variable_name)
|
static const char* channel_get_variable(switch_core_session_t *session, switch_event_t *var_event, const char *variable_name)
|
||||||
{
|
{
|
||||||
const char *variable = NULL;
|
const char *variable = NULL;
|
||||||
|
|
||||||
if (var_event) {
|
if (var_event) {
|
||||||
if ((variable = switch_event_get_header(var_event, variable_name))) {
|
if ((variable = switch_event_get_header(var_event, variable_name))) {
|
||||||
return variable;
|
return variable;
|
||||||
@ -2234,7 +2234,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxo_signal)
|
|||||||
|
|
||||||
ftdm_log(FTDM_LOG_DEBUG, "got FXO sig %d:%d [%s]\n", spanid, chanid, ftdm_signal_event2str(sigmsg->event_id));
|
ftdm_log(FTDM_LOG_DEBUG, "got FXO sig %d:%d [%s]\n", spanid, chanid, ftdm_signal_event2str(sigmsg->event_id));
|
||||||
|
|
||||||
switch(sigmsg->event_id) {
|
switch (sigmsg->event_id) {
|
||||||
case FTDM_SIGEVENT_PROGRESS_MEDIA:
|
case FTDM_SIGEVENT_PROGRESS_MEDIA:
|
||||||
{
|
{
|
||||||
if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) {
|
if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) {
|
||||||
@ -2302,7 +2302,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxs_signal)
|
|||||||
|
|
||||||
ftdm_log(FTDM_LOG_DEBUG, "got FXS sig [%s]\n", ftdm_signal_event2str(sigmsg->event_id));
|
ftdm_log(FTDM_LOG_DEBUG, "got FXS sig [%s]\n", ftdm_signal_event2str(sigmsg->event_id));
|
||||||
|
|
||||||
switch(sigmsg->event_id) {
|
switch (sigmsg->event_id) {
|
||||||
case FTDM_SIGEVENT_UP:
|
case FTDM_SIGEVENT_UP:
|
||||||
{
|
{
|
||||||
if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) {
|
if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) {
|
||||||
@ -2804,8 +2804,8 @@ static uint32_t enable_analog_option(const char *str, uint32_t current_options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create ftdm_conf_node_t tree based on a fixed pattern XML configuration list
|
* Create ftdm_conf_node_t tree based on a fixed pattern XML configuration list.
|
||||||
* last 2 args are for limited aka dumb recursivity
|
* Last 2 args are for limited aka dumb recursivity.
|
||||||
*/
|
*/
|
||||||
static int add_config_list_nodes(switch_xml_t swnode, ftdm_conf_node_t *rootnode,
|
static int add_config_list_nodes(switch_xml_t swnode, ftdm_conf_node_t *rootnode,
|
||||||
const char *list_name, const char *list_element_name,
|
const char *list_name, const char *list_element_name,
|
||||||
@ -2859,8 +2859,10 @@ static int add_config_list_nodes(switch_xml_t swnode, ftdm_conf_node_t *rootnode
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create ftdm_conf_node_t tree based on a fixed pattern XML configuration list
|
/*
|
||||||
* last arg is to specify if we have any sublist for e.g.
|
* Create ftdm_conf_node_t tree based on a fixed pattern XML configuration list.
|
||||||
|
* Last arg is to specify if we have any sublist for e.g.:
|
||||||
|
*
|
||||||
* <list_name>
|
* <list_name>
|
||||||
* <list_element_name>
|
* <list_element_name>
|
||||||
* <param name="xxx" value="xxx"/>
|
* <param name="xxx" value="xxx"/>
|
||||||
@ -2869,7 +2871,7 @@ static int add_config_list_nodes(switch_xml_t swnode, ftdm_conf_node_t *rootnode
|
|||||||
* </sub-list>
|
* </sub-list>
|
||||||
* </list_element_name>
|
* </list_element_name>
|
||||||
* </list_name>
|
* </list_name>
|
||||||
* */
|
*/
|
||||||
static int add_config_nodes(switch_xml_t swnode, ftdm_conf_node_t *rootnode,
|
static int add_config_nodes(switch_xml_t swnode, ftdm_conf_node_t *rootnode,
|
||||||
const char *list_name, const char *list_element_name, const char *sub_list_name)
|
const char *list_name, const char *list_element_name, const char *sub_list_name)
|
||||||
{
|
{
|
||||||
@ -2996,11 +2998,11 @@ static ftdm_conf_node_t *_get_ss7_config_node(switch_xml_t cfg, const char *conf
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* operating mode , M2UA or ISUP */
|
/* operating mode , M2UA or ISUP */
|
||||||
if(operating_mode && ('\0' != operating_mode[0])) {
|
if (operating_mode && ('\0' != operating_mode[0])) {
|
||||||
if(!strcasecmp(operating_mode, "ISUP")) {
|
if (!strcasecmp(operating_mode, "ISUP")) {
|
||||||
is_isup = 0x01;
|
is_isup = 0x01;
|
||||||
}
|
}
|
||||||
else if(!strcasecmp(operating_mode, "M2UA_SG")) {
|
else if (!strcasecmp(operating_mode, "M2UA_SG")) {
|
||||||
is_isup = 0x00;
|
is_isup = 0x00;
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid operating Mode[%s] \n", operating_mode);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid operating Mode[%s] \n", operating_mode);
|
||||||
@ -3053,7 +3055,7 @@ static ftdm_conf_node_t *_get_ss7_config_node(switch_xml_t cfg, const char *conf
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_isup) {
|
if (is_isup) {
|
||||||
/* add mtp3 links */
|
/* add mtp3 links */
|
||||||
if (add_config_list_nodes(isup, rootnode, "mtp3_links", "mtp3_link", NULL, NULL)) {
|
if (add_config_list_nodes(isup, rootnode, "mtp3_links", "mtp3_link", NULL, NULL)) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp3_links for sng_isup config %s\n", confname);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to process mtp3_links for sng_isup config %s\n", confname);
|
||||||
@ -3248,10 +3250,12 @@ static void parse_gsm_spans(switch_xml_t cfg, switch_xml_t spans)
|
|||||||
LOAD_ERROR("Error configuring Sangoma GSM FreeTDM span %d\n", span_id);
|
LOAD_ERROR("Error configuring Sangoma GSM FreeTDM span %d\n", span_id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPAN_CONFIG[span_id].span = span;
|
SPAN_CONFIG[span_id].span = span;
|
||||||
switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context));
|
switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context));
|
||||||
switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan));
|
switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan));
|
||||||
switch_copy_string(SPAN_CONFIG[span_id].type, "GSM", sizeof(SPAN_CONFIG[span_id].type));
|
switch_copy_string(SPAN_CONFIG[span_id].type, "GSM", sizeof(SPAN_CONFIG[span_id].type));
|
||||||
|
|
||||||
ftdm_log(FTDM_LOG_DEBUG, "Configured GSM FreeTDM span %d\n", span_id);
|
ftdm_log(FTDM_LOG_DEBUG, "Configured GSM FreeTDM span %d\n", span_id);
|
||||||
ftdm_span_start(span);
|
ftdm_span_start(span);
|
||||||
}
|
}
|
||||||
@ -3379,10 +3383,12 @@ static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans)
|
|||||||
LOAD_ERROR("Error configuring Sangoma ISDN FreeTDM span %d\n", span_id);
|
LOAD_ERROR("Error configuring Sangoma ISDN FreeTDM span %d\n", span_id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPAN_CONFIG[span_id].span = span;
|
SPAN_CONFIG[span_id].span = span;
|
||||||
switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context));
|
switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context));
|
||||||
switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan));
|
switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan));
|
||||||
switch_copy_string(SPAN_CONFIG[span_id].type, "Sangoma (ISDN)", sizeof(SPAN_CONFIG[span_id].type));
|
switch_copy_string(SPAN_CONFIG[span_id].type, "Sangoma (ISDN)", sizeof(SPAN_CONFIG[span_id].type));
|
||||||
|
|
||||||
ftdm_log(FTDM_LOG_DEBUG, "Configured Sangoma ISDN FreeTDM span %d\n", span_id);
|
ftdm_log(FTDM_LOG_DEBUG, "Configured Sangoma ISDN FreeTDM span %d\n", span_id);
|
||||||
ftdm_span_start(span);
|
ftdm_span_start(span);
|
||||||
}
|
}
|
||||||
@ -3400,6 +3406,7 @@ static switch_status_t load_config(void)
|
|||||||
|
|
||||||
memset(&globals, 0, sizeof(globals));
|
memset(&globals, 0, sizeof(globals));
|
||||||
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, module_pool);
|
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, module_pool);
|
||||||
|
|
||||||
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
|
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
|
||||||
return SWITCH_STATUS_TERM;
|
return SWITCH_STATUS_TERM;
|
||||||
@ -3490,14 +3497,17 @@ static switch_status_t load_config(void)
|
|||||||
|
|
||||||
memset(spanparameters, 0, sizeof(spanparameters));
|
memset(spanparameters, 0, sizeof(spanparameters));
|
||||||
paramindex = 0;
|
paramindex = 0;
|
||||||
if(operating_mode){
|
|
||||||
|
if (operating_mode) {
|
||||||
spanparameters[paramindex].var = "operating-mode";
|
spanparameters[paramindex].var = "operating-mode";
|
||||||
spanparameters[paramindex].val = operating_mode;
|
spanparameters[paramindex].val = operating_mode;
|
||||||
paramindex++;
|
paramindex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
spanparameters[paramindex].var = "confnode";
|
spanparameters[paramindex].var = "confnode";
|
||||||
spanparameters[paramindex].ptr = ss7confnode;
|
spanparameters[paramindex].ptr = ss7confnode;
|
||||||
paramindex++;
|
paramindex++;
|
||||||
|
|
||||||
for (param = switch_xml_child(myspan, "param"); param; param = param->next) {
|
for (param = switch_xml_child(myspan, "param"); param; param = param->next) {
|
||||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||||
char *val = (char *) switch_xml_attr_soft(param, "value");
|
char *val = (char *) switch_xml_attr_soft(param, "value");
|
||||||
@ -3525,12 +3535,16 @@ static switch_status_t load_config(void)
|
|||||||
LOAD_ERROR("Error configuring ss7 FreeTDM span %d\n", span_id);
|
LOAD_ERROR("Error configuring ss7 FreeTDM span %d\n", span_id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPAN_CONFIG[span_id].span = span;
|
SPAN_CONFIG[span_id].span = span;
|
||||||
|
|
||||||
switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context));
|
switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context));
|
||||||
switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan));
|
switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan));
|
||||||
switch_copy_string(SPAN_CONFIG[span_id].type, "Sangoma (SS7)", sizeof(SPAN_CONFIG[span_id].type));
|
switch_copy_string(SPAN_CONFIG[span_id].type, "Sangoma (SS7)", sizeof(SPAN_CONFIG[span_id].type));
|
||||||
|
|
||||||
ftdm_log(FTDM_LOG_DEBUG, "Configured ss7 FreeTDM span %d with config node %s\n", span_id, configname);
|
ftdm_log(FTDM_LOG_DEBUG, "Configured ss7 FreeTDM span %d with config node %s\n", span_id, configname);
|
||||||
if(FTDM_SUCCESS != ftdm_span_start(span)){
|
|
||||||
|
if (FTDM_SUCCESS != ftdm_span_start(span)) {
|
||||||
LOAD_ERROR("Error Starting ss7 FreeTDM span %d\n", span_id);
|
LOAD_ERROR("Error Starting ss7 FreeTDM span %d\n", span_id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user