Commit Graph

114 Commits

Author SHA1 Message Date
Pau Espin 55faf38675 Bump version: 1.1.0.11-11a0-dirty → 1.1.1
Change-Id: Iefb8ada270a7a34d5db1c1e3c94f72a02e2dd609
2018-05-06 17:45:55 +02:00
Harald Welte 11a0de04b6 use osmo_init_logging2() to avoid allocating from NULL context
This requires libosmocore I216837780e9405fdaec8059c63d10699c695b360 or
later to work.

Change-Id: Id704689c9ad35a0db97aedae014e8b36eb1f86e2
2018-04-15 22:15:25 +02:00
Harald Welte 6369f30c4d sip: Register log callback function with sofia-sip
sofia-sip allows applications to register a log backend function
which will be called every time the library wants to log something.

We register such a call-back and make it log using the libosmocore logging
framework.

The problem is that sofia-sip has its own log level management, and by
the time the message hits libosmocore, we don't know which log level we
shall use :(

Change-Id: Ib269b6b50f9d79bbd13acc43a626834921f05edb
Related: OS#3105
2018-04-15 22:12:42 +02:00
Harald Welte 65fa803f0c osmoappdesc: Fix VTY prompt to use OsmoSIPcon, not old OsmoMNCC
In Change-Id Iba20c1c90e528d08bd362be39d86317569c253e6 we changed the
prompt, but didn't update osmoappdesc.py

Change-Id: I7c7868bda2195e5e67b2db5824caee8fbfb5a3b6
2018-03-27 15:51:02 +02:00
Harald Welte a6a34fd718 Call the program "OsmoSIPcon" (also in vty)
It's confusing to access the telnet interface and then see a prompt
that's not like the program name

Change-Id: Iba20c1c90e528d08bd362be39d86317569c253e6
2018-03-23 19:35:59 +01:00
Harald Welte fd203f6a97 mncc: use 'const' to denote read-only input buffer/message
We normally use the 'const' modifier whenever using read-only input
data, let's do so in the mncc parser/handler, too.

Change-Id: Ide24feb536c04fe7ef08c62b4498fdd95605b58c
2018-03-19 10:03:26 +01:00
Harald Welte 05cd0f2628 comments
Change-Id: Icf0e9211a4e93eb1b05b5a5d68f9ba766982da8d
2018-03-19 10:00:01 +01:00
Pau Espin cdc5e591bb contrib: jenkins.sh: Disable doxygen in libosmocore build
Change-Id: I7befa0cb4e72a6ad086e3c2d290546dbf22f1676
2018-02-20 20:23:10 +01:00
Pau Espin df62bb330e contrib: Add systemd service file
Change-Id: I36dd16b75beb4d9bd8081aca6e44c5b72e58fead
2018-02-16 17:04:30 +01:00
Harald Welte b18bbf3fd8 debian/control: Fix URLs for homepage / git
Change-Id: Ib431d5dcaf78cc31dbfaa4fd13105ec62142e9be
2018-02-09 11:17:29 +01:00
Harald Welte 4954fee4c6 mncc.c: Ensure proper string buffer NUL termination
Change-Id: I2f58a495f60ed744c1f625dc8df56aa4dc0aa4cb
Fixes: Coverity CID#92223
2017-11-07 20:55:12 +00:00
Neels Hofmeyr dd9909db1d vty: skip installing cmds now always installed by default
vty_install_default() and install_default() will soon be deprecated.

Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b
Change-Id: I97dab6871ff37279be2caf24a8e8dc6af39d1e06
2017-11-01 00:52:58 +01:00
Harald Welte 8706a688ff Tag/Release Version 1.1.0
Change-Id: Id3876b2d940b5612788760dfeabe308f43d42ae2
2017-10-28 18:20:02 +02:00
Harald Welte 5094bf1eab configure.ac: Depend on latest upstream libosmo-*
Change-Id: I9bb7ced1197effb1082a57b2ed060d94ab9648c8
2017-10-28 18:20:01 +02:00
Harald Welte 94ae40aae6 Fix git-version-gen
It seems we didn't import a proper/clean git-version-gen into the
repository.  Let's fix this.

Change-Id: I5132d10b3ed5a75e562cdd74db02eda68d828a08
2017-10-28 18:20:00 +02:00
Neels Hofmeyr 4abdb313e3 jenkins: use osmo-clean-workspace.sh before and after build
See osmo-ci change I2409b2928b4d7ebbd6c005097d4ad7337307dd93 for rationale.

Depends: I2409b2928b4d7ebbd6c005097d4ad7337307dd93
Change-Id: I7e9f19755f55b274def9d757f72f2a08a01a4cce
2017-10-27 22:54:50 +02:00
Neels Hofmeyr 535df15bc5 vty: install default commands for SIP,MNCC,APP_NODE
Change-Id: Iee51881cc07d56209647fb4f505f8f6be6b885f0
2017-09-19 03:30:03 +02: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
Max 148df95d42 Fix build after recent libosmocore update
Change-Id: Idd1eba7ed0c5454de29d86a8bb72beb24d03ef2a
2017-09-01 10:19:18 +02:00
Max 9d1ac29a48 Use release helper from libosmocore
Change-Id: I1a65695d6191aa7647b9872e58da4a00bbad59e2
Related: OS#1861
2017-08-26 05:56:55 +00:00
Max 6cb76c7ee5 Add git review config
Change-Id: I60f6b29998954b0698e523efaa766f8bb895cdf7
2017-08-25 18:38:05 +02:00
Holger Hans Peter Freyther 417f254216 mncc/sip: Attempt to parse the media from session in progress
Parse the media from session in progress and if present in alerting
connect the call early. Sadly this sets RTP to the sendrecv mode even
if we would like to keep it as recvonly.

Change-Id: I98d173abc46c67b87666ed2f193a581d6e72344b
Related: OS#1784
2017-03-23 09:01:45 +00:00
Holger Hans Peter Freyther 9d796ff156 mncc: Enable in-band signalling for early media
Besides sending the alerting request we should inform the
MS that there is in-band information now. We do not seem
to export these flags in protocol/gsm_04_08.h so hardcode
them for now (until I come up with good names for them).

Related: OS#1784

Change-Id: I80b1e1f4ca045bd63536476702a5812f27d9b36d
2017-03-23 09:01:14 +00: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 0cea3df01d testpbx: Add another number that will just play a ringback
This will enable early media to play a ringback to the phone.

Change-Id: I4c778b1f0e7484a755716133f91767af8b1102c0
2017-03-23 09:41:25 +01:00
Holger Hans Peter Freyther 3d9ae085bf sip: Actually honor the remote port of the pbx
So far the remote_port has never been used. sofia-sip did the right
thing and put the port into the "Contact" and the rport option for
the via. But we would have never been able to connect a PBX on a
different port (as sofia-sip seems to parse the destination from the
to address).

Change-Id: Ifbd49b4aa6b01b118fe67e39dddef50b2946159c
2017-03-23 07:32:04 +00:00
Holger Hans Peter Freyther 63942320b3 testpbx: Enable GSM and AMR as codecs to actually be relevant
Without these codecs we will not have much joy when working with a
default GSM BTS/BSC.

Change-Id: I8719c392f57e0dbed0c0c792d1381592dcd662c1
2017-03-23 07:31:25 +00:00
Holger Hans Peter Freyther 62f50f5297 dtmf: Start handling the DTMF MNCC messages and respond
Simply respond to the dtmf start/stop with a response
and move on.

Change-Id: Iffc92ea2112c9943ce89c244a9b323125c352ae5
2017-03-23 07:30:17 +00:00
Neels Hofmeyr 301860387a jenkins: add value_string termination check
Change-Id: Ic247005aeeabdf349caf48657af0249da8c8d9ea
Depends: libosmocore change-id I2bc93ab4781487e7685cfb63091a489cd126b1a8
2017-03-16 19:00:59 +00:00
Holger Hans Peter Freyther 37c2254f5d evpoll: Add workaround for usage of IP_RECVERR in sofia-sip
We are using glib to benefit from the sofia-sip-glib eventloop
integration and set a poll func (evpoll) to be called by glib
to integrate with the rest of libosmocore.

Sofia-sip will use IP_RECVERR to enable error reporting on the
socket and then sets SU_WAIT_ERR (mapped to POLLERR if not using
kqueue) in the internal events flag of the socket. This will
be registered with a su_wait (mapped to struct pollfd) and then
glib will be called with g_source_add_poll. At this point the
the fd->events will still have the POLLERR bit set.

Before glib is calling its internal poll routine or our one
it will copy all registered fd into an array and mask the
events flags:

      /* In direct contradiction to the Unix98 spec, IRIX runs into
       * difficulty if you pass in POLLERR, POLLHUP or POLLNVAL
       * flags in the events field of the pollfd while it should
       * just ignoring them. So we mask them out here.
       */
      events = pollrec->fd->events & ~(G_IO_ERR|G_IO_HUP|G_IO_NVAL);

This leads to the POLLERR flag never been set in the revents
of the struct poll_fd and as such we never put them in the
exceptionset and as such:

	static int tport_base_wakeup(tport_t *self, int events)
	{
  	int error = 0;

  	if (events & SU_WAIT_ERR)
    		error = tport_error_event(self);

tport_base_wakeup will never call tport_error_event. And the error
will be stuck in the socket data forever and recvmsg will return
a zero length packet. And this will repeat until the end of time.

As a first hack I mapped SU_WAIT_ERR to POLLPRI but when using
select the Linux kernel will not put the socket error into the
except queue unless the sockopt SOCK_SELECT_ERR_QUEUE is used.

One option is to use poll and then map the select requirements
to poll. Right now I just signal POLLERR as well to trigger
tport_error_event. This will result in extra syscalls for each
received UDP message right now.

Change-Id: I5bec4a7b70f421ab670e649e5bc1ea6faf59707c
2017-03-08 10:32:13 +01:00
Holger Hans Peter Freyther 49880ddf74 mncc: Fix use after free on mncc socket disconnection
When the MNCC socket breaks down we would release all callds but when
there is no remote call the call would be released before

	if (call->remote)
		...

is being executed leading to a use after free. Fix it by copying the
legs first and assuming the call will be gone after that.

==3618== Invalid read of size 4
==3618==    at 0x804A18A: app_mncc_disconnected (app.c:49)
==3618==    by 0x804B52D: close_connection (mncc.c:255)
==3618==    by 0x804BCFA: mncc_rtp_send.constprop.13 (mncc.c:145)
==3618==    by 0x804CC86: check_setup (mncc.c:435)
==3618==    by 0x804CC86: mncc_data (mncc.c:795)
==3618==    by 0x42FCF94: osmo_fd_disp_fds (select.c:167)
==3618==    by 0x804D1F2: evpoll (evpoll.c:92)
==3618==    by 0x4205053: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1)
==3618==    by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1)
==3618==    by 0x8049AA6: main (main.c:171)
==3618==  Address 0x47f3258 is 64 bytes inside a block of size 76 free'd
==3618==    at 0x402A3A8: free (vg_replace_malloc.c:473)
==3618==    by 0x42E7FD1: ??? (in /usr/lib/i386-linux-gnu/libtalloc.so.2.1.5)
==3618==    by 0x804A3FD: call_leg_release (call.c:87)
==3618==    by 0x804A186: app_mncc_disconnected (app.c:48)
==3618==    by 0x804B52D: close_connection (mncc.c:255)
==3618==    by 0x804BCFA: mncc_rtp_send.constprop.13 (mncc.c:145)
==3618==    by 0x804CC86: check_setup (mncc.c:435)
==3618==    by 0x804CC86: mncc_data (mncc.c:795)
==3618==    by 0x42FCF94: osmo_fd_disp_fds (select.c:167)
==3618==    by 0x804D1F2: evpoll (evpoll.c:92)
==3618==    by 0x4205053: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1)
==3618==    by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1)
==3618==    by 0x8049AA6: main (main.c:171)
==3618==

Change-Id: I1889013ed315f896e4295358f6daf76ce523dc2a
2017-03-06 21:10:07 +00:00
Holger Hans Peter Freyther 068f547954 call: Fix call release handling on mncc connection loss
The app_mncc_disconnected will be called when the MNCC socket is down
and lead to all calls being released. It directly released the call but
did not stop the MNCC CMD timer. Go through the call release callback.

==3618==    at 0x804A18A: app_mncc_disconnected (app.c:49)
==3618==    by 0x804B52D: close_connection (mncc.c:255)

This lead to the timer not being removed:

==3593== Invalid read of size 4
==3593==    at 0x4305D42: rb_first (rbtree.c:294)
==3593==    by 0x42FCB37: osmo_timers_update (timer.c:220)
==3593==    by 0x804D1D5: evpoll (evpoll.c:89)
==3593==    by 0x4205053: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1)
==3593==    by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1)
==3593==    by 0x8049AA6: main (main.c:171)
==3593==  Address 0x47f3380 is 232 bytes inside a block of size 272 free'd
==3593==    at 0x402A3A8: free (vg_replace_malloc.c:473)
==3593==    by 0x42E7FD1: ??? (in /usr/lib/i386-linux-gnu/libtalloc.so.2.1.5)
==3593==    by 0x804A3C4: call_leg_release (call.c:83)
==3593==    by 0x804A188: app_mncc_disconnected (app.c:48)
==3593==    by 0x804B52D: close_connection (mncc.c:255)
==3593==    by 0x804BCFA: mncc_rtp_send.constprop.13 (mncc.c:145)
==3593==    by 0x804CC86: check_setup (mncc.c:435)
==3593==    by 0x804CC86: mncc_data (mncc.c:795)
==3593==    by 0x42FCF94: osmo_fd_disp_fds (select.c:167)
==3593==    by 0x804D1F2: evpoll (evpoll.c:92)
==3593==    by 0x4205053: ??? (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1)
==3593==    by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/libglib-2.0.so.0.4200.1)
==3593==    by 0x8049AA6: main (main.c:171)

