Creating multiple TCP listeners in PJSUA2

AM
Aleksandar Milenkovic
Wed, Jan 4, 2017 2:49 PM

Hello folks,

I'm trying to create multiple TCP listeners in pjsua2 on android using the
pjproject-2.5.5 release. Thing is, I don't really require many of them, i
just need to replace the current one with a new instance because Doze mode
is messing things up.

After returning from Doze mode, I cannot create more TCP listeners and thus
cannot (re)register anymore, here's the error I'm getting in Java:

D/PJSIP: 15:20:41.303    tcptp:47899  SIP TCP transport destroyed
D/PJSIP: 15:20:41.304  pjsua_core.c  Error creating SIP TCP listener:
Object with the same type exists (PJSIP_ETYPEEXISTS) [status=171002]
D/PJSIP: 15:20:41.304  endpoint.cpp  pjsua_transport_create(type, &tcfg,
&tid) error: Object with the same type exists (PJSIP_ETYPEEXISTS)
(status=171002) [../src/pjsua2/endpoint.cpp:1614]
W/System.err: java.lang.Exception: Title:
pjsua_transport_create(type, &tcfg, &tid)
W/System.err: Code:        171002
W/System.err: Description: Object with the same type exists
(PJSIP_ETYPEEXISTS)
W/System.err: Location:    ../src/pjsua2/endpoint.cpp:1614
W/System.err:    at
org.pjsip.pjsua2.pjsua2JNI.Endpoint_transportCreate(Native Method)
W/System.err:    at
org.pjsip.pjsua2.Endpoint.transportCreate(Endpoint.java:178)
W/System.err:    at
org.pjsip.pjsua2.app.MyApp.createTransport(MyApp.java:105)
W/System.err:    at
com.packagename.app.calling.MyService.initializeSIP(MyService.java:798)
W/System.err:    at
com.packagename.app.calling.MyService.access$1600(MyService.java:109)
W/System.err:    at
com.packagename.app.calling.MyService$MyBroadcastReceiver.onReceive(MyService.java:1982)
W/System.err:    at
android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1122)
W/System.err:    at android.os.Handler.handleCallback(Handler.java:751)
W/System.err:    at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err:    at android.os.Looper.loop(Looper.java:154)
W/System.err:    at
android.app.ActivityThread.main(ActivityThread.java:6077)
W/System.err:    at java.lang.reflect.Method.invoke(Native Method)
W/System.err:    at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
W/System.err:    at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
E/PJSIP: java.lang.Exception: Title:      pjsua_transport_create(type,
&tcfg, &tid)
Code:        171002
Description: Object with the same type exists
(PJSIP_ETYPEEXISTS)
Location:    ../src/pjsua2/endpoint.cpp:1614

So i've grepped for PJSIP_ETYPEEXISTS and found occurances in
pjsip/src/pjsip/sip_transport.c and made a small patch in this fashoin:

PJ_DEF(pj_status_t) pjsip_tpmgr_register_tpfactory( pjsip_tpmgr *mgr,
pjsip_tpfactory *tpf)
{
pjsip_tpfactory *p;
pj_status_t status;

pj_lock_acquire(mgr->lock);

/* Check that no factory with the same type has been registered. */
status = PJ_SUCCESS;
for (p=mgr->factory_list.next; p!=&mgr->factory_list; p=p->next) {

if (p->type == tpf->type) {
/*
* SHARK
* attempted fix; if a type exists, simply
* overwrite it instead of telling me it already exists

  • status = PJSIP_ETYPEEXISTS;
  • break;
    */

pj_list_insert_after(p, tpf);
pj_list_erase(&p);
pj_lock_release(mgr->lock);
return status;

}
//rest of the function ommited

However, I'm still facing the PJSIP_ETYPEEXISTS error and am somewhat
clueless as to where it's coming from as if the patch didn't have any
effect which leads me to believe i patched the wrong file or in the wrong
place

I have also read the archives about a similar-ish problem in a thread
called "Multiple endpoints" in which a one-liner patch was attached by *Alain
Totouom *which i cannot find...

Would someone be able to nudge me in the right direction with this issue?

Kind regards, happy new year and merry christmass holidays,
Aleksandar

Hello folks, I'm trying to create multiple TCP listeners in pjsua2 on android using the pjproject-2.5.5 release. Thing is, I don't really require many of them, i just need to replace the current one with a new instance because Doze mode is messing things up. After returning from Doze mode, I cannot create more TCP listeners and thus cannot (re)register anymore, here's the error I'm getting in Java: D/PJSIP: 15:20:41.303 tcptp:47899 SIP TCP transport destroyed D/PJSIP: 15:20:41.304 pjsua_core.c Error creating SIP TCP listener: Object with the same type exists (PJSIP_ETYPEEXISTS) [status=171002] D/PJSIP: 15:20:41.304 endpoint.cpp pjsua_transport_create(type, &tcfg, &tid) error: Object with the same type exists (PJSIP_ETYPEEXISTS) (status=171002) [../src/pjsua2/endpoint.cpp:1614] W/System.err: java.lang.Exception: Title: pjsua_transport_create(type, &tcfg, &tid) W/System.err: Code: 171002 W/System.err: Description: Object with the same type exists (PJSIP_ETYPEEXISTS) W/System.err: Location: ../src/pjsua2/endpoint.cpp:1614 W/System.err: at org.pjsip.pjsua2.pjsua2JNI.Endpoint_transportCreate(Native Method) W/System.err: at org.pjsip.pjsua2.Endpoint.transportCreate(Endpoint.java:178) W/System.err: at org.pjsip.pjsua2.app.MyApp.createTransport(MyApp.java:105) W/System.err: at com.packagename.app.calling.MyService.initializeSIP(MyService.java:798) W/System.err: at com.packagename.app.calling.MyService.access$1600(MyService.java:109) W/System.err: at com.packagename.app.calling.MyService$MyBroadcastReceiver.onReceive(MyService.java:1982) W/System.err: at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1122) W/System.err: at android.os.Handler.handleCallback(Handler.java:751) W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95) W/System.err: at android.os.Looper.loop(Looper.java:154) W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6077) W/System.err: at java.lang.reflect.Method.invoke(Native Method) W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) E/PJSIP: java.lang.Exception: Title: pjsua_transport_create(type, &tcfg, &tid) Code: 171002 Description: Object with the same type exists (PJSIP_ETYPEEXISTS) Location: ../src/pjsua2/endpoint.cpp:1614 So i've grepped for PJSIP_ETYPEEXISTS and found occurances in pjsip/src/pjsip/sip_transport.c and made a small patch in this fashoin: PJ_DEF(pj_status_t) pjsip_tpmgr_register_tpfactory( pjsip_tpmgr *mgr, pjsip_tpfactory *tpf) { pjsip_tpfactory *p; pj_status_t status; pj_lock_acquire(mgr->lock); /* Check that no factory with the same type has been registered. */ status = PJ_SUCCESS; for (p=mgr->factory_list.next; p!=&mgr->factory_list; p=p->next) { if (p->type == tpf->type) { /* * SHARK * attempted fix; if a type exists, simply * overwrite it instead of telling me it already exists * status = PJSIP_ETYPEEXISTS; * break; */ pj_list_insert_after(p, tpf); pj_list_erase(&p); pj_lock_release(mgr->lock); return status; } //rest of the function ommited However, I'm still facing the PJSIP_ETYPEEXISTS error and am somewhat clueless as to where it's coming from as if the patch didn't have any effect which leads me to believe i patched the wrong file or in the wrong place I have also read the archives about a similar-ish problem in a thread called "Multiple endpoints" in which a one-liner patch was attached by *Alain Totouom *which i cannot find... Would someone be able to nudge me in the right direction with this issue? Kind regards, happy new year and merry christmass holidays, Aleksandar
AT
Alain Totouom
Thu, Jan 5, 2017 11:19 AM

Hi Aleksandar,

attached the one-liner from the thread [1] you’re talking about.
If you want to use|support more than 64 listeners of the same type,
you'll have to adjust PJ_IOQUEUE_MAX_HANDLES (config_site.h) as well.

Regards,
Alain

[1]
http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2015-November/018754.html

On 04/01/2017 15:49, Aleksandar Milenkovic wrote:

Hello folks,

I'm trying to create multiple TCP listeners in pjsua2 on android using the
pjproject-2.5.5 release. Thing is, I don't really require many of them, i
just need to replace the current one with a new instance because Doze mode
is messing things up.

After returning from Doze mode, I cannot create more TCP listeners and thus
cannot (re)register anymore, here's the error I'm getting in Java:

