[OpenSIPS-Users] OpenSIPS and source SIP-domain routing

Labus roman_chel at mail.ru
Mon Apr 19 11:13:53 CEST 2010


Hello there!

 I have a small question: is it possible to route by source SIP-domain?

I have one MS OCS installation and one mediation server, that route calls to
OpenSIPS server. So, I have several SIP-domains on OCS. Every domain have
self PSTN-GW (asterisk) and I need to route outound calls to desired
asterisk GW by source sip.

 I made several attempts, but no luck (sorry my bad english).

/******************My config******************************/

route {

    if (!mf_process_maxfwd_header("10")) {
        xlog("L_NOTICE","Too many hops\n");
        sl_send_reply("483", "Too many hops, forward count exceeded
limit\n");
        exit();
    };

    if (msg:len >= max_len) {
        xlog("L_NOTICE","Message too large, >= 2048 bytes\n");
        sl_send_reply("513", "Message too large, exceeded limit\n");
        exit();
    };

    if (is_method("OPTIONS")) {
        sl_send_reply("200", "ok");
        exit();
    };

    #Routes
#    if (has_totag()) {
            if (src_ip ==A.A.A.A) {             #IP of OCS

#                     route(1); #from OCS

             xlog("L_ERR", "******************* $fu 
************************");
             if (uri =~"sip:.+ at domain1.loc") { 
                     sethostport("B.B.B.B:5060");   #Asterisk PSTN gw for
domain1.loc
                     xlog( "L_ERR",
"------------------SEVEREN-----------------------------------\n" );
                     xlog( "L_ERR", "LOG: from uri=[$fu] \n");
                     xlog( "L_ERR", "LOG: request's method=[$rm] \n ");
                     xlog( "L_ERR", "LOG: request's uri=[$ru] \n ");
                     xlog( "L_ERR", "LOG: to uri=[$tu] \n");
                     xlog( "L_ERR", "LOG: ip source=[$src_ip]\n" );
                     xlog( "L_ERR", "LOG: remote uri=[$rU]\n" );
                     xlog( "L_ERR",
"------------------------------------------------------------\n" );
                exit;
             };
             if (uri =~"sip:.+ at domain2.loc") { #Asterisk PSTN-GW for
domain2.loc
                     sethostport("C.C.C.C:5060");
                     xlog( "L_ERR",
"------------------SEVEREN-----------------------------------\n" );
                     xlog( "L_ERR", "LOG: from uri=[$fu] \n");
                     xlog( "L_ERR", "LOG: request's method=[$rm] \n ");
                     xlog( "L_ERR", "LOG: request's uri=[$ru] \n ");
                     xlog( "L_ERR", "LOG: to uri=[$tu] \n");
                     xlog( "L_ERR", "LOG: ip source=[$src_ip]\n" );
                     xlog( "L_ERR", "LOG: remote uri=[$rU]\n" );
                     xlog( "L_ERR",
"------------------------------------------------------------\n" );
               exit;
              };
             if (!t_relay()) {
                         sl_reply_error();
                     exit;
#             };



            } else {
#                       route(2); }; #from Asterisk
             sethostport("A.A.A.A:5060");  #My mediation server IP

    };


    };
}

onreply_route {
    xlog( "L_ERR",
"------------------------------------------------------------\n" );
    xlog( "L_ERR", "LOG: from uri=[$fu] \n , request's method=[$rm] \n ,
request's uri=[$ru] \n ,to uri=[$tu] \n , ip source=[$src_ip]\n" );
    xlog( "L_ERR", "LOG: remote uri=[$rU]\n" );
    xlog( "L_ERR",
"------------------------------------------------------------\n" );
    exit;
}


-- 
View this message in context: http://n2.nabble.com/OpenSIPS-and-source-SIP-domain-routing-tp4924234p4924234.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.



More information about the Users mailing list