neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/34412?usp=email )
Change subject: fix codecs in internal call bridge
......................................................................
fix codecs in internal call bridge
This is a fixup for the patch
'3G: decapsulate IuUP to AMR at the MGW; allow 3G<-AMR->2G'
I386a6a426c318040b019ab5541689c67e94672a1
After this patch, osmo-msc intelligently decides which codecs to run on
which legs of the RTP streams. In the meantime, the necessary matching
changes to call_leg_local_bridge() have been lost in patch reviews.
Testing 3G to 3G voice now, I noticed that call_leg_local_bridge()
overwrites the intelligent choices made earlier.
The history of an MGW endpoint that should convert from IUFP to plain
AMR, extracted from a pcap, looks like this:
- CRCX None None
- CRCX-OK audio 4050 RTP/AVP 112 None
- MDCX audio 4056 RTP/AVP 112 AMR
- MDCX-OK audio 4050 RTP/AVP 112 AMR
- MDCX audio 4056 RTP/AVP 96 VND.3GPP.IUFP
- MDCX-OK audio 4050 RTP/AVP 96 VND.3GPP.IUFP
So after call_leg_local_bridge(), there is an extra MDCX + MDCX-OK that
switches the codec from 112 AMR back to 96 IUFP.
That is because call_leg_local_bridge() copies the *RAN* side's codec to
both CN sides, which used to be ok when RAN and CN codecs were always
identical.
Instead, adjust only the CN sides of the MGW endpoints, and adjust them
so that both CN sides are identical. osmo-mgw should then be able to
trivially translate the codecs appropriately.
Change-Id: I130bcd77ec57e332370c487a11b0b973b6e1089d
---
M src/libmsc/call_leg.c
1 file changed, 73 insertions(+), 11 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/12/34412/1
diff --git a/src/libmsc/call_leg.c b/src/libmsc/call_leg.c
index d0dc642..9c3b8a0 100644
--- a/src/libmsc/call_leg.c
+++ b/src/libmsc/call_leg.c
@@ -352,25 +352,46 @@
int call_leg_local_bridge(struct call_leg *cl1, uint32_t call_id1, struct gsm_trans *trans1,
struct call_leg *cl2, uint32_t call_id2, struct gsm_trans *trans2)
{
- struct sdp_audio_codecs *codecs;
+ struct sdp_audio_codecs *cn_codecs = NULL;
cl1->local_bridge = cl2;
cl2->local_bridge = cl1;
- /* 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. */
- if (!cl1->rtp[RTP_TO_RAN] || !cl1->rtp[RTP_TO_RAN]->codecs_known) {
- LOG_CALL_LEG(cl1, LOGL_ERROR, "RAN-side RTP stream codec is not known, not ready for bridging\n");
+ /* Marry the two CN sides of the call legs. Call establishment should have made all efforts for these to be
+ * compatible. However, for local bridging, the codecs and payload type numbers must be exactly identical on
+ * both sides. Both sides may so far have different payload type numbers or slightly differing codecs, but it
+ * will only work when the SDP on the RTP_TO_CN sides of the call legs talk the same payload type numbers.
+ * So, simply take the SDP from one RTP_TO_CN side, and overwrite the other RTP_TO_CN side's SDP with it.
+ * If all goes to plan, the codecs will be identical, or possibly the MGW will do a conversion like AMR-BE to
+ * AMR-OA. In the worst case, the other call leg cannot transcode, and the call fails -- because codec
+ * negotiation did not do a good enough job.
+ *
+ * When codecs match:
+ *
+ * call leg 1 call leg 2
+ * ---MGW-ep------- ---MGW-ep-------
+ * RAN CN CN RAN
+ * AMR:112 AMR:112 AMR:96 AMR:96
+ * |
+ * +-------+
+ * |
+ * V
+ * AMR:112 AMR:112 AMR:112 AMR:96
+ * ^MGW-endpoint converts payload type numbers between 112 and 96.
+ */
+ if (cl1->rtp[RTP_TO_CN] && cl1->rtp[RTP_TO_CN]->codecs_known)
+ cn_codecs = &cl1->rtp[RTP_TO_CN]->codecs;
+ else if (cl2->rtp[RTP_TO_CN] && cl2->rtp[RTP_TO_CN]->codecs_known)
+ cn_codecs = &cl2->rtp[RTP_TO_CN]->codecs;
+ if (!cn_codecs) {
+ LOG_CALL_LEG(cl1, LOGL_ERROR, "RAN-side CN stream codec is not known, not ready for bridging\n");
+ LOG_CALL_LEG(cl2, LOGL_ERROR, "RAN-side CN stream codec is not known, not ready for bridging\n");
return -EINVAL;
}
- codecs = &cl1->rtp[RTP_TO_RAN]->codecs;
-
- if (!cl1->rtp[RTP_TO_CN] || !cl2->rtp[RTP_TO_CN])
- return -ENOTCONN;
call_leg_ensure_ci(cl1, RTP_TO_CN, call_id1, trans1,
- codecs, &cl2->rtp[RTP_TO_CN]->local);
+ cn_codecs, &cl2->rtp[RTP_TO_CN]->local);
call_leg_ensure_ci(cl2, RTP_TO_CN, call_id2, trans2,
- codecs, &cl1->rtp[RTP_TO_CN]->local);
+ cn_codecs, &cl1->rtp[RTP_TO_CN]->local);
return 0;
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/34412?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I130bcd77ec57e332370c487a11b0b973b6e1089d
Gerrit-Change-Number: 34412
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: keith, neels, pespin.
Hello Jenkins Builder, keith, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-sip-connector/+/16222?usp=email
to look at the new patch set (#9).
The following approvals got outdated and were removed:
Code-Review+1 by pespin, Verified-1 by Jenkins Builder
Change subject: forward SDP between SIP and MNCC
......................................................................
forward SDP between SIP and MNCC
We have added support for sending SDP via MNCC a long time ago, but so
far the SDP section remained empty. Now, implement actually forwarding
SDP codec information between SIP and MNCC.
The aim is to let the MSC know about all codec choices the remote SIP
call leg has to offer, so that finding a codec match between local and
remote call leg becomes possible.
Store any SDP info contained in incoming SIP and MNCC messages, and send
the stored SDP to the other call leg in all outgoing SIP and MNCC
messages.
In sdp_create_file(), we used to compose fixed SDP -- instead, take the
other call leg's SDP as-is, only make sure to modify the mode (e.g.
"a=sendrecv") to reflect the current call hold state.
The RTP address and codec info in the MNCC structures is now essentially
a redundant / possibly less accurate copy of the SDP info, but leave all
of that as-is, for backwards compat.
There is codec checking that may reject unexpected codecs. The
overall/future aim is to leave all codec checking up to the MSC, but so
far just leave current behaviour unchanged, until we notice problems.
Related: SYS#5066
Related: osmo-ttcn3-hacks Ib2ae8449e673f5027f01d428d3718c006f76d93e
Change-Id: I3df5d06f38ee2d122706a9ebffde7db4f2bd6bae
---
M src/call.c
M src/call.h
M src/mncc.c
M src/sdp.c
M src/sdp.h
M src/sip.c
6 files changed, 241 insertions(+), 42 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/22/16222/9
--
To view, visit https://gerrit.osmocom.org/c/osmo-sip-connector/+/16222?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-Change-Id: I3df5d06f38ee2d122706a9ebffde7db4f2bd6bae
Gerrit-Change-Number: 16222
Gerrit-PatchSet: 9
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: keith <keith(a)rhizomatica.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: keith <keith(a)rhizomatica.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: keith, neels.
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-sip-connector/+/16222?usp=email )
Change subject: forward SDP between SIP and MNCC
......................................................................
Patch Set 8:
(1 comment)
File src/sdp.c:
Robot Comment from checkpatch (run ID jenkins-gerrit-lint-11016):
https://gerrit.osmocom.org/c/osmo-sip-connector/+/16222/comment/40fc7658_ac…
PS8, Line 265: osmo_sockaddr_ntop((const struct sockaddr*)&other->addr, ip_addr);
"(foo*)" should be "(foo *)"
--
To view, visit https://gerrit.osmocom.org/c/osmo-sip-connector/+/16222?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-Change-Id: I3df5d06f38ee2d122706a9ebffde7db4f2bd6bae
Gerrit-Change-Number: 16222
Gerrit-PatchSet: 8
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: keith <keith(a)rhizomatica.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: keith <keith(a)rhizomatica.org>
Gerrit-Comment-Date: Wed, 13 Sep 2023 22:43:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: keith, neels.
Hello Jenkins Builder, keith,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-sip-connector/+/16222?usp=email
to look at the new patch set (#8).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: forward SDP between SIP and MNCC
......................................................................
forward SDP between SIP and MNCC
We have added support for sending SDP via MNCC a long time ago, but so
far the SDP section remained empty. Now, implement actually forwarding
SDP codec information between SIP and MNCC.
The aim is to let the MSC know about all codec choices the remote SIP
call leg has to offer, so that finding a codec match between local and
remote call leg becomes possible.
Store any SDP info contained in incoming SIP and MNCC messages, and send
the stored SDP to the other call leg in all outgoing SIP and MNCC
messages.
In sdp_create_file(), we used to compose fixed SDP -- instead, take the
other call leg's SDP as-is, only make sure to modify the mode (e.g.
"a=sendrecv") to reflect the current call hold state.
The RTP address and codec info in the MNCC structures is now essentially
a redundant / possibly less accurate copy of the SDP info, but leave all
of that as-is, for backwards compat.
There is codec checking that may reject unexpected codecs. The
overall/future aim is to leave all codec checking up to the MSC, but so
far just leave current behaviour unchanged, until we notice problems.
Related: SYS#5066
Related: osmo-ttcn3-hacks Ib2ae8449e673f5027f01d428d3718c006f76d93e
Change-Id: I3df5d06f38ee2d122706a9ebffde7db4f2bd6bae
---
M src/call.c
M src/call.h
M src/mncc.c
M src/sdp.c
M src/sdp.h
M src/sip.c
6 files changed, 240 insertions(+), 42 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/22/16222/8
--
To view, visit https://gerrit.osmocom.org/c/osmo-sip-connector/+/16222?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-Change-Id: I3df5d06f38ee2d122706a9ebffde7db4f2bd6bae
Gerrit-Change-Number: 16222
Gerrit-PatchSet: 8
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: keith <keith(a)rhizomatica.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: keith <keith(a)rhizomatica.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: neels.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-sip-connector/+/34410?usp=email )
Change subject: sdp_get_sdp_mode(): fix wrong return value
......................................................................
Patch Set 1: Code-Review+1
(1 comment)
File src/sdp.c:
https://gerrit.osmocom.org/c/osmo-sip-connector/+/34410/comment/dc896dc9_e8…
PS1, Line 68: return sdp_sendrecv;
where the hell is this symbol coming from? I can't see it in this function.
--
To view, visit https://gerrit.osmocom.org/c/osmo-sip-connector/+/34410?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-Change-Id: Id27eb82a018293cf54d068877dc222e1c7eab253
Gerrit-Change-Number: 34410
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 13 Sep 2023 22:38:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment