summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/manager.c55
-rw-r--r--main/rtp_engine.c8
-rw-r--r--main/utils.c34
3 files changed, 76 insertions, 21 deletions
diff --git a/main/manager.c b/main/manager.c
index 99c550275..455a49c4e 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -651,6 +651,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
<parameter name="Channel"/>
<parameter name="Context"/>
<parameter name="Exten"/>
+ <parameter name="Application"/>
+ <parameter name="Data"/>
<parameter name="Reason"/>
<parameter name="Uniqueid"/>
<parameter name="CallerIDNum"/>
@@ -4969,22 +4971,43 @@ static void *fast_originate(void *data)
}
/* Tell the manager what happened with the channel */
chans[0] = chan;
- ast_manager_event_multichan(EVENT_FLAG_CALL, "OriginateResponse", chan ? 1 : 0, chans,
- "%s"
- "Response: %s\r\n"
- "Channel: %s\r\n"
- "Context: %s\r\n"
- "Exten: %s\r\n"
- "Reason: %d\r\n"
- "Uniqueid: %s\r\n"
- "CallerIDNum: %s\r\n"
- "CallerIDName: %s\r\n",
- in->idtext, res ? "Failure" : "Success",
- chan ? ast_channel_name(chan) : requested_channel, in->context, in->exten, reason,
- chan ? ast_channel_uniqueid(chan) : "<null>",
- S_OR(in->cid_num, "<unknown>"),
- S_OR(in->cid_name, "<unknown>")
- );
+ if (!ast_strlen_zero(in->app)) {
+ ast_manager_event_multichan(EVENT_FLAG_CALL, "OriginateResponse", chan ? 1 : 0, chans,
+ "%s"
+ "Response: %s\r\n"
+ "Channel: %s\r\n"
+ "Application: %s\r\n"
+ "Data: %s\r\n"
+ "Reason: %d\r\n"
+ "Uniqueid: %s\r\n"
+ "CallerIDNum: %s\r\n"
+ "CallerIDName: %s\r\n",
+ in->idtext, res ? "Failure" : "Success",
+ chan ? ast_channel_name(chan) : requested_channel,
+ in->app, in->appdata, reason,
+ chan ? ast_channel_uniqueid(chan) : S_OR(in->channelid, "<unknown>"),
+ S_OR(in->cid_num, "<unknown>"),
+ S_OR(in->cid_name, "<unknown>")
+ );
+ } else {
+ ast_manager_event_multichan(EVENT_FLAG_CALL, "OriginateResponse", chan ? 1 : 0, chans,
+ "%s"
+ "Response: %s\r\n"
+ "Channel: %s\r\n"
+ "Context: %s\r\n"
+ "Exten: %s\r\n"
+ "Reason: %d\r\n"
+ "Uniqueid: %s\r\n"
+ "CallerIDNum: %s\r\n"
+ "CallerIDName: %s\r\n",
+ in->idtext, res ? "Failure" : "Success",
+ chan ? ast_channel_name(chan) : requested_channel,
+ in->context, in->exten, reason,
+ chan ? ast_channel_uniqueid(chan) : S_OR(in->channelid, "<unknown>"),
+ S_OR(in->cid_num, "<unknown>"),
+ S_OR(in->cid_name, "<unknown>")
+ );
+ }
/* Locked and ref'd by ast_pbx_outgoing_exten or ast_pbx_outgoing_app */
if (chan) {
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index beda8cd74..7c5ef311a 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -1634,14 +1634,14 @@ int ast_rtp_dtls_cfg_parse(struct ast_rtp_dtls_cfg *dtls_cfg, const char *name,
}
} else if (!strcasecmp(name, "dtlscertfile")) {
ast_free(dtls_cfg->certfile);
- if (!ast_file_is_readable(value)) {
+ if (!ast_strlen_zero(value) && !ast_file_is_readable(value)) {
ast_log(LOG_ERROR, "%s file %s does not exist or is not readable\n", name, value);
return -1;
}
dtls_cfg->certfile = ast_strdup(value);
} else if (!strcasecmp(name, "dtlsprivatekey")) {
ast_free(dtls_cfg->pvtfile);
- if (!ast_file_is_readable(value)) {
+ if (!ast_strlen_zero(value) && !ast_file_is_readable(value)) {
ast_log(LOG_ERROR, "%s file %s does not exist or is not readable\n", name, value);
return -1;
}
@@ -1651,14 +1651,14 @@ int ast_rtp_dtls_cfg_parse(struct ast_rtp_dtls_cfg *dtls_cfg, const char *name,
dtls_cfg->cipher = ast_strdup(value);
} else if (!strcasecmp(name, "dtlscafile")) {
ast_free(dtls_cfg->cafile);
- if (!ast_file_is_readable(value)) {
+ if (!ast_strlen_zero(value) && !ast_file_is_readable(value)) {
ast_log(LOG_ERROR, "%s file %s does not exist or is not readable\n", name, value);
return -1;
}
dtls_cfg->cafile = ast_strdup(value);
} else if (!strcasecmp(name, "dtlscapath") || !strcasecmp(name, "dtlscadir")) {
ast_free(dtls_cfg->capath);
- if (!ast_file_is_readable(value)) {
+ if (!ast_strlen_zero(value) && !ast_file_is_readable(value)) {
ast_log(LOG_ERROR, "%s file %s does not exist or is not readable\n", name, value);
return -1;
}
diff --git a/main/utils.c b/main/utils.c
index 3eeafed4f..3a8d46ae4 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -1404,7 +1404,13 @@ int ast_carefulwrite(int fd, char *s, int len, int timeoutms)
if (res < 0 && errno != EAGAIN && errno != EINTR) {
/* fatal error from write() */
- ast_log(LOG_ERROR, "write() returned error: %s\n", strerror(errno));
+ if (errno == EPIPE) {
+#ifndef STANDALONE
+ ast_debug(1, "write() failed due to reading end being closed: %s\n", strerror(errno));
+#endif
+ } else {
+ ast_log(LOG_ERROR, "write() returned error: %s\n", strerror(errno));
+ }
return -1;
}
@@ -2949,3 +2955,29 @@ int ast_file_is_readable(const char *filename)
return 1;
#endif
}
+
+int ast_compare_versions(const char *version1, const char *version2)
+{
+ unsigned int major[2] = { 0 };
+ unsigned int minor[2] = { 0 };
+ unsigned int patch[2] = { 0 };
+ unsigned int extra[2] = { 0 };
+ int res;
+
+ sscanf(version1, "%u.%u.%u.%u", &major[0], &minor[0], &patch[0], &extra[0]);
+ sscanf(version2, "%u.%u.%u.%u", &major[1], &minor[1], &patch[1], &extra[1]);
+
+ res = major[0] - major[1];
+ if (res) {
+ return res;
+ }
+ res = minor[0] - minor[1];
+ if (res) {
+ return res;
+ }
+ res = patch[0] - patch[1];
+ if (res) {
+ return res;
+ }
+ return extra[0] - extra[1];
+}