D/PJSIP: 15:20:41.303    tcptp:47899  SIP TCP transport destroyed
D/PJSIP: 15:20:41.304  pjsua_core.c  Error creating SIP TCP listener:
Object with the same type exists (PJSIP_ETYPEEXISTS) [status=171002]
D/PJSIP: 15:20:41.304  endpoint.cpp  pjsua_transport_create(type, &tcfg,
&tid) error: Object with the same type exists (PJSIP_ETYPEEXISTS)
(status=171002) [../src/pjsua2/endpoint.cpp:1614]
W/System.err: java.lang.Exception: Title:
pjsua_transport_create(type, &tcfg, &tid)
W/System.err: Code:        171002
W/System.err: Description: Object with the same type exists
(PJSIP_ETYPEEXISTS)
W/System.err: Location:    ../src/pjsua2/endpoint.cpp:1614
W/System.err:    at
org.pjsip.pjsua2.pjsua2JNI.Endpoint_transportCreate(Native Method)
W/System.err:    at
org.pjsip.pjsua2.Endpoint.transportCreate(Endpoint.java:178)
W/System.err:    at
org.pjsip.pjsua2.app.MyApp.createTransport(MyApp.java:105)
W/System.err:    at
com.packagename.app.calling.MyService.initializeSIP(MyService.java:798)
W/System.err:    at
com.packagename.app.calling.MyService.access$1600(MyService.java:109)
W/System.err:    at
com.packagename.app.calling.MyService$MyBroadcastReceiver.onReceive(MyService.java:1982)
W/System.err:    at
android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1122)
W/System.err:    at android.os.Handler.handleCallback(Handler.java:751)
W/System.err:    at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err:    at android.os.Looper.loop(Looper.java:154)
W/System.err:    at
android.app.ActivityThread.main(ActivityThread.java:6077)
W/System.err:    at java.lang.reflect.Method.invoke(Native Method)
W/System.err:    at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
W/System.err:    at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
E/PJSIP: java.lang.Exception: Title:      pjsua_transport_create(type,
&tcfg, &tid)
Code:        171002
Description: Object with the same type exists
(PJSIP_ETYPEEXISTS)
Location:    ../src/pjsua2/endpoint.cpp:1614

So i've grepped for PJSIP_ETYPEEXISTS and found occurances in
pjsip/src/pjsip/sip_transport.c and made a small patch in this fashoin:

