[Asterisk-code-review] ACN: Configuration renaming for pjsip endpoint (asterisk[master])

Joshua Colp asteriskteam at digium.com
Thu Aug 6 10:50:17 CDT 2020


Joshua Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14689 )

Change subject: ACN: Configuration renaming for pjsip endpoint
......................................................................

ACN: Configuration renaming for pjsip endpoint

This change renames the codec preference endpoint options.
incoming_offer_codec_prefs becomes codec_prefs_incoming_offer
to keep the options together when showing an endpoint.

Change-Id: I6202965b4723777f22a83afcbbafcdafb1d11c8d
---
M configs/samples/pjsip.conf.sample
M contrib/ast-db-manage/config/versions/b80485ff4dd0_add_pjsip_endpoint_acn_options.py
M include/asterisk/res_pjsip.h
M res/res_pjsip.c
M res/res_pjsip/pjsip_configuration.c
5 files changed, 32 insertions(+), 32 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  Kevin Harwell: Looks good to me, approved



diff --git a/configs/samples/pjsip.conf.sample b/configs/samples/pjsip.conf.sample
index 2636f63..3c91664 100644
--- a/configs/samples/pjsip.conf.sample
+++ b/configs/samples/pjsip.conf.sample
@@ -843,7 +843,7 @@
                            ; at the end of the joint list.
                            ; remote_first - Include only the first codec in
                            ; the remote list.
-;incoming_offer_codec_prefs=; This is a string that describes how the codecs
+;codec_prefs_incoming_offer=; This is a string that describes how the codecs
                             ; specified on an incoming SDP offer (pending) are
                             ; reconciled with the codecs specified on an endpoint
                             ; (configured) before being sent to the Asterisk core.
@@ -855,7 +855,7 @@
                             ;    | only_nonpreferred>,
                             ; keep: <first | all>,
                             ; transcode: <allow | prevent>
-;outgoing_offer_codec_prefs=; This is a string that describes how the codecs
+;codec_prefs_outgoing_offer=; This is a string that describes how the codecs
                             ; specified in the topology that comes from the
                             ; Asterisk core (pending) are reconciled with the
                             ; codecs specified on an endpoint (configured)
@@ -868,7 +868,7 @@
                             ;    | only_preferred | only_nonpreferred>,
                             ; keep: <first | all>,
                             ; transcode: <allow | prevent>
-;incoming_answer_codec_prefs=; This is a string that describes how the codecs
+;codec_prefs_incoming_answer=; This is a string that describes how the codecs
                              ; specified in an incoming SDP answer (pending)
                              ; are reconciled with the codecs specified on an
                              ; endpoint (configured) when receiving an SDP
@@ -880,7 +880,7 @@
                              ; operation: <intersect | union
                              ;    | only_preferred | only_nonpreferred>,
                              ; keep: <first | all>
-;outgoing_answer_codec_prefs=; This is a string that describes how the codecs
+;codec_prefs_outgoing_answer=; This is a string that describes how the codecs
                              ; that come from the core (pending) are reconciled
                              ; with the codecs specified on an endpoint
                              ; (configured) when sending an SDP answer.
diff --git a/contrib/ast-db-manage/config/versions/b80485ff4dd0_add_pjsip_endpoint_acn_options.py b/contrib/ast-db-manage/config/versions/b80485ff4dd0_add_pjsip_endpoint_acn_options.py
index 241185a..5e01204 100644
--- a/contrib/ast-db-manage/config/versions/b80485ff4dd0_add_pjsip_endpoint_acn_options.py
+++ b/contrib/ast-db-manage/config/versions/b80485ff4dd0_add_pjsip_endpoint_acn_options.py
@@ -16,14 +16,14 @@
 max_value_length = 128
 
 def upgrade():
-    op.add_column('ps_endpoints', sa.Column('incoming_offer_codec_prefs', sa.String(max_value_length)))
-    op.add_column('ps_endpoints', sa.Column('outgoing_offer_codec_prefs', sa.String(max_value_length)))
-    op.add_column('ps_endpoints', sa.Column('incoming_answer_codec_prefs', sa.String(max_value_length)))
-    op.add_column('ps_endpoints', sa.Column('outgoing_answer_codec_prefs', sa.String(max_value_length)))
+    op.add_column('ps_endpoints', sa.Column('codec_prefs_incoming_offer', sa.String(max_value_length)))
+    op.add_column('ps_endpoints', sa.Column('codec_prefs_outgoing_offer', sa.String(max_value_length)))
+    op.add_column('ps_endpoints', sa.Column('codec_prefs_incoming_answer', sa.String(max_value_length)))
+    op.add_column('ps_endpoints', sa.Column('codec_prefs_outgoing_answer', sa.String(max_value_length)))
 
 
 def downgrade():
