Commit Graph

60 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther b2b13f69ae mncc: Use snprintf correctly create format specifier
I was focusing so much on the length that I didn't notice the
wrong usage of snprintf. Correct it.

Warning on Ubuntu:
mncc.c:679:3: warning: format not a string literal and no format arguments [-Wformat-security]
   snprintf(mncc.imsi, 15, called);
2016-04-04 16:26:50 +02:00
Holger Hans Peter Freyther 270c73c11f mncc: Reject hold requests for now
MNCC hold to sip has not been implemented, so let me reject the
request right now. A ticket (OS#1686) has been filed to track
implementing call holding.
2016-04-04 12:38:10 +02:00
Holger Hans Peter Freyther 6d7d7f2cd3 mncc: Have all release go through a local method
Have all release go through a local method first. This way we can
make sure to stop the timer. I have seen something odd (a busy loop
in the RB tree of the timer code) and we can easily avoid having a
timer run on a page of memory that has been "freed".
2016-04-04 12:38:01 +02:00
Holger Hans Peter Freyther c313ab0f6b mncc: Only copy 15 chars to leave the last one as NULL
Right now we are lucky the next byte after imsi is already set
to NUL here but we should not rely on that.
2016-04-01 15:42:41 +02:00
Holger Hans Peter Freyther 3d2787646b app/mncc: Add "use-imsi" to allow calling by IMSI
In case one is using a PBX it might be the easiest just to
call based on IMSI. Add a VTY option to enable/disable this
feature. It can be used to keep the number assignment outside
of the HLR database.
2016-04-01 15:35:29 +02:00
Holger Hans Peter Freyther 0e9434184e debian: Add dh-autoreconf required by the debian packaging 2016-03-31 20:04:54 +02:00
Holger Hans Peter Freyther bec32eb207 coverity: Address two issues found by coverity
Add NULL check in the case of MNCC disconnect that was missing and
add an assert to show that at this point the other leg must exist.

Fixes: CID#80799, CID#80800, 80801
2016-03-31 19:36:27 +02:00
Holger Hans Peter Freyther adc7484a0c debian: Initial packaging of the osmo-sip-connector
It installs a service file but requires a user to create a config
file. We will not provide a sysv start script.
2016-03-31 19:12:56 +02: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 c2474dc0be mncc: Add handling to connect a MNCC MT call
This will go through the stage of:

* MNCC_CALL_CONF_IND (to which we create a RTP socket)
* then we might receive a MNCC_ALERT_IND
* and finally the MNCC_SETUP_CNF

For the last two we inform the other leg about the progress.
2016-03-31 16:06:04 +02:00
Holger Hans Peter Freyther 8763cf8850 sip: Pass to not enable media on our 200 response
In case we send a 200 but don't have this tag, a 500 response will
be sent and the call will be dropped.
2016-03-31 16:04:47 +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 4bfaf60ed2 mncc: Convert ip address so BTS sends it to the right place 2016-03-31 14:17:33 +02:00
Holger Hans Peter Freyther b8e802851d mncc: Handle REJ_IND from the NITB
In case a call can not be connected we will receive a REJ.IND.
Inform the other leg and release the call.
2016-03-27 17:05:48 +02:00
Holger Hans Peter Freyther a4970327f2 mncc: Stop timer when starting the release process 2016-03-27 17:05:48 +02:00
Holger Hans Peter Freyther 00a43e20ab mncc: On timeout release the other leg as well
In case we don't receive the response we had expected let us
take down the other part of the call as well.
2016-03-27 17:05:48 +02:00
Holger Hans Peter Freyther 916348b7dc mncc: Begin to implement MT call handling for SIP->MNCC
Initiate the setup request that should result in the call getting
all the way to the connected state at some point in time. The device
I test with sadly rejects the call too soon.
2016-03-27 17:02:39 +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 dac13bed50 sip/app: Route call from SIP to MNCC and deal with the release
Fix releasing of the leg in case it is not routable and make the
differentation if we initiated the invite (send CANCEL) or send
a final error. The error code was randomly picked and once we have
an enum of causes we can decide where to map it to.
2016-03-26 21:09:07 +01: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 5f29be5acf sip: Actually return after having rejected the new call 2016-03-26 20:30:14 +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
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 586abf9f0f sip: Handle incoming message and screen the SDP file
Check if the SDP file has any codec potentially supported by GSM.
The topic of codec selection is a complicated one and we will not
support it correctly in the beginning.
2016-03-26 19:44:03 +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 989bef0875 app: Translate payload name to IETF codec name
Convert the MNCC codec type to the IETF codec name.
2016-03-26 16:33:15 +01:00
Holger Hans Peter Freyther f9ba5612a9 Write down some of the limitations of the current setup 2016-03-26 16:31:00 +01:00
Holger Hans Peter Freyther 997d72e0fe app: Ask the sip side to create a leg
Create SIP leg and if it is failing release the call
2016-03-26 06:22:07 +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 2e36090fea sip: Tell sofia-sip that we will ack certain things ourselves
This has not tested re-transmission and if a call is connected
multiple times or not.
2016-03-26 06:22:06 +01:00
Holger Hans Peter Freyther 71fbe870d8 mncc: In case of a disconnect.ind inform the other leg
In case the call got disconnected propagate it to the other leg
of the call.
2016-03-26 06:22:06 +01:00
Holger Hans Peter Freyther d3d8348c62 mncc: Send RTP_CONNECT and verify connect result
The current code can not deal with two outstanding commands. Let's
assume the user will hang up if the voice connection will fail and
we will add a general RTP_CONNECT check to tearn down a call.
2016-03-26 06:22:06 +01:00
Holger Hans Peter Freyther ad6eabd4b5 mncc: Refactor and reduce some code clones for sanity checks
Not every message might have the size of gsm_mncc and the size check
is done inside each routine. Routines that relate to calls now share
the code to check the size and the look-up to find the leg.
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 4ca311e629 mncc: Handle disconnect and release the call
Send a release request and release the leg on conformation
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 aab9ac5191 mncc: Log commands in hex to find the name more easily in mncc_protocol.h
In the long run we should print these by name and not by the number
but as the table is in OpenBSC and I did not want to copy it we will
have to cope with the numbers a little longer.
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 153ebbf6e2 call: Change to past tense and move code after the free
Reading the "releasing" log output sounded like one more message
had been sent and this code is waiting for something. Take a copy
of the call id and then print that the call has been released.
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 e08887ec4e app: Release the call by releasing the initial request
This will then go through the release procedure of the relevant
call instead of letting it timeout on the initial leg.
2016-03-26 06:11:09 +01:00
Holger Hans Peter Freyther 4f8cafa5b0 call: Continue up to the point of call routing
We accept the call on MNCC and ask the core to select/create the
second leg of the call.
2016-03-23 17:41:23 +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 dbe55c1eb5 mncc: Add logging messages about the leg on all points
With a bit more code the logging will print:

<0001> mncc.c:233 Created call(5001) with MNCC leg(2147483659) IMSI(274018000000001)
<0001> mncc.c:178 RTP set-up continuing with call with leg(2147483659)
<0001> mncc.c:65 Got response, stopping timer on leg(2147483659)
<0002> call.c:51 call(5001) releasing.

Use %zu for size_t arguments, e.g. returned from sizeof.
2016-03-23 17:05:16 +01:00
Holger Hans Peter Freyther 239a122842 doc: Update with some requirements and limitations 2016-03-23 17:02:32 +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