pjproject icon indicating copy to clipboard operation
pjproject copied to clipboard

PJSUA2 doesn't work over TCP

Open niknaz87 opened this issue 4 years ago • 2 comments

Describe the bug Trying to make pjsua2_demo work over TCP connection. Code:

    EpConfig ep_cfg;
    ep.libInit( ep_cfg );

    // Create transport
    TransportConfig tcfg;
    tcfg.port = 5060;
    ep.transportCreate(PJSIP_TRANSPORT_UDP, tcfg);

To Reproduce Make changes to pjsua2_demo.c to work over TCP. Code: ep.transportCreate(PJSIP_TRANSPORT_UDP, tcfg);

Try to register with the modified code.

Expected behavior Registration should be successful over TCP

Logs/Screenshots

18:43:19.444            pjsua_acc.c  Adding account: id=sip:[email protected]
18:43:19.444            pjsua_acc.c  .Account sip:[email protected] added with id 0
18:43:19.444            pjsua_acc.c  .Acc 0: setting registration..
18:43:19.444            pjsua_acc.c  ..Unable to generate suitable Contact header for registration: Unsupported transport (PJSIP_EUNSUPTRANSPORT) [status=171060]

Desktop/Smartphone (please complete the following information): DESKTOP

  • OS, Distribution & Version: [e.g. MacOS Mojave, Ubuntu 16.04, iOS 13] RHEL and MacOS: 10.15.7
  • PJSIP
    • version: version 2.10
    • applied patch(es): [e.g: patches from issue/PR xyz]
    • configure script params: ...
    • config_site.h contents: ...
    • related third party libraries & versions: [e.g: OpenSSL 1.1.1b]

Smartphone (please also complete the following information):

  • Device: [e.g. iPhone 6]

Additional context Add any other context about the problem here.

niknaz87 avatar Oct 29 '20 18:10 niknaz87

Have you added ";transport=tcp" at the end of the SIP URL? for example: "sip:[email protected];transport=tcp"

mostafafarzaneh avatar Jun 23 '21 14:06 mostafafarzaneh

Have you added ";transport=tcp" at the end of the SIP URL? for example: "sip:[email protected];transport=tcp"

This works for me as a workaround. Is this a prefered way how to make other than UDP (which is default) work? I need to append also this string to the outgoing call URI when I configure with userless account.

BTW, I do not see this documented in https://www.pjsip.org/docs/book-latest/html/account.html#creating-account When I checked also some example codes, it required only ep.transportCreate(...) https://github.com/pjsip/pjproject/blob/master/pjsip-apps/src/samples/pjsua2_demo.cpp#L438

@mostafafarzaneh

martin-flaska avatar Sep 14 '22 14:09 martin-flaska