Change-Id: I2e8e14b3983f84c9be046bbd96bbcd1e5766993e
2017-03-06 21:10:07 +00:00
Holger Hans Peter Freyther 7166d0f448 contrib: Add Dockerfile to build and configure a FreeSWITCH
Rhizomatica is using FreeSWITCH and we should have an easy way to
test against it. A docker container with exposed ports seems like
the easiest. FreeSWITCH by default is giving us some exmaple numbers:

	* 5000 a menu... that allows DTMF
	* 9195 an echo test
	* 9198 tetris.

The config is copied on top of the default/big config that is
installed. If this PBX should be reached from the outside one needs
to change 127.0.0.1 to the external address and maybe configure the
acl as well to add more CIDRs.

Besides that
	make container
	make run

Will build it and start the container. Takes a bit of time and requires
docker. With it configure one can see things like:

2017-03-05 15:32:49.913912 [INFO] switch_channel.c:515 RECV DTMF 3:2000
2017-03-05 15:32:50.952752 [INFO] switch_channel.c:515 RECV DTMF 2:2000

Now to test DTMF in the system.

Change-Id: I7f3aa8c81b9e8698df090a05d2e41a41b67d8e3c
2017-03-05 17:01:21 +01:00
Holger Hans Peter Freyther 42b073a233 evpoll: Don't try to be more smart than g_poll
gpoll.c:g_poll maps G_IO_PRI (which is POLLPRI) to the errorfds of
the select call. Let's do the same.