PJ_DEF(pj_status_t) pjsip_tpmgr_register_tpfactory( pjsip_tpmgr *mgr,
pjsip_tpfactory *tpf)
{
pjsip_tpfactory *p;
pj_status_t status;

  pj_lock_acquire(mgr->lock);

  /* Check that no factory with the same type has been registered. */
  status = PJ_SUCCESS;
  for (p=mgr->factory_list.next; p!=&mgr->factory_list; p=p->next) {

if (p->type == tpf->type) {
/*
* SHARK
* attempted fix; if a type exists, simply
* overwrite it instead of telling me it already exists
* status = PJSIP_ETYPEEXISTS;
* break;
*/

 pj_list_insert_after(p, tpf);
 pj_list_erase(&p);
 pj_lock_release(mgr->lock);
 return status;

}
//rest of the function ommited

However, I'm still facing the PJSIP_ETYPEEXISTS error and am somewhat
clueless as to where it's coming from as if the patch didn't have any
effect which leads me to believe i patched the wrong file or in the wrong
place

I have also read the archives about a similar-ish problem in a thread
called "Multiple endpoints" in which a one-liner patch was attached by *Alain
Totouom *which i cannot find...

Would someone be able to nudge me in the right direction with this issue?

Kind regards, happy new year and merry christmass holidays,
Aleksandar


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

--
1024D/A9F85A52      2000-01-18      Alain Totouom totouom@gmx.de
PGP Fingerprint DA18 0DF2 FBD2 5F67 0656 452D E3A2 7531 A9F8 5A52

Hi Aleksandar, attached the one-liner from the thread [1] you’re talking about. If you want to use|support more than 64 listeners of the same type, you'll have to adjust PJ_IOQUEUE_MAX_HANDLES (config_site.h) as well. Regards, Alain [1] http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2015-November/018754.html On 04/01/2017 15:49, Aleksandar Milenkovic wrote: > Hello folks, > > I'm trying to create multiple TCP listeners in pjsua2 on android using the > pjproject-2.5.5 release. Thing is, I don't really require many of them, i > just need to replace the current one with a new instance because Doze mode > is messing things up. > > After returning from Doze mode, I cannot create more TCP listeners and thus > cannot (re)register anymore, here's the error I'm getting in Java: > > > D/PJSIP: 15:20:41.303 tcptp:47899 SIP TCP transport destroyed > D/PJSIP: 15:20:41.304 pjsua_core.c Error creating SIP TCP listener: > Object with the same type exists (PJSIP_ETYPEEXISTS) [status=171002] > D/PJSIP: 15:20:41.304 endpoint.cpp pjsua_transport_create(type, &tcfg, > &tid) error: Object with the same type exists (PJSIP_ETYPEEXISTS) > (status=171002) [../src/pjsua2/endpoint.cpp:1614] > W/System.err: java.lang.Exception: Title: > pjsua_transport_create(type, &tcfg, &tid) > W/System.err: Code: 171002 > W/System.err: Description: Object with the same type exists > (PJSIP_ETYPEEXISTS) > W/System.err: Location: ../src/pjsua2/endpoint.cpp:1614 > W/System.err: at > org.pjsip.pjsua2.pjsua2JNI.Endpoint_transportCreate(Native Method) > W/System.err: at > org.pjsip.pjsua2.Endpoint.transportCreate(Endpoint.java:178) > W/System.err: at > org.pjsip.pjsua2.app.MyApp.createTransport(MyApp.java:105) > W/System.err: at > com.packagename.app.calling.MyService.initializeSIP(MyService.java:798) > W/System.err: at > com.packagename.app.calling.MyService.access$1600(MyService.java:109) > W/System.err: at > com.packagename.app.calling.MyService$MyBroadcastReceiver.onReceive(MyService.java:1982) > W/System.err: at > android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1122) > W/System.err: at android.os.Handler.handleCallback(Handler.java:751) > W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95) > W/System.err: at android.os.Looper.loop(Looper.java:154) > W/System.err: at > android.app.ActivityThread.main(ActivityThread.java:6077) > W/System.err: at java.lang.reflect.Method.invoke(Native Method) > W/System.err: at > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) > W/System.err: at > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) > E/PJSIP: java.lang.Exception: Title: pjsua_transport_create(type, > &tcfg, &tid) > Code: 171002 > Description: Object with the same type exists > (PJSIP_ETYPEEXISTS) > Location: ../src/pjsua2/endpoint.cpp:1614 > > > So i've grepped for PJSIP_ETYPEEXISTS and found occurances in > pjsip/src/pjsip/sip_transport.c and made a small patch in this fashoin: > > PJ_DEF(pj_status_t) pjsip_tpmgr_register_tpfactory( pjsip_tpmgr *mgr, > pjsip_tpfactory *tpf) > { > pjsip_tpfactory *p; > pj_status_t status; > > pj_lock_acquire(mgr->lock); > > /* Check that no factory with the same type has been registered. */ > status = PJ_SUCCESS; > for (p=mgr->factory_list.next; p!=&mgr->factory_list; p=p->next) { > if (p->type == tpf->type) { > /* > * SHARK > * attempted fix; if a type exists, simply > * overwrite it instead of telling me it already exists > * status = PJSIP_ETYPEEXISTS; > * break; > */ > > pj_list_insert_after(p, tpf); > pj_list_erase(&p); > pj_lock_release(mgr->lock); > return status; > > } > //rest of the function ommited > > However, I'm still facing the PJSIP_ETYPEEXISTS error and am somewhat > clueless as to where it's coming from as if the patch didn't have any > effect which leads me to believe i patched the wrong file or in the wrong > place > > I have also read the archives about a similar-ish problem in a thread > called "Multiple endpoints" in which a one-liner patch was attached by *Alain > Totouom *which i cannot find... > > Would someone be able to nudge me in the right direction with this issue? > > Kind regards, happy new year and merry christmass holidays, > Aleksandar > > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org -- 1024D/A9F85A52 2000-01-18 Alain Totouom <totouom@gmx.de> PGP Fingerprint DA18 0DF2 FBD2 5F67 0656 452D E3A2 7531 A9F8 5A52
TT
Telesonic Telesonic
Sun, Jan 8, 2017 5:38 PM

Hello

Can somebody point me on docs about how to sent AT commands to SIP server ? (making SIP GSM gateway)

I have SIP client program on Windows (using pjsip as SIP lib). I have connections with devices (IOS, Android, others) via bluetooth.

Now I need to send media from device (via bluetooth) to SIP server througth my SIP windows program and back to device media via AT commands.

Thanks in advcance!))

GR
Guillaume Roguez
Mon, Jan 9, 2017 8:55 PM

Sorry, I'm a bit confused by given information and the question.

There is nothing such AT command into the SIP standard.

  • If such has to exist, it'll be a service given by the gateway itself, so try to check the gateway manual.
  • If you try to make a gateway, you can use SIP MESSAGE (with a specific mime-type?) to deliver the AT command as a simple text string.

How do you use bluetooth here? Is it just a lower-protocol to provide TCP or UDP access between devices and the IP gateway?

--
Guillaume Roguez | Senior Free Software Consultant
Ring Project Development Director - https://ring.cx
RingID: 007871859FFA8E8FFDE776A6BA8E8FA35ABD9A7B
PGP : 2A3A3627C9DCA7E733EE1034820371F4E07DE571

----- Le 8 Jan 17, à 12:38, Telesonic Telesonic telesonic@yandex.ru a écrit :

Hello
Can somebody point me on docs about how to sent AT commands to SIP server ?
(making SIP GSM gateway)
I have SIP client program on Windows (using pjsip as SIP lib). I have
connections with devices (IOS, Android, others) via bluetooth.
Now I need to send media from device (via bluetooth) to SIP server througth my
SIP windows program and back to device media via AT commands.
Thanks in advcance!))


