News:

On Tuesday September 6th the forum will be down for maintenance from 9:30 PM to 11:59 PM PDT

Main Menu

Trouble with OBi212 as FXO for FreePBX

Started by legotech, November 27, 2018, 09:34:25 AM

Previous topic - Next topic

legotech

I'm a new user for the Obihai products as well as FreePBX.  I have a lot of technical experience, but not a lot with phones & SIP.  I've automated a lot of my home (OpenHAB with lots of various devices) and am looking to upgrade my home phones to add paging, conferencing, etc. 

I've installed FreePBX 14.0.2.10 on a Raspberry Pi to do some initial testing (I'll move over to a Linux VM on my home server if I like how things work).  This will let me test various phones, etc. in an isolated network environment before I roll it out to the whole house.  It's not going to get worked very hard, so the Pi could run it indefinitely, but I probably won't.

As part of this project, we have a land-line phone that I want to integrate (doesn't get used much, just places that we don't want to give our cell # to but might need to reach us once in a great while) using the OBi212 as an FXO gateway (and FXS for an analog phone, but that's working).

I've tried every article and tutorial I can find, and cannot get the FXO to register with FreePBX.  All the tutorials I've found are oriented toward the 110, etc. so I'm wondering if there's something unique about the 212 that's causing me trouble.  Specifically, I've used these resources (plus a few other lesser ones):

http://www.obitalk.com/forum/index.php?topic=1157.0
http://www.obitalk.com/forum/index.php?topic=57.0
https://wiki.freepbx.org/pages/viewpage.action?pageId=4161594

OBi212 us running version 3.2.1 (Build: 5735EX).  I don't have the OBi212 registered with Obitalk, as I prefer not to if possible.

The FXS is using SP1 on the 212 and is registering with FreePBX successfully.  The FXO doesn't, and I get the message "Register Failed: 401 Unauthorized" in the Obi212 GUI for SP2 service status.

Looking in the FreePBX log, I see:


[2018-04-06 16:29:06] NOTICE[5857] res_pjsip/pjsip_distributor.c: Request 'REGISTER' from '<sip:CLTRUNK@192.168.1.30>' failed for '192.168.1.31:5060' (callid: 413716167a1e9cac@192.168.1.31) - Failed to authenticate
[2018-04-06 16:29:06] NOTICE[5857] res_pjsip/pjsip_distributor.c: Request 'REGISTER' from '<sip:CLTRUNK@192.168.1.30>' failed for '192.168.1.31:5060' (callid: 413716167a1e9cac@192.168.1.31) - No matching endpoint found


I've googled these errors, without much luck.

At this point, I've completely started over 4 times, thinking maybe I've just missed a step somewhere, but I don't think so...  I've also deviated from the above instructions by changing ports, and everything else I can think of in an effort to fix this, but I always end up with the same messages.  Anyone have any ideas or suggestions?

Thanks,

Danny

azrobert

The following is the method I use with my OBi110. I don't register to the OBi110. I recently restored Raspbx from a backup and currently not using it with my OBi110/PSTN. I just successfully routing a call from the OBi110 to an extension on the PBX.

Create a Chan_SIP Trunk
General
Trunk Name: OBi212
Outbound CID: <8005551212>

SIP Settings Outgoing:

Trunk Name: OBi212
Peer Details:
type=peer
username=8005551212
host=192.168.1.100
port=5061
canreinvite=no
insecure=invite,port
qualify=yes

Replace 192.168.1.100 with the IP address of the OBi212
5061 = X_UserAgentPort of SP2

OBi212

SP1 = PBX Extension

Service Providers -> ITSP Profile B -> SIP -> ProxyServer: 127.0.0.1
Service Providers -> ITSP Profile B -> SIP -> X_SpoofCallerID: Checked
Voice Services -> SP2 Service -> AuthUserName: OBi212
Voice Services -> SP2 Service -> X_RegisterEnable: unchecked
Voice Services -> SP2 Service -> X_ServProvProfile: B
Voice Services -> SP2 Service -> X_InboundCallRoute: li

Physical Interfaces -> Line Port -> InboundCallRoute:
sp2(100@192.168.1.101:port)

100 = extension number
Replace 192.168.1.101 with IP of Raspbx
I have port set to the Chan_SIP listening port

drgeoff

#2
I use an OBi110 (192.168.1.21) with FreePBX (192.168.1.23).

Peer details on the PBX for the chan-sip trunk
-----------------------
username=OBITRUNK1
secret= redacted
host=dynamic
type=friend
context=from-trunk
qualify=yes
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw&alaw
------------------------

Left the Incoming settings and Register string empty.

Used the above username and secret for the SP2 SIP credentials AuthUserName and Authpassword on the 110.

110 Status shows as registered.

Asterisk Peers line says
OBITRUNK1/OBITRUNK1       192.168.1.21                             D  Yes        Yes            5061     OK (3 ms)

As a test I deliberately changed the 'secret' on the PBX and the log gave the error message

chan_sip.c: Registration from '<sip:OBITRUNK1@192.168.1.23>' failed for '192.168.1.21:5061' - Wrong password

I'm slightly suspicious that your error message has port 5060 even though you, like me, are using SP2.

legotech

Azrobert, I tried your method, and I honestly can't tell if antying works or not.  For a status on SP2, I now have "Registration not required", but trying inbound and outbound calls, nothing works (which could be a problem with those areas as I've been focused on getting the FXO recognized first...

drgeoff, I tried your method and it's the same as the guides I mentioned - 401 error message.   I did have a port changed from testing something else that I put back to default for SP2, but it didn't help but at least the logs from FreePBX show port 5061...

Anyone have any other ideas?  Base on everything I've tried, I'm thinking there's something unique about the 212 that requires something to be set differently somewhere vs the 110.

Thanks,

Danny

azrobert

drjeoff,

Thanks for the post. I never knew how to use "host=dynamic".

I used a softphone to register to the trunk. I was able to call the softphone from an extension after defining an outbound route. I was also able to call an extension from the softphone, but was unable to make an outbound call using another trunk on the PBX. After changing the context to "from-internal", outbound calls started working.

Obviously, I can't send an outbound call from the PBX to the softphone, but I'm confident it would work using an OBi device, since I was able to send an extension number to ring the softphone.

Your method is superior, but an open slot is needed for a trunk definition. A Voice Gateway can be used with my method.

azrobert

Quote from: legotech on November 28, 2018, 05:19:38 PM
Anyone have any other ideas? 

I don't think it's an OBi212 problem. 401 is an unauthorized error.

In FreePBX click Settings -> SIP Settings -> Chan SIP Settings
Bind Port is the port number you need to use.

Click on Chan PJSIP Settings. Make sure the bind port is different than the SIP bind port.

This should be set to the Chan SIP bind port:
Voice Services -> SP2 Service -> ProxyServerPort

Make sure this is set correctly:
Voice Services -> SP2 Service -> X_ServProvProfile: B


drgeoff

I don't take any credit for the method I used above.  It was taken directly from one of the threads on this forum.  Agreed that it requires an SP slot but that should not be a problem for someone with an OBi212 which has 4 SP slots.  One for the analogue phone port, one for the trunk between it and the PBX and up to 2 for GV accounts.  Any other ITSPs would be configured as PBX trunks.  Needa bit of adding prefixes (at the PBX) and removing them (at the Obi) to signal which of LINE, SP1 or SP2 the PBX wants to send a call to.

Today I've been able to try the same method connecting an OBi200 as another trunk to the same FreePBX.  The only configs I made on the OBi200 were:
Service Providers, ITSP Profile B, Proxy Server.  I entered the local IP address of the FreePBX machine.
Voice Services, SP2 Service, X_ServProvProfile.  I selected B.
Voice Services, SP2 Service, AuthUserName.  I entered OBITRUNK2.
Voice Services, SP2 Service, Authpassword.  I entered the same string as used for the secret in the PBX trunk config.

Used the "copy trunk" option in FreePBX.  Changed OBITRUNK1 to OBITRUNK2 in the relevant places.

Shows as registered in the OBi200 Status page and shows as a peer in FreePBX.

legotech

Quote from: azrobert on November 28, 2018, 06:37:37 PM
In FreePBX click Settings -> SIP Settings -> Chan SIP Settings
Bind Port is the port number you need to use.

Click on Chan PJSIP Settings. Make sure the bind port is different than the SIP bind port.

This ended up being the root of the issue.  In FreePBX, the port was 5160, which I didn't expect nor read about anywhere (everything uses 5060, 5061, etc.).  Changed the port settings for ITSP Profile B (used by SP2) to use port 5160 instead of 5061 and all was well.

Thanks,

Danny