Asterisk 12 chan_pjsip TCP config problem

Hi,

I’m just getting to grips with Asterisk12.5 and chan_pjsip.

In my setup I have local clients registering with Asterisk via chan_sip on a separate interface, and I have a pjsip trunk to an OpenSIPS server (pjsip.conf config below). This all works fine if I use protocol=udp in the transport settings but gives the following error if I change it to protocol=tcp.

Is there something else I need to setup in order to switch to using tcp transport?

Thanks in advance.

Ian

pjsip.conf

;==============TRANSPORTS

[simpletrans]
type=transport
; tcp fails...
;protocol=tcp
; udp works...
protocol=udp
bind=192.168.1.34

;===============TRUNK

[mytrunk]
type=registration
transport=simpletrans
outbound_auth=mytrunk
server_uri=sip:192.168.1.39
client_uri=sip:GW1@192.168.1.39
retry_interval=60

[mytrunk]
type=auth
auth_type=userpass
password=secret
username=GW1

[mytrunk]
type=aor
contact=sip:192.168.1.39:5060

[mytrunk]
type=endpoint
transport=simpletrans
context=externalIncoming
disallow=all
allow=gsm
allow=ulaw
allow=alaw
outbound_auth=mytrunk
aors=mytrunk


[mytrunk]
type=identify
endpoint=mytrunk
match=192.168.1.39

After a bit more digging I found a solution to my problem…

I fixed it by adding an outbound_proxy=…;transport=tcp entry to the registration config section of pjsip.conf. As in the example below.

[simpletrans]
type=transport
protocol=tcp
bind=192.168.1.34

;===============TRUNK
[mytrunk]
type=registration
transport=simpletrans
outbound_auth=mytrunk
outbound_proxy=sip:192.168.1.39\;transport=tcp
server_uri=sip:192.168.1.39
client_uri=sip:GW1@192.168.1.39
retry_interval=60

...etc.

Using the above I can now register and initiate calls over tcp rather than udp.