Jump to content
Калькуляторы

Помогите разобраться с opensips

Добрый день.
Ковырять Asterisk стало скучно и задумался на тему построения полноценного кластера. В роли SBC выбрал Opensips.
У меня получилось его настроить на проксирование в сторону астериска, но проблема том, что opensips не проксирует ответы обратно клиенту.
Как только я не пытался решить эту проблему, ничего не выходит. В трассировке все в порядке, в логах я вижу: DBG:tm:t_lookup_request: no transaction found 
DBG:sipmsgops:has_totag: no totag

Мой конфиг:

route {
    if (!mf_process_maxfwd_header(10)) {
        sl_send_reply(483, "Too Many Hops");
        exit;
    }

    if ( is_method("CANCEL") ) {
        if ( t_check_trans() )
                t_relay();
                exit;
        }


    if (is_method("OPTIONS")) {
        sl_send_reply(200, "OK");
        exit;
    }
    record_route();
    # Initial INVITE processing
    if (is_method("INVITE") && !has_totag()) {
        route(INVITE);
    }

    if (is_method("REGISTER")) {

        route(REGISTER);
    }

    if (!lookup("location")) {
        send_reply(404, "Not Found");
        exit;
    }

    if (loose_route()) {
        route(relay);
        exit;
    }

    t_check_trans();

    route(relay);
}


route[REGISTER] {

        if (is_method("REGISTER")) {

                if (!www_authorize("", "subscriber")) {
                www_challenge("", "auth");
                exit;
                }

                if (!save("location")) {
                sl_reply_error();
                }
        exit;
    }


        exit;
}

route[relay] {

        if(!t_relay()){
                send_reply(500,"Server Error");
        }
        exit;
}

route[INVITE] {
    if (!has_totag()) {
        xlog("INVITE from $fu to $ru - proxying to Asterisk\n");

        $du = "sip:1.1.1.1:5060";

        t_on_branch("BRANCH_OPS");
        t_on_reply("REPLY_OPS");
        t_on_failure("FAIL_OPS");

        force_rport();
        fix_nated_register();
        # NAT handling
       if (nat_uac_test(19)) {
           fix_nated_contact();
       }

        # Record-Route
        record_route();
        if (!t_relay() && t_newtran()) {
            sl_reply_error();
        }
        exit;
    }
}

branch_route[BRANCH_OPS] {
    xlog("Proxying call to Asterisk branch: $ru\n");

}

onreply_route[REPLY_OPS] {
    xlog("Received $rs reply from Asterisk\n");
}


failure_route[FAIL_OPS] {
    xlog("Call failed with status $rc\n");
    if (t_was_cancelled()) {
        xlog("Call was cancelled\n");
    }
}

route[handle_response] {
    xlog("Response $rs code received\n");
}

Пока что я просто пытаюсь настроить проксирование, без проверки регистрации

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.