Help, how to get device to register as chan_sip on non standard port while pjsip is also active, works for softphone but both ATA try to use PJSIP despite being configured to use chan_sip port

Help, how to get device to register as chan_sip on non standard port while pjsip is also active, works for softphone but both ATA try to use PJSIP despite being configured to use chan_sip port

I tried searching, but came up empty, part of the problem is not being sure of what search terms I should be using, I seemed to get the most hits with “chan_sip pjsip port” but did not return anything relevant.

So I have been using gvsip for a while now, and it has been working great! However I am wanting to try chan_sip instead of pjsip for my extensions, that way the only thing using pjsip will be the google voice trunk.

On my Softphone CSipSimple, I was able to create a basic account with username and password and direct it to my asterisk IPaddress:port using the chan_sip port of 5160: 192.168.5.240:5160

This allows it to register as CHAN_SIP on the softphone, and the softphone is able to make and receive calls.

If I do the same thing with either of my two ATA devices (HT802 and PAP2T) by making sure their port is set to 5160 instead of 5060, and create the extension as chan_sip in FreePBX, then they will NOT register. If I pickup and try to place a call, I can see in the asterisk CLI that they are trying to be forced to using PJsip instead of chan_sip despite being configured to the correct port for chan_sip:

I found a way to get the HT802 and PAP2T to register and work, although I think I just found a round about back assward way of making them work that is probably not even the intended way of using them.
So if I create a PJSIP extension for HT802 and PAP2T , BUT have those two devices configured to use the chan_sip port, then they will register and function, this is the only way I have managed to get those two ATA devices to work. I am thinking I must be doing something wrong, but I am not so sure because the softphone CSipSimple seems to be working correctly unlike the HT802 and PAP2T

here is a log of me trying to place a call from extension 5001 (HT802 chan_sip port 5160)

<--- Received SIP request (1121 bytes) from UDP:192.168.5.154:5160 --->
INVITE sip:13604276226@192.168.5.240 SIP/2.0
Via: SIP/2.0/UDP 192.168.5.154:5160;branch=z9hG4bK506859590;rport
From: "5001" <sip:5001@192.168.5.240>;tag=732649100
To: <sip:13604276226@192.168.5.240>
Call-ID: 479303005-5160-5@BJC.BGI.B.BFE
CSeq: 30 INVITE
Contact: "5001" <sip:5001@192.168.5.154:5160>
Max-Forwards: 70
User-Agent: Grandstream HT802 1.0.3.2
Privacy: none
P-Preferred-Identity: "5001" <sip:5001@192.168.5.240>
Supported: replaces, path, timer, eventlist
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE
Content-Type: application/sdp
Accept: application/sdp, application/dtmf-relay
Content-Length:   454

v=0
o=5001 8000 8000 IN IP4 192.168.5.154
s=SIP Call
c=IN IP4 192.168.5.154
t=0 0
m=audio 5004 RTP/AVP 0 123 8 4 18 2 97 101
a=sendrecv
a=rtpmap:0 PCMU/8000
a=ptime:20
a=rtpmap:123 opus/48000/2
a=fmtp:123 maxplaybackrate=16000
a=rtpmap:8 PCMA/8000
a=rtpmap:4 G723/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:2 G726-32/8000
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=20
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16,32-36,54

[2018-07-29 11:07:26] ERROR[6877]: res_pjsip.c:3438 ast_sip_set_tpselector_from_transport_name: Unable to retrieve PJSIP transport 'udp,tcp,ws,wss'
<--- Transmitting SIP response (348 bytes) to UDP:192.168.5.154:5160 --->
SIP/2.0 500 Internal Server Error
Via: SIP/2.0/UDP 192.168.5.154:5160;rport=5160;received=192.168.5.154;branch=z9hG4bK506859590
Call-ID: 479303005-5160-5@BJC.BGI.B.BFE
From: "5001" <sip:5001@192.168.5.240>;tag=732649100
To: <sip:13604276226@192.168.5.240>;tag=z9hG4bK506859590
CSeq: 30 INVITE
Server: FPBX-14.0.3.6(15)
Content-Length:  0


<--- Received SIP request (297 bytes) from UDP:192.168.5.154:5160 --->
ACK sip:13604276226@192.168.5.240 SIP/2.0
Via: SIP/2.0/UDP 192.168.5.154:5160;branch=z9hG4bK506859590;rport
From: "5001" <sip:5001@192.168.5.240>;tag=732649100
To: <sip:13604276226@192.168.5.240>;tag=z9hG4bK506859590
Call-ID: 479303005-5160-5@BJC.BGI.B.BFE
CSeq: 30 ACK
Content-Length: 0


<--- Received SIP request (553 bytes) from UDP:192.168.5.154:5160 --->
REGISTER sip:192.168.5.240 SIP/2.0
Via: SIP/2.0/UDP 192.168.5.154:5160;branch=z9hG4bK621769056;rport
From: "5001" <sip:5001@192.168.5.240>;tag=1413644956
To: <sip:5001@192.168.5.240>
Call-ID: 49576363-5160-2@BJC.BGI.B.BFE
CSeq: 2001 REGISTER
Contact: <sip:5001@192.168.5.154:5160>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-1000-8000-000B82A69986>"
Max-Forwards: 70
User-Agent: Grandstream HT802 1.0.3.2
Supported: path
Expires: 3600
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE
Content-Length: 0


