OpenSIPS离线消息功能配置(6)

      if(! t_newtran()){
            sl_reply_error();
            exit;
        }
        if (!method=="MESSAGE")
        {
                    if (!t_reply("404", "Not found"))
                    {
                            sl_reply_error();
                      };
                    exit;
                };
        log("MSILO:Message received -> storing using MSILO\n");
        if (m_store("$ru")){
            log("MSILO:offline message stored\n");
            if (!t_reply("202","Accepted")){
                sl_reply_error();
            };
        }else{
            log("MSILO:offline message NOT stroed\n");
            if(!t_reply("503","Service Unavailable")){
                sl_reply_error();
            };
        };
        exit;
    }
    t_on_failure("1");

if (isbflagset(NAT)) setflag(NAT);

# when routing via usrloc, log the missed calls also
    setflag(ACC_MISSED);
    route(relay);
}


route[relay] {
    # for INVITEs enable some additional helper routes
    if (is_method("INVITE")) {
       
        if (isflagset(NAT)) {
            rtpproxy_offer("ro");
        }

t_on_branch("per_branch_ops");
        t_on_reply("handle_nat");
        t_on_failure("missed_call");
    }

if (isflagset(NAT)) {
        add_rr_param(";nat=yes");
        }

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


branch_route[per_branch_ops] {
    xlog("new branch at $ru\n");
}


onreply_route[handle_nat] {
    if (nat_uac_test("1"))
        fix_nated_contact();
    if ( isflagset(NAT) )
        rtpproxy_answer("ro");
    xlog("incoming reply\n");
}


failure_route[missed_call] {
    if (t_was_cancelled()) {
        exit;
    }

# uncomment the following lines if you want to block client
    # redirect based on 3xx replies.
    ##if (t_check_status("3[0-9][0-9]")) {
    ##t_reply("404","Not found");
    ##    exit;
    ##}


}

local_route {
    if (is_method("BYE") && $DLG_dir=="UPSTREAM") {
       
        acc_db_request("200 Dialog Timeout", "acc");
       
    }
}

failure_route[1] {
    # forwarding failed -- check if the request was a MESSAGE
    if (!method=="MESSAGE")
    {
        exit;
    };
   
    log(1,"MSILO:the downstream UA doesn't support MESSAGEs\n");
    # we have changed the R-URI with the contact address, ignore it now
    if (m_store("$ou"))
    {
        log("MSILO: offline message stored\n");
        t_reply("202", "Accepted");
    }else{
        log("MSILO: offline message NOT stored\n");
        t_reply("503", "Service Unavailable");
    };
}

RHEL6.5下安装OpenSIPS 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/be802415f58a50a6dd4148a293dd9b39.html