[OpenSIPS-Users] OpenSIPS and SIP source routing

Bogdan-Andrei Iancu bogdan at voice-system.ro
Wed Apr 28 11:13:56 CEST 2010


yes, as using dialplan module, you can create some rule to automatically 
translate from the DOMAIN of the incoming call to the IP of the 
corresponding Asterisk:


if (!db_translate("1","$rd/$rd")) {
    send_reply("404","domain not found");
    exit;
}
t_relay();


and try  
http://www.opensips.org/html/docs/modules/1.6.x/dialplan.html#id227156  
with 1.4.1.4. String conversion (equal detection, replacement).

Regards,
Bogdan

Labus wrote:
> Little less...
>
> In my issue I have some organizations in OCS (each organization have self
> sip domain and self PSTN GW).
>
> All calls from OCS go to OpenSIPS (through OCS Mediation). I don't use TEL
> URI instead SIP URI, so OpenSIPS receive something like this:
> user1 at domain1.loc, user2 at domain1.loc, user3 at domain1.loc and all these users
> I need routed to Asterisk1 (PSTN-GW1), but if OpenSIPS receive
> userA at domain35.loc (other sip domain) I need routed this call to other
> Asterisk35 (PSTN-GW35).
>
> route{
>     if (!mf_process_maxfwd_header("10")) {
>         sl_send_reply("483","Too Many Hops");
>         exit;
>     };
>     if (msg:len >=  2048 ) {
>         sl_send_reply("513", "Message too big");
>         exit;
>     };
>     if (loose_route())
>     {
>         append_hf("P-hint: rr-enforced\r\n");
>         route(1);
>     };
>     if (is_method("PUBLISH|SUBSCRIBE|NOTIFY|REGISTER"))
>     {
>         sl_send_reply("501", "Method $rm not implemented");
>         exit;
>     };
>
>     if (src_ip==X.X.X.X)   ######## FROM OCS SERVER
>     {
>         xlog("Request from OCS \n");
>         remove_hf("Contact");
>         append_hf("P-hint: outbound\r\n");
>         if($rm=="INVITE" && uri=="user1 at domain1.loc")
>         {
>                 sethostport("A.A.A.A:5060");   #######  PSTN-GW1 
>                 xlog("*******************************");
>                 xlog("DOMAIN1 outbound call from OCS.\n");
>                 xlog("From uri=[$fu]\n");
>                 xlog("Request's method=[$rm]\n");
>                 xlog("Request's uri=[$ru]\n");
>                 xlog("To uri=[$tu]\n");
>                 xlog("*******************************");
>                 if (!t_relay("udp:A.A.A.A:5060"))
>                 {
>                     sl_reply_error();
>                 };
>                 exit;
>        }
>        else  if($rm=="INVITE" && uri=="user1 at domain35.loc")
>        {
>                 sethostport("B.B.B.B:5060");   #######  PSTN-GW35
>                 xlog("*******************************");
>                 xlog("DOMAIN35 outbound call from OCS.\n");
>                 xlog("From uri=[$fu]\n");
>                 xlog("Request's method=[$rm]\n");
>                 xlog("Request's uri=[$ru]\n");
>                 xlog("To uri=[$tu]\n");
>                 xlog("*******************************");
>                 if (!t_relay("udp:B.B.B.B:5060"))
>                 {
>                     sl_reply_error();
>                 };
>                 exit;
>        };
>     }
>     else    # When incoming call from PSTN-GW NN route this to OCS throught
> route1
>     {
>     route(1);
>     };
> }
>
>
> route[1] {
>     # When incoming call from PSTN-GW NN route this to OCS
>     sethostport("X.X.X.X:5060");
>     if (!t_relay("tcp:X.X.X.X:5060")) {
>         sl_reply_error();
>     };
>     exit;
> }
>
> onreply_route {
>         xlog("---------REPLY-------------");
>         xlog("Reply route");
>         xlog("From uri=[$fu]\n");
>         xlog("Request's method=[$rm]\n");
>         xlog("Request's uri=[$ru]\n");
>         xlog("To uri=[$tu]\n");
>         xlog("IP source=[$src_ip]\n");
>         xlog("---------------------------");
> exit;
> }
>
>   


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




More information about the Users mailing list