mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.
Don't set msg->lchan nor msg->dst.
Don't use lchan in libmsc.
Decouple lac from bts.
Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication:
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to
different interfaces depending on the actual subscriber connection.
While iu_tx() is going to be functional fairly soon, the a_tx() is going to be
just a dummy for some time (see comment).
Add Iu specific fields in gsm_subscriber_connection: the UE connection pointer
and an indicator for the Integrity Protection status on Iu (to be fully
implemented in later commits).
Add lac member to gsm_subscriber_connection, to allow decoupling from
bts->location_area_code. The conn->lac will actually be set in iu.c in an
upcoming commit ("add iucs.[hc]").
move to libcommon-cs: gsm48_extract_mi(), gsm48_paging_extract_mi().
libmsc: duplicate gsm0808 / gsm48 functions (towards BSC).
In osmo-nitb, libmsc would directly call the functions on the BSC level, not
always via the bsc_api. When separating libmsc from libbsc, some functions are
missing from the linkage.
Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also
add a _tx to gsm0808_cipher_mode():
* add msc_gsm0808_tx_cipher_mode() (dummy/stub)
* add msc_gsm48_tx_mm_serv_ack()
* add msc_gsm48_tx_mm_serv_rej()
Call these from libmsc instead of
* gsm0808_cipher_mode()
* gsm48_tx_mm_serv_ack()
* gsm48_tx_mm_serv_rej()
Also add a comment related to msc_gsm0808_tx_cipher_mode() in two places.
Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.
Remove LCHAN_MODIFY from internal MNCC state machine.
Temporarily disable all paging to be able to link libmsc without libbsc.
Skip the paging part of channel_test because the paging is now disabled.
Employ fake paging shims in order for msc_vlr_tests to still work.
msc_compl_l3(): publish in .h, tweak return value. Use new libmsc enum values
for return val, to avoid dependency on libbsc headers. Make callable from
other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c
add gsm_encr to subscr_conn
move subscr_request to gsm_subscriber.h
subscr_request_channel() -> subscr_request_conn()
move to libmsc: osmo_stats_vty_add_cmds()
gsm_04_08: remove apply_codec_restrictions()
gsm0408_test: use NULL for root ctx
move to libbsc: gsm_bts_neighbor()
move to libbsc: lchan_next_meas_rep()
move vty config for t3212 to network level (periodic lu)
remove unneccessary linking from some tests
remove handle_abisip_signal()
abis_rsl.c: don't use libvlr from libbsc
gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.
Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.
Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-05-08 13:12:20 +00:00
|
|
|
/* Implementation for MSC decisions which interface to send messages out on. */
|
|
|
|
|
|
|
|
/* (C) 2016 by sysmocom s.m.f.c GmbH <info@sysmocom.de>
|
|
|
|
*
|
|
|
|
* All Rights Reserved
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <osmocom/core/logging.h>
|
|
|
|
|
2017-09-04 13:04:35 +00:00
|
|
|
#include <osmocom/msc/debug.h>
|
|
|
|
#include <osmocom/msc/gsm_data.h>
|
|
|
|
#include <osmocom/msc/msc_ifaces.h>
|
|
|
|
#include <osmocom/msc/gsm_subscriber.h>
|
|
|
|
#include <osmocom/msc/transaction.h>
|
2017-09-03 23:03:58 +00:00
|
|
|
#include <osmocom/mgcp_client/mgcp_client.h>
|
2017-09-04 13:04:35 +00:00
|
|
|
#include <osmocom/msc/vlr.h>
|
|
|
|
#include <osmocom/msc/a_iface.h>
|
2017-09-15 09:22:30 +00:00
|
|
|
#include <osmocom/msc/gsm_04_08.h>
|
2016-05-20 19:59:55 +00:00
|
|
|
|
|
|
|
#include "../../bscconfig.h"
|
|
|
|
|
|
|
|
#ifdef BUILD_IU
|
2017-07-05 13:19:52 +00:00
|
|
|
#include <osmocom/ranap/iu_client.h>
|
2016-05-20 19:59:55 +00:00
|
|
|
extern struct msgb *ranap_new_msg_rab_assign_voice(uint8_t rab_id,
|
|
|
|
uint32_t rtp_ip,
|
|
|
|
uint16_t rtp_port,
|
|
|
|
bool use_x213_nsap);
|
2017-07-05 13:19:52 +00:00
|
|
|
#else
|
2017-09-04 13:04:35 +00:00
|
|
|
#include <osmocom/msc/iu_dummy.h>
|
2016-05-20 19:59:55 +00:00
|
|
|
#endif /* BUILD_IU */
|
mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.
Don't set msg->lchan nor msg->dst.
Don't use lchan in libmsc.
Decouple lac from bts.
Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication:
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to
different interfaces depending on the actual subscriber connection.
While iu_tx() is going to be functional fairly soon, the a_tx() is going to be
just a dummy for some time (see comment).
Add Iu specific fields in gsm_subscriber_connection: the UE connection pointer
and an indicator for the Integrity Protection status on Iu (to be fully
implemented in later commits).
Add lac member to gsm_subscriber_connection, to allow decoupling from
bts->location_area_code. The conn->lac will actually be set in iu.c in an
upcoming commit ("add iucs.[hc]").
move to libcommon-cs: gsm48_extract_mi(), gsm48_paging_extract_mi().
libmsc: duplicate gsm0808 / gsm48 functions (towards BSC).
In osmo-nitb, libmsc would directly call the functions on the BSC level, not
always via the bsc_api. When separating libmsc from libbsc, some functions are
missing from the linkage.
Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also
add a _tx to gsm0808_cipher_mode():
* add msc_gsm0808_tx_cipher_mode() (dummy/stub)
* add msc_gsm48_tx_mm_serv_ack()
* add msc_gsm48_tx_mm_serv_rej()
Call these from libmsc instead of
* gsm0808_cipher_mode()
* gsm48_tx_mm_serv_ack()
* gsm48_tx_mm_serv_rej()
Also add a comment related to msc_gsm0808_tx_cipher_mode() in two places.
Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.
Remove LCHAN_MODIFY from internal MNCC state machine.
Temporarily disable all paging to be able to link libmsc without libbsc.
Skip the paging part of channel_test because the paging is now disabled.
Employ fake paging shims in order for msc_vlr_tests to still work.
msc_compl_l3(): publish in .h, tweak return value. Use new libmsc enum values
for return val, to avoid dependency on libbsc headers. Make callable from
other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c
add gsm_encr to subscr_conn
move subscr_request to gsm_subscriber.h
subscr_request_channel() -> subscr_request_conn()
move to libmsc: osmo_stats_vty_add_cmds()
gsm_04_08: remove apply_codec_restrictions()
gsm0408_test: use NULL for root ctx
move to libbsc: gsm_bts_neighbor()
move to libbsc: lchan_next_meas_rep()
move vty config for t3212 to network level (periodic lu)
remove unneccessary linking from some tests
remove handle_abisip_signal()
abis_rsl.c: don't use libvlr from libbsc
gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.
Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.
Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-05-08 13:12:20 +00:00
|
|
|
|
|
|
|
static int msc_tx(struct gsm_subscriber_connection *conn, struct msgb *msg)
|
|
|
|
{
|
2017-04-09 10:32:51 +00:00
|
|
|
if (!msg)
|
|
|
|
return -EINVAL;
|
2017-09-07 09:39:58 +00:00
|
|
|
if (!conn) {
|
|
|
|
msgb_free(msg);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2016-05-20 19:59:55 +00:00
|
|
|
DEBUGP(DMSC, "msc_tx %u bytes to %s via %s\n",
|
|
|
|
msg->len, vlr_subscr_name(conn->vsub),
|
|
|
|
ran_type_name(conn->via_ran));
|
mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.
Don't set msg->lchan nor msg->dst.
Don't use lchan in libmsc.
Decouple lac from bts.
Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication:
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to
different interfaces depending on the actual subscriber connection.
While iu_tx() is going to be functional fairly soon, the a_tx() is going to be
just a dummy for some time (see comment).
Add Iu specific fields in gsm_subscriber_connection: the UE connection pointer
and an indicator for the Integrity Protection status on Iu (to be fully
implemented in later commits).
Add lac member to gsm_subscriber_connection, to allow decoupling from
bts->location_area_code. The conn->lac will actually be set in iu.c in an
upcoming commit ("add iucs.[hc]").
move to libcommon-cs: gsm48_extract_mi(), gsm48_paging_extract_mi().
libmsc: duplicate gsm0808 / gsm48 functions (towards BSC).
In osmo-nitb, libmsc would directly call the functions on the BSC level, not
always via the bsc_api. When separating libmsc from libbsc, some functions are
missing from the linkage.
Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also
add a _tx to gsm0808_cipher_mode():
* add msc_gsm0808_tx_cipher_mode() (dummy/stub)
* add msc_gsm48_tx_mm_serv_ack()
* add msc_gsm48_tx_mm_serv_rej()
Call these from libmsc instead of
* gsm0808_cipher_mode()
* gsm48_tx_mm_serv_ack()
* gsm48_tx_mm_serv_rej()
Also add a comment related to msc_gsm0808_tx_cipher_mode() in two places.
Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.
Remove LCHAN_MODIFY from internal MNCC state machine.
Temporarily disable all paging to be able to link libmsc without libbsc.
Skip the paging part of channel_test because the paging is now disabled.
Employ fake paging shims in order for msc_vlr_tests to still work.
msc_compl_l3(): publish in .h, tweak return value. Use new libmsc enum values
for return val, to avoid dependency on libbsc headers. Make callable from
other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c
add gsm_encr to subscr_conn
move subscr_request to gsm_subscriber.h
subscr_request_channel() -> subscr_request_conn()
move to libmsc: osmo_stats_vty_add_cmds()
gsm_04_08: remove apply_codec_restrictions()
gsm0408_test: use NULL for root ctx
move to libbsc: gsm_bts_neighbor()
move to libbsc: lchan_next_meas_rep()
move vty config for t3212 to network level (periodic lu)
remove unneccessary linking from some tests
remove handle_abisip_signal()
abis_rsl.c: don't use libvlr from libbsc
gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.
Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.
Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-05-08 13:12:20 +00:00
|
|
|
switch (conn->via_ran) {
|
|
|
|
case RAN_GERAN_A:
|
|
|
|
msg->dst = conn;
|
2017-04-09 10:32:51 +00:00
|
|
|
return a_iface_tx_dtap(msg);
|
mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.
Don't set msg->lchan nor msg->dst.
Don't use lchan in libmsc.
Decouple lac from bts.
Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication:
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to
different interfaces depending on the actual subscriber connection.
While iu_tx() is going to be functional fairly soon, the a_tx() is going to be
just a dummy for some time (see comment).
Add Iu specific fields in gsm_subscriber_connection: the UE connection pointer
and an indicator for the Integrity Protection status on Iu (to be fully
implemented in later commits).
Add lac member to gsm_subscriber_connection, to allow decoupling from
bts->location_area_code. The conn->lac will actually be set in iu.c in an
upcoming commit ("add iucs.[hc]").
move to libcommon-cs: gsm48_extract_mi(), gsm48_paging_extract_mi().
libmsc: duplicate gsm0808 / gsm48 functions (towards BSC).
In osmo-nitb, libmsc would directly call the functions on the BSC level, not
always via the bsc_api. When separating libmsc from libbsc, some functions are
missing from the linkage.
Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also
add a _tx to gsm0808_cipher_mode():
* add msc_gsm0808_tx_cipher_mode() (dummy/stub)
* add msc_gsm48_tx_mm_serv_ack()
* add msc_gsm48_tx_mm_serv_rej()
Call these from libmsc instead of
* gsm0808_cipher_mode()
* gsm48_tx_mm_serv_ack()
* gsm48_tx_mm_serv_rej()
Also add a comment related to msc_gsm0808_tx_cipher_mode() in two places.
Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.
Remove LCHAN_MODIFY from internal MNCC state machine.
Temporarily disable all paging to be able to link libmsc without libbsc.
Skip the paging part of channel_test because the paging is now disabled.
Employ fake paging shims in order for msc_vlr_tests to still work.
msc_compl_l3(): publish in .h, tweak return value. Use new libmsc enum values
for return val, to avoid dependency on libbsc headers. Make callable from
other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c
add gsm_encr to subscr_conn
move subscr_request to gsm_subscriber.h
subscr_request_channel() -> subscr_request_conn()
move to libmsc: osmo_stats_vty_add_cmds()
gsm_04_08: remove apply_codec_restrictions()
gsm0408_test: use NULL for root ctx
move to libbsc: gsm_bts_neighbor()
move to libbsc: lchan_next_meas_rep()
move vty config for t3212 to network level (periodic lu)
remove unneccessary linking from some tests
remove handle_abisip_signal()
abis_rsl.c: don't use libvlr from libbsc
gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.
Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.
Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-05-08 13:12:20 +00:00
|
|
|
|
|
|
|
case RAN_UTRAN_IU:
|
|
|
|
msg->dst = conn->iu.ue_ctx;
|
2017-07-05 13:19:52 +00:00
|
|
|
return ranap_iu_tx(msg, 0);
|
2016-05-20 19:59:55 +00:00
|
|
|
|
mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.
Don't set msg->lchan nor msg->dst.
Don't use lchan in libmsc.
Decouple lac from bts.
Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication:
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to
different interfaces depending on the actual subscriber connection.
While iu_tx() is going to be functional fairly soon, the a_tx() is going to be
just a dummy for some time (see comment).
Add Iu specific fields in gsm_subscriber_connection: the UE connection pointer
and an indicator for the Integrity Protection status on Iu (to be fully
implemented in later commits).
Add lac member to gsm_subscriber_connection, to allow decoupling from
bts->location_area_code. The conn->lac will actually be set in iu.c in an
upcoming commit ("add iucs.[hc]").
move to libcommon-cs: gsm48_extract_mi(), gsm48_paging_extract_mi().
libmsc: duplicate gsm0808 / gsm48 functions (towards BSC).
In osmo-nitb, libmsc would directly call the functions on the BSC level, not
always via the bsc_api. When separating libmsc from libbsc, some functions are
missing from the linkage.
Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also
add a _tx to gsm0808_cipher_mode():
* add msc_gsm0808_tx_cipher_mode() (dummy/stub)
* add msc_gsm48_tx_mm_serv_ack()
* add msc_gsm48_tx_mm_serv_rej()
Call these from libmsc instead of
* gsm0808_cipher_mode()
* gsm48_tx_mm_serv_ack()
* gsm48_tx_mm_serv_rej()
Also add a comment related to msc_gsm0808_tx_cipher_mode() in two places.
Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.
Remove LCHAN_MODIFY from internal MNCC state machine.
Temporarily disable all paging to be able to link libmsc without libbsc.
Skip the paging part of channel_test because the paging is now disabled.
Employ fake paging shims in order for msc_vlr_tests to still work.
msc_compl_l3(): publish in .h, tweak return value. Use new libmsc enum values
for return val, to avoid dependency on libbsc headers. Make callable from
other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c
add gsm_encr to subscr_conn
move subscr_request to gsm_subscriber.h
subscr_request_channel() -> subscr_request_conn()
move to libmsc: osmo_stats_vty_add_cmds()
gsm_04_08: remove apply_codec_restrictions()
gsm0408_test: use NULL for root ctx
move to libbsc: gsm_bts_neighbor()
move to libbsc: lchan_next_meas_rep()
move vty config for t3212 to network level (periodic lu)
remove unneccessary linking from some tests
remove handle_abisip_signal()
abis_rsl.c: don't use libvlr from libbsc
gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.
Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.
Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-05-08 13:12:20 +00:00
|
|
|
default:
|
|
|
|
LOGP(DMSC, LOGL_ERROR,
|
|
|
|
"msc_tx(): conn->via_ran invalid (%d)\n",
|
|
|
|
conn->via_ran);
|
2017-09-07 09:39:58 +00:00
|
|
|
msgb_free(msg);
|
mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.
Don't set msg->lchan nor msg->dst.
Don't use lchan in libmsc.
Decouple lac from bts.
Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication:
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to
different interfaces depending on the actual subscriber connection.
While iu_tx() is going to be functional fairly soon, the a_tx() is going to be
just a dummy for some time (see comment).
Add Iu specific fields in gsm_subscriber_connection: the UE connection pointer
and an indicator for the Integrity Protection status on Iu (to be fully
implemented in later commits).
Add lac member to gsm_subscriber_connection, to allow decoupling from
bts->location_area_code. The conn->lac will actually be set in iu.c in an
upcoming commit ("add iucs.[hc]").
move to libcommon-cs: gsm48_extract_mi(), gsm48_paging_extract_mi().
libmsc: duplicate gsm0808 / gsm48 functions (towards BSC).
In osmo-nitb, libmsc would directly call the functions on the BSC level, not
always via the bsc_api. When separating libmsc from libbsc, some functions are
missing from the linkage.
Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also
add a _tx to gsm0808_cipher_mode():
* add msc_gsm0808_tx_cipher_mode() (dummy/stub)
* add msc_gsm48_tx_mm_serv_ack()
* add msc_gsm48_tx_mm_serv_rej()
Call these from libmsc instead of
* gsm0808_cipher_mode()
* gsm48_tx_mm_serv_ack()
* gsm48_tx_mm_serv_rej()
Also add a comment related to msc_gsm0808_tx_cipher_mode() in two places.
Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.
Remove LCHAN_MODIFY from internal MNCC state machine.
Temporarily disable all paging to be able to link libmsc without libbsc.
Skip the paging part of channel_test because the paging is now disabled.
Employ fake paging shims in order for msc_vlr_tests to still work.
msc_compl_l3(): publish in .h, tweak return value. Use new libmsc enum values
for return val, to avoid dependency on libbsc headers. Make callable from
other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c
add gsm_encr to subscr_conn
move subscr_request to gsm_subscriber.h
subscr_request_channel() -> subscr_request_conn()
move to libmsc: osmo_stats_vty_add_cmds()
gsm_04_08: remove apply_codec_restrictions()
gsm0408_test: use NULL for root ctx
move to libbsc: gsm_bts_neighbor()
move to libbsc: lchan_next_meas_rep()
move vty config for t3212 to network level (periodic lu)
remove unneccessary linking from some tests
remove handle_abisip_signal()
abis_rsl.c: don't use libvlr from libbsc
gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.
Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.
Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-05-08 13:12:20 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int msc_tx_dtap(struct gsm_subscriber_connection *conn,
|
|
|
|
struct msgb *msg)
|
|
|
|
{
|
|
|
|
return msc_tx(conn, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 9.2.5 CM service accept */
|
|
|
|
int msc_gsm48_tx_mm_serv_ack(struct gsm_subscriber_connection *conn)
|
|
|
|
{
|
2017-04-09 10:32:51 +00:00
|
|
|
struct msgb *msg;
|
|
|
|
struct gsm48_hdr *gh;
|
|
|
|
|
|
|
|
if (!conn)
|
|
|
|
return -EINVAL;
|
mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.
Don't set msg->lchan nor msg->dst.
Don't use lchan in libmsc.
Decouple lac from bts.
Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication:
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to
different interfaces depending on the actual subscriber connection.
While iu_tx() is going to be functional fairly soon, the a_tx() is going to be
just a dummy for some time (see comment).
Add Iu specific fields in gsm_subscriber_connection: the UE connection pointer
and an indicator for the Integrity Protection status on Iu (to be fully
implemented in later commits).
Add lac member to gsm_subscriber_connection, to allow decoupling from
bts->location_area_code. The conn->lac will actually be set in iu.c in an
upcoming commit ("add iucs.[hc]").
move to libcommon-cs: gsm48_extract_mi(), gsm48_paging_extract_mi().
libmsc: duplicate gsm0808 / gsm48 functions (towards BSC).
In osmo-nitb, libmsc would directly call the functions on the BSC level, not
always via the bsc_api. When separating libmsc from libbsc, some functions are
missing from the linkage.
Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also
add a _tx to gsm0808_cipher_mode():
* add msc_gsm0808_tx_cipher_mode() (dummy/stub)
* add msc_gsm48_tx_mm_serv_ack()
* add msc_gsm48_tx_mm_serv_rej()
Call these from libmsc instead of
* gsm0808_cipher_mode()
* gsm48_tx_mm_serv_ack()
* gsm48_tx_mm_serv_rej()
Also add a comment related to msc_gsm0808_tx_cipher_mode() in two places.
Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.
Remove LCHAN_MODIFY from internal MNCC state machine.
Temporarily disable all paging to be able to link libmsc without libbsc.
Skip the paging part of channel_test because the paging is now disabled.
Employ fake paging shims in order for msc_vlr_tests to still work.
msc_compl_l3(): publish in .h, tweak return value. Use new libmsc enum values
for return val, to avoid dependency on libbsc headers. Make callable from
other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c
add gsm_encr to subscr_conn
move subscr_request to gsm_subscriber.h
subscr_request_channel() -> subscr_request_conn()
move to libmsc: osmo_stats_vty_add_cmds()
gsm_04_08: remove apply_codec_restrictions()
gsm0408_test: use NULL for root ctx
move to libbsc: gsm_bts_neighbor()
move to libbsc: lchan_next_meas_rep()
move vty config for t3212 to network level (periodic lu)
remove unneccessary linking from some tests
remove handle_abisip_signal()
abis_rsl.c: don't use libvlr from libbsc
gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.
Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.
Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-05-08 13:12:20 +00:00
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
msg = gsm48_msgb_alloc_name("GSM 04.08 SERV ACC");
|
|
|
|
|
|
|
|
gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh));
|
mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.
Don't set msg->lchan nor msg->dst.
Don't use lchan in libmsc.
Decouple lac from bts.
Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication:
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to
different interfaces depending on the actual subscriber connection.
While iu_tx() is going to be functional fairly soon, the a_tx() is going to be
just a dummy for some time (see comment).
Add Iu specific fields in gsm_subscriber_connection: the UE connection pointer
and an indicator for the Integrity Protection status on Iu (to be fully
implemented in later commits).
Add lac member to gsm_subscriber_connection, to allow decoupling from
bts->location_area_code. The conn->lac will actually be set in iu.c in an
upcoming commit ("add iucs.[hc]").
move to libcommon-cs: gsm48_extract_mi(), gsm48_paging_extract_mi().
libmsc: duplicate gsm0808 / gsm48 functions (towards BSC).
In osmo-nitb, libmsc would directly call the functions on the BSC level, not
always via the bsc_api. When separating libmsc from libbsc, some functions are
missing from the linkage.
Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also
add a _tx to gsm0808_cipher_mode():
* add msc_gsm0808_tx_cipher_mode() (dummy/stub)
* add msc_gsm48_tx_mm_serv_ack()
* add msc_gsm48_tx_mm_serv_rej()
Call these from libmsc instead of
* gsm0808_cipher_mode()
* gsm48_tx_mm_serv_ack()
* gsm48_tx_mm_serv_rej()
Also add a comment related to msc_gsm0808_tx_cipher_mode() in two places.
Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.
Remove LCHAN_MODIFY from internal MNCC state machine.
Temporarily disable all paging to be able to link libmsc without libbsc.
Skip the paging part of channel_test because the paging is now disabled.
Employ fake paging shims in order for msc_vlr_tests to still work.
msc_compl_l3(): publish in .h, tweak return value. Use new libmsc enum values
for return val, to avoid dependency on libbsc headers. Make callable from
other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c
add gsm_encr to subscr_conn
move subscr_request to gsm_subscriber.h
subscr_request_channel() -> subscr_request_conn()
move to libmsc: osmo_stats_vty_add_cmds()
gsm_04_08: remove apply_codec_restrictions()
gsm0408_test: use NULL for root ctx
move to libbsc: gsm_bts_neighbor()
move to libbsc: lchan_next_meas_rep()
move vty config for t3212 to network level (periodic lu)
remove unneccessary linking from some tests
remove handle_abisip_signal()
abis_rsl.c: don't use libvlr from libbsc
gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.
Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.
Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-05-08 13:12:20 +00:00
|
|
|
gh->proto_discr = GSM48_PDISC_MM;
|
|
|
|
gh->msg_type = GSM48_MT_MM_CM_SERV_ACC;
|
|
|
|
|
2016-05-20 19:59:55 +00:00
|
|
|
DEBUGP(DMM, "-> CM SERVICE ACCEPT %s\n",
|
|
|
|
vlr_subscr_name(conn->vsub));
|
mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.
Don't set msg->lchan nor msg->dst.
Don't use lchan in libmsc.
Decouple lac from bts.
Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication:
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to
different interfaces depending on the actual subscriber connection.
While iu_tx() is going to be functional fairly soon, the a_tx() is going to be
just a dummy for some time (see comment).
Add Iu specific fields in gsm_subscriber_connection: the UE connection pointer
and an indicator for the Integrity Protection status on Iu (to be fully
implemented in later commits).
Add lac member to gsm_subscriber_connection, to allow decoupling from
bts->location_area_code. The conn->lac will actually be set in iu.c in an
upcoming commit ("add iucs.[hc]").
move to libcommon-cs: gsm48_extract_mi(), gsm48_paging_extract_mi().
libmsc: duplicate gsm0808 / gsm48 functions (towards BSC).
In osmo-nitb, libmsc would directly call the functions on the BSC level, not
always via the bsc_api. When separating libmsc from libbsc, some functions are
missing from the linkage.
Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also
add a _tx to gsm0808_cipher_mode():
* add msc_gsm0808_tx_cipher_mode() (dummy/stub)
* add msc_gsm48_tx_mm_serv_ack()
* add msc_gsm48_tx_mm_serv_rej()
Call these from libmsc instead of
* gsm0808_cipher_mode()
* gsm48_tx_mm_serv_ack()
* gsm48_tx_mm_serv_rej()
Also add a comment related to msc_gsm0808_tx_cipher_mode() in two places.
Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.
Remove LCHAN_MODIFY from internal MNCC state machine.
Temporarily disable all paging to be able to link libmsc without libbsc.
Skip the paging part of channel_test because the paging is now disabled.
Employ fake paging shims in order for msc_vlr_tests to still work.
msc_compl_l3(): publish in .h, tweak return value. Use new libmsc enum values
for return val, to avoid dependency on libbsc headers. Make callable from
other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c
add gsm_encr to subscr_conn
move subscr_request to gsm_subscriber.h
subscr_request_channel() -> subscr_request_conn()
move to libmsc: osmo_stats_vty_add_cmds()
gsm_04_08: remove apply_codec_restrictions()
gsm0408_test: use NULL for root ctx
move to libbsc: gsm_bts_neighbor()
move to libbsc: lchan_next_meas_rep()
move vty config for t3212 to network level (periodic lu)
remove unneccessary linking from some tests
remove handle_abisip_signal()
abis_rsl.c: don't use libvlr from libbsc
gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.
Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.
Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-05-08 13:12:20 +00:00
|
|
|
|
|
|
|
return msc_tx_dtap(conn, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 9.2.6 CM service reject */
|
|
|
|
int msc_gsm48_tx_mm_serv_rej(struct gsm_subscriber_connection *conn,
|
|
|
|
enum gsm48_reject_value value)
|
|
|
|
{
|
|
|
|
struct msgb *msg;
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
if (!conn)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2016-05-20 19:59:55 +00:00
|
|
|
conn->received_cm_service_request = false;
|
mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.
Don't set msg->lchan nor msg->dst.
Don't use lchan in libmsc.
Decouple lac from bts.
Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication:
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to
different interfaces depending on the actual subscriber connection.
While iu_tx() is going to be functional fairly soon, the a_tx() is going to be
just a dummy for some time (see comment).
Add Iu specific fields in gsm_subscriber_connection: the UE connection pointer
and an indicator for the Integrity Protection status on Iu (to be fully
implemented in later commits).
Add lac member to gsm_subscriber_connection, to allow decoupling from
bts->location_area_code. The conn->lac will actually be set in iu.c in an
upcoming commit ("add iucs.[hc]").
move to libcommon-cs: gsm48_extract_mi(), gsm48_paging_extract_mi().
libmsc: duplicate gsm0808 / gsm48 functions (towards BSC).
In osmo-nitb, libmsc would directly call the functions on the BSC level, not
always via the bsc_api. When separating libmsc from libbsc, some functions are
missing from the linkage.
Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also
add a _tx to gsm0808_cipher_mode():
* add msc_gsm0808_tx_cipher_mode() (dummy/stub)
* add msc_gsm48_tx_mm_serv_ack()
* add msc_gsm48_tx_mm_serv_rej()
Call these from libmsc instead of
* gsm0808_cipher_mode()
* gsm48_tx_mm_serv_ack()
* gsm48_tx_mm_serv_rej()
Also add a comment related to msc_gsm0808_tx_cipher_mode() in two places.
Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.
Remove LCHAN_MODIFY from internal MNCC state machine.
Temporarily disable all paging to be able to link libmsc without libbsc.
Skip the paging part of channel_test because the paging is now disabled.
Employ fake paging shims in order for msc_vlr_tests to still work.
msc_compl_l3(): publish in .h, tweak return value. Use new libmsc enum values
for return val, to avoid dependency on libbsc headers. Make callable from
other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c
add gsm_encr to subscr_conn
move subscr_request to gsm_subscriber.h
subscr_request_channel() -> subscr_request_conn()
move to libmsc: osmo_stats_vty_add_cmds()
gsm_04_08: remove apply_codec_restrictions()
gsm0408_test: use NULL for root ctx
move to libbsc: gsm_bts_neighbor()
move to libbsc: lchan_next_meas_rep()
move vty config for t3212 to network level (periodic lu)
remove unneccessary linking from some tests
remove handle_abisip_signal()
abis_rsl.c: don't use libvlr from libbsc
gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.
Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.
Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-05-08 13:12:20 +00:00
|
|
|
|
|
|
|
msg = gsm48_create_mm_serv_rej(value);
|
|
|
|
if (!msg) {
|
|
|
|
LOGP(DMM, LOGL_ERROR, "Failed to allocate CM Service Reject.\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUGP(DMM, "-> CM SERVICE Reject cause: %d\n", value);
|
|
|
|
|
|
|
|
return msc_tx_dtap(conn, msg);
|
|
|
|
}
|
2016-05-20 19:59:55 +00:00
|
|
|
|
|
|
|
int msc_tx_common_id(struct gsm_subscriber_connection *conn)
|
|
|
|
{
|
2017-04-09 10:32:51 +00:00
|
|
|
if (!conn)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2016-05-20 19:59:55 +00:00
|
|
|
/* Common ID is only sent over IuCS */
|
|
|
|
if (conn->via_ran != RAN_UTRAN_IU) {
|
|
|
|
LOGP(DMM, LOGL_INFO,
|
|
|
|
"%s: Asked to transmit Common ID, but skipping"
|
|
|
|
" because this is not on UTRAN\n",
|
|
|
|
vlr_subscr_name(conn->vsub));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUGP(DIUCS, "%s: tx CommonID %s\n",
|
|
|
|
vlr_subscr_name(conn->vsub), conn->vsub->imsi);
|
2017-07-05 13:19:52 +00:00
|
|
|
return ranap_iu_tx_common_id(conn->iu.ue_ctx, conn->vsub->imsi);
|
2016-05-20 19:59:55 +00:00
|
|
|
}
|
|
|
|
|
2017-07-05 13:19:52 +00:00
|
|
|
static int iu_rab_act_cs(struct ranap_ue_conn_ctx *uectx, uint8_t rab_id,
|
2017-04-09 10:32:51 +00:00
|
|
|
uint32_t rtp_ip, uint16_t rtp_port)
|
2016-05-20 19:59:55 +00:00
|
|
|
{
|
2017-04-09 10:32:51 +00:00
|
|
|
#ifdef BUILD_IU
|
2016-05-20 19:59:55 +00:00
|
|
|
struct msgb *msg;
|
|
|
|
bool use_x213_nsap;
|
|
|
|
uint32_t conn_id = uectx->conn_id;
|
|
|
|
|
2017-07-05 13:19:52 +00:00
|
|
|
use_x213_nsap = (uectx->rab_assign_addr_enc == RANAP_NSAP_ADDR_ENC_X213);
|
2016-05-20 19:59:55 +00:00
|
|
|
|
|
|
|
LOGP(DIUCS, LOGL_DEBUG, "Assigning RAB: conn_id=%u, rab_id=%d,"
|
|
|
|
" rtp=%x:%u, use_x213_nsap=%d\n", conn_id, rab_id, rtp_ip,
|
|
|
|
rtp_port, use_x213_nsap);
|
|
|
|
|
|
|
|
msg = ranap_new_msg_rab_assign_voice(rab_id, rtp_ip, rtp_port,
|
|
|
|
use_x213_nsap);
|
|
|
|
msg->l2h = msg->data;
|
|
|
|
|
2017-07-05 13:19:52 +00:00
|
|
|
if (ranap_iu_rab_act(uectx, msg))
|
2016-05-20 19:59:55 +00:00
|
|
|
LOGP(DIUCS, LOGL_ERROR, "Failed to send RAB Assignment:"
|
|
|
|
" conn_id=%d rab_id=%d rtp=%x:%u\n",
|
|
|
|
conn_id, rab_id, rtp_ip, rtp_port);
|
2017-04-09 10:32:51 +00:00
|
|
|
return 0;
|
|
|
|
#else
|
|
|
|
LOGP(DMSC, LOGL_ERROR, "Cannot send Iu RAB Assignment: built without Iu support\n");
|
|
|
|
return -ENOTSUP;
|
|
|
|
#endif
|
2016-05-20 19:59:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void mgcp_response_rab_act_cs_crcx(struct mgcp_response *r, void *priv)
|
|
|
|
{
|
|
|
|
struct gsm_trans *trans = priv;
|
|
|
|
struct gsm_subscriber_connection *conn = trans->conn;
|
|
|
|
uint32_t rtp_ip;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
if (r->head.response_code != 200) {
|
|
|
|
LOGP(DMGCP, LOGL_ERROR,
|
|
|
|
"MGCPGW response yields error: %d %s\n",
|
|
|
|
r->head.response_code, r->head.comment);
|
|
|
|
goto rab_act_cs_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = mgcp_response_parse_params(r);
|
|
|
|
if (rc) {
|
|
|
|
LOGP(DMGCP, LOGL_ERROR,
|
|
|
|
"Cannot parse MGCP response, for %s\n",
|
|
|
|
vlr_subscr_name(trans->vsub));
|
|
|
|
goto rab_act_cs_error;
|
|
|
|
}
|
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
conn->rtp.port_cn = r->audio_port;
|
2016-05-20 19:59:55 +00:00
|
|
|
|
2017-09-03 23:03:58 +00:00
|
|
|
rtp_ip = mgcp_client_remote_addr_n(conn->network->mgw.client);
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
if (trans->conn->via_ran == RAN_UTRAN_IU) {
|
|
|
|
/* Assign a voice channel via RANAP on 3G */
|
2017-07-05 13:19:52 +00:00
|
|
|
if (iu_rab_act_cs(conn->iu.ue_ctx, conn->iu.rab_id, rtp_ip, conn->rtp.port_subscr))
|
2017-04-09 10:32:51 +00:00
|
|
|
goto rab_act_cs_error;
|
|
|
|
} else if (trans->conn->via_ran == RAN_GERAN_A) {
|
|
|
|
/* Assign a voice channel via A on 2G */
|
|
|
|
if (a_iface_tx_assignment(trans))
|
|
|
|
goto rab_act_cs_error;
|
|
|
|
} else
|
|
|
|
goto rab_act_cs_error;
|
|
|
|
|
|
|
|
/* Respond back to MNCC (if requested) */
|
|
|
|
if (trans->tch_rtp_create) {
|
|
|
|
if (gsm48_tch_rtp_create(trans))
|
|
|
|
goto rab_act_cs_error;
|
|
|
|
}
|
|
|
|
return;
|
2016-05-20 19:59:55 +00:00
|
|
|
|
|
|
|
rab_act_cs_error:
|
|
|
|
/* FIXME abort call, invalidate conn, ... */
|
2017-04-09 10:32:51 +00:00
|
|
|
LOGP(DMSC, LOGL_ERROR, "%s: failure during assignment\n",
|
|
|
|
vlr_subscr_name(trans->vsub));
|
2016-05-20 19:59:55 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
int msc_call_assignment(struct gsm_trans *trans)
|
2016-05-20 19:59:55 +00:00
|
|
|
{
|
2017-04-09 10:32:51 +00:00
|
|
|
struct gsm_subscriber_connection *conn;
|
2017-09-03 23:03:58 +00:00
|
|
|
struct mgcp_client *mgcp;
|
2016-05-20 19:59:55 +00:00
|
|
|
struct msgb *msg;
|
2017-04-09 10:32:51 +00:00
|
|
|
uint16_t bts_base;
|
|
|
|
|
|
|
|
if (!trans)
|
|
|
|
return -EINVAL;
|
|
|
|
if (!trans->conn)
|
|
|
|
return -EINVAL;
|
2016-05-20 19:59:55 +00:00
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
conn = trans->conn;
|
2017-09-03 23:03:58 +00:00
|
|
|
mgcp = conn->network->mgw.client;
|
2016-05-20 19:59:55 +00:00
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
#ifdef BUILD_IU
|
2017-07-05 13:19:52 +00:00
|
|
|
/* FIXME: HACK. where to scope the RAB Id? At the conn / subscriber / ranap_ue_conn_ctx? */
|
2017-04-09 10:32:51 +00:00
|
|
|
static uint8_t next_iu_rab_id = 1;
|
|
|
|
if (conn->via_ran == RAN_UTRAN_IU)
|
|
|
|
conn->iu.rab_id = next_iu_rab_id ++;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
conn->rtp.mgcp_rtp_endpoint =
|
2017-09-03 23:03:58 +00:00
|
|
|
mgcp_client_next_endpoint(conn->network->mgw.client);
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
/* This will calculate the port we assign to the BTS via AoIP
|
|
|
|
* assignment command (or rab-assignment on 3G) The BTS will send
|
|
|
|
* its RTP traffic to that port on the MGCPGW side. The MGCPGW only
|
|
|
|
* gets the endpoint ID via the CRCX. It will do the same calculation
|
|
|
|
* on his side too to get knowledge of the rtp port. */
|
2017-09-03 23:03:58 +00:00
|
|
|
bts_base = mgcp_client_conf_actual(mgcp)->bts_base;
|
2017-04-09 10:32:51 +00:00
|
|
|
conn->rtp.port_subscr = bts_base + 2 * conn->rtp.mgcp_rtp_endpoint;
|
2016-05-20 19:59:55 +00:00
|
|
|
|
|
|
|
/* Establish the RTP stream first as looping back to the originator.
|
|
|
|
* The MDCX will patch through to the counterpart. TODO: play a ring
|
|
|
|
* tone instead. */
|
2017-04-09 10:32:51 +00:00
|
|
|
msg = mgcp_msg_crcx(mgcp, conn->rtp.mgcp_rtp_endpoint,
|
|
|
|
conn->rtp.mgcp_rtp_endpoint, MGCP_CONN_LOOPBACK);
|
2017-09-03 23:03:58 +00:00
|
|
|
return mgcp_client_tx(mgcp, msg, mgcp_response_rab_act_cs_crcx, trans);
|
2016-05-20 19:59:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void mgcp_response_bridge_mdcx(struct mgcp_response *r, void *priv);
|
|
|
|
|
|
|
|
static void mgcp_bridge(struct gsm_trans *from, struct gsm_trans *to,
|
|
|
|
enum bridge_state state,
|
|
|
|
enum mgcp_connection_mode mode)
|
|
|
|
{
|
|
|
|
struct gsm_subscriber_connection *conn1 = from->conn;
|
|
|
|
struct gsm_subscriber_connection *conn2 = to->conn;
|
2017-09-03 23:03:58 +00:00
|
|
|
struct mgcp_client *mgcp = conn1->network->mgw.client;
|
2016-05-20 19:59:55 +00:00
|
|
|
const char *ip;
|
|
|
|
struct msgb *msg;
|
|
|
|
|
|
|
|
OSMO_ASSERT(mgcp);
|
|
|
|
|
|
|
|
from->bridge.peer = to;
|
|
|
|
from->bridge.state = state;
|
|
|
|
|
|
|
|
/* Loop back to the same MGCP GW */
|
2017-09-03 23:03:58 +00:00
|
|
|
ip = mgcp_client_remote_addr_str(mgcp);
|
2016-05-20 19:59:55 +00:00
|
|
|
|
|
|
|
msg = mgcp_msg_mdcx(mgcp,
|
2017-04-09 10:32:51 +00:00
|
|
|
conn1->rtp.mgcp_rtp_endpoint,
|
|
|
|
ip, conn2->rtp.port_cn,
|
2016-05-20 19:59:55 +00:00
|
|
|
mode);
|
2017-09-03 23:03:58 +00:00
|
|
|
if (mgcp_client_tx(mgcp, msg, mgcp_response_bridge_mdcx, from))
|
2016-05-20 19:59:55 +00:00
|
|
|
LOGP(DMGCP, LOGL_ERROR,
|
|
|
|
"Failed to send MDCX message for %s\n",
|
|
|
|
vlr_subscr_name(from->vsub));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mgcp_response_bridge_mdcx(struct mgcp_response *r, void *priv)
|
|
|
|
{
|
|
|
|
struct gsm_trans *trans = priv;
|
|
|
|
struct gsm_trans *peer = trans->bridge.peer;
|
|
|
|
|
|
|
|
switch (trans->bridge.state) {
|
|
|
|
case BRIDGE_STATE_LOOPBACK_PENDING:
|
|
|
|
trans->bridge.state = BRIDGE_STATE_LOOPBACK_ESTABLISHED;
|
|
|
|
|
|
|
|
switch (peer->bridge.state) {
|
|
|
|
case BRIDGE_STATE_LOOPBACK_PENDING:
|
|
|
|
/* Wait until the other is done as well. */
|
|
|
|
return;
|
|
|
|
case BRIDGE_STATE_LOOPBACK_ESTABLISHED:
|
|
|
|
/* Now that both are in loopback, switch both to
|
|
|
|
* forwarding. */
|
|
|
|
mgcp_bridge(trans, peer, BRIDGE_STATE_BRIDGE_PENDING,
|
|
|
|
MGCP_CONN_RECV_SEND);
|
|
|
|
mgcp_bridge(peer, trans, BRIDGE_STATE_BRIDGE_PENDING,
|
|
|
|
MGCP_CONN_RECV_SEND);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
LOGP(DMGCP, LOGL_ERROR,
|
|
|
|
"Unexpected bridge state: %d for %s\n",
|
|
|
|
trans->bridge.state, vlr_subscr_name(trans->vsub));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BRIDGE_STATE_BRIDGE_PENDING:
|
|
|
|
trans->bridge.state = BRIDGE_STATE_BRIDGE_ESTABLISHED;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
LOGP(DMGCP, LOGL_ERROR,
|
|
|
|
"Unexpected bridge state: %d for %s\n",
|
|
|
|
trans->bridge.state, vlr_subscr_name(trans->vsub));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
int msc_call_connect(struct gsm_trans *trans, uint16_t port, uint32_t ip)
|
|
|
|
{
|
|
|
|
/* With this function we inform the MGCP-GW where (ip/port) it
|
|
|
|
* has to send its outgoing voic traffic. The receiving end will
|
|
|
|
* usually be a PBX (e.g. Asterisk). The IP-Address we tell, will
|
|
|
|
* not only be used to direct the traffic, it will also be used
|
|
|
|
* as a filter to make sure only RTP packets from the right
|
|
|
|
* remote end will reach the BSS. This is also the reason why
|
|
|
|
* inbound audio will not work until this step is performed */
|
|
|
|
|
|
|
|
/* NOTE: This function is used when msc_call_bridge(), is not
|
|
|
|
* applicable. This is usually the case when an external MNCC
|
|
|
|
* is in use */
|
|
|
|
|
|
|
|
struct gsm_subscriber_connection *conn;
|
2017-09-03 23:03:58 +00:00
|
|
|
struct mgcp_client *mgcp;
|
2017-04-09 10:32:51 +00:00
|
|
|
struct msgb *msg;
|
|
|
|
|
|
|
|
if (!trans)
|
|
|
|
return -EINVAL;
|
|
|
|
if (!trans->conn)
|
|
|
|
return -EINVAL;
|
|
|
|
if (!trans->conn->network)
|
|
|
|
return -EINVAL;
|
2017-09-03 23:03:58 +00:00
|
|
|
if (!trans->conn->network->mgw.client)
|
2017-04-09 10:32:51 +00:00
|
|
|
return -EINVAL;
|
|
|
|
|
2017-09-03 23:03:58 +00:00
|
|
|
mgcp = trans->conn->network->mgw.client;
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
struct in_addr ip_addr;
|
|
|
|
ip_addr.s_addr = ntohl(ip);
|
|
|
|
|
|
|
|
conn = trans->conn;
|
|
|
|
|
|
|
|
msg = mgcp_msg_mdcx(mgcp,
|
|
|
|
conn->rtp.mgcp_rtp_endpoint,
|
|
|
|
inet_ntoa(ip_addr), port, MGCP_CONN_RECV_SEND);
|
2017-09-03 23:03:58 +00:00
|
|
|
if (mgcp_client_tx(mgcp, msg, NULL, trans))
|
2017-04-09 10:32:51 +00:00
|
|
|
LOGP(DMGCP, LOGL_ERROR,
|
|
|
|
"Failed to send MDCX message for %s\n",
|
|
|
|
vlr_subscr_name(trans->vsub));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-05-20 19:59:55 +00:00
|
|
|
int msc_call_bridge(struct gsm_trans *trans1, struct gsm_trans *trans2)
|
|
|
|
{
|
2017-04-09 10:32:51 +00:00
|
|
|
if (!trans1)
|
|
|
|
return -EINVAL;
|
|
|
|
if (!trans2)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2016-05-20 19:59:55 +00:00
|
|
|
/* First setup as loopback and configure the counterparts' endpoints,
|
|
|
|
* so that when transmission starts the originating addresses are
|
|
|
|
* already known to be valid. The mgcp callback will continue. */
|
|
|
|
mgcp_bridge(trans1, trans2, BRIDGE_STATE_LOOPBACK_PENDING,
|
|
|
|
MGCP_CONN_LOOPBACK);
|
|
|
|
mgcp_bridge(trans2, trans1, BRIDGE_STATE_LOOPBACK_PENDING,
|
|
|
|
MGCP_CONN_LOOPBACK);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
void msc_call_release(struct gsm_trans *trans)
|
|
|
|
{
|
|
|
|
struct msgb *msg;
|
|
|
|
struct gsm_subscriber_connection *conn;
|
2017-09-03 23:03:58 +00:00
|
|
|
struct mgcp_client *mgcp;
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
if (!trans)
|
|
|
|
return;
|
|
|
|
if (!trans->conn)
|
|
|
|
return;
|
|
|
|
if (!trans->conn->network)
|
|
|
|
return;
|
|
|
|
|
|
|
|
conn = trans->conn;
|
2017-09-03 23:03:58 +00:00
|
|
|
mgcp = conn->network->mgw.client;
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
/* Send DLCX */
|
|
|
|
msg = mgcp_msg_dlcx(mgcp, conn->rtp.mgcp_rtp_endpoint,
|
|
|
|
conn->rtp.mgcp_rtp_endpoint);
|
2017-09-03 23:03:58 +00:00
|
|
|
if (mgcp_client_tx(mgcp, msg, NULL, NULL))
|
2017-04-09 10:32:51 +00:00
|
|
|
LOGP(DMGCP, LOGL_ERROR,
|
|
|
|
"Failed to send DLCX message for %s\n",
|
|
|
|
vlr_subscr_name(trans->vsub));
|
|
|
|
|
|
|
|
/* Release endpoint id */
|
2017-09-03 23:03:58 +00:00
|
|
|
mgcp_client_release_endpoint(conn->rtp.mgcp_rtp_endpoint, mgcp);
|
2017-04-09 10:32:51 +00:00
|
|
|
}
|