Ejemplo n.º 1
0
static int luasofia_nua_handle_unregister(lua_State *L)
{
    /* get and check first argument (should be a luasofia_nua_handle_t) */
    luasofia_nua_handle_t *lnh = (luasofia_nua_handle_t*) luaL_checkudata(L, 1, NUA_HANDLE_MTABLE);
    if (lnh->nh) {
        su_home_t *home = su_home_create();
        /* get and check second argument (should be a tag table) */
        tagi_t *tags = luasofia_tags_table_to_taglist(L, 2, home);

        nua_unregister(lnh->nh, TAG_NEXT(tags));
        su_home_unref(home);
    }
    return 0;
}
Ejemplo n.º 2
0
/** Un-register NUA user.
 *
 * <pre>
 *  A                  B
 *  |-----REGISTER---->|
 *  |<-----200 OK------|
 *  |                  |
 * </pre>
 */
void s2_register_teardown(void)
{
  if (s2 && s2->registration->nh) {
    nua_handle_t *nh = s2->registration->nh;
    struct message *m;

    nua_unregister(nh, TAG_END());

    m = s2_sip_wait_for_request(SIP_METHOD_REGISTER); assert(m);
    s2_save_register(m);
    s2_sip_respond_to(m, NULL,
		  SIP_200_OK,
		  SIPTAG_CONTACT(s2->registration->contact),
		  TAG_END());
    assert(s2->registration->contact == NULL);

    s2_sip_free_message(m);

    fail_unless_event(nua_r_unregister, 200);

    nua_handle_destroy(nh);
    s2->registration->nh = NULL;
  }
}