Commit Graph

67 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther 19c530c5e7 ipaccess: Put our extensions to the protocol into the same enum
Rename NAT_IPAC_PROTO_MGCP to IPAC_PROTO_MGCP and place it in
the enum. We need to be prepared to change this number if IPA
is ever going to use it for something else.
2010-10-13 23:55:32 +02:00
Holger Hans Peter Freyther f2eedff052 nat: Send a transcoder reset on start up.
The transcoder RESET is using the same extensions to reset all
endpoints on a remote site. This makes sure that all allocations
can be made in a properly configured network.
2010-09-20 02:51:30 +08:00
Holger Hans Peter Freyther 985f5694c7 nat: Keep the audio name and default payload around
For all forwarded messages this will not be used, but it is of
use for the transcoding.
2010-09-20 02:51:29 +08:00
Holger Hans Peter Freyther 249d69a26c nat: Use the write_queue inside the CFG. 2010-09-20 02:51:29 +08:00
Holger Hans Peter Freyther 3c79214727 nat: NULL check the allocation and print a nice warning. 2010-09-20 02:48:43 +08:00
Holger Hans Peter Freyther f7c86c5b4d nat: Replace the MGCP Endpoint if that is required
Add code to replace the Endpoint number for the mgcp.
2010-08-30 13:44:32 +08:00
Holger Hans Peter Freyther bf812fa83c nat: Use different static transaction numbers for the DLCX/MDCX message 2010-08-30 12:01:36 +08:00
Holger Hans Peter Freyther d38aa450d7 nat: Document that the MDCX message is not implemented 2010-08-30 11:58:49 +08:00
Holger Hans Peter Freyther 601180f2d9 nat: Send the right MDCX down the stream 2010-08-29 23:40:33 +08:00
Holger Hans Peter Freyther 7d5bb26fdc nat: Remove the code that is wrongly placed..
i refers to the MSC side of endpoints and not the BSC..
2010-08-29 22:44:10 +08:00
Holger Hans Peter Freyther 8574dcf9da nat: Close the right endpoint down the stream. 2010-08-29 22:39:07 +08:00
Holger Hans Peter Freyther 45fd07dc33 nat: Attempt to assign the BSC Timeslot based on a free list
Do attempt to not reassign an endpoint immediately but go
to the next free one.
2010-08-29 16:35:26 +08:00
Holger Hans Peter Freyther 39cd32e650 nat: Remove the CRCX value from the nat
Assume that if the MSC has assigned a timeslot/multiplex it will
also be used for the MGCP. So we just assume that it was allocated
on the BSC as well... in the worse case we will send a DLCX downstream
but it should be fine.
2010-08-29 16:35:25 +08:00
Holger Hans Peter Freyther c021fbe603 nat: Reindent the code, no functional change 2010-08-29 16:35:25 +08:00
Holger Hans Peter Freyther f4b3439206 nat: Make the code work in terms of endpoints instead of timeslot/multiplex
We are going to have more than one trunk, so all code hardcoding the
multiplex to zero must go. Avoid this kind of problem by saving the
MGCP endpoint number and comparing that.
2010-08-29 16:35:24 +08:00
Holger Hans Peter Freyther 591003328d nat: Use the bsc_timeslot when talking to the BSC downstream 2010-08-29 16:35:24 +08:00
Holger Hans Peter Freyther 7d47601a35 nat: In case the downstream fails on a CRCX, ask it to do a DLCX
If the CRCX is failing, we will send a DLCX downstream and the next
time the callagent tries to do a CRCX we will be more lucky. This is
for the case where we have an endp allocated.
2010-08-06 19:16:34 +08:00
Holger Hans Peter Freyther c2ff55475e nat: Use the state information for the callback. 2010-08-06 09:07:20 +08:00
Holger Hans Peter Freyther 5b2726e6b5 nat: Keep the state (CRCX,MDCX,DLCX) of the operation..
This will allow to have additional debug information and to
use the state inside the forwarding code.
2010-08-06 09:07:07 +08:00
Holger Hans Peter Freyther b84b5f61ac nat: Free the endpoint when we get an empty CI.
In case the BSC is sending us an empty/unused CI we have
a bug, but for now let us free the endpoint and figure out
which response we are getting.
2010-08-06 08:34:46 +08:00
Holger Hans Peter Freyther 4634013cde mgcp: Make the CI uint32_t all the way to avoid mismatch 2010-08-06 08:29:37 +08:00
Holger Hans Peter Freyther 9c31cfc3a2 nat: Provide information of when a msg does not contain a CI
When we fail to find a CI in a message that should contain it
then print the message so we can analyze the issue and improve
the code later on.
2010-08-06 08:19:05 +08:00
Holger Hans Peter Freyther d5e6c2374b nat: Use the mgcp_config_alloc to have defaults initialized
Initialize the net_base properly and benefit from future
config changes but also reset certain defauls that we do
not want at the nat.
2010-08-05 19:17:25 +08:00
Holger Hans Peter Freyther 58ff219c85 mgcp: Attempt to separate the RTP/RTCP port for the Network and for the BTS
We plan to have two different ports for the network and for the
BTS to avoid detecting the BTS and to dynamically allocate the
port to have old data not go to a new socket.
2010-08-05 06:10:57 +08:00
Holger Hans Peter Freyther a17d701a70 mgcp: Group the state for bts/net into a struct and have two instances
Group the data that each end (network/bts) have into a struct and use
this struct throughout the sourcecode.
2010-08-05 06:10:54 +08:00
Holger Hans Peter Freyther e66cac359e nat: Fix the spelling of that comment. 2010-08-05 06:04:13 +08:00
Harald Welte d5db12c160 Use new include paths of libosmo-sccp 0.0.2 2010-08-03 15:11:51 +02:00
Holger Hans Peter Freyther c2b31ed9cd nat: Fix compilation with nat not being enabled.
common_vty.c was including bsc_nat.h which tried to
get the sccp/sccp_types.h which is not required to be
installed. Move all structs using/embedding SCCP structures
into the bsc_nat_sccp.h and include. This should fix
the compilation.
2010-07-31 05:20:31 +08:00
Holger Hans Peter Freyther e2c1520a71 nat: u_int16_t -> uint16_t 2010-07-23 19:09:21 +08:00
Holger Hans Peter Freyther dbd16fe59a nat: u_int8_t -> uint8_t 2010-07-23 19:08:55 +08:00
Holger Hans Peter Freyther 8330c1c386 nat: Count the number of dropped SCCP and MGCP calls as well.
Count the number of dropped calls and lost SCCP connections
due the loss of a connection to the BSC...
2010-06-17 18:29:42 +08:00
Holger Hans Peter Freyther 69d801e23a nat: Do not use the bssap.h include as it does not exist in this branch. 2010-06-15 20:24:21 +08:00
Holger Hans Peter Freyther 3a347f0ace nat: Fix memory leak... in MGCP forwarding
The code needs to be refactored but this is fixing the leak for
now. We used to forward everything to the BSC but now we handle
the DLCX locally and this means we need to clear the patched
message. We should refactor it to not generate the patched msg
until a lot later.
2010-06-15 20:24:17 +08:00
Holger Hans Peter Freyther fef76122a7 nat: Release the transaction id earlier, always reset the BSC
In case we can not find the SCCP connection we still want to
free any pending transaction ids and reset the BSC inside the
endpoint. In most cases this should be already done when the
SCCP connection or the whole BSC is gone.
2010-06-15 20:24:16 +08:00
Holger Hans Peter Freyther 3d194d9986 nat: Attempt to clarify the text inside the log message. 2010-06-15 20:24:16 +08:00
Holger Hans Peter Freyther 959bbcf0e7 nat: Only send DLCX when we have send a CRCX to the BSC on this endpoint 2010-06-15 20:24:16 +08:00
Holger Hans Peter Freyther f42f45bf6a nat: Use hex for the endpoint names 2010-06-15 20:24:16 +08:00
Holger Hans Peter Freyther 7b7eef62c1 nat: Change MGCP DLCX handling and send dummy MDCX to the BTS.
When setting a new MSC timeslot to a SCCP connection check if
any of the existing connections have this timeslot, if so we will
send a DLCX down the stream to make sure it is closed there, when
we will CRCX this new timeslot we will happily reallocate it.

