FreePBX: Door phone integration

Hello guys,

I am - by no means - an expert on FreePBX. Except for asking once in here, I’ve managed to get a setup working with a SIP trunk, a SIP-GSM gateway and some more stuff. Please bear with me.

New challenge though: I’m trying to integrate a door phone device which interfaces with a proprietary device bus (TwinBus, the device is a Ritto Door Wiser Gateway from Schneider Electric specifically). It comes with an abysmal app but also allows for one SIP endpoint. It seems to run Yate on the device for SIP stuff.

My idea:
Add this thing as a trunk in FreePBX. When it rings, put it in a ring group and have someone pick up (and possibly open the door).

This basically works, but basic is the word to underline here:

1.) The call comes in to DID “s”. Okay. Since the CID is unique (enough, i.e. 9999), I’m using this for now as an identifier for an inbound route.

2.) Audio only works one way. I can hear the caller but not the other way around. Sometimes, it works intermittently though. Very strange. That might be a phone problem though (Grandstream GXV 3380). If I’m interpreting the SIP messages correctly, it only supports PCMU and PCMA. Sometimes (it’s really random, at least for my limited understanding) the phone showed G722 as the working codec and I still heard audio (see below). I have limited the trunk now to alaw and ulaw but that didn’t help. Not much too go on here :frowning:

3.) Video doesn’t work and probably FreePBXs fault (well, more like my configuration of it). When I connect the phone directly to the gateway with the account I’m using on the trunk it works. Internal video calls with FreePBX work too.

What I can see with sngrep is:
Gate sending an invite to FPBX:

v=0
o=- 3791258676 3791258678 IN IP4 172.30.255.8
s=pjmedia
b=AS:352
t=0 0
a=X-nat:0
m=audio 4088 RTP/AVP 0 8 96
c=IN IP4 172.30.255.8
b=TIAS:64000
a=rtcp:4089 IN IP4 172.30.255.8
a=sendrecv
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16
m=video 4090 RTP/AVP 97
c=IN IP4 172.30.255.8
b=TIAS:256000
a=rtcp:4091 IN IP4 172.30.255.8
a=sendrecv
a=rtpmap:97 H264/90000
a=fmtp:97 profile-level-id=42e01e; packetization-mode=1

FPBX sends an invite to my phone containing this:

v=0
o=- 677014478 677014478 IN IP4 172.30.1.9
s=Asterisk
c=IN IP4 172.30.1.9
t=0 0
m=audio 14138 RTP/AVP 8 0 9 111 3 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:9 G722/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

No video here, right?
What is also strange is the additional codecs offered there? Is this because FPBX does a conversion in the middle?

Thanks for any input!

Why did you set this up as a Trunk and not as an extension?

Also, did you enable video support under SIP Settings?

Good question - my understanding is that there is no difference internally. The door device sets up a SIP account with username and password though. So, in order to get FreePBX to register with the device, I used the trunk setup. Is there a way to do this with an extension? And if so, what’s different then?

Regarding video: Yes, video is enabled and works internally between the phones.

When setting up a device with video, I’d first try setting up as an extension rather then a Trunk. With a Trunk you need to specify all settings manually.

Okay then. But as far as I understand it, creating an extension gives me a username/password pair that allows a device to register with FreePBX. With this door device, I do however need FPBX to register with the device. Is there any way to do that with an extension?

That makes no sense what so ever. Why would the PBX need to register to the device that is going to send stuff to the PBX? It’s an endpoint just like any other phone, it needs to connect to the PBX properly. I have yet to see a door device where I have to do what you are saying.

Is that so? The device lets me create a SIP account intended for a SIP phone to connect to it.
There is no way to have it connect to a PBX.

So this is a 1:1 device where it expects a single device to be on the other side and not a PBX. That’s a bit different. So you need a trunk that does outbound registration and you’ll need to add all those video codecs to the trunk AND to any phone that is going to be picking up the call.

I do have the trunk (pjsip) already, the outbound registration also works.

The available codec list only shows audio codecs though. Having read through a bunch of threads here, it seems there are only the general “Asterisk SIP settings” to enable video and specific video codecs.

Video is enabled, all (video) codecs are enabled, video call between my regular phones work.

