[pjsip] TCP transport problem

Benny Prijono bennylp at teluu.com
Wed Aug 19 17:02:45 EDT 2009


On Tue, Aug 18, 2009 at 10:42 AM, Philippe<philippe.leuba at eyepmedia.com> wrote:
> Hi,
>
>
>
> Some servers (or SBC) reject SIP TCP requests (i.e. REGISTER) if they
> contain a different port in the Via and in the Contact.
>
>
>
> By default in pjsip, Contact is filled with listening port, but Via is
> filled with real port of the TCP sending connection.
>
>

Via must always be set to the source address of the request, so we
shouldn't change that. Contact, on the other hand, is filled up by the
application (or PJSUA-LIB), and in fact current PJSUA-LIB fills this
with the same value as the Via sent-by already. I forgot in which
version this was changed like this, but it's quite a long time ago
(must be more than a year I think).

If you're not using PJSUA-LIB then just change your app. :)

>
> We want to have the listener port in the Via and in the Contact headers.
>
>
>
> I have tried to put the port of the listener in the TCP transport internal
> structure at the creation and this work the first time.
>
> But If I destroy the TCP factory and recreate a new one, the TCP transport
> stays in the list of the transport
>
> manager and will be reused for the next sending to the same destination. By
> consequence, the transport keeps the port of the previous listener and this
> is not correct.
>
>

That is the intended behavior. All transports keep a reference counter
of their users (e.g. transactions, registration sessions), and for
ephemeral transport such as TCP (client), it will only be closed after
a certain idle period (PJSIP_TRANSPORT_IDLE_TIME, 10 minutes default),
that is after it's reference counter gets to zero.

What you should also do is to call pjsip_transport_shutdown() for the
particular TCP transport, so that it won't get used for subsequent
request.

>
> TCP transports are only destroyed when we destroy the transport manager and
> our usage of pjsip is that we create and destroy transports at will without
> destroying the endpoint and therefore the transport manager.
>

See above.

>
>
> Usage of transport selector seems to not solve the problem as well because
> it seems that in this case a new TCP transport is created for each sending!
>
>

Looking at the code, you're probably right!

Cheers
 Benny



>
> Do you have a suggestion how to solve this problem?
>
>
>
> We are using a pretty old release of pjsip (0.8) but it seems that no
> significant changes were done in this domain.
>
>
>
> Best regards
>
>
>
> Philippe Leuba
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>




More information about the pjsip mailing list