Visit our blog: http://blog.pjsip.org

--
Guillaume Roguez | Senior Free Software Consultant
Ring Project Development Director - https://ring.cx
RingID: 007871859FFA8E8FFDE776A6BA8E8FA35ABD9A7B
PGP : 2A3A3627C9DCA7E733EE1034820371F4E07DE571

Sorry, I'm a bit confused by given information and the question. There is nothing such AT command into the SIP standard. * If such has to exist, it'll be a service given by the gateway itself, so try to check the gateway manual. * If you try to make a gateway, you can use SIP MESSAGE (with a specific mime-type?) to deliver the AT command as a simple text string. How do you use bluetooth here? Is it just a lower-protocol to provide TCP or UDP access between devices and the IP gateway? -- Guillaume Roguez | Senior Free Software Consultant Ring Project Development Director - https://ring.cx RingID: 007871859FFA8E8FFDE776A6BA8E8FA35ABD9A7B PGP : 2A3A3627C9DCA7E733EE1034820371F4E07DE571 ----- Le 8 Jan 17, à 12:38, Telesonic Telesonic <telesonic@yandex.ru> a écrit : > Hello > Can somebody point me on docs about how to sent AT commands to SIP server ? > (making SIP GSM gateway) > I have SIP client program on Windows (using pjsip as SIP lib). I have > connections with devices (IOS, Android, others) via bluetooth. > Now I need to send media from device (via bluetooth) to SIP server througth my > SIP windows program and back to device media via AT commands. > Thanks in advcance!)) > _______________________________________________ > Visit our blog: http://blog.pjsip.org > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org -- Guillaume Roguez | Senior Free Software Consultant Ring Project Development Director - https://ring.cx RingID: 007871859FFA8E8FFDE776A6BA8E8FA35ABD9A7B PGP : 2A3A3627C9DCA7E733EE1034820371F4E07DE571
TT
Telesonic Telesonic
Tue, Jan 10, 2017 8:56 PM

Hi Guillaume!

Yes exact - I want to make a gateway SIP-GSM

What do you mean by "gateway manual" ?

About SIP MESSAGE - ok, I will look at this.

Main question in fact - how can I transfer media from SIP to GSM and back - from GSM to SIP..

09.01.2017, 23:56, "Guillaume Roguez" <guillaume.roguez@savoirfairelinux.com>:

Sorry, I'm a bit confused by given information and the question.

There is nothing such AT command into the SIP standard.

  • If such has to exist, it'll be a service given by the gateway itself, so try to check the gateway manual.

  • If you try to make a gateway, you can use SIP MESSAGE (with a specific mime-type?) to deliver the AT command as a simple text string.

How do you use bluetooth here? Is it just a lower-protocol to provide TCP or UDP access between devices and the IP gateway?

--

Guillaume Roguez | Senior Free Software Consultant
Ring Project Development Director - https://ring.cx
RingID: 007871859FFA8E8FFDE776A6BA8E8FA35ABD9A7B
PGP : 2A3A3627C9DCA7E733EE1034820371F4E07DE571

----- Le 8 Jan 17, à 12:38, Telesonic Telesonic <telesonic@yandex.ru> a écrit :> Hello

Can somebody point me on docs about how to sent AT commands to SIP server ? (making SIP GSM gateway)

I have SIP client program on Windows (using pjsip as SIP lib). I have connections with devices (IOS, Android, others) via bluetooth.

Now I need to send media from device (via bluetooth) to SIP server througth my SIP windows program and back to device media via AT commands.

Thanks in advcance!))

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

--

Guillaume Roguez | Senior Free Software Consultant
Ring Project Development Director - https://ring.cx
RingID: 007871859FFA8E8FFDE776A6BA8E8FA35ABD9A7B
PGP : 2A3A3627C9DCA7E733EE1034820371F4E07DE571

,_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

3
301@free.fr
Mon, Jan 16, 2017 9:59 AM

Hi Aleksandar,

Are you trying to create a new listener on the same IP/port?
Keep in mind that only one instance of an endpoint shall be created.

Regards,
Thibault

2017-01-04 15:49 GMT+01:00 Aleksandar Milenkovic shark@lotusflare.com:

Hello folks,

I'm trying to create multiple TCP listeners in pjsua2 on android using the
pjproject-2.5.5 release. Thing is, I don't really require many of them, i
just need to replace the current one with a new instance because Doze mode
is messing things up.

