3cx > FreePBX interop - Server Internal Error

Status
Not open for further replies.

ewallig

Customer
Joined
Jan 16, 2020
Messages
13
Reaction score
0
Hi, I have a 3cx Pro on-premise install which is working great. As part of our overall build, I was tasked to provide control from our 3cx connected phones (Snom D785) to our legacy door access control system. After trying a couple of things I built out the following solution:
  • Rasberry Pi running RasPBX (FreePBX).
  • SIP trunk between 3cx and RasPBX.
  • GPIO package on Pi.
    • Snom phone user dials a remote extension which is trunked to the RasPBX.
    • Extension (on the Pi) has custom instructions which invokes a script that changes GPIO state.
    • GPIO pins are connected to input feeds on the access controller which triggers door release.
OK, this all works - relay clicks and door striker operates but I get a "Server Internal Error" message on the Snom's display screen for the extension dialed. The message goes away after 5-7 seconds but it generates questions from the staff who have to open the door using this method.

So, I'm looking for insight on why this error message occurs and is there a way to send a different message (ex. "door command sent", etc.). Thanks in advance...
 
Are you aware you can convert FreePBX install's to 3CX easily: https://www.3cx.com/docs/free-pbx-converter/

You can even go as far (although its not something I like the idea of) running 3CX on the Rasperry Pi device you are running FreePBX on already: https://www.3cx.com/docs/installing-pbx-raspberry-pi/

I know there is a bigger picture here in that you have it mostly working bar the door entry part however going forward it might be a better option rather than attempting interop as you never know when it might break.
 
Hi, I have a 3cx Pro on-premise install which is working great. As part of our overall build, I was tasked to provide control from our 3cx connected phones (Snom D785) to our legacy door access control system. After trying a couple of things I built out the following solution:
  • Rasberry Pi running RasPBX (FreePBX).
  • SIP trunk between 3cx and RasPBX.
  • GPIO package on Pi.
    • Snom phone user dials a remote extension which is trunked to the RasPBX.
    • Extension (on the Pi) has custom instructions which invokes a script that changes GPIO state.
    • GPIO pins are connected to input feeds on the access controller which triggers door release.
OK, this all works - relay clicks and door striker operates but I get a "Server Internal Error" message on the Snom's display screen for the extension dialed. The message goes away after 5-7 seconds but it generates questions from the staff who have to open the door using this method.

So, I'm looking for insight on why this error message occurs and is there a way to send a different message (ex. "door command sent", etc.). Thanks in advance...

You are building something this? Just with a PI?!

https://www.baudisch.com/en/knowledgebase/quick-start-guide-sip-relay-module-maxi/
 
Hi,

Thanks for the reply - the point of using the Pi (with the RasPBX) was to be able to leverage Linux-style scripting and the Pi's GPIO board as an interface between the IP phone system and our legacy "2-wire" access control system. The only real interop that is occurring is the SIP trunk between the 3cx and the RasPBX which as long as 3cx continues to support SIP trunks shouldn't break. You are also correct in that there is more going on "big picture" with this build in terms of having to adapt to other legacy access control components and the flexibility using the *Nix-based Pi gives is necessary for this project.

The only real question I have here is why does the 3cx server return a 503 error and is there any way to provide different info for the end user? Some conditional scripting, etc that would say "for this extension send a different message to the dialing station" or something along those lines. If not, it's not a big deal....the system works - just trying to smooth the rough edges out.

Thanks
 
The only real question I have here is why does the 3cx server return a 503 error and is there any way to provide different info for the end user? Some conditional scripting, etc that would say "for this extension send a different message to the dialing station" or something along those lines.

A trace of this SIP flow would be fine.. Maybe there are some header from the FreePBX that should not be there ;-)

Did you use SIP-Trunk or Bridge to connect the FreePBX? Just asking because Bridges are a bit more friendly when calling "internal" users
 
Using a Bridge - here's a wireshark capture of an operation - the RasPBX is replying "503" even though the operation is successful:

