[help] How to using different tcp port to register server.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 9, 2009 at 12:28 PM, DaCheng <ato_wu at yahoo.com.tw> wrote:

> Hi Benny:
>
> Thanks your reply.
> I have been tried your solution before.
> unfortunately, the server does not obey our "hopefully".
> Just the INVITE method brings the extern param ";x-my-acc-id=1", and the
> others method are not.
>

What other methods that you saw?


So I wants use the incoming port to decide which account to use.
> It can easy work in UDP transport, because I can create two UDP transport,
> then use the  the  transport id to bind the account.
> Ex:
> cfg_1.port = 5060;
> pjsua_transport_create(PJSIP_TRANSPORT_UDP, &cfg_1, tp_id_1)
> acc_cfg_1.transport_id = tp_id_1;
> pjsua_acc_add(&acc_cfg_1, PJ_TRUE, &acc_id_1);
>
> cfg_2.port = 5062;
> pjsua_transport_create(PJSIP_TRANSPORT_UDP, &cfg_2, tp_id_2)
> acc_cfg_2.transport_id = tp_id_2;
> pjsua_acc_add(&acc_cfg_2, PJ_TRUE, &acc_id_2);
>
> But, the above way can not use in the TCP transport, event I enable
> cfg.allow_contact_rewrite = PJ_TRUE.
> As far I understand, the pjsua_transport_create( ) for PJSIP_TRANSPORT_TCP
> just can
> only call it once.
> If call it twice, the system will return PJSIP_ETYPEEXISTS.
>

Yes. At the moment we don't allow more than one SIP TCP listeners to be
instantiated, although this looks to be easy to fix (just comment out the
check in pjsip_tpmgr_register_tpfactory()). But mind you this would
introduce another problem, see below.



> Besides, it just create a port to listen, not create port to connect to SIP
> server.
>
> I trace the transport, the tp_mgr is using remote ip and port as the hash
> key.
> If the account 1 has already connect to server, and the account2 will found
> the
> transport in the tp_mgr. Because of the destination (remote ip and port) is
> the same.
>
>
True, unless if the account is locked to a specific listener, which would
cause a new outgoing TCP connection to be created for *every* outgoing
requests.But alas, that's the problem!



> I have no idea to modify the code to reach my goal anymore.
> Do you have any idea how to reach it?
>
>
I'd say you need to rethink about the whole problem/solution. Why do you
need to use two *exactly identical* accounts in the first place?

In pjsip, we tried to hide the SIP transport layer as much as possible, so
that you won't see IP/socket address in any of the SIP API (instead the SIP
API works with SIP URIs), which is good in most cases, but the drawback is
we have less flexibility in the transport arrangements.

For the TCP case, it's a bit hard to fix, or at least I haven't had any
ideas on how to make it work. So until then, I guess we'll just have to
accept this as a limitation.

Cheers
 Benny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20091210/c73dc5c2/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux