|
@@ -4,7 +4,7 @@
|
|
|
# $Id$
|
|
|
#
|
|
|
|
|
|
-debug=1 # debug level (cmd line: -dddddddddd)
|
|
|
+debug=3 # debug level (cmd line: -dddddddddd)
|
|
|
fork=yes
|
|
|
log_stderror=no # (cmd line: -E)
|
|
|
#log_stderror=yes # (cmd line: -E)
|
|
@@ -46,104 +46,93 @@ modparam("auth", "user_column", "user_id")
|
|
|
|
|
|
|
|
|
route{
|
|
|
-
|
|
|
- # special measure for our US friends
|
|
|
- if (uri=~"sip:17@") {
|
|
|
- seturi("sip:[email protected]");
|
|
|
- forward( "siptest.wcom.com", 5060 );
|
|
|
- break;
|
|
|
- };
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- # filter local stateless ACK generated by authentication of mf replies
|
|
|
+ # filter local stateless ACK generated by authentication and other replies
|
|
|
sl_filter_ACK();
|
|
|
|
|
|
# filter too old messages
|
|
|
- log("Checking maxfwd\n");
|
|
|
+ log("Checking maxfwd\n");
|
|
|
if (!mf_process_maxfwd_header("10")) {
|
|
|
log("Too many hops\n");
|
|
|
sl_send_reply("483","Too Many Hops");
|
|
|
break;
|
|
|
};
|
|
|
|
|
|
- # Do strict routing if route headers present
|
|
|
+ # Do strict routing if route headers present
|
|
|
rewriteFromRoute();
|
|
|
|
|
|
# divert voicemail requests
|
|
|
if (uri=~"mail\.iptel\.org" | uri=~":5066") {
|
|
|
log("Request is for voicemail\n");
|
|
|
- #forward("fox.iptel.org", 6060);
|
|
|
sethost("iptel.org");
|
|
|
t_relay_to("fox.iptel.org", "5066");
|
|
|
- } else {
|
|
|
- # process requests for iptel.org (note the wildcard in
|
|
|
- # the regex end -- that captures URIs which have port
|
|
|
- # numbers or parameters in them); also include gateway
|
|
|
- # here too -- we RR to the gateway which means that its
|
|
|
- # address shows up in d-uri of subsequent requests after
|
|
|
- # having called rewriteFromRoute and we want the requests
|
|
|
- # to go through our PSTN authorization code
|
|
|
- if (uri=~"[@:]iptel\.org([;:].*)*" | uri=~"[@:]195\.37\.77\.101([;:].*)*" |
|
|
|
- uri=~"@195\.37\.77\.110([;:].*)*" ) {
|
|
|
- log("Request is for iptel.org\n");
|
|
|
-
|
|
|
- # registers always MUST be authenticated to
|
|
|
- # avoid stealing incoming calls
|
|
|
- if (method=="REGISTER") {
|
|
|
- log("Request is REGISTER\n");
|
|
|
- if (!authorize("iptel.org")) {
|
|
|
- log("REGISTER has no credentials, sending challenge\n");
|
|
|
- challenge("iptel.org", "noqop");
|
|
|
- break;
|
|
|
- };
|
|
|
- # prohibit attempts to grab someone else's address
|
|
|
- # using someone else's valid credentials
|
|
|
- if (!check_to()) {
|
|
|
- log("Cheating attempt\n");
|
|
|
- sl_send_reply("403", "What a nasty guy you are");
|
|
|
- break;
|
|
|
- };
|
|
|
-
|
|
|
- # update Contact database
|
|
|
- log("REGISTER is authorized, saving location\n");
|
|
|
- save_contact("location");
|
|
|
+ break;
|
|
|
+ };
|
|
|
+
|
|
|
+ # process requests for iptel.org (note the wildcard in
|
|
|
+ # the regex end -- that captures URIs which have port
|
|
|
+ # numbers or parameters in them); also include gateway
|
|
|
+ # here too -- we RR to the gateway which means that its
|
|
|
+ # address shows up in d-uri of subsequent requests after
|
|
|
+ # having called rewriteFromRoute and we want the requests
|
|
|
+ # to go through our PSTN authorization code
|
|
|
+ if (uri=~"[@:]iptel\.org([;:].*)*" | uri=~"[@:]195\.37\.77\.101([;:].*)*" |
|
|
|
+ uri=~"@195\.37\.77\.110([;:].*)*" ) {
|
|
|
+ log("Request is for iptel.org\n");
|
|
|
+
|
|
|
+ # registers always MUST be authenticated to
|
|
|
+ # avoid stealing incoming calls
|
|
|
+ if (method=="REGISTER") {
|
|
|
+ log("Request is REGISTER\n");
|
|
|
+ if (!authorize("iptel.org")) {
|
|
|
+ log("REGISTER has no credentials, sending challenge\n");
|
|
|
+ challenge("iptel.org", "noqop");
|
|
|
break;
|
|
|
};
|
|
|
-
|
|
|
- # various aliases (might use a database in future)
|
|
|
- if (uri=~"sip:9040@.*") {
|
|
|
- setuser("jiri");
|
|
|
+ # prohibit attempts to grab someone else's address
|
|
|
+ # using someone else's valid credentials
|
|
|
+ if (!check_to()) {
|
|
|
+ log("Cheating attempt\n");
|
|
|
+ sl_send_reply("403", "What a nasty guy you are");
|
|
|
+ break;
|
|
|
};
|
|
|
-# if (uri=~"sip:jiri@.*" & method=="INVITE") {
|
|
|
-# t_fork_to("[email protected]");
|
|
|
-# };
|
|
|
-# if (uri=~"sip:jiri@.*" & method=="INVITE") {
|
|
|
-# t_fork_to("195.37.77.110", "5060");
|
|
|
-# };
|
|
|
-
|
|
|
- # now it's about PSTN destinations through our gateway;
|
|
|
- # note that 8.... is exempted for numerical destinations
|
|
|
- if (uri=~"sip:[0-79][0-9]*@.*") {
|
|
|
- # free call destinations ... no authentication needed
|
|
|
- if (uri=~"sip:001795061546@.*" | uri=~"sip:0016097265544.*" | uri=~"sip:[79][0-9][0-9][0-9]@.*") {
|
|
|
- log("Free PSTN\n");
|
|
|
- } else {
|
|
|
- # all other PSTN destinations only for authenticated users
|
|
|
- # (Cisco GW, which has no digest support, is authenticated
|
|
|
- # by its IP address -- that's for sure not very strong;
|
|
|
- # wth confirmed that we filter packets coming from outside
|
|
|
- # and bearing SRC IP address of a Fokus network)
|
|
|
- if (!(src_ip==195.37.77.110) & !(authorize("iptel.org"))) {
|
|
|
- challenge("iptel.org", "noqop");
|
|
|
- break;
|
|
|
- };
|
|
|
+
|
|
|
+ # update Contact database
|
|
|
+ log("REGISTER is authorized, saving location\n");
|
|
|
+ save_contact("location");
|
|
|
+ break;
|
|
|
+ };
|
|
|
+
|
|
|
+ # various aliases (might use a database in future)
|
|
|
+ if (uri=~"sip:9040@.*") {
|
|
|
+ setuser("jiri");
|
|
|
+ };
|
|
|
+ # special measure for our US friends
|
|
|
+ if (uri=~"sip:17@") {
|
|
|
+ seturi("sip:[email protected]");
|
|
|
+ };
|
|
|
+
|
|
|
+ # now it's about PSTN destinations through our gateway;
|
|
|
+ # note that 8.... is exempted for numerical destinations
|
|
|
+ if (uri=~"sip:[0-79][0-9]*@.*") {
|
|
|
+ # free call destinations ... no authentication needed
|
|
|
+ if (uri=~"sip:001795061546@.*" | uri=~"sip:0016097265544.*" | uri=~"sip:[79][0-9][0-9][0-9]@.*") {
|
|
|
+ log("Free PSTN\n");
|
|
|
+ } else {
|
|
|
+ # all other PSTN destinations only for authenticated users
|
|
|
+ # (Cisco GW, which has no digest support, is authenticated
|
|
|
+ # by its IP address -- that's for sure not very strong;
|
|
|
+ # wth confirmed that we filter packets coming from outside
|
|
|
+ # and bearing SRC IP address of a Fokus network)
|
|
|
+ if (!(src_ip==195.37.77.110) & !(authorize("iptel.org"))) {
|
|
|
+ challenge("iptel.org", "noqop");
|
|
|
+ break;
|
|
|
+ };
|
|
|
|
|
|
- # authorize only for INVITEs -- RR/Contact may result in weird
|
|
|
- # things showing up in d-uri that would break our logic; our
|
|
|
- # major concern is INVITE which causes PSTN costs anyway
|
|
|
+ # authorize only for INVITEs -- RR/Contact may result in weird
|
|
|
+ # things showing up in d-uri that would break our logic; our
|
|
|
+ # major concern is INVITE which causes PSTN costs anyway
|
|
|
|
|
|
- if (method=="INVITE") {
|
|
|
+ if (method=="INVITE") {
|
|
|
|
|
|
# does the authenticated user have a permission for local
|
|
|
# calls? (i.e., is he in the "local" group?)
|
|
@@ -174,47 +163,53 @@ route{
|
|
|
break;
|
|
|
};
|
|
|
|
|
|
- };
|
|
|
- };
|
|
|
- # requests to gateway must be record-route because the GW accepts
|
|
|
- # only reqeusts coming from our proxy
|
|
|
- if (method=="INVITE")
|
|
|
- addRecordRoute();
|
|
|
- # if you have passed through all the checks, let your call go to GW!
|
|
|
- rewritehostport("195.37.77.110:5060");
|
|
|
- } else {
|
|
|
- /* added by Bogdan for cpl demo - Dorgham request*/
|
|
|
- if (uri=~"sip:test@.*" && method=="INVITE")
|
|
|
- {
|
|
|
- log("SER : runing CPL!! :)\n");
|
|
|
- if ( !cpl_run_script() )
|
|
|
- {
|
|
|
- log("SER : Error during running CPL script!\n");
|
|
|
- }else{
|
|
|
- if ( cpl_is_response_reject() ) {
|
|
|
- log("SER: reject");
|
|
|
- sl_send_reply("603","I am not available!");
|
|
|
- break;
|
|
|
- }else if ( cpl_is_response_redirect() ) {
|
|
|
- log("SER : redirect\n");
|
|
|
- cpl_update_contact();
|
|
|
- sl_send_reply("302","Moved temporarily");
|
|
|
- break;
|
|
|
- };
|
|
|
- };
|
|
|
- };
|
|
|
-
|
|
|
- # native SIP destinations are handled using our USRLOC DB
|
|
|
- if (!lookup_contact("location")) {
|
|
|
- log("Unable to lookup contact, sending 404\n");
|
|
|
- sl_send_reply("404", "Not Found");
|
|
|
- break;
|
|
|
- };
|
|
|
- # requests from gateway should be RR-ed too
|
|
|
- if (src_ip==195.37.77.110 && method=="INVITE") {
|
|
|
- addRecordRoute();
|
|
|
};
|
|
|
};
|
|
|
+
|
|
|
+ # requests to gateway must be record-route because the GW accepts
|
|
|
+ # only reqeusts coming from our proxy
|
|
|
+ if (method=="INVITE") addRecordRoute();
|
|
|
+ # if you have passed through all the checks, let your call go to GW!
|
|
|
+ rewritehostport("195.37.77.110:5060");
|
|
|
+ } else {
|
|
|
+
|
|
|
+ # non-nummerical destnations now
|
|
|
+
|
|
|
+ # demo stuff *******************************************
|
|
|
+ /* added by Bogdan for cpl demo - Dorgham request*/
|
|
|
+ if (uri=~"sip:test@.*" && method=="INVITE")
|
|
|
+ {
|
|
|
+ log("SER : runing CPL!! :)\n");
|
|
|
+ if ( !cpl_run_script() )
|
|
|
+ {
|
|
|
+ log("SER : Error during running CPL script!\n");
|
|
|
+ }else{
|
|
|
+ if ( cpl_is_response_reject() ) {
|
|
|
+ log("SER: reject");
|
|
|
+ sl_send_reply("603","I am not available!");
|
|
|
+ break;
|
|
|
+ }else if ( cpl_is_response_redirect() ) {
|
|
|
+ log("SER : redirect\n");
|
|
|
+ cpl_update_contact();
|
|
|
+ sl_send_reply("302","Moved temporarily");
|
|
|
+ break;
|
|
|
+ };
|
|
|
+ };
|
|
|
+ };
|
|
|
+ # End of demo stuff *******************************************
|
|
|
+
|
|
|
+ # native SIP destinations are handled using our USRLOC DB
|
|
|
+ if (!lookup_contact("location")) {
|
|
|
+ log("Unable to lookup contact, sending 404\n");
|
|
|
+ sl_send_reply("404", "Not Found");
|
|
|
+ break;
|
|
|
+ };
|
|
|
+ # requests from gateway should be RR-ed too
|
|
|
+ # (numerical destinations are all RR-ed above)
|
|
|
+ if (src_ip==195.37.77.110 && method=="INVITE") {
|
|
|
+ addRecordRoute();
|
|
|
+ };
|
|
|
+ };
|
|
|
} else {
|
|
|
# outbound requests are allowed only for our users -- we don't
|
|
|
# support relaying and don't like strangers bothering us
|
|
@@ -230,6 +225,5 @@ route{
|
|
|
|
|
|
# we now know we may, we now where, let it go out now!
|
|
|
t_relay();
|
|
|
- };
|
|
|
}
|
|
|
|