summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/manager.c31
-rw-r--r--main/manager_channels.c21
-rw-r--r--res/res_pjsip.c28
-rw-r--r--res/res_pjsip_mwi.c2
4 files changed, 41 insertions, 41 deletions
diff --git a/main/manager.c b/main/manager.c
index 3aa910501..177959ac8 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1770,7 +1770,12 @@ void manager_json_to_ast_str(struct ast_json *obj, const char *key,
{
struct ast_json_iter *i;
- if (!obj || (!res && !(*res) && (!(*res = ast_str_create(1024))))) {
+ /* If obj or res is not given, just return */
+ if (!obj || !res) {
+ return;
+ }
+
+ if (!*res && !(*res = ast_str_create(1024))) {
return;
}
@@ -1801,11 +1806,14 @@ void manager_json_to_ast_str(struct ast_json *obj, const char *key,
}
}
-
struct ast_str *ast_manager_str_from_json_object(struct ast_json *blob, key_exclusion_cb exclusion_cb)
{
struct ast_str *res = ast_str_create(1024);
- manager_json_to_ast_str(blob, NULL, &res, exclusion_cb);
+
+ if (!ast_json_is_null(blob)) {
+ manager_json_to_ast_str(blob, NULL, &res, exclusion_cb);
+ }
+
return res;
}
@@ -9497,23 +9505,16 @@ struct ast_datastore *astman_datastore_find(struct mansession *s, const struct a
}
int ast_str_append_event_header(struct ast_str **fields_string,
- const char *header, const char *value)
+ const char *header, const char *value)
{
- struct ast_str *working_str = *fields_string;
-
- if (!working_str) {
- working_str = ast_str_create(128);
- if (!working_str) {
+ if (!*fields_string) {
+ *fields_string = ast_str_create(128);
+ if (!*fields_string) {
return -1;
}
- *fields_string = working_str;
}
- ast_str_append(&working_str, 0,
- "%s: %s\r\n",
- header, value);
-
- return 0;
+ return (ast_str_append(fields_string, 0, "%s: %s\r\n", header, value) < 0) ? -1 : 0;
}
static void manager_event_blob_dtor(void *obj)
diff --git a/main/manager_channels.c b/main/manager_channels.c
index 81dafd74b..37269a917 100644
--- a/main/manager_channels.c
+++ b/main/manager_channels.c
@@ -488,16 +488,17 @@ struct ast_str *ast_manager_build_channel_state_string_prefix(
const struct ast_channel_snapshot *snapshot,
const char *prefix)
{
- struct ast_str *out = ast_str_create(1024);
- int res = 0;
- char *caller_name, *connected_name;
+ struct ast_str *out;
+ char *caller_name;
+ char *connected_name;
+ int res;
- if (!out) {
+ if (snapshot->tech_properties & AST_CHAN_TP_INTERNAL) {
return NULL;
}
- if (snapshot->tech_properties & AST_CHAN_TP_INTERNAL) {
- ast_free(out);
+ out = ast_str_create(1024);
+ if (!out) {
return NULL;
}
@@ -534,10 +535,11 @@ struct ast_str *ast_manager_build_channel_state_string_prefix(
prefix, snapshot->uniqueid,
prefix, snapshot->linkedid);
+ ast_free(caller_name);
+ ast_free(connected_name);
+
if (!res) {
ast_free(out);
- ast_free(caller_name);
- ast_free(connected_name);
return NULL;
}
@@ -553,9 +555,6 @@ struct ast_str *ast_manager_build_channel_state_string_prefix(
}
}
- ast_free(caller_name);
- ast_free(connected_name);
-
return out;
}
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index bf859fe88..310ff20bc 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -66,7 +66,7 @@
It contains the core SIP related options only, endpoints are <emphasis>NOT</emphasis>
dialable entries of their own. Communication with another SIP device is
accomplished via Addresses of Record (AoRs) which have one or more
- contacts assicated with them. Endpoints <emphasis>NOT</emphasis> configured to
+ contacts associated with them. Endpoints <emphasis>NOT</emphasis> configured to
use a <literal>transport</literal> will default to first transport found
in <filename>pjsip.conf</filename> that matches its type.
</para>
@@ -449,7 +449,7 @@
<configOption name="timers_min_se" default="90">
<synopsis>Minimum session timers expiration period</synopsis>
<description><para>
- Minimium session timer expiration period. Time in seconds.
+ Minimum session timer expiration period. Time in seconds.
</para></description>
</configOption>
<configOption name="timers" default="yes">
@@ -467,7 +467,7 @@
<configOption name="timers_sess_expires" default="1800">
<synopsis>Maximum session timer expiration period</synopsis>
<description><para>
- Maximium session timer expiration period. Time in seconds.
+ Maximum session timer expiration period. Time in seconds.
</para></description>
</configOption>
<configOption name="transport">
@@ -509,7 +509,7 @@
<synopsis>Must be of type 'endpoint'.</synopsis>
</configOption>
<configOption name="use_ptime" default="no">
- <synopsis>Use Endpoint's requested packetisation interval</synopsis>
+ <synopsis>Use Endpoint's requested packetization interval</synopsis>
</configOption>
<configOption name="use_avpf" default="no">
<synopsis>Determines whether res_pjsip will use and enforce usage of AVPF for this
@@ -647,7 +647,7 @@
Forward error correction should be used.
</para></enum>
<enum name="redundancy"><para>
- Redundacy error correction should be used.
+ Redundancy error correction should be used.
</para></enum>
</enumlist>
</description>
@@ -1111,7 +1111,7 @@
<description><para>Only used when auth_type is <literal>md5</literal>.</para></description>
</configOption>
<configOption name="password">
- <synopsis>PlainText password used for authentication.</synopsis>
+ <synopsis>Plain text password used for authentication.</synopsis>
<description><para>Only used when auth_type is <literal>userpass</literal>.</para></description>
</configOption>
<configOption name="realm">
@@ -1316,7 +1316,7 @@
</description>
</configOption>
<configOption name="symmetric_transport" default="no">
- <synopsis>Use the same transport for outgoing reqests as incoming ones.</synopsis>
+ <synopsis>Use the same transport for outgoing requests as incoming ones.</synopsis>
<description>
<para>When a request from a dynamic contact
comes in on a transport with this option set to 'yes',
@@ -1361,7 +1361,7 @@
<configOption name="qualify_timeout" default="3.0">
<synopsis>Timeout for qualify</synopsis>
<description><para>
- If the contact doesn't repond to the OPTIONS request before the timeout,
+ If the contact doesn't respond to the OPTIONS request before the timeout,
the contact is marked unavailable.
If <literal>0</literal> no timeout. Time in fractional seconds.
</para></description>
@@ -1445,8 +1445,8 @@
<literal>endpoint</literal> for calls.
</para><para>
This can be used as another way of grouping a list of contacts to dial
- rather than specifing them each directly when dialing via the dialplan.
- This must be used in conjuction with the <literal>PJSIP_DIAL_CONTACTS</literal>.
+ rather than specifying them each directly when dialing via the dialplan.
+ This must be used in conjunction with the <literal>PJSIP_DIAL_CONTACTS</literal>.
</para><para>
Registrations: For Asterisk to match an inbound registration to an endpoint,
the AoR object name must match the user portion of the SIP URI in the "To:"
@@ -1486,7 +1486,7 @@
<configOption name="maximum_expiration" default="7200">
<synopsis>Maximum time to keep an AoR</synopsis>
<description><para>
- Maximium time to keep a peer with explicit expiration. Time in seconds.
+ Maximum time to keep a peer with explicit expiration. Time in seconds.
</para></description>
</configOption>
<configOption name="max_contacts" default="0">
@@ -1560,7 +1560,7 @@
<configOption name="qualify_timeout" default="3.0">
<synopsis>Timeout for qualify</synopsis>
<description><para>
- If the contact doesn't repond to the OPTIONS request before the timeout,
+ If the contact doesn't respond to the OPTIONS request before the timeout,
the contact is marked unavailable.
If <literal>0</literal> no timeout. Time in fractional seconds.
</para></description>
@@ -1659,7 +1659,7 @@
<configOption name="disable_multi_domain" default="no">
<synopsis>Disable Multi Domain support</synopsis>
<description><para>
- If disabled it can improve realtime performace by reducing number of database requsts.
+ If disabled it can improve realtime performance by reducing the number of database requests.
</para></description>
</configOption>
<configOption name="max_initial_qualify_time" default="0">
@@ -1785,7 +1785,7 @@
in the user field of a SIP URI then the field is truncated
at the first semicolon. This effectively makes the semicolon
a non-usable character for PJSIP endpoint names, extensions,
- and AORs. This can be useful for improving compatability with
+ and AORs. This can be useful for improving compatibility with
an ITSP that likes to use user options for whatever reason.
</para>
<example title="Sample SIP URI">
diff --git a/res/res_pjsip_mwi.c b/res/res_pjsip_mwi.c
index 90fdc098c..4cd892c05 100644
--- a/res/res_pjsip_mwi.c
+++ b/res/res_pjsip_mwi.c
@@ -650,11 +650,11 @@ static void send_mwi_notify(struct mwi_subscription *sub)
.body_type = AST_SIP_MESSAGE_ACCUMULATOR,
.body_data = &counter,
};
- const char *resource = ast_sip_subscription_get_resource_name(sub->sip_sub);
ao2_callback(sub->stasis_subs, OBJ_NODATA, get_message_count, &counter);
if (sub->is_solicited) {
+ const char *resource = ast_sip_subscription_get_resource_name(sub->sip_sub);
struct ast_sip_endpoint *endpoint = ast_sip_subscription_get_endpoint(sub->sip_sub);
struct ast_sip_aor *aor = find_aor_for_resource(endpoint, resource);
pjsip_dialog *dlg = ast_sip_subscription_get_dialog(sub->sip_sub);