mncc: introduce 'struct gsm_mncc_bridge' for MNCC_BRIDGE

When a MNCC handler wants to issue the MNCC_BRIDGE primitive
overt the MNCC interface, this was not possible so far via the
MNCC socket.   This primitive was so far only available from the
internal MNCC handler, more or less by accident I suppose.  The reason
for this is in the way the array of two call references had been passed
into mncc_tx_to_cc().
This commit is contained in:
Harald Welte 2015-12-03 14:59:04 +01:00
parent da8a19fec0
commit 53d51f501c
3 changed files with 13 additions and 8 deletions

View File

@ -191,6 +191,11 @@ struct gsm_mncc_rtp {
uint32_t payload_msg_type;
};
struct gsm_mncc_bridge {
uint32_t msg_type;
uint32_t callref[2];
};
const char *get_mncc_name(int value);
void mncc_set_cause(struct gsm_mncc *data, int loc, int val);
void cc_tx_to_mncc(struct gsm_network *net, struct msgb *msg);

View File

@ -1662,10 +1662,10 @@ static int tch_map(struct gsm_lchan *lchan, struct gsm_lchan *remote_lchan)
}
/* bridge channels of two transactions */
static int tch_bridge(struct gsm_network *net, uint32_t *refs)
static int tch_bridge(struct gsm_network *net, struct gsm_mncc_bridge *bridge)
{
struct gsm_trans *trans1 = trans_find_by_callref(net, refs[0]);
struct gsm_trans *trans2 = trans_find_by_callref(net, refs[1]);
struct gsm_trans *trans1 = trans_find_by_callref(net, bridge->callref[0]);
struct gsm_trans *trans2 = trans_find_by_callref(net, bridge->callref[1]);
if (!trans1 || !trans2)
return -EIO;

View File

@ -186,7 +186,7 @@ static int mncc_setup_cnf(struct gsm_call *call, int msg_type,
struct gsm_mncc connect_ack, frame_recv;
struct gsm_network *net = call->net;
struct gsm_call *remote;
uint32_t refs[2];
struct gsm_mncc_bridge bridge = { .msg_type = MNCC_BRIDGE };
/* acknowledge connect */
memset(&connect_ack, 0, sizeof(struct gsm_mncc));
@ -202,19 +202,19 @@ static int mncc_setup_cnf(struct gsm_call *call, int msg_type,
mncc_tx_to_cc(remote->net, MNCC_SETUP_RSP, connect);
/* bridge tch */
refs[0] = call->callref;
refs[1] = call->remote_ref;
bridge.callref[0] = call->callref;
bridge.callref[1] = call->remote_ref;
DEBUGP(DMNCC, "(call %x) Bridging with remote.\n", call->callref);
/* in direct mode, we always have to bridge the channels */
if (ipacc_rtp_direct)
return mncc_tx_to_cc(call->net, MNCC_BRIDGE, refs);
return mncc_tx_to_cc(call->net, MNCC_BRIDGE, &bridge);
/* proxy mode */
if (!net->handover.active) {
/* in the no-handover case, we can bridge, i.e. use
* the old RTP proxy code */
return mncc_tx_to_cc(call->net, MNCC_BRIDGE, refs);
return mncc_tx_to_cc(call->net, MNCC_BRIDGE, &bridge);
} else {
/* in case of handover, we need to re-write the RTP
* SSRC, sequence and timestamp values and thus