-    op.drop_column('ps_endpoints', 'incoming_offer_codecs_prefs')
-    op.drop_column('ps_endpoints', 'outgoing_offer_codecs_prefs')
-    op.drop_column('ps_endpoints', 'incoming_answer_codecs_prefs')
-    op.drop_column('ps_endpoints', 'outgoing_answer_codecs_prefs')
+    op.drop_column('ps_endpoints', 'codec_prefs_incoming_offer')
+    op.drop_column('ps_endpoints', 'codec_prefs_outgoing_offer')
+    op.drop_column('ps_endpoints', 'codec_prefs_incoming_answer')
+    op.drop_column('ps_endpoints', 'codec_prefs_outgoing_answer')
diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h
index eaa9b21..48da005 100644
--- a/include/asterisk/res_pjsip.h
+++ b/include/asterisk/res_pjsip.h
@@ -804,13 +804,13 @@
 	/*! Codec preference for an outgoing offer */
 	struct ast_flags outgoing_call_offer_pref;
 	/*! Codec negotiation prefs for incoming offers */
-	struct ast_stream_codec_negotiation_prefs incoming_offer_codec_prefs;
+	struct ast_stream_codec_negotiation_prefs codec_prefs_incoming_offer;
 	/*! Codec negotiation prefs for outgoing offers */
-	struct ast_stream_codec_negotiation_prefs outgoing_offer_codec_prefs;
+	struct ast_stream_codec_negotiation_prefs codec_prefs_outgoing_offer;
 	/*! Codec negotiation prefs for incoming answers */
-	struct ast_stream_codec_negotiation_prefs incoming_answer_codec_prefs;
+	struct ast_stream_codec_negotiation_prefs codec_prefs_incoming_answer;
 	/*! Codec negotiation prefs for outgoing answers */
