mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-21 03:17:59 +00:00
cleanup, null checks. etc.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6708 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
54ec86f6ce
commit
504f1275db
@ -74,9 +74,14 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
|
|||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
|
|
||||||
if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
|
if (switch_ivr_generate_xml_cdr(session, &cdr) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Generating Data!\n");
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* build the XML */
|
/* build the XML */
|
||||||
if (!(xml_text = switch_xml_toxml(cdr, SWITCH_TRUE))) {
|
xml_text = switch_xml_toxml(cdr, SWITCH_TRUE);
|
||||||
|
if (!xml_text) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -117,7 +122,7 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
|
|||||||
switch_size_t need_bytes = strlen(xml_text) * 3;
|
switch_size_t need_bytes = strlen(xml_text) * 3;
|
||||||
|
|
||||||
xml_text_escaped = malloc(need_bytes);
|
xml_text_escaped = malloc(need_bytes);
|
||||||
assert(xml_text_escaped);
|
switch_assert(xml_text_escaped);
|
||||||
memset(xml_text_escaped, 0, sizeof(xml_text_escaped));
|
memset(xml_text_escaped, 0, sizeof(xml_text_escaped));
|
||||||
if (globals.encode == 1) {
|
if (globals.encode == 1) {
|
||||||
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
|
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
|
||||||
@ -198,9 +203,6 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Generating Data!\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
success:
|
success:
|
||||||
|
@ -194,7 +194,9 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
|
|||||||
if(keep_files_around) {
|
if(keep_files_around) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "XML response is in %s\n", filename);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "XML response is in %s\n", filename);
|
||||||
} else {
|
} else {
|
||||||
unlink(filename);
|
if (unlink(filename) != 0) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "XML response file [%s] delete failed\n", filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return xml;
|
return xml;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user