diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index b022ecb3de1c32dab1151d2507fb2f1444f7e7ba..8c71b70bd663315b9fb9a2a9f873ad494e64a335 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -2491,7 +2491,7 @@ const char *ast_sip_call_codec_pref_to_str(struct ast_flags pref)
 
 	if (ast_sip_call_codec_pref_test(pref, LOCAL) &&  ast_sip_call_codec_pref_test(pref, INTERSECT) && ast_sip_call_codec_pref_test(pref, ALL)) {
 		value = "local";
-	} else if (ast_sip_call_codec_pref_test(pref, LOCAL) &&  ast_sip_call_codec_pref_test(pref, UNION) && ast_sip_call_codec_pref_test(pref, ALL)) {
+	} else if (ast_sip_call_codec_pref_test(pref, LOCAL) &&  ast_sip_call_codec_pref_test(pref, INTERSECT) && ast_sip_call_codec_pref_test(pref, ALL)) {
 		value = "local_merge";
 	} else if (ast_sip_call_codec_pref_test(pref, LOCAL) &&  ast_sip_call_codec_pref_test(pref, INTERSECT) && ast_sip_call_codec_pref_test(pref, FIRST)) {
 		value = "local_first";
@@ -2515,7 +2515,7 @@ int ast_sip_call_codec_str_to_pref(struct ast_flags *pref, const char *pref_str,
 	if (strcmp(pref_str, "local") == 0) {
 		ast_set_flag(pref, AST_SIP_CALL_CODEC_PREF_LOCAL | AST_SIP_CALL_CODEC_PREF_INTERSECT | AST_SIP_CALL_CODEC_PREF_ALL);
 	} else if (is_outgoing && strcmp(pref_str, "local_merge") == 0) {
-		ast_set_flag(pref, AST_SIP_CALL_CODEC_PREF_LOCAL | AST_SIP_CALL_CODEC_PREF_UNION | AST_SIP_CALL_CODEC_PREF_ALL);
+		ast_set_flag(pref, AST_SIP_CALL_CODEC_PREF_LOCAL | AST_SIP_CALL_CODEC_PREF_INTERSECT | AST_SIP_CALL_CODEC_PREF_ALL);
 	} else if (strcmp(pref_str, "local_first") == 0) {
 		ast_set_flag(pref, AST_SIP_CALL_CODEC_PREF_LOCAL | AST_SIP_CALL_CODEC_PREF_INTERSECT | AST_SIP_CALL_CODEC_PREF_FIRST);
 	} else if (strcmp(pref_str, "remote") == 0) {