-	struct ast_stream_codec_negotiation_prefs outgoing_answer_codec_prefs;
+	struct ast_stream_codec_negotiation_prefs codec_prefs_outgoing_answer;
 };
 
 /*!
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index bb77e54..d7655ad 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -102,7 +102,7 @@
 				<configOption name="allow">
 					<synopsis>Media Codec(s) to allow</synopsis>
 				</configOption>
-				<configOption name="incoming_offer_codec_prefs">
+				<configOption name="codec_prefs_incoming_offer">
 					<synopsis>Codec negotiation prefs for incoming offers.</synopsis>
 					<description>
 						<para>
@@ -154,7 +154,7 @@
 						<para>
 						</para>
 						<example>
-							incoming_offer_codec_prefs = prefer: pending, operation: intersect, keep: all, transcode: allow
+							codec_prefs_incoming_offer = prefer: pending, operation: intersect, keep: all, transcode: allow
 						</example>
 						<para>
 							Prefer the codecs coming from the caller.  Use only the ones that are common.
@@ -162,7 +162,7 @@
 						</para>
 					</description>
 				</configOption>
-				<configOption name="outgoing_offer_codec_prefs">
+				<configOption name="codec_prefs_outgoing_offer">
 					<synopsis>Codec negotiation prefs for outgoing offers.</synopsis>
 					<description>
 						<para>
@@ -215,7 +215,7 @@
 						<para>
 						</para>
 						<example>
-						outgoing_offer_codec_prefs = prefer: configured, operation: union, keep: first, transcode: prevent
+						codec_prefs_outgoing_offer = prefer: configured, operation: union, keep: first, transcode: prevent
 						</example>
 						<para>
 						Prefer the codecs coming from the endpoint.  Merge them with the codecs from the core
@@ -223,7 +223,7 @@
 						</para>
 					</description>
 				</configOption>
-				<configOption name="incoming_answer_codec_prefs">
+				<configOption name="codec_prefs_incoming_answer">
 					<synopsis>Codec negotiation prefs for incoming answers.</synopsis>
 					<description>
 						<para>
@@ -272,14 +272,14 @@
 						<para>
 						</para>
 						<example>
-						incoming_answer_codec_prefs = keep: first
+						codec_prefs_incoming_answer = keep: first
 						</example>
 						<para>
 						Use the defaults but keep oinly the first codec.
 						</para>
 					</description>
 				</configOption>
-				<configOption name="outgoing_answer_codec_prefs">
+				<configOption name="codec_prefs_outgoing_answer">
 					<synopsis>Codec negotiation prefs for outgoing answers.</synopsis>
 					<description>
 						<para>
@@ -328,7 +328,7 @@
 						<para>
 						</para>
 						<example>
-						incoming_answer_codec_prefs = keep: first
+						codec_prefs_incoming_answer = keep: first
 						</example>
 						<para>
 						Use the defaults but keep oinly the first codec.
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index 89ae3e1..20acdcf 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -1194,19 +1194,19 @@
 				var->name);
 			return -1;
 		}
-		endpoint->media.incoming_offer_codec_prefs = prefs;
+		endpoint->media.codec_prefs_incoming_offer = prefs;
 		default_prefer = CODEC_NEGOTIATION_PREFER_PENDING;
 		default_operation = CODEC_NEGOTIATION_OPERATION_INTERSECT;
 	} else if (strcmp(var->name, "outgoing_offer_codec_prefs") == 0) {
-		endpoint->media.outgoing_offer_codec_prefs = prefs;
+		endpoint->media.codec_prefs_outgoing_offer = prefs;
 		default_prefer = CODEC_NEGOTIATION_PREFER_PENDING;
 		default_operation = CODEC_NEGOTIATION_OPERATION_UNION;
 	} else if (strcmp(var->name, "incoming_answer_codec_prefs") == 0) {
-		endpoint->media.incoming_answer_codec_prefs = prefs;
+		endpoint->media.codec_prefs_incoming_answer = prefs;
 		default_prefer = CODEC_NEGOTIATION_PREFER_PENDING;
 		default_operation = CODEC_NEGOTIATION_OPERATION_INTERSECT;
 	} else if (strcmp(var->name, "outgoing_answer_codec_prefs") == 0) {
-		endpoint->media.outgoing_answer_codec_prefs = prefs;
+		endpoint->media.codec_prefs_outgoing_answer = prefs;
 		default_prefer = CODEC_NEGOTIATION_PREFER_PENDING;
 		default_operation = CODEC_NEGOTIATION_OPERATION_INTERSECT;
 	}
@@ -1248,25 +1248,25 @@
 static int incoming_offer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
 {
 	const struct ast_sip_endpoint *endpoint = obj;
-	return codec_prefs_to_str(&endpoint->media.incoming_offer_codec_prefs, obj, args, buf);
+	return codec_prefs_to_str(&endpoint->media.codec_prefs_incoming_offer, obj, args, buf);
 }
 
 static int outgoing_offer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
 {
 	const struct ast_sip_endpoint *endpoint = obj;
-	return codec_prefs_to_str(&endpoint->media.outgoing_offer_codec_prefs, obj, args, buf);
+	return codec_prefs_to_str(&endpoint->media.codec_prefs_outgoing_offer, obj, args, buf);
 }
 
 static int incoming_answer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
 {
 	const struct ast_sip_endpoint *endpoint = obj;
-	return codec_prefs_to_str(&endpoint->media.incoming_answer_codec_prefs, obj, args, buf);
+	return codec_prefs_to_str(&endpoint->media.codec_prefs_incoming_answer, obj, args, buf);
 }
 
 static int outgoing_answer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
 {
 	const struct ast_sip_endpoint *endpoint = obj;
-	return codec_prefs_to_str(&endpoint->media.outgoing_answer_codec_prefs, obj, args, buf);
+	return codec_prefs_to_str(&endpoint->media.codec_prefs_outgoing_answer, obj, args, buf);
 }
 
 static void *sip_nat_hook_alloc(const char *name)

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14689
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I6202965b4723777f22a83afcbbafcdafb1d11c8d
Gerrit-Change-Number: 14689
Gerrit-PatchSet: 2
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200806/b5aef02a/attachment-0001.html>


More information about the asterisk-code-review mailing list