When the SCCP connection goes away, or we get a DLCX from the
network, or the BSC is gone we will send a DLCX message down the
stream as well.

When we receive a CRCX from the network we will forward the CRCX
as usual and send a dummy MDCX after it.

For the DLCX and the dummy MDCX we send a custom MGCP message
that will not provoke an answer. Even if the downstream MGCP GW
will answer we will ignore it due the dummy transaction id that
is not used anywhere else.

This change should make sure that we close the dowstream endpoint
all the time, even when the DLCX arrives after the SCCP connection
is torndown.
2010-06-15 20:24:16 +08:00
Holger Hans Peter Freyther 842c0c020f [nat] Reword warning when we had a pending transaction and forget about it. 2010-06-15 20:24:15 +08:00
Holger Hans Peter Freyther 317ae72c47 nat: Clear the connection on a DLCX
We can forget about the timeslot/multiplex when getting
the DLCX. This way we make room for the next connection
that might need to reuse this address.
2010-06-15 20:24:15 +08:00
Holger Hans Peter Freyther 08a1b16674 nat: Return the SCCP Connection again...
We will reset the multiplex in a DLCX message and then
we can reset the multiplex as well...even if the MGCP
connection is staying open. or at least this is a theory.

The MSC likes to leave a connection open during CallControl
when hanging up early enough in the process.
2010-06-15 20:24:14 +08:00
Holger Hans Peter Freyther eb52e89c3a nat: Return the newest SCCP connection...
In case we have a stale SCCP connection with an Endpoint that
we want to reassign...use the newest (last) occurence of that
as it is most likely the one we want to handle.
2010-06-15 20:24:14 +08:00
Holger Hans Peter Freyther 1395948e18 Use osmocore tlv definition for GSM0808. 2010-06-15 20:24:14 +08:00
Holger Hans Peter Freyther 290d84e15f nat: Set a dummy bts_ip to avoid misdetection of the bts...
It was possible that the nat detected the core network
gateway as the bts just due being the first to send data
to the port. Fix it by setting a dummy bts_ip to force
the mgcp_network code to compare the in_addr.
2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther 2896df7605 nat: Attempt to have a single BSC write method
This method currently prepends the IPA header and sends
the data. In the future we might be able to use SCTP for
it.