After returning from Doze mode, I cannot create more TCP listeners and
thus cannot (re)register anymore, here's the error I'm getting in Java:

D/PJSIP: 15:20:41.303    tcptp:47899  SIP TCP transport destroyed
D/PJSIP: 15:20:41.304  pjsua_core.c  Error creating SIP TCP listener:
Object with the same type exists (PJSIP_ETYPEEXISTS) [status=171002]
D/PJSIP: 15:20:41.304  endpoint.cpp  pjsua_transport_create(type, &tcfg,
&tid) error: Object with the same type exists (PJSIP_ETYPEEXISTS)
(status=171002) [../src/pjsua2/endpoint.cpp:1614]
W/System.err: java.lang.Exception: Title:
pjsua_transport_create(type, &tcfg, &tid)
W/System.err: Code:        171002
W/System.err: Description: Object with the same type exists
(PJSIP_ETYPEEXISTS)
W/System.err: Location:    ../src/pjsua2/endpoint.cpp:1614
W/System.err:    at org.pjsip.pjsua2.pjsua2JNI.Endpoint_transportCreate(Native
Method)
W/System.err:    at org.pjsip.pjsua2.Endpoint.
transportCreate(Endpoint.java:178)
W/System.err:    at org.pjsip.pjsua2.app.MyApp.
createTransport(MyApp.java:105)
W/System.err:    at com.packagename.app.calling.MyService.initializeSIP(
MyService.java:798)
W/System.err:    at com.packagename.app.calling.MyService.access$1600(
MyService.java:109)
W/System.err:    at com.packagename.app.calling.
MyService$MyBroadcastReceiver.onReceive(MyService.java:1982)
W/System.err:    at android.app.LoadedApk$ReceiverDispatcher$Args.run(
LoadedApk.java:1122)
W/System.err:    at android.os.Handler.handleCallback(Handler.java:751)
W/System.err:    at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err:    at android.os.Looper.loop(Looper.java:154)
W/System.err:    at android.app.ActivityThread.
main(ActivityThread.java:6077)
W/System.err:    at java.lang.reflect.Method.invoke(Native Method)
W/System.err:    at com.android.internal.os.ZygoteInit$
MethodAndArgsCaller.run(ZygoteInit.java:865)
W/System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.
java:755)
E/PJSIP: java.lang.Exception: Title:      pjsua_transport_create(type,
&tcfg, &tid)
Code:        171002
Description: Object with the same type
exists (PJSIP_ETYPEEXISTS)
Location:    ../src/pjsua2/endpoint.cpp:1614

So i've grepped for PJSIP_ETYPEEXISTS and found occurances in
pjsip/src/pjsip/sip_transport.c and made a small patch in this fashoin:

PJ_DEF(pj_status_t) pjsip_tpmgr_register_tpfactory( pjsip_tpmgr *mgr,
pjsip_tpfactory *tpf)
{
pjsip_tpfactory *p;
pj_status_t status;

 pj_lock_acquire(mgr->lock);

 /* Check that no factory with the same type has been registered. */
 status = PJ_SUCCESS;
 for (p=mgr->factory_list.next; p!=&mgr->factory_list; p=p->next) {

if (p->type == tpf->type) {
/*
* SHARK
* attempted fix; if a type exists, simply
* overwrite it instead of telling me it already exists
* status = PJSIP_ETYPEEXISTS;
* break;
*/

pj_list_insert_after(p, tpf);
pj_list_erase(&p);
pj_lock_release(mgr->lock);
return status;

}
//rest of the function ommited

However, I'm still facing the PJSIP_ETYPEEXISTS error and am somewhat
clueless as to where it's coming from as if the patch didn't have any
effect which leads me to believe i patched the wrong file or in the wrong
place

I have also read the archives about a similar-ish problem in a thread
called "Multiple endpoints" in which a one-liner patch was attached by *Alain
Totouom *which i cannot find...

Would someone be able to nudge me in the right direction with this issue?

Kind regards, happy new year and merry christmass holidays,
Aleksandar


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi Aleksandar, Are you trying to create a new listener on the same IP/port? Keep in mind that only one instance of an endpoint shall be created. Regards, Thibault 2017-01-04 15:49 GMT+01:00 Aleksandar Milenkovic <shark@lotusflare.com>: > Hello folks, > > I'm trying to create multiple TCP listeners in pjsua2 on android using the > pjproject-2.5.5 release. Thing is, I don't really require many of them, i > just need to replace the current one with a new instance because Doze mode > is messing things up. > > After returning from Doze mode, I cannot create more TCP listeners and > thus cannot (re)register anymore, here's the error I'm getting in Java: > > > D/PJSIP: 15:20:41.303 tcptp:47899 SIP TCP transport destroyed > D/PJSIP: 15:20:41.304 pjsua_core.c Error creating SIP TCP listener: > Object with the same type exists (PJSIP_ETYPEEXISTS) [status=171002] > D/PJSIP: 15:20:41.304 endpoint.cpp pjsua_transport_create(type, &tcfg, > &tid) error: Object with the same type exists (PJSIP_ETYPEEXISTS) > (status=171002) [../src/pjsua2/endpoint.cpp:1614] > W/System.err: java.lang.Exception: Title: > pjsua_transport_create(type, &tcfg, &tid) > W/System.err: Code: 171002 > W/System.err: Description: Object with the same type exists > (PJSIP_ETYPEEXISTS) > W/System.err: Location: ../src/pjsua2/endpoint.cpp:1614 > W/System.err: at org.pjsip.pjsua2.pjsua2JNI.Endpoint_transportCreate(Native > Method) > W/System.err: at org.pjsip.pjsua2.Endpoint. > transportCreate(Endpoint.java:178) > W/System.err: at org.pjsip.pjsua2.app.MyApp. > createTransport(MyApp.java:105) > W/System.err: at com.packagename.app.calling.MyService.initializeSIP( > MyService.java:798) > W/System.err: at com.packagename.app.calling.MyService.access$1600( > MyService.java:109) > W/System.err: at com.packagename.app.calling. > MyService$MyBroadcastReceiver.onReceive(MyService.java:1982) > W/System.err: at android.app.LoadedApk$ReceiverDispatcher$Args.run( > LoadedApk.java:1122) > W/System.err: at android.os.Handler.handleCallback(Handler.java:751) > W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95) > W/System.err: at android.os.Looper.loop(Looper.java:154) > W/System.err: at android.app.ActivityThread. > main(ActivityThread.java:6077) > W/System.err: at java.lang.reflect.Method.invoke(Native Method) > W/System.err: at com.android.internal.os.ZygoteInit$ > MethodAndArgsCaller.run(ZygoteInit.java:865) > W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit. > java:755) > E/PJSIP: java.lang.Exception: Title: pjsua_transport_create(type, > &tcfg, &tid) > Code: 171002 > Description: Object with the same type > exists (PJSIP_ETYPEEXISTS) > Location: ../src/pjsua2/endpoint.cpp:1614 > > > So i've grepped for PJSIP_ETYPEEXISTS and found occurances in > pjsip/src/pjsip/sip_transport.c and made a small patch in this fashoin: > > PJ_DEF(pj_status_t) pjsip_tpmgr_register_tpfactory( pjsip_tpmgr *mgr, > pjsip_tpfactory *tpf) > { > pjsip_tpfactory *p; > pj_status_t status; > > pj_lock_acquire(mgr->lock); > > /* Check that no factory with the same type has been registered. */ > status = PJ_SUCCESS; > for (p=mgr->factory_list.next; p!=&mgr->factory_list; p=p->next) { > if (p->type == tpf->type) { > /* > * SHARK > * attempted fix; if a type exists, simply > * overwrite it instead of telling me it already exists > * status = PJSIP_ETYPEEXISTS; > * break; > */ > > pj_list_insert_after(p, tpf); > pj_list_erase(&p); > pj_lock_release(mgr->lock); > return status; > > } > //rest of the function ommited > > However, I'm still facing the PJSIP_ETYPEEXISTS error and am somewhat > clueless as to where it's coming from as if the patch didn't have any > effect which leads me to believe i patched the wrong file or in the wrong > place > > I have also read the archives about a similar-ish problem in a thread > called "Multiple endpoints" in which a one-liner patch was attached by *Alain > Totouom *which i cannot find... > > Would someone be able to nudge me in the right direction with this issue? > > Kind regards, happy new year and merry christmass holidays, > Aleksandar > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > >
GR
Guillaume Roguez
Fri, Feb 17, 2017 5:11 PM

Hi

----- Le 10 Jan 17, à 15:56, Telesonic Telesonic telesonic@yandex.ru a écrit :

Hi Guillaume!
Yes exact - I want to make a gateway SIP-GSM
What do you mean by "gateway manual" ?

I would mean "the user-manual of the gateway device". Maybe a solution is written inside.

About SIP MESSAGE - ok, I will look at this.
Main question in fact - how can I transfer media from SIP to GSM and back - from
GSM to SIP..

If nothing is already available in the gateway device, you've to do it yourself.
My first idea is to use SIP MESSAGE for that : the SIP server tx/rx a MESSAGE with AT command inside,
and the gateway does the same but serialize/deserialize the AT command to the GSM side.