Change-Id: I8c9163f7495e0b237bde2d48beffea3b0776a1dd
Related: OS#1934
2017-02-11 13:06:32 +07:00
Holger Hans Peter Freyther e19f9ce39f evpoll: Always initialize revents for the output
Even if we have not selected the fd (e.g. fd < 0), initialize revents
to 0. This seems to match gpoll.c:g_poll of glib.

Change-Id: I9e16a6d5a74a204c85808ba67a8f0f7af3045059
2017-02-11 13:01:12 +07:00
Holger Hans Peter Freyther 70926c8bb5 evpoll: Use {} in the middle of the if/else if/else block
Curly braces are used the lines above and below, don't make the middle
stick out like this.

Change-Id: I48a15a8665a47db206f8a7ccbc792f6bec8549c2
2017-02-11 13:00:19 +07:00
Holger Hans Peter Freyther 14488c1c46 sip: Treat SIP 183 as progress too
It doesn't fix early media yet but brings us one step
closer to it:

   The 183 (Session Progress) response is used to convey information
   about the progress of the call that is not otherwise classified.  The
   Reason-Phrase, header fields, or message body MAY be used to convey
   more details about the call progress.

Change-Id: Ibf264f251e41c06a7b4839acc0d0853e6400291c
2017-02-11 04:53:16 +01:00
Neels Hofmeyr fffc742777 jenkins.sh: use osmo-build-dep.sh, log test failures
Like in libosmo-abis' and other jenkins.sh

