path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2018-12-19wipgsmevent admin2-3/+3
2018-11-12Allow GSM340_PLAN_UNKNOWN on MNCC originated leg.Keith Whyte1-4/+6
Allows dialing of numbers with GSM340_PLAN_UNKNOWN, for example a number beginning with '*' Change-Id: I8d71cac5b169e3b19675b9b9626e6993f3acd979
2018-10-16Add --version cmdline optionOliver Smith1-1/+7
Related: OS#3577 Change-Id: Ibdda54acddde0ac03e202286736d56b6fa51a365
2018-10-08vty: make 'show calls summary' more userfriendlyOliver Smith1-29/+26
Display a table with one row per call (instead of two lines per call), and display the phone numbers of the people making the calls instead of internal IDs. This should make the VTY command friendlier for end users, especially if they have bigger networks. There is still the 'show calls' command with all the verbose output. Example output: OsmoSIPcon> show calls summary No active calls. OsmoSIPcon> show calls summary ID From To State ----- -------------------------------- -------------------------------- ---------- 5001 101 100 PROCEEDING OsmoSIPcon> show calls summary ID From To State ----- -------------------------------- -------------------------------- ---------- 5001 101 100 CONNECTED Relates: OS#1680 Change-Id: I2092d58d80a34e6083f618593b92bb9e838aa906
2018-10-05Fix mncc socket nameDaniel Willmann1-1/+1
For OpenBSC it made sense to have a /tmp/bsc_mncc file to share for external MNCC, but now that we have an MSC osmo-sip-connector communicates with that, so rename the socket file to avoid confusion. Change-Id: I5e0dbf1aafe1b9c3776c49a08a76d64dd4fe9cc5
2018-10-04cosmetic: call.h: spaces -> tabs for consistencyOliver Smith1-9/+9
Change-Id: I1ae638af50fa3741e84e421687270d2177e1be2d
2018-10-02Logging: Further use of osmo_mncc_name() in loggingKeith1-4/+6
Use osmo_mncc_name() in timer functions and in logging the type of MNCC message sent to the socket. Change-Id: Ic77e0d86c91c29ff7304e620fdecb69b22127d33
2018-09-21Fix typo in -h: s/hekp/helpOliver Smith1-1/+1
Change-Id: I5336212845acc221d50d0aa306cccc13723b9868
2018-09-04Log using GSM48 Cause Value stringsKeith2-8/+8
Use gsm48_cc_cause_name() in logging messages Depends-On: I296f208581ce2550805f9d96e20f7319e1199023 Change-Id: I6e3541b66cb3407f0cb23fb6e00a04685fe90757
2018-09-04Cosmetic: correct spelling error in loggingKeith1-1/+1
Change-Id: I1f323a738f2c8ff21984b574a0ff47fe175e9161
2018-09-04Logging: Add debug logging for status/causesKeith2-3/+9
Adds some DEBUG level logging for SIP status and MNCC causes. Change-Id: Ib56e34ba079c7927e932c1b29d3e8341b8099ae0
2018-09-03mncc: Fix missing conditional clausePau Espin Pedrol1-3/+6
Fixes following compilation warning: osmo-sip-connector/src/mncc.c: In function ‘check_disc_ind’: osmo-sip-connector/src/mncc.c:517:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] if (other_leg) ^~ Fixes: 008915ee41900c34ec0fd8df0c9f1d7c2cbdb3b2 ("Implement Cause Mapping") Change-Id: I5bdbc29a3f82bdc92b156c1f7df68c9503f85f8f
2018-08-31Implement Cause MappingKeith3-2/+25
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-31Add SIP <-> MNCC Cause MapKeith1-0/+88
Implements a cause_map, mapping the SIP status codes to GSM48_CC_CAUSE_* that are defined in libosmocore. The map at the same time implements the Q.850 cause texts that are subsequently used in the SIP Reason: header. Implements two functions cause2status() and status2cause() to read the map and return the the mapped status. The mapping mostly follows the implemention in the LCR program, so that any implementation relying on that mapping should continue to work as expected with osmo-sip-connector. Change-Id: Id82be8603a30a6aec28fc0258236c1746973db58
2018-08-28Use htonl, not ntohl before inet_ntoa()Keith Whyte1-1/+1
Change-Id: I805864759c287ad4e1d74e5f6ee16bf2d6a1b01f
2018-08-28Logging: Log RTP IP in dotted quad format.Keith Whyte1-2/+3
in check_rtp_create() log the IP address in human readable dotted quad format. Change-Id: I298b13836cc6b9c5888f931deca61132d31da035
2018-05-28Add Cause to DISCONNECT and RELEASE RequestsKeith1-7/+12
GSM 04.08 (Table 10.85) states: Coding standards other than the standard defined for the GSM PLMNS shall not be used if the cause can be represented with the GSM standardized coding. This patch adds cause coding GSM PLMS (3) and sets cause location to "public network serving the local user" (2) This prevents UE that pay attention to this from treating all call termination as an error and paves the way to adding correct cause mapping from Table 10.86 Also replaces use of magic numbers with enum constants. Change-Id: I5d3fe3f0c9e8de26dd0c73b10b7e4fc63dff3952
2018-05-24Logging: Log mncc_names in mncc_data()Keith3-3/+6
Links libosmocore (libosmogsm) for access to osmo_mncc_name() Remove reference to get_mncc_name() in src/mncc_protocol.h Uses osmo_mncc_name() to output to debug log which MNCC_* message was received. Change-Id: I161d1b841ac5fe1b7e092b329ae0674cb340f5ac
2018-04-15use osmo_init_logging2() to avoid allocating from NULL contextHarald Welte1-1/+1
This requires libosmocore I216837780e9405fdaec8059c63d10699c695b360 or later to work. Change-Id: Id704689c9ad35a0db97aedae014e8b36eb1f86e2
2018-04-15sip: Register log callback function with sofia-sipHarald Welte4-1/+33
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-03-23Call the program "OsmoSIPcon" (also in vty)Harald Welte2-2/+2
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-19mncc: use 'const' to denote read-only input buffer/messageHarald Welte1-37/+37
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-19commentsHarald Welte1-0/+14
Change-Id: Icf0e9211a4e93eb1b05b5a5d68f9ba766982da8d
2017-11-07mncc.c: Ensure proper string buffer NUL terminationHarald Welte1-2/+2
Change-Id: I2f58a495f60ed744c1f625dc8df56aa4dc0aa4cb Fixes: Coverity CID#92223
2017-11-01vty: skip installing cmds now always installed by defaultNeels Hofmeyr1-3/+0
vty_install_default() and install_default() will soon be deprecated. Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b Change-Id: I97dab6871ff37279be2caf24a8e8dc6af39d1e06
2017-09-19vty: install default commands for SIP,MNCC,APP_NODENeels Hofmeyr1-0/+3
Change-Id: Iee51881cc07d56209647fb4f505f8f6be6b885f0
2017-09-03sdp.c Send octet-align in fmtpKeith1-1/+10
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-03-23mncc/sip: Attempt to parse the media from session in progressHolger Hans Peter Freyther2-4/+17
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-23mncc: Enable in-band signalling for early mediaHolger Hans Peter Freyther1-1/+9
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-23dtmf: Forward DTMF from MNCC to SIPHolger Hans Peter Freyther3-0/+29
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-23sip: Actually honor the remote port of the pbxHolger Hans Peter Freyther1-4/+6
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-23dtmf: Start handling the DTMF MNCC messages and respondHolger Hans Peter Freyther1-7/+59
Simply respond to the dtmf start/stop with a response and move on. Change-Id: Iffc92ea2112c9943ce89c244a9b323125c352ae5
2017-03-08evpoll: Add workaround for usage of IP_RECVERR in sofia-sipHolger Hans Peter Freyther1-1/+1
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-06mncc: Fix use after free on mncc socket disconnectionHolger Hans Peter Freyther1-5/+12
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/ ==3618== by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/ ==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/ ==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/ ==3618== by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/ ==3618== by 0x8049AA6: main (main.c:171) ==3618== Change-Id: I1889013ed315f896e4295358f6daf76ce523dc2a
2017-03-06call: Fix call release handling on mncc connection lossHolger Hans Peter Freyther1-2/+2
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/ ==3593== by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/ ==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/ ==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/ ==3593== by 0x4205478: g_main_loop_run (in /lib/i386-linux-gnu/ ==3593== by 0x8049AA6: main (main.c:171) Change-Id: I2e8e14b3983f84c9be046bbd96bbcd1e5766993e
2017-02-11evpoll: Don't try to be more smart than g_pollHolger Hans Peter Freyther1-4/+4
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-11evpoll: Always initialize revents for the outputHolger Hans Peter Freyther1-1/+2
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-11evpoll: Use {} in the middle of the if/else if/else blockHolger Hans Peter Freyther1-2/+2
Curly braces are used the lines above and below, don't make the middle stick out like this. Change-Id: I48a15a8665a47db206f8a7ccbc792f6bec8549c2
2017-02-11sip: Treat SIP 183 as progress tooHolger Hans Peter Freyther1-1/+1
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
2016-09-26log VTY telnet bind only onceNeels Hofmeyr1-2/+0
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-05-07sip: Start the application even if sofia-sip is brokenHolger Hans Peter Freyther1-4/+3
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-04-24distcheck: Package the logging.h file as wellHolger Hans Peter Freyther1-1/+1
2016-04-04vty: Add VTY command about the state of the mncc connectionHolger Hans Peter Freyther3-0/+23
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-04mncc: Use strcpy for these routines and not memcpyHolger Hans Peter Freyther1-2/+2
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-04vty: Add extended show calls command with all informationHolger Hans Peter Freyther1-0/+63
Print everything we know about the call. This can be useful to debug stuck calls or similiar events.
2016-04-04sip/call/mncc: Move source/dest into the call structureHolger Hans Peter Freyther6-25/+35
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-04vty: Fix the number of documented argumentsHolger Hans Peter Freyther1-1/+1
2016-04-04vty: Add simple VTY output for current callsHolger Hans Peter Freyther3-0/+109
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-04mncc: Use snprintf correctly create format specifierHolger Hans Peter Freyther1-1/+1
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-04mncc: Reject hold requests for nowHolger Hans Peter Freyther1-0/+17
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.