No. Time Source Destination Protocol Length Info
1 0.000000 192.168.52.37 192.168.52.54 SIP 665 Request: REGISTER sip:192.168.52.54 (1 binding) |
2 0.083856 192.168.52.54 192.168.52.37 SIP 467 Status: 407 Proxy Authentication Required |
3 0.084465 192.168.52.37 192.168.52.54 SIP 671 Request: REGISTER sip:192.168.52.54 (1 binding) |
4 0.140493 192.168.52.54 192.168.52.37 SIP 413 Status: 200 OK (1 binding) |
5 2.462670 192.168.52.54 192.168.52.37 SIP/SDP 926 Request: INVITE sip:[email protected]:5160 |
6 2.466297 192.168.52.37 192.168.52.54 SIP 577 Status: 100 Trying |
7 5.000639 Raspberr_18:a5:c9 HewlettP_b1:ae:5c ARP 60 Who has 192.168.52.54? Tell 192.168.52.37
8 5.000650 HewlettP_b1:ae:5c Raspberr_18:a5:c9 ARP 42 192.168.52.54 is at ac:16:2d:b1:ae:5c
9 6.159951 192.168.52.37 192.168.52.54 SIP 564 Status: 503 Service Unavailable |
10 6.160168 192.168.52.54 192.168.52.37 SIP 370 Request: ACK sip:[email protected]:5160 |
11 7.144655 HewlettP_b1:ae:5c Raspberr_18:a5:c9 ARP 42 Who has 192.168.52.37? Tell 192.168.52.54
12 7.144752 Raspberr_18:a5:c9 HewlettP_b1:ae:5c ARP 60 192.168.52.37 is at dc:a6:32:18:a5:c9
13 12.786858 192.168.52.37 192.168.52.54 SIP 586 Request: OPTIONS sip:192.168.52.54 |
14 12.802270 192.168.52.54 192.168.52.37 SIP 614 Status: 200 OK |
 
This does not look successful.
There is no 200-OK for the INVITE. So the call is not accepted by 3CX. The content of the INVITE message could help.
 
This does not look successful.
There is no 200-OK for the INVITE. So the call is not accepted by 3CX. The content of the INVITE message could help.
I believe that is because there is no actual endpoint (phone, etc.) for this extension. The extension fires a shell script which manipulates the state of a GPIO pin. Here is the custom extension syntax:

[custom-exec-lobbydoor]
exten => s,1,System(sudo -uasterisk sh /etc/scripts/lobbydoor.sh)
exten => s,n,Wait(1)
exten => s,n,Congestion
exten => h,1,Hangup

This custom extension is invoked when a user dials the extension on their 3cx-connected phone. 3cx id's that the extension is called via the SIP trunk between 3cx and the Pi (extension resides on the Pi). An inbound rule on the Pi routes the call to the "custom destination" which runs the custom dial plan. Again, this is working; the relay that is connected to the Pi's GPIO clicks and the door striker operates. The only issue I'm having is the error message that the user is seeing on their phone.
 
So a little more info...it's actually the Pi sending the 503 error - maybe this is something that I need to address on the Pi vs. the 3cx server.
 
OK so a little more info - it is indeed the Pi sending the error code. I have been able to manipulate the returned codes using "Asterisk Hangup code causes" and can see the respective SIP responses for the given codes in both the Pi and in the 3cx log:

Pi (time is UTC on the Pi):
17:38:56.822117 IP pbx.3cx.local.sip > 192.168.52.37.5160: SIP: INVITE sip:[email protected]:5160 SIP/2.0
17:38:56.826322 IP 192.168.52.37.5160 > pbx.3cx.local.sip: SIP: SIP/2.0 100 Trying
17:39:00.540330 IP 192.168.52.37.5160 > pbx.3cx.local.sip: SIP: SIP/2.0 603 Declined
17:39:00.540645 IP pbx.3cx.local.sip > 192.168.52.37.5160: SIP: ACK sip:[email protected]:5160 SIP/2.0

3cx activity log:
01/24/2020 12:39:00 PM - Call to T:Line:11002>>10001@[Dev:sip:[email protected]:5160] from L:132.1[Extn:246] failed, cause: Cause: 603 Declined/INVITE from 192.168.52.37:5160
01/24/2020 12:39:00 PM - [CM503003]: Call(C:132): Call to <sip:[email protected]:5160> has failed; Cause: 603 Declined/INVITE from 192.168.52.37:5160

This transaction was based on my setting a value of "16" in the "Hangup" command for my "Custom destination" on the Pi. Other codes generate other SIP responses (404, 480, 486, etc.) though not all of them cross over and you end up with the generic 503 error code.

So, I guess the next question would be - is there any way to program 3cx, when it receives this error code from the IP of the Pi, to send a custom message to the user's phone? I'm guessing this is long shot but figured I would ask.

Thanks again...
 
So, I guess the next question would be - is there any way to program 3cx, when it receives this error code from the IP of the Pi, to send a custom message to the user's phone? I'm guessing this is long shot but figured I would ask.

Thanks again...

I think not. E.g. Yealink phones show some text messages on 4xx messages. But i think they use the own language file and not the status text of the message.
 
Status
Not open for further replies.

Forum statistics

Threads
111,832
Messages
589,284
Members
164,662
Latest member
DejanMDS