Using an OBI device as a PJSIP Trunk?

I am trying to set up an OBI device as a PJSIP trunk. Any good guide? I found multiple ones for SIP and tried but they are not working. Thanks.

Example, assuming OBi110 (OBi212 should be very similar):

Trunk Name: OBI
Authentication: Both
Registration: Receive
Secret: changethis
Match Inbound Authentication: Auth Username
Rewrite Contact: Yes

On the OBi side, ITSP Profile:

ProxyServer: (IP address or domain name of PBX)
ProxyServerPort: 5060 (or whatever you have set Port to Listen On)
RegistrarServer: (IP address or domain name of PBX)
RegistrarServerPort: 5060 (or whatever you have set Port to Listen On)
Turn on X_SpoofCallerID

SPx Service:

AuthUserName: OBI (must match Trunk Name)
AuthPassword: changethis (must match Secret)

You also need to set up X_InboundCallRoute to send some or all calls coming in on the Line port to the SPx in question, and send calls coming in on the SPx to the Line port. Sorry for the vagueness here, I don’t have access to an OBi right now.

Followed your instructions but can’t register the OBI to the FreePBX. Register Failed: 401 Unauthorized (server=xxx.xxx.xxx.xxx:5060; retry in 90s).

That means it has been asked for a password, but doesn’t have one to use.

Confirm that OBi Auth Username matches PBX Trunk Name and OBi Auth Password matches PBX Secret. Some devices have limitations on field width and/or character set; your Trunk Name and Secret should each consist of only letters and digits, no more than 15 characters.
If no luck:

At the Asterisk command prompt type
pjsip set logger on
wait for the OBi to attempt registration, paste the Asterisk log for the attempt at pastebin.com and post the link here.

Also post screenshots of ITSP Profile and SPx in the OBi and PBX trunk settings.

So even though the other side is challenging for auth, it doesn’t need the auth to work?

I read it as Asterisk is challenging for authorisation and the OBI has backed off its registrations because it has no authorisation to provide.

Well Asterisk will send the 401 and the device will either resend the INVITE with the auth digest in it or it will re-transmit the INVITE without the auth digest and be challenged again. At some point the device has a failure retry that will be hit and then it will stop.

So either setup the trunk to auth by IP or setup the Obi right to send credentials.

I just realize that for some reason its not saving the parameters you suggested on the Freepbx trunk , I only have this right now :

Now on the Obi I have the followin :

And the log shows:

<--- Received SIP request (823 bytes) from UDP:xxx.xxx.xxx.xxx:14424 --->
REGISTER sip:freepbx.xxx:5060 SIP/2.0
Call-ID: [email protected]
Content-Length: 0
CSeq: 46794 REGISTER
From: <sip:[email protected]>;tag=SP47fbf802c1f24a091
Max-Forwards: 70
To: <sip:[email protected]>
Via: SIP/2.0/UDP 192.168.1.130:5063;branch=z9hG4bK-f9ff0c07;rport
Authorization: Digest algorithm=MD5,nc=00000001,qop=auth,cnonce="57eadb424dfed232",nonce="1709332613/f6a74671e0b812f923a7cbdd6f908747",opaque="2191339e2fff7417",realm="asterisk",response="0316a426df7e7f8ebe6cf288db2e630a",uri="sip:freepbx.xxx:5060",username="obitalk"
User-Agent: OBIHAI/OBi202-3.2.2.8680
Contact: <sip:[email protected]:5063>;expires=60;+sip.instance="<urn:uuid:00000000-0000-0000-0000-9cadef217ee5>"
Allow: ACK,BYE,CANCEL,INFO,INVITE,NOTIFY,OPTIONS,PRACK,REFER,UPDATE
Supported: replaces


[2024-03-01 22:36:53] NOTICE[20001]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'REGISTER' from '<sip:[email protected]>' failed for 'xxx.xxx.xxx.xxx:14424' (callid: [email protected]) - No matching endpoint found
[2024-03-01 22:36:53] NOTICE[20001]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'REGISTER' from '<sip:[email protected]>' failed for 'xxx.xxx.xxx.xxx:14424' (callid: [email protected]) - Failed to authenticate
<--- Transmitting SIP response (500 bytes) to UDP:xxx.xxx.xxx.xxx:14424 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.1.130:5063;rport=14424;received=xxx.xxx.xxx.xxx;branch=z9hG4bK-f9ff0c07
Call-ID: [email protected]
From: <sip:[email protected]>;tag=SP47fbf802c1f24a091
To: <sip:[email protected]>;tag=z9hG4bK-f9ff0c07
CSeq: 46794 REGISTER
WWW-Authenticate: Digest realm="asterisk",nonce="1709332613/f6a74671e0b812f923a7cbdd6f908747",opaque="3e1e065b0071ebc6",algorithm=MD5,qop="auth"
Server: FPBX-16.0.40.7(18.16.0)
Content-Length:  0

Thanks in advance

Grillo

Something went very wrong setting up the trunk on the FreePBX side – it somehow became a chan_sip trunk! On the General tab, delete the trunk and start over, creating the obitalk trunk again.

