Commit Graph

24 Commits

Author SHA1 Message Date
Keith Whyte bd2d14bd4a Prepare to support MO Call HOLD
Add function pointers to the call_leg struct for call hold and retrieve.

Add function to send re-INVITE to SIP side when MNCC side puts call on HOLD/RETRIEVES.

Add MNCC/SIP CC_HOLD to call states.

Change-Id: I2595626dfa50eb2f8e29a02540b708c9c1dce88c
2019-08-05 19:05:43 +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
Oliver Smith d4eb8babd0 cosmetic: call.h: spaces -> tabs for consistency
Change-Id: I1ae638af50fa3741e84e421687270d2177e1be2d
2018-10-04 11:35:45 +02:00
Keith Whyte 008915ee41 Implement Cause Mapping
Adds cause field to the call_leg and sip_call_leg structs.

Translates the SIP status to MNCC cause and vice versa and
uses this information in the SIP/MNCC messages at call leg
release time.

Change-Id: Ic1b80dff7e583cd6fff2b662bc6cc4bad3f81cd4
2018-08-31 19:11:45 +02:00
Holger Hans Peter Freyther 4649746798 dtmf: Forward DTMF from MNCC to SIP
We are not using the RTP telephony-event here but the older dtmf
relay. We also only have a fixed DTMF duration for now.

Change-Id: Icf770fae89f7aedf6eba9a119db9b8acc7f938df
2017-03-23 09:00:24 +00:00
Holger Hans Peter Freyther 211ad859de sip/call/mncc: Move source/dest into the call structure
In preparation of a better show calls VTY command it is of interest
to know which number has been dialed by whom. For that store the
source/dest in there.

MNCC: Change the talloc root context to the call and don't try to
free the strings after calling the routing code

SIP: Use talloc_strdup to duplicate them.

Call: Add null check because the talloc_strdup of the SIP layer
could have failed.
2016-04-04 19:52:41 +02:00
Holger Hans Peter Freyther c39c3df251 vty: Add simple VTY output for current calls
Start with a show call summary that lists simple data about the
current set of calls:

Call(5002) initial(type=SIP,state=CONFIRMED) remote(type=MNCC,state=INITIAL)
Call(5001) initial(type=MNCC,state=PROCEEDING) remote(type=SIP,state=CONFIRMED)

Related: OS#1680
2016-04-04 17:09:30 +02:00
Holger Hans Peter Freyther 275571ff20 mncc: Introduce direction and start to handle it separetely
For releasing a MT-Call we will need to send a release request
and then wait for the release confirmation. Add if/else to it.
If this turns out to be too ugly we will be able to create one
MO and one MT leg.
2016-03-31 14:17:58 +02:00
Holger Hans Peter Freyther 7a30c94030 sip: Continue SIP->MNCC (MO or SIP Originated) implementation
Copy out to/from numbers, copy the sdp file, set the magic for the
nh handle. With the incoming cancel the leg and the entire call will
be terminated.
2016-03-26 20:55:02 +01:00
Holger Hans Peter Freyther b723cceee9 call: Create a call with a SIP leg
Clone the MNCC code and create a call with a SIP leg.
2016-03-26 19:51:33 +01:00
Holger Hans Peter Freyther 6f039c158d sip: Mark call as MT call in preparation for incoming calls 2016-03-26 19:03:04 +01:00
Holger Hans Peter Freyther b927a0bbde call: It is call_create and not sip_create
It is not creating anything related to sip at all. Remove the
prefix in preparation to creating a call from a sip_call_leg.
2016-03-26 18:52:22 +01:00
Holger Hans Peter Freyther 2211c3ba56 sip: Implement MT call out to SIP
* Create a new handle
* Send the invite
* Have some state transitions
* Allow to release a call in initial unconfirmed state, confirmed
one with cancel and connected with bye
* Add simple SDP parsing to find the rtpmap/codec that is used by
gsm
2016-03-26 06:22:06 +01:00
Holger Hans Peter Freyther 49a4a643da mncc: Prepare alerting and and connecting the call
What is not done is to actually set-up rtp that it can flow to the
now confirmed remote.
2016-03-26 06:22:06 +01:00
Holger Hans Peter Freyther cacce82810 mncc: In case of an unexpected REL.IND inform the other leg about it
I had modified my code to do nothing after having sent the PROCEEDING
message. First the MS will issue a DISCONNECT.IND (which I ignored) and
then there will be REL.IND. Let's inform the other leg about this event
and let's assume the call will then be terminated.
2016-03-26 06:22:06 +01:00
Holger Hans Peter Freyther f86979e1eb call/mncc: Set proceeding and deal with release based on this state
Let's inform the MS that we have collected everything to move forward
with the call. A new way to release the call is required in this state.
2016-03-26 06:22:06 +01:00
Holger Hans Peter Freyther 292e2cddd0 mncc: Extract the RTP port information before continuing
These need to be used by the SIP leg to move forward.
2016-03-26 06:22:06 +01:00
Holger Hans Peter Freyther aa41b0aafc call: Re-order includes from local to osmocom to system
Let's follow the self first, local next, osmocom, system order of
include files.
2016-03-26 06:22:06 +01:00
Holger Hans Peter Freyther bc4fed27e1 mncc: Add a timeout when issuing a MNCC command 2016-03-23 17:08:03 +01:00
Holger Hans Peter Freyther a0aa566ec4 mncc: Remember the IMSI as well 2016-03-23 17:07:00 +01:00
Holger Hans Peter Freyther c4d01f9a90 call: Add a backpointer from leg to call and drop the argument
Simplify the structure by either working with a call or just
a leg of it. No need to carry both pointers all the time.
2016-03-22 21:04:56 +01:00
Holger Hans Peter Freyther 29b556490f mncc: Dispatch setup and issue rtp create in response then continue
The code is not tested and might be broken. Parse the setup request
of a MO call, create a new "call" with a MNCC leg and then issue the
call to create a RTP socket. Once this has been done, release the call
as the code to open a second leg has not been written yet.
2016-03-22 21:04:56 +01:00
Holger Hans Peter Freyther 45f0fa09d2 call/app: Hook the MNCC disconnect event in the app and release calls
In case the MNCC server is crashing we need to release all calls,
use the event emitted by the MNCC connection and iterate over all
calls and call the release function.
2016-03-22 16:32:48 +01:00
Holger Hans Peter Freyther 10e22bd6f4 call: Introduce a structure for representing a call
Right now a call has two legs, the initial one and the remote. In
general this will allow a SIP to SIP, SIP to MNCC and MNCC to MNCC
structure in the future.
2016-03-22 16:32:48 +01:00