View Issue Details

IDProjectCategoryView StatusLast Update
0000021SIP Trip PhoneSIP Trip Phonepublic2024-11-06 13:54
Reporterpmarini Assigned ToDoubleBastionAdmin  
PrioritynormalSeverityminorReproducibilityalways
Status acknowledgedResolutionsuspended 
Summary0000021: Error in configuring SIP Trip Phone
DescriptionHello,

While I have a good knowledge of Nextcloud, I don't on SIP in general.

I'm trying to configure the app in my Nextcloud instance, with a Localphone provided phone number and a self-hosted Asterisk. I followed as close as possible the instructions here - https://www.doublebastion.com/install-asterisk/.

When opening the app in the top bar I get:

-----------------------
{
  "reqId": "iVeuXplHSG7dYcv9EMjL",
  "level": 3,
  "time": "2024-06-13T15:42:59+02:00",
  "remoteAddr": "10.0.0.76",
  "user": "pmarini",
  "app": "index",
  "method": "GET",
  "url": "/apps/sip_trip_phone/user/getcontactsnmbrs/%3C?php%20p($userId);%20?%3E",
  "message": "explode(): Argument #2 ($string) must be of type string, null given in file '/var/www/nextcloud/apps/sip_trip_phone/lib/Service/SphoneService.php' line 134",
  "userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0",
  "version": "29.0.2.2",
  "exception": {
    "Exception": "Exception",
    "Message": "explode(): Argument #2 ($string) must be of type string, null given in file '/var/www/nextcloud/apps/sip_trip_phone/lib/Service/SphoneService.php' line 134",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 338,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1050,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 49,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 170,
    "Previous": {
      "Exception": "TypeError",
      "Message": "explode(): Argument #2 ($string) must be of type string, null given",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/nextcloud/apps/sip_trip_phone/lib/Service/SphoneService.php",
          "line": 134,
          "function": "explode"
        },
        {
          "file": "/var/www/nextcloud/apps/sip_trip_phone/lib/Controller/SphoneController.php",
          "line": 87,
          "function": "getcontactsnmbrs",
          "class": "OCA\\SIPTripPhone\\Service\\SphoneService",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 232,
          "function": "getcontactsnmbrs",
          "class": "OCA\\SIPTripPhone\\Controller\\SphoneController",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 138,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
          "line": 184,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Route/Router.php",
          "line": 338,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/var/www/nextcloud/lib/base.php",
          "line": 1050,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/index.php",
          "line": 49,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/var/www/nextcloud/apps/sip_trip_phone/lib/Service/SphoneService.php",
      "Line": 134
    },
    "message": "explode(): Argument #2 ($string) must be of type string, null given in file '/var/www/nextcloud/apps/sip_trip_phone/lib/Service/SphoneService.php' line 134",
    "exception": {},
    "CustomMessage": "explode(): Argument #2 ($string) must be of type string, null given in file '/var/www/nextcloud/apps/sip_trip_phone/lib/Service/SphoneService.php' line 134"
  }
}
-----------------------



Using SIP Trip Phone 1.1.5 on server 29.0.2 running with Apache stock version on Ubuntu 22.04.

Localphone is correctly connected to my Asterisk in the sense that "pjsip show endpoints" returns the expected output.
TagsNo tags attached.

Activities

pmarini

2024-06-13 13:56

reporter  

ksnip_20240613-155348.png (76,226 bytes)   
ksnip_20240613-155348.png (76,226 bytes)   

pmarini

2024-06-13 14:02

reporter   ~0000059

I forgot to mention that I'm natting 1029 to 8089 on the system that hosts Nextcloud.

REF:
https://www.doublebastion.com/apache-configuration-for-nextcloud/

This is a puzzling to me as I don't see any service defined to listen on port 8089, while I see one configured to listen on port 8088

Thanks!

DoubleBastionAdmin

2024-06-13 14:27

administrator   ~0000060

Last edited: 2024-06-13 15:18

The only problem that the log you posted shows is:

"message": "explode(): Argument #2 ($string) must be of type string, null given in file '/var/www/nextcloud/apps/sip_trip_phone/lib/Service/SphoneService.php' line 134",

For some reason the second query in the 'getcontactsnmbrs' function in the 'SphoneService.php' file fails to get the data from the 'oc_cards' table, from your Nextcloud database.

To begin debugging this issue, please run the following test:

- open the '/apps/sip_trip_phone/js/launchphone.js' file and comment out the code block starting with:

    "// Get the (voice call capable) phone numbers of the current user's contacts and of all the Nextcloud users who didn't hide their phone numbers"

This means you have to place /* at the beginning of that code block and */ at the end, then remove all the browser's cache, and open again SIP Trip Phone. In this way, you won't see the list of contacts with their phone numbers, but the phone should start correctly and register to Asterisk, allowing you to make and receive calls to/from your mobile phone, to test making and receiving calls.