When you choose Add Trunk, select Add SIP (chan_pjsip) Trunk. If that option doesn’t appear or doesn’t work, possibly FreePBX wasn’t built or installed correctly. If you didn’t install from the Distro ISO, explain how you obtained and set up FreePBX.

My mistake that was when I was trying to do it as SIP , I switched out to PJSIP this is the log:

[2024-03-02 18:19:08] NOTICE[19591]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'SUBSCRIBE' from '<sip:[email protected]>' failed for '68.150.5.XXX:14424' (callid: [email protected]) - No matching endpoint found
[2024-03-02 18:19:15] ERROR[19591]: res_pjsip_header_funcs.c:717 remove_header: No headers had been previously added to this session.
[2024-03-02 18:19:18] NOTICE[19591]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'SUBSCRIBE' from '<sip:[email protected]>' failed for '68.150.5.XXX:14424' (callid: [email protected]) - No matching endpoint found
[2024-03-02 18:19:28] NOTICE[19591]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'SUBSCRIBE' from '<sip:[email protected]>' failed for '68.150.5.XXX:14424' (callid: [email protected]) - No matching endpoint found

But in the Obi the SP4 Status is Registered (server=XXX.XXX.XXX:5060; expire in 38s)

<--- Received SIP request (434 bytes) from UDP:XX.XXX.X.XXX:14424 --->
SUBSCRIBE sip:[email protected]:5060 SIP/2.0
Call-ID: [email protected]
Content-Length: 0
CSeq: 8001 SUBSCRIBE
From: <sip:[email protected]>;tag=SP45ef95f0cefdec9de
Max-Forwards: 70
To: <sip:[email protected]>
Via: SIP/2.0/UDP 192.168.1.130:5063;branch=z9hG4bK-59fb9d84;rport
User-Agent: OBIHAI/OBi202-3.2.2.8680
Event: message-summary
Contact: <sip:[email protected]:5063>
Expires: 3600


[2024-03-02 18:52:35] NOTICE[19591]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'SUBSCRIBE' from '<sip:[email protected]>' failed for 'XX.XXX.X.XXX:14424' (callid: [email protected]) - No matching endpoint found
<--- Transmitting SIP response (500 bytes) to UDP:XX.XXX.X.XXX:14424 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.1.130:5063;rport=14424;received=XX.XXX.X.XXX;branch=z9hG4bK-59fb9d84
Call-ID: [email protected]
From: <sip:[email protected]>;tag=SP45ef95f0cefdec9de
To: <sip:[email protected]>;tag=z9hG4bK-59fb9d84
CSeq: 8001 SUBSCRIBE
WWW-Authenticate: Digest realm="asterisk",nonce="1709405555/04484914159268c7f7b28dfb9e397432",opaque="3c54db296fb0b9dd",algorithm=MD5,qop="auth"
Server: FPBX-16.0.40.7(18.16.0)
Content-Length:  0


<--- Received SIP request (714 bytes) from UDP:XX.XXX.X.XXX:14424 --->
SUBSCRIBE sip:[email protected]:5060 SIP/2.0
Call-ID: [email protected]
Content-Length: 0
CSeq: 8002 SUBSCRIBE
From: <sip:[email protected]>;tag=SP45ef95f0cefdec9de
Max-Forwards: 70
To: <sip:[email protected]>
Via: SIP/2.0/UDP 192.168.1.130:5063;branch=z9hG4bK-5def8975;rport
Authorization: Digest algorithm=MD5,nc=00000001,qop=auth,cnonce="abffc7d17ffdd827",nonce="1709405555/04484914159268c7f7b28dfb9e397432",opaque="3c54db296fb0b9dd",realm="asterisk",response="3e38886e08395b84e87863cdfee7eed1",uri="sip:[email protected]:5060",username="obitalk"
User-Agent: OBIHAI/OBi202-3.2.2.8680
Event: message-summary
Contact: <sip:[email protected]:5063>
Expires: 3600


<--- Transmitting SIP response (351 bytes) to UDP:XX.XXX.X.XXX:14424 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.1.130:5063;rport=14424;received=XX.XXX.X.XXX;branch=z9hG4bK-5def8975
Call-ID: [email protected]
From: <sip:[email protected]>;tag=SP45ef95f0cefdec9de
To: <sip:[email protected]>;tag=z9hG4bK-5def8975
CSeq: 8002 SUBSCRIBE
Server: FPBX-16.0.40.7(18.16.0)
Content-Length:  0


Turn off X_MWISubscribe, or ignore the error; it shouldn’t hurt anything.

What goes wrong on attempted incoming call? On outgoing?

Everything is working fine my only question is how can I route the calls from freepbx to use SP1, SP2, FXO etc ?

First, decide how to determine the desired routing (which country or area you’re calling, which extension is making the call, a prefix dialed by the user, etc.). Then, set up the Outbound Route to prepend a digit to the number sent on the trunk. At the OBi inbound call route, use that digit to select the SPx or line, stripping it off before sending the number out.

1 Like

Thanks pal you are a the best !!!

I’ve been using Obi with freepbx pjsip for years. Works great. Standard setup guides for Obi should suffice. I don’t think there is anything freepbx/asterisk/pjsip specific that needs to be done.

1 Like

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