On 3/19/08, Andr? Teixeira <coelho at wit-software.com> wrote: > Hi, > > Is it possible to have two pjsip instances running simultaneously in the > same app? No, not possible, sorry. We have some global variables lying around, so this is not possible. > I want to have two "SIP engines" running side by side (don't ask why :p) I'm afraid I have to ask why. :) Cheers, -benny > After SIPEngine_1 is initialized and running fine, I try to launch > SIPEngine_2 but the problems start when I try to Init the transaction > layer... > > This is what I try to run when start SIP Engine 2 > > ------------------------------------------------------------------------------ > > pj_status_t status; > > /* Must init PJLIB first: */ > // status = pj_init(); > // pj_assert(status == PJ_SUCCESS); > > > /* Then init PJLIB-UTIL: */ > // status = pjlib_util_init(); > // pj_assert(status == PJ_SUCCESS); > > > pj_thread_desc desc; > pj_thread_t *this_thread; > > status = pj_thread_register("Thread FaxSipEngine", desc, &this_thread); > if (status != PJ_SUCCESS) { > Logger::instance->Debug("FAXSIPENGINE | Unable to register > pj_thread"); > return; > } > > /* Must create a pool factory before we can allocate any memory. */ > pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0); > > > /* Create global endpoint: */ > { > const pj_str_t *hostname; > const char *endpt_name; > > /* Endpoint MUST be assigned a globally unique name. > * The name will be used as the hostname in Warning header. > */ > > /* For this implementation, we'll use hostname for simplicity */ > hostname = pj_gethostname(); > endpt_name = hostname->ptr; > > /* Create the endpoint: */ > > status = pjsip_endpt_create(&cp.factory, endpt_name, > &g_endpt); > pj_assert(status == PJ_SUCCESS); > } > > > /* > * Add UDP transport, with hard-coded port > * Alternatively, application can use pjsip_udp_transport_attach() to > * start UDP transport, if it already has an UDP socket (e.g. after it > * resolves the address with STUN). > */ > { > pj_sockaddr_in addr; > > status = !PJ_SUCCESS; > > while(status != PJ_SUCCESS){ > addr.sin_family = pj_AF_INET(); > addr.sin_addr.s_addr = 0; > addr.sin_port = pj_htons((pj_uint16_t)mySipPort); > status = pjsip_udp_transport_start( g_endpt, &addr, NULL, 1, > NULL); > if(status != PJ_SUCCESS) > Fax::instance->mySipPort++; > } > > if (status != PJ_SUCCESS) { > ;//app_perror(THIS_FILE, "Unable to start UDP transport", > status); > return; > } > } > > > ------------------------------------------------------------------------------ > PROBLEMS START HERE, I get an assertion error inside > pjsip_tsx_layer_init_module(g_endpt); > ------------------------------------------------------------------------------ > /* > * Init transaction layer. > * This will create/initialize transaction hash tables etc. > */ > status = pjsip_tsx_layer_init_module(g_endpt); > pj_assert(status == PJ_SUCCESS); > > > /* > * Initialize UA layer module. > * This will create/initialize dialog hash tables etc. > */ > status = pjsip_ua_init_module( g_endpt, NULL ); > pj_assert(status == PJ_SUCCESS); > > > [...] > > ------------------------------------------------------------------------------ > > > Any help will be appreciated ;) > > Andr? > > _______________________________________________ > 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 >