Exemplo n.º 1
0
void s2_nua_teardown(void)
{
  if (s2) {
    struct s2nua *zap = s2;
    nua_destroy(s2->nua), s2->nua = NULL;
    s2 = NULL;
    su_home_unref(zap->home);
  }

  s2_dns_teardown();
  s2_sip_teardown();
  s2_teardown();

}
Exemplo n.º 2
0
static int luasofia_nua_destroy(lua_State *L)
{
    /* get and check first argument (should be a luasofia_nua_t) */
    luasofia_nua_t *lnua = (luasofia_nua_t*)luaL_checkudata(L, 1, NUA_MTABLE);

    if (lnua->nua) {
        /* remove nua of the luasofia userdata table */
        luasofia_userdata_table_remove(L, lnua->nua);

        // TODO test if shutdown complete before call nua_destroy
        nua_destroy(lnua->nua);
        lnua->nua = NULL;
    }
    return 0;
}
static apt_bool_t mrcp_sofia_task_run(apt_task_t *task)
{
	mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task);

	if(sofia_agent->nua) {
		/* Run event loop */
		su_root_run(sofia_agent->root);
		
		/* Destroy allocated resources */
		nua_destroy(sofia_agent->nua);
		sofia_agent->nua = NULL;
	}
	su_root_destroy(sofia_agent->root);
	sofia_agent->root = NULL;
	su_deinit();

	apt_task_child_terminate(task);
	return TRUE;
}
static apt_bool_t mrcp_sofia_task_run(apt_task_t *task)
{
    mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task);

    /* Initialize Sofia-SIP library and create event loop */
    su_init();
    sofia_agent->root = su_root_create(NULL);

    /* Create a user agent instance. The stack will call the 'event_callback()'
     * callback when events such as succesful registration to network,
     * an incoming call, etc, occur.
     */
    sofia_agent->nua = nua_create(
                           sofia_agent->root,         /* Event loop */
                           mrcp_sofia_event_callback, /* Callback for processing events */
                           sofia_agent,               /* Additional data to pass to callback */
                           NUTAG_URL(sofia_agent->sip_bind_str), /* Address to bind to */
                           TAG_END());                /* Last tag should always finish the sequence */
    if(sofia_agent->nua) {
        nua_set_params(
            sofia_agent->nua,
            NUTAG_AUTOANSWER(0),
            NUTAG_APPL_METHOD("OPTIONS"),
            SIPTAG_USER_AGENT_STR(sofia_agent->config->user_agent_name),
            TAG_END());

        /* Run event loop */
        su_root_run(sofia_agent->root);

        /* Destroy allocated resources */
        nua_destroy(sofia_agent->nua);
        sofia_agent->nua = NULL;
    }
    su_root_destroy(sofia_agent->root);
    sofia_agent->root = NULL;
    su_deinit();

    apt_task_child_terminate(task);
    return TRUE;
}