We have to remove the IPA header from the static messages
for that to work.

This code is untested.
2010-06-15 20:24:13 +08:00
Holger Hans Peter Freyther bba593406b nat: Allow to realloc already allocated endpoints
E.g. when the MGCP on the BSS is not responding we could block
all of our endpoints. As we are mostly in the middle and forward
bits we will happily reallocate the endpoints.
2010-06-15 20:24:12 +08:00
Holger Hans Peter Freyther dd16b425c8 nat: Attempt to make MGCP forwarding more robust
When not being able to allocate the msgb for the forwarded data
there is no point in keeping and preparing the transaction. So
we can move the msg creation a bit up and only do the allocations
after having done the msgb allocation.

When receiving a DLCX we will now delete the endpoint right away. This
means when a BSS does not respond to the DLCX our endpoint will not
be blocked. E.g. this could happen when the MGCP is restarting or
in similiar conditions. When the BSS is not responding we move the
burden up the chain to the CallAgent. We have to still keep track
of the transaction id and the bsc pointer to keep the mgcp forward
routine working.
2010-06-15 20:24:12 +08:00
Holger Hans Peter Freyther 2066b8c267 nat: Fix thinko... use the right fd to determine the IP of the bts
Use the fd of the BSC Connection to determine the IP address of the
BTS as we are seeing it.
2010-06-15 20:24:12 +08:00
Holger Hans Peter Freyther 92febd3ea4 nat: Improve the log message and print the errno/strerror(errno) 2010-06-15 20:24:12 +08:00
Holger Hans Peter Freyther 4ad5850d63 nat: Set the MGCP audio payload to -1.
This value is copied into the bts_audio_payload when allocating
a BTS MGCP endpoint. For the nat we have actually no interest in
patching MGCP messages. We will patch them to the network because
the code will do it anyway, we will not patch things back to the
BTS.
2010-06-15 20:24:12 +08:00