do CN CRCX first

In order to send the MSC's RTP endpoint IP address+port in the initial
SDP, move the MGCP CRCX up to an earlier point in the sequence of
establishing a voice call.

Update the voice call sequence chart to show the effects.

Though the semantic change is rather simple, the patch is rather huge --
things have to happen in a different order, and async waits have to
happen at different times.

The new codec filter helps to carry codec resolution information across
the newly arranged code paths.

Related: SYS#5066
Change-Id: Ie433db1ba0c46d4b97538a969233c155cefac21c
diff --git a/include/osmocom/msc/gsm_04_08.h b/include/osmocom/msc/gsm_04_08.h
index bfc8027..cd5074e 100644
--- a/include/osmocom/msc/gsm_04_08.h
+++ b/include/osmocom/msc/gsm_04_08.h
@@ -45,6 +45,11 @@
 int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, uint8_t power_class);
 int gsm48_send_ho_cmd(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan, uint8_t power_command, uint8_t ho_ref);
 
+void gsm48_cc_rx_setup_cn_local_rtp_port_known(struct gsm_trans *trans);
+void gsm48_cc_rx_call_conf_cn_local_rtp_port_known(struct gsm_trans *trans);
+int cc_on_cn_local_rtp_port_known(struct gsm_trans *trans);
+int cc_on_assignment_done(struct gsm_trans *trans);
+
 int mncc_tx_to_cc(struct gsm_network *net, void *arg);
 
 /* convert a ASCII phone number to call-control BCD */
diff --git a/include/osmocom/msc/msc_a.h b/include/osmocom/msc/msc_a.h
index 18eb76c..3b11155 100644
--- a/include/osmocom/msc/msc_a.h
+++ b/include/osmocom/msc/msc_a.h
@@ -208,6 +208,7 @@
 bool msc_a_is_accepted(const struct msc_a *msc_a);
 bool msc_a_is_establishing_auth_ciph(const struct msc_a *msc_a);
 
+int msc_a_ensure_cn_local_rtp(struct msc_a *msc_a, struct gsm_trans *cc_trans);
 int msc_a_try_call_assignment(struct gsm_trans *cc_trans);
 
 const char *msc_a_cm_service_type_to_use(enum osmo_cm_service_type cm_service_type);