09.01.2017, 23:56, "Guillaume Roguez" guillaume.roguez@savoirfairelinux.com:

Sorry, I'm a bit confused by given information and the question.
There is nothing such AT command into the SIP standard.

  • If such has to exist, it'll be a service given by the gateway itself, so try
    to check the gateway manual.
  • If you try to make a gateway, you can use SIP MESSAGE (with a specific
    mime-type?) to deliver the AT command as a simple text string.
    How do you use bluetooth here? Is it just a lower-protocol to provide TCP or UDP
    access between devices and the IP gateway?
    --
    Guillaume Roguez | Senior Free Software Consultant
    Ring Project Development Director - https://ring.cx
    RingID: 007871859 FFA8E8FFDE776A6BA8E8FA35ABD9A7B
    PGP : 2A3A3627C9DCA7E733EE 1034820371 F4E07DE571

----- Le 8 Jan 17, à 12:38, Telesonic Telesonic < telesonic@yandex.ru > a écrit
:

Hello
Can somebody point me on docs about how to sent AT commands to SIP server ?
(making SIP GSM gateway)
I have SIP client program on Windows (using pjsip as SIP lib). I have
connections with devices (IOS, Android, others) via bluetooth.
Now I need to send media from device (via bluetooth) to SIP server througth my
SIP windows program and back to device media via AT commands.
Thanks in advcance!))


Visit our blog: http://blog.pjsip.org

--
Guillaume Roguez | Senior Free Software Consultant
Ring Project Development Director - https://ring.cx
RingID: 007871859 FFA8E8FFDE776A6BA8E8FA35ABD9A7B
PGP : 2A3A3627C9DCA7E733EE 1034820371 F4E07DE571
,


Visit our blog: http://blog.pjsip.org

Hi ----- Le 10 Jan 17, à 15:56, Telesonic Telesonic <telesonic@yandex.ru> a écrit : > Hi Guillaume! > Yes exact - I want to make a gateway SIP-GSM > What do you mean by "gateway manual" ? I would mean "the user-manual of the gateway device". Maybe a solution is written inside. > About SIP MESSAGE - ok, I will look at this. > Main question in fact - how can I transfer media from SIP to GSM and back - from > GSM to SIP.. If nothing is already available in the gateway device, you've to do it yourself. My first idea is to use SIP MESSAGE for that : the SIP server tx/rx a MESSAGE with AT command inside, and the gateway does the same but serialize/deserialize the AT command to the GSM side. > 09.01.2017, 23:56, "Guillaume Roguez" <guillaume.roguez@savoirfairelinux.com>: >> Sorry, I'm a bit confused by given information and the question. >> There is nothing such AT command into the SIP standard. >> * If such has to exist, it'll be a service given by the gateway itself, so try >> to check the gateway manual. >> * If you try to make a gateway, you can use SIP MESSAGE (with a specific >> mime-type?) to deliver the AT command as a simple text string. >> How do you use bluetooth here? Is it just a lower-protocol to provide TCP or UDP >> access between devices and the IP gateway? >> -- >> Guillaume Roguez | Senior Free Software Consultant >> Ring Project Development Director - https://ring.cx >> RingID: 007871859 FFA8E8FFDE776A6BA8E8FA35ABD9A7B >> PGP : 2A3A3627C9DCA7E733EE 1034820371 F4E07DE571 >> ----- Le 8 Jan 17, à 12:38, Telesonic Telesonic < telesonic@yandex.ru > a écrit >> : >>> Hello >>> Can somebody point me on docs about how to sent AT commands to SIP server ? >>> (making SIP GSM gateway) >>> I have SIP client program on Windows (using pjsip as SIP lib). I have >>> connections with devices (IOS, Android, others) via bluetooth. >>> Now I need to send media from device (via bluetooth) to SIP server througth my >>> SIP windows program and back to device media via AT commands. >>> Thanks in advcance!)) >>> _______________________________________________ >>> Visit our blog: http://blog.pjsip.org >>> pjsip mailing list >>> pjsip@lists.pjsip.org >>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> -- >> Guillaume Roguez | Senior Free Software Consultant >> Ring Project Development Director - https://ring.cx >> RingID: 007871859 FFA8E8FFDE776A6BA8E8FA35ABD9A7B >> PGP : 2A3A3627C9DCA7E733EE 1034820371 F4E07DE571 >> , >> _______________________________________________ >> Visit our blog: http://blog.pjsip.org >> pjsip mailing list >> pjsip@lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > _______________________________________________ > Visit our blog: http://blog.pjsip.org > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org