pmarini

2024-06-13 14:33

reporter   ~0000061

Thanks for the prompt reply. Can you please give me the exact line range to comment out?

The comment you mention is at line 60.

DoubleBastionAdmin

2024-06-13 14:35

administrator   ~0000062

The lines from 60 to 111 including 60 and 111 should be commented out.

pmarini

2024-06-13 14:42

reporter   ~0000063

No error now, but nothing happens.

An extract of my web server log, if it is useful:

10.0.0.76 - - [13/Jun/2024:16:39:58 +0200] "GET /push/ws HTTP/1.1" 101 247 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0"
10.0.0.76 - - [13/Jun/2024:16:40:09 +0200] "GET /apps/sip_trip_phone/ HTTP/1.1" 200 15252 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0"
10.0.0.76 - - [13/Jun/2024:16:40:10 +0200] "POST /apps/notify_push/pre_auth HTTP/1.1" 200 852 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0"
10.0.0.76 - - [13/Jun/2024:16:40:10 +0200] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 965 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0"
10.0.0.76 - - [13/Jun/2024:16:40:10 +0200] "GET /ocs/v2.php/search/providers?from=%2Fapps%2Fsip_trip_phone%2F HTTP/1.1" 200 1501 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0"
10.0.0.76 - - [13/Jun/2024:16:40:10 +0200] "GET /apps/sip_trip_phone/user/getappdirectory/%3C?php%20p($userId);%20?%3E HTTP/1.1" 200 835 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0"
10.0.0.76 - - [13/Jun/2024:16:40:10 +0200] "POST /contactsmenu/contacts HTTP/1.1" 200 3349 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0"
10.0.0.76 - - [13/Jun/2024:16:40:10 +0200] "GET /apps/sip_trip_phone/user/getsettings/%3C?php%20p($userId);%20?%3E HTTP/1.1" 200 1015 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0"

DoubleBastionAdmin

2024-06-13 14:49

administrator   ~0000064

The Apache error log is more important than the access log. Also, what do you see in your Nextcloud log when opening SIP Trip Phone ?

If your Asterisk server is located in your local LAN and behind a router with NAT, things get a bit complicated. I understand that you have a local Ubuntu server on which you have installed from scratch both Nextcloud and Asterisk.
In principle, you should open on your Ubuntu server ports 8088 and 8089 (ufw allow 8088 and ufw allow 8089) and be able to forward ports 8088 and 8089 from your router to your Ubuntu server. Then, when you run:
  netstat -tlpn
you should see Asterisk listening on both ports 8088 and 8089.

And in your Apache configuration you should have these two lines:

             ProxyPass http://0.0.0.0:8088/ws/
             ProxyPassReverse http://0.0.0.0:8088/ws/

as explained at https://www.doublebastion.com/apache-configuration-for-nextcloud/

DoubleBastionAdmin

2024-06-13 15:17

administrator   ~0000065

To debug the first error related to the 'oc_cards' table: if you use phpMyAdmin to access the tables of your Nextcloud installation, please look at your 'oc_cards' table and click on any BLOB from the 'carddata' column, on any row where the 'uid' column looks like this: "5973f254-c28e-43d1-8a1e-7c6f067dc352". When you click on the BLOB, you will be prompted to save a bin file to your computer. After you save it, open it with a text editor and post here the content of the vcard, after you have changed the sensitive information (the name of the contact and his phone number(s)). The content of the vcard should look similar to this:

BEGIN:VCARD
VERSION:4.0
PRODID:-//Nextcloud Contacts v6.0.0
UID:54c095be-bdc6-4ce2-a031-dfaa928b38c2
FN:Harold Wienecken
ADR;TYPE=HOME:;;;;;;
EMAIL;TYPE=HOME:
TEL;TYPE=WORK,VOICE:+15057532504
TITLE:Marketing Specialist
TEL;TYPE=CELL:+15053820528
REV;VALUE=DATE-AND-OR-TIME:20240509T146002Z
END:VCARD

pmarini

2024-06-13 19:51

reporter   ~0000066

I have the following architecture

Asterisk is installed in a system called 'pbx' with private ip 10.0.0.10,
Nextcloud is installed in a system called 'nc' with private ip 10.0.0.20. It is behind a reverse proxy where TLS is terminated.

From nc:

# nc -zv pbx 8089
Connection to pbx (10.0.0.10) 8089 port [tcp/*] succeeded!
# nc -zv pbx 8088
Connection to pbx (10.0.0.10) 8088 port [tcp/omniorb] succeeded!

In apache2 virtual host:

             ProxyPass http://10.0.0.10:8088/ws/
             ProxyPassReverse http://10.0.0.10:8088/ws/

Notify Push is also installed and configured in the system with its ProxyPass and ProxyPassReverse directives

No errors are shown in the Apache error nor in the Nextcloud log file even with loglevel=0.

In asterisk

 Endpoint: 602 Unavailable 0 of inf
     InAuth: auth602/602
        Aor: 602 250
  Transport: transport-wss wss 0 0 0.0.0.0:1078
   Identify: 602/602
        Match: my.public.ip.address/32

 Endpoint: Ln+34******** Not in use 0 of inf
    OutAuth: localphone1/219****
        Aor: localphone1 500
      Contact: localphone1/sip:219****@localphone.com 01ddf9a4e3 NonQual nan
  Transport: transport-udp udp 0 0 0.0.0.0:1078
   Identify: localphone1/Ln+34********
        Match: 94.75.247.45/32
        Match: 95.211.119.240/32

Asterisk start log

[Jun 13 19:49:54] Asterisk 20.8.1 built by root @ pbx on a x86_64 running Linux on 2024-05-31 06:29:30 UTC
[Jun 13 19:49:54] NOTICE[847] loader.c: 337 modules will be loaded.
[Jun 13 19:49:54] NOTICE[847] cdr.c: CDR simple logging enabled.
[Jun 13 19:49:54] NOTICE[847] indications.c: Default country for indication tones: us
[Jun 13 19:49:54] NOTICE[847] indications.c: Setting default indication country to 'us'
[Jun 13 19:49:54] WARNING[847] config.c: parse error: No category context for line 310 of /etc/asterisk/geolocation.conf
[Jun 13 19:49:54] ERROR[847] res_sorcery_config.c: Contents of config file 'geolocation.conf' are invalid and cannot be parsed
[Jun 13 19:49:54] WARNING[847] config.c: parse error: No category context for line 310 of /etc/asterisk/geolocation.conf
[Jun 13 19:49:54] ERROR[847] res_sorcery_config.c: Contents of config file 'geolocation.conf' are invalid and cannot be parsed
[Jun 13 19:49:55] NOTICE[847] res_smdi.c: No SMDI interfaces are available to listen on, not starting SMDI listener.
[Jun 13 19:49:55] NOTICE[847] confbridge/conf_config_parser.c: Adding default_menu menu to app_confbridge
[Jun 13 19:49:55] NOTICE[847] cel_custom.c: No mappings found in cel_custom.conf. Not logging CEL to custom CSVs.
[Jun 13 19:49:55] WARNING[847] loader.c: Module 'res_adsi' has been loaded but may be removed in a future release.
[Jun 13 19:49:55] WARNING[847] loader.c: Module 'app_adsiprog' has been loaded but may be removed in a future release.
[Jun 13 19:49:55] WARNING[847] loader.c: Module 'app_getcpeid' has been loaded but may be removed in a future release.

DoubleBastionAdmin

2024-06-14 07:03

administrator   ~0000067

Last edited: 2024-11-06 13:54

Since you have "Endpoint: 602 Unavailable" it's clear that SIP Trip Phone cannot register to Asterisk.

Our guide describes in detail the general case where you rent a VPS with a public IP, you have the web server, Nextcloud and Asterisk on the same machine, you don't terminate TLS on a different machine and you don't forward any ports. The setups that you can have with Apache/Nginx, Nextcloud and Asterisk are almost infinite. The guide doesn't pretend to cover all possible scenarios. We took the setup that we considered ideal and we described that setup. We obtained a robust system that has been functioning well for us for years. Since you have a specific and very different setup, with a local network containing a few servers behind NAT, things get complicated because of the TLS termination and port forwarding. Asterisk is very peculiar when it comes to TLS. Even the Let's Encrypt certificates have to be copied from their default location ("/etc/letsencrypt/live/cloud.example.com/cert.pem" and "/etc/letsencrypt/live/cloud.example.com/privkey.pem") to "/etc/asterisk/keys", and specify their new location in "/etc/asterisk/http.conf", as explained in the guide. Otherwise, Asterisk refuses to use them. (This is in the classic setup, without TLS termination.)

You will have to experiment with different settings in Asterisk and Apache and see what works in your setup. In principle, on the machine with Asterisk you will have to open the custom Asterisk port (5827 in our guide), ports from 10000 to 20000 over UDP, port 8088 and port 8089. Then I would recommend looking carefully at the Asterisk settings that contain ports and IPs. For example, in "/etc/asterisk/http.conf" you should have:

   enabled=yes

   bindaddr=123.123.123.123

   bindport=8088

   tlsenable=yes
   tlsbindaddr=123.123.123.123:8089

   tlscertfile=/etc/asterisk/keys/cert.pem
   tlsprivatekey=/etc/asterisk/keys/privkey.pem

where 123.123.123.123 is the public IP of your network. Yet, you will have to forward port 8089 and the port range from 10000 to 20000 (only UDP) from your router to your Asterisk machine's local IP, on the same internal ports. If your local IPs are assigned through DHCP, you will have to make sure you have 'IP address reservation', so that each machine's MAC address is bound to a specific local IP, so that the local IPs stay always the same.

pmarini

2024-06-14 10:56

reporter   ~0000068

Hello,

Ok thank you very much for your help. I'll try to find the time to try the guide out in a system fulfilling the requirements you describe!

Regards

DoubleBastionAdmin

2024-06-14 13:59

administrator   ~0000069

Last edited: 2024-06-14 14:02

If you want to try Nextcloud + Asterisk + SIP Trip Phone on a VPS, probably the best VPS hosting at the lowest prices is offered by linode.com and vultr.com. For $5 / month, you can have a VPS with 1GB of RAM, capable enough to run Nextcloud + Asterisk + SIP Trip Phone. If you want to host other applications, like WordPress websites, a mail server, etc., it's recommended to rent a 2GB of RAM VPS, which costs $10 / month ("1 vCPU 2 GB" plan: https://www.vultr.com/pricing/ ) or $12 / month ("Linode 2 GB" plan: https://www.linode.com/pricing/ ). Both Linode and Vultr have data centers in Spain. We are not affiliated with Linode or Vultr or with any other hosting provider.

Also, as mentioned in our guide, we don't recommend using Apache at all. Nginx was specifically built to surpass Apache and it's by far better, not only in terms of RAM usage and high HTTP requests throughput, but in many other respects. Also, since Canonical tried to force Ubuntu users a while ago to browse through Amazon products while using the main search function of the operating system, in order to earn affiliate income, and also tried to minimize user control over various desktop elements, to push their 'Ubuntu mobile' agenda, many users lost their trust in Ubuntu (regarding both the desktop and server version), and for good reason. Many users realized that a truly community-driven operating system, like Debian, is much better than a system that is driven by the corporate interests of a company like Canonical Ltd. This is why we recommend in our guide to use Debian + Nginx + MariaDB + PHP as the foundation for all web applications. (The LEMP stack and not the LAMP stack.)

I hope my previous post wasn't wrongly understood. The setup that you probably use in your business, with the local network with multiple servers behind NAT is a good idea, because it brings more control over your server-side computing. Nextcloud + SIP Trip Phone + Asterisk can work in this setup, but you will have to test to see which settings work in your specific case. In fact, our overall goal was to describe in detail first how to insall Nextcloud + SIP Trip Phone + Asterisk and all the other applications, in the simplest setup possible, on a rented low-cost VPS (and we already did that in our current guide), then to describe how to install the same applications on a local server cluster, behind NAT, similar to your setup, to allow the users who can afford the initial investment in hardware to have the maximum control possible over their 'cloud' computing. However, we haven't tested this second scenario and haven't published the second guide yet. It will require first buying the hardware, then testing everything, then writing the detailed instructions, like we did for the first scenario.

Issue History

Date Modified Username Field Change
2024-06-13 13:56 pmarini New Issue
2024-06-13 13:56 pmarini File Added: ksnip_20240613-155348.png
2024-06-13 14:02 pmarini Note Added: 0000059
2024-06-13 14:27 DoubleBastionAdmin Note Added: 0000060
2024-06-13 14:33 pmarini Note Added: 0000061
2024-06-13 14:35 DoubleBastionAdmin Note Added: 0000062
2024-06-13 14:42 pmarini Note Added: 0000063
2024-06-13 14:49 DoubleBastionAdmin Note Added: 0000064
2024-06-13 15:17 DoubleBastionAdmin Note Added: 0000065
2024-06-13 15:18 DoubleBastionAdmin Note Edited: 0000060
2024-06-13 19:51 pmarini Note Added: 0000066
2024-06-14 07:03 DoubleBastionAdmin Note Added: 0000067
2024-06-14 07:28 DoubleBastionAdmin Note Edited: 0000067
2024-06-14 10:56 pmarini Note Added: 0000068
2024-06-14 13:59 DoubleBastionAdmin Note Added: 0000069
2024-06-14 14:02 DoubleBastionAdmin Note Edited: 0000069
2024-07-04 07:26 DoubleBastionAdmin Assigned To => DoubleBastionAdmin
2024-07-04 07:26 DoubleBastionAdmin Status new => closed
2024-07-04 07:26 DoubleBastionAdmin Resolution open => suspended
2024-07-04 07:35 DoubleBastionAdmin Status closed => acknowledged
2024-11-06 13:54 DoubleBastionAdmin Note Edited: 0000067