Change-Id: I1b03786069cc4373dec73711e3a31ec05dfac2e3
2016-10-07 01:54:33 +02:00
Neels Hofmeyr ff8ca58821 configure: check for pkg-config presence
Change-Id: Iaca22089bcb21b56048fa541f588c4ad4bed8f6d
2016-10-01 01:07:11 +02:00
Neels Hofmeyr ecacdc65c3 build: be robust against install-sh files above the root dir
Explicitly set AC_CONFIG_AUX_DIR.

To reproduce the error avoided by this patch:

  rm install-sh        # in case it was already generated.
  touch ../install-sh  # yes, outside this source tree
  autoreconf -fi

This will produce an error like

  ...
  configure.ac:16: error: required file '../ltmain.sh' not found
  configure.ac:5: installing '../missing'
  src/Makefile.am: installing '../depcomp'
  autoreconf: automake failed with exit status: 1

See also automake (vim `which automake`) and look for 'sub locate_aux_dir'.

Change-Id: I9c96c087bffb41533ef6fb9b1d00bd903d71693e
2016-10-01 01:07:11 +02:00
Neels Hofmeyr c403ed69cd log VTY telnet bind only once
After libosmocore 55dc2edc89c1a85187ef8aafc09f7d922383231f which outputs
'telnet at <ip> <port>' from telnet_init_dynif(), there's no need to log the
telnet VTY bind here anymore.

Change-Id: I7db7f7a2e61ba676c2712bcc149a5fd5a69b80b2
2016-09-26 22:56:27 +02:00
Holger Hans Peter Freyther 550264987f sip: Start the application even if sofia-sip is broken
In case of solely managing the application through the VTY we
want/need to have the application running besides a wrong config
has been entered. SIP will be broken but a user will be able to
see the log message and can fix it.
2016-05-07 11:52:24 +02:00
Holger Hans Peter Freyther e4bd8d42e9 jenkins: Make it find the libosmocore library as well 2016-04-25 08:41:19 +02:00
Holger Hans Peter Freyther 5be5044895 jenkins: Use separate check invocation tor un the tests 2016-04-24 22:35:13 +02:00
Holger Hans Peter Freyther 5f4c6f3a04 jenkins: Try to enable the vty tests as well 2016-04-24 22:32:49 +02:00
Holger Hans Peter Freyther e932949ac0 distcheck: Package the logging.h file as well 2016-04-24 22:30:26 +02:00
Holger Hans Peter Freyther f896df6b8e distcheck/tests: Add the referenced osmoappdesc.py for testing
distcheck fails because the file is not present. Write it out to
get our standard vty checking to work. Add simple Makefile and
call it.
2016-04-24 22:28:35 +02:00
Holger Hans Peter Freyther 9a333be20b jenkins: Add first CI script for the SIP connector 2016-04-24 21:58:07 +02:00
Holger Hans Peter Freyther d1c11b1e97 vty: Add VTY command about the state of the mncc connection
Add VTY command with the state of the MNCC connection. It gives
a simple state and is connected in case of the READY state.
2016-04-04 20:17:29 +02:00
Holger Hans Peter Freyther 02b19354e4 mncc: Use strcpy for these routines and not memcpy
We need to stop on the first occurence of a \0 in the address
provided by SIP. Do not copy the full amount of bytes.
2016-04-04 20:16:27 +02:00