I’m not sure if I’m interpreting the SIP snippets (see above) correctly: The door device sends INVITEs including video, the INVITE from FPBX to the phone however doesn’t include that.

OK well this is where you’re going to run into a problem. One might consider this a limitation but since there’s not video over the PSTN, the PJSIP trunk codec settings don’t offer up video codecs to be selected. So you can enable them in Asterisk SIP Settings but that doesn’t automatically allow them on a PJSIP endpoints.

You can use the custom_post.conf file for the pjsip endpoints to do

[endpoint](+)
allow=codec

This would add those codecs to the endpoint config and should get you the video codecs in the SDP.

Thank you much for this!

So, just to make sure I’m not missing anything:
Having set up the device as a trunk and an inbound route which has its destination set to extension 10, I would add the following to

pjsip_custom_post.conf

[10](+)
allow=h264

(with H.264 being the video codec supported by the device)

I did that and there is (still) no video in the SDP. What’s the best way to debug this? The “full log” shows a bunch of things but nothing about allowed or rejected codecs. If I use the “pjsip show endpoints” command on the Asterisk console I can’t see e.g. which codecs would be allowed.

No, extensions can have video codecs set on them. The trunk is what you want to do this for. So replace 10 with whatever the trunk endpoint name is.

Oh, well, that was painfully obvious :roll_eyes:
Thank you for bearing with me …

Unfortunately the outcome remains unchanged.
My debug attempts: “pjsip show endpoint door-gw” doesn’t show codecs. I was happy to see “max_video_streams” set to 1 but that doesn’t change with the custom configuration at all.

Is there a way to check the allowed codecs against a running configuration?

Allowed codecs would be under “allow” on show endpoint at the top.

Thanks! :grinning:

So, video codecs are definitely allowed for the endpoint now:

allow                              : (alaw|ulaw|h264|h263|h261|h263p)

Still looks like this from the door “phone” to FPBX:

v=0
o=- 3791703424 3791703427 IN IP4 172.30.255.8
s=pjmedia
b=AS:352
t=0 0
a=X-nat:0
m=audio 4140 RTP/AVP 8 96
c=IN IP4 172.30.255.8
b=TIAS:64000
a=rtcp:4141 IN IP4 172.30.255.8
a=rtpmap:8 PCMA/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16
a=sendrecv
m=video 4142 RTP/AVP 97
c=IN IP4 172.30.255.8
b=TIAS:256000
a=rtcp:4143 IN IP4 172.30.255.8
a=rtpmap:97 H264/90000
a=fmtp:97 profile-level-id=42e01e; packetization-mode=1
a=sendrecv

And then from FPBX to the phone like this:

v=0
o=- 1134391926 1134391926 IN IP4 172.30.1.9
s=Asterisk
c=IN IP4 172.30.1.9
t=0 0
m=audio 16374 RTP/AVP 8 0 9 111 3 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:9 G722/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

I know this is late, but have you tried connecting a single SIP phone to the opener and see what transpires? A tcpdump of that datastream might give you some insight that we don’t have right now.

I did create a dump with Wireshark (phone is now registering with the device directly) from which I’ve pasted the stream of SIP messages from an incoming call from the door phone to my phone (the “9999” device is the door phone).

https://pastebin.com/58nxMQtY

With the direct connection from my phone to the device, the phone prompts if I want to accept incoming video (after having picked up the call).

I’m not sure what the “unsupported media type” message in between tries to tell me (since there is not much more info in there) but I suspect this is related to the second issue (the one way audio which sporadically works for a few seconds)

Hi Oliver, I am not familiar with that device but if this is an experiment for a bigger deployment you might consider 2N devices. Axis aka Axis surveillance cameras bought them a year or so ago and now US based support is available. I have several in place with cameras and they integrate seamlessly with FreePBX as an extension including video if you want to use video phones. I am not affiliated in any way with 2N or Axis other than a user but just wanted to put that out there. PS, Like Axis cams they are not cheap but they work.

Thank your for that. I do already have a 2N device integrated with FPBX (a SIP to mobile network gateway) which is really nice.

Changing the door phone device is not an option though because this is a multi tenant office building which has this proprietary bus system (Twin Bus) for all kinds of building automation stuff and this particular device is the only product from Schneider Electric / Ritto that provides an interface to SIP :expressionless:

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.