[OpenSIPS-Users] OpenSIPS and SIP source routing
Labus
roman_chel at mail.ru
Mon Apr 26 13:32:21 CEST 2010
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;
}
--
View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/OpenSIPS-and-SIP-source-routing-tp4930040p4962114.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
More information about the Users
mailing list