Commit Graph

16 Commits

Author SHA1 Message Date
Neels Hofmeyr a8a5bcf2ed verbosely log MNCC and SDP
Change-Id: Ie923117929c6b79b1eb61e5a9f02a169edabc599
2024-01-25 02:55:58 +01:00
Neels Hofmeyr d50637eec6 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
2023-09-15 04:21:06 +02:00
Neels Hofmeyr e148da87ed sdp_get_sdp_mode(): fix wrong return value
Change-Id: Id27eb82a018293cf54d068877dc222e1c7eab253
2023-09-13 22:49:07 +02:00
Neels Hofmeyr 97c7916892 fix use-after-free in SIP re-INVITE
Copy the m_mode before freeing the parser.
Address sanitizer aborted with:

20210601033017695 DSIP INFO re-INVITE for call 854A5CDA8037073 (sip.c:192)
=================================================================
==8583==ERROR: AddressSanitizer: heap-use-after-free on address 0x612000003250 at pc 0x55c3b4624dc5 bp 0x7ffe8a4464d0 sp 0x7ffe8a4464c8
READ of size 8 at 0x612000003250 thread T0
    #0 0x55c3b4624dc4 in sdp_get_sdp_mode ../../../src/osmo-sip-connector/src/sdp.c:72
    #1 0x55c3b462be9e in sip_handle_reinvite ../../../src/osmo-sip-connector/src/sip.c:202
    #2 0x55c3b462d676 in nua_callback ../../../src/osmo-sip-connector/src/sip.c:397
[...]

Change-Id: I4c48832f01e61e98536de8f164ab5a3caa64f34a
2021-06-01 03:35:53 +02:00
Pau Espin cebab664a8 sdp: Don't select addresses failing to parse
Change-Id: Ibfc308bdfab77d0032d8f20c2f0df913e336b75b
2020-09-18 00:32:01 +02:00
Pau Espin b6cb607d12 mncc: Support IPv6 addresses (new version mncc 7)
Change-Id: I3b1bebbcc9e36be43d8d055c8d28cbb38ff21b37
2020-09-10 17:08:19 +02:00
Keith Whyte 5311868c26 Cosmetic: Logging and Comments, spelling and clarity changes
Also removes a comment in sdp_create_file() about the
IP address in o= and c= having to be the same.
It is completely legal in SDP and often normal for the
originator and the connection information IP to be different.

Change-Id: I057573467c335fc27ead391c0bb4c775f2f6ba0a
2019-08-07 02:16:07 +02:00
Keith Whyte a5b65505f9 inet_ntoa() is deprecated, use inet_ntop() instead
Change-Id: If6a96ede7d5e73884c32fbfdb03052e2bda50a77
2019-08-06 16:53:29 +02:00
Keith Whyte 279e910a4a Following from previous commit, assume other->ip is network byte order
Change-Id: I3641a843a3b4a9b2686c1a07d48f52527dce46a2
2019-08-06 15:00:02 +02:00
Keith Whyte 5f73c2033b Handle SIP re-INVITEs
SIP end points can send periodic re-INVITES. Previous to this commit,
the osmo-sip-connector would send a new call SETUP to the MSC for each
re-INVITE.

Add a function to find if we already handle this call based on the nua handle.
Use this function to detect and respond with an ACK to re-INVITES.

Add a function to extract the media mode from the SDP.
In the case the re-INVITE has a=sendonly (HOLD) respond with a=recvonly

In the case that the re-INVITE changes the media connection ip/port,
forward this to the MNCC side with an MNCC_RTP_CONNECT

Change-Id: I4083ed50d0cf1b302b80354fe0c2b73fc6e14fed
2019-08-05 19:05:40 +02:00
Keith Whyte f9a2a414ef Add media mode parameter to sdp_create_file()
This enables call hold implemented by subsequent commits

Prior to this commit, osmo-sip-connector would not send
any media mode attribute in the sdp. After this commit
we will by default always include a=sendrecv.

Given that a media mode attribute of "sendrecv" is default
and implicit it its absense, this does not represent any
functional change.

Change-Id: Ib4212d0174955042e7d80d3744ce632a4942ccb2
2019-08-01 09:38:55 +02:00
Keith Whyte 6fc496eba3 Use htonl, not ntohl before inet_ntoa()
Change-Id: I805864759c287ad4e1d74e5f6ee16bf2d6a1b01f
2018-08-28 07:22:30 -04:00
Keith Whyte b603272787 sdp.c Send octet-align in fmtp
rfc4867 8.2:

      octet-align: Permissible values are 0 and 1.  If 1, octet-aligned
               operation SHALL be used.  If 0 or if not present,
               bandwidth-efficient operation is employed.

We don't have any support for AMR BE mode, but if we don't
send this the other end expects BE mode and can't decode the stream

Change-Id: I938758ac4ec55db9223e3da6c3c277e8fa670055
2017-09-03 18:30:53 +00:00
Holger Hans Peter Freyther 2a7cfb5c93 sip/sdp: Hack to get a GSM codec call connected
Extract IP and port once we have received the INVITE. In the near
future we need to improve this!
2016-03-31 16:28:21 +02:00
Holger Hans Peter Freyther 80880d45b7 sip: Refactor sdp file creation and implement alert+connect
The codec negotiation is still a huge todo and the initial version
will be far from perfect. We will use whatever MNCC has decided on
and then see if it is compatible in the end.
2016-03-26 22:11:06 +01:00
Holger Hans Peter Freyther 392313ff73 sdp: Extract SDP traversing into a separate module
The code will still know about SIP and the sip_call_leg but is
now separate of the call handling logic.
2016-03-26 20:02:06 +01:00