mgcp: use codec information returned with ASSIGNMENT COMPL.

When the assignment completes a choosen codec is returned. At the
moment we do not use this information.

- add struct members for codec info (both, RAN and CN)
- parse codec info in BSSMAP ASSIGNMENT COMPLETE
- use codec info on mgcp

Since the MNCC API is not complete yet, we currently only use the
codec info only on the internal MNCC yet.

Change-Id: I9d5b1cd016d9a058b22a367d0e5e9f2ef447931a
Related: OS#2728
diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c
index 8becd05..2c17e22 100644
--- a/src/libmsc/gsm_04_08_cc.c
+++ b/src/libmsc/gsm_04_08_cc.c
@@ -319,6 +319,15 @@
 	/* Which subscriber do we want to track trans1 or trans2? */
 	log_set_context(LOG_CTX_VLR_SUBSCR, trans1->vsub);
 
+	/* This call briding mechanism is only used with the internal MNCC.
+	 * functionality (with external MNCC briding would be done by the PBX)
+	 * This means we may just copy the codec info we have for the RAN side
+	 * of the first leg to the CN side of both legs. This also means that
+	 * if both legs use different codecs the MGW must perform transcoding
+	 * on the second leg. */
+	trans1->conn->rtp.codec_cn = trans1->conn->rtp.codec_ran;
+	trans2->conn->rtp.codec_cn = trans1->conn->rtp.codec_ran;
+
 	/* Bridge RTP streams */
 	rc = msc_mgcp_call_complete(trans1, trans2->conn->rtp.local_port_cn,
 				    trans2->conn->rtp.local_addr_cn);
@@ -1716,6 +1725,16 @@
 	struct gsm_mncc_rtp *rtp = arg;
 	struct in_addr addr;
 
+	/* FIXME: in *rtp we should get the codec information of the remote
+	 * leg. We will have to populate trans->conn->rtp.codec_cn with a
+	 * meaningful value based on this information but unfortunately we
+	 * can't do that yet because the mncc API can not signal dynamic
+	 * payload types yet. This must be fixed first. Also there may be
+	 * additional members necessary in trans->conn->rtp because we
+	 * somehow need to deal with dynamic payload types that do not
+	 * comply to 3gpp's assumptions of payload type numbers on the A
+	 * interface. See also related tickets: OS#3399 and OS1683 */
+
 	/* Find callref */
 	trans = trans_find_by_callref(net, rtp->callref);
 	if (!trans) {