<--- Transmitting SIP response (333 bytes) to UDP:192.168.5.154:5160 --->
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 192.168.5.154:5160;rport=5160;received=192.168.5.154;branch=z9hG4bK621769056
Call-ID: 49576363-5160-2@BJC.BGI.B.BFE
From: "5001" <sip:5001@192.168.5.240>;tag=1413644956
To: <sip:5001@192.168.5.240>;tag=z9hG4bK621769056
CSeq: 2001 REGISTER
Server: FPBX-14.0.3.6(15)
Content-Length:  0

notice these two lines:

Unable to retrieve PJSIP transport ‘udp,tcp,ws,wss’ (it should be trying chan_sip not pjsip I think)

SIP/2.0 403 Forbidden (and then 403 forbidden, although i will register just fine if i disable pjsip or make the extension pjsip but use the chan_sip port)

Almost forgot, if I disable PJSIP on the system, then the two ATA will register as chan_sip like they should! but obviously that makes google voice stop working.

EDIT: Also if I have not provided enough info, please let me know what else you need me to do, test, or provide and I will get on it ASAP.

I might have this figured out after reading here: https://www.ukvoipforums.com/viewtopic.php?t=940

I have my fingers crossed and am testing now.

EDIT: so in addtion to setting the port number under setting -> asterisk sip settings / pjsip settings

you also can set the port for the extension under applications -> extensions, edit an extension, click advanced tab, and the port is set there as well, however this was set correctly.

Sounds like a FreePBX (https://community.freepbx.org/), not an Asterisk issue.

it very well could be, the softphone that I THOUGHT was working properly(extension 5005), and that I configured to use 5160 is actually using 5060:

gvsip*CLI> sip show peers
Name/username             Host                                    Dyn Forcerport Comedia    ACL Port     Status      Description                      
5001                      (Unspecified)                            D  No         No          A  0        UNKNOWN                                      
5005/5005                 192.168.5.153                            D  No         No          A  5060     OK (482 ms)                                  
2 sip peers [Monitored: 1 online, 1 offline Unmonitored: 0 online, 0 offline]

[2018-07-29 12:21:55] NOTICE[782]: chan_sip.c:28679 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 5005

There’s two different ports involved.

There is the port that chan_sip listens on, receives traffic on, and sends traffic from.
There is the port that the device listens on, receives traffic on, and sends traffic from.

The port in “sip show peers” is showing the port that the device is listening on.

The device itself has to be configured in some manner to connect to chan_sip on the correct port. Asterisk can’t tell it what to use.

In the softphone CSipSimple, you specify the port as part of the connection string:

192.168.5.240:5160

but it still seems to be using 5060, but now that you mention that, I am thinking I should try a different softphone, incase CSipSimple is being goofy, will report back.

It’s ultimately up to the endpoint, so it may require configuring it in some different way or something.

1 Like

just tried Zoiper which also successfully connects as chan_sip while PJSIP is active, it shows using port 54875, so it seems the port listed in sip show peers, does not matter as much as the port used to initially connect.


gvsip*CLI> sip show peers
Name/username             Host                                    Dyn Forcerport Comedia    ACL Port     Status      Description                      
5001                      (Unspecified)                            D  No         No          A  0        UNKNOWN                                      
5005/5005                 192.168.5.153                            D  No         No          A  54875    OK (12 ms)

I have configured both the PAP2T and HT802 to use 5160 which is the chan_sip port, but unless I create the extensions for those devices as PJsip they will not register.

jcolp, what would you recommend testing/checking to further debug why this happens? There really are not many configuration options in these ATA devices, they are pretty simple.

Every device is different including configuration. There’s nothing really I can add.

As I stated the port in “sip show peers” is the port the endpoint is using to receive SIP traffic. It doesn’t matter what port is used, as long as Asterisk can send to it.

1 Like

I got one idea, and that is to try setting the devices to use port 5060 (the original standard SIP port) instead of 5160, but then use some port forwarding maybe int he Asterisk machine IPtables, to change that port from 5060 to 5160.

I am happy that I was able to figure out that configuring them in Freepbx as PJsip extensions but having them connect on the chan_sip port, allows them to register and function, but it seems really odd to me. I thought maybe I had found a bug, but after your feedback I am thinking maybe not and these ATA devices just dont like it when PJSIP is thrown into the mix, and I am probably lucky that I got them to work at all.

I most likely wont be posting anymore, unless somebody asks me for more info, because I am at a loss as well.

I will just continue to use the HT802 and PAP2T as pjsip extensions on the chan_sip port for now.

Just wanted to add one last thing to this.

One user (markosjal) in my thread was reporting similar problems:

I went into Settings -> Asterisk SIP settings, and disabled UDP for PJsip, I then configured chan_sip to use 5060 instead of of 5160, next I logged into the configuration pages for my ATA devices and changed them from 5160 to 5060, and finally I delete the PJsip extensions and created chan_sip extensions.

Now the ATA are registering as chan_sip without a problem, and it seems google voice is still connected without a problem as well, so maybe google voice only needs the TLS connection on 5061?

Yes, I believe Google Voice does only need TLS.

1 Like

Hello, I solved specified in Primary SIP Server: IPX.Y.Z.Z:5160 and in Local SIP Port: 5060.
Now HT802 report registered It sames to work fine.
Piero

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