[OpenSIPS-Users] OpenSIPS and SIP source routing

Bogdan-Andrei Iancu bogdan at voice-system.ro
Wed Apr 21 11:16:18 CEST 2010


Hi Roman,

Do you need to do routing based on Source SIP domain (from FROM URI) or 
on Source IP (from network level) ?

Regards,
Bogdan

Labus wrote:
> 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",
> "-----------------------------------------------------\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",
> "-----------------------------------------------------\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;
> }
>
>   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro




More information about the Users mailing list