Maria,
I implemented this using avpops. Subscribers enable/disable call forwarding, forward busy, forward no answer via a rows in usr_preferences which avpops reads before routing the call.
If a "forward xxxx" setting is enabled then the on_failure[] route kicks in and uses avp_pushto() in order to get the next appropriate destination as specified by the forwarding settings.
Here is a snippet from my ser.cfg. It took quite a bit of work to get all the forwarding stuff working because I needed to make sure that users couldn't forward to "invalid" destinations such as 411 or international (if they weren't in the "int" group) or even to the PSTN if they weren't in the free-pstn group.
Regards, Paul
modparam("avpops", "avp_url", "mysql://ser:heslo@localhost/ser") modparam("avpops", "avp_table", "usr_preferences") modparam("avpops", "avp_aliases", "voicemail=i:500;calltype=i:700;fwd_no_answer_type=i:701;fwd_busy_type=i:702")
route { .. All the ususal stuff lookup("aliases"); ...blah blah
if (!lookup("location")) { ..more blah blah };
# ------------------------------------------------------------------------ # Call Forwarding Section # ------------------------------------------------------------------------ if (method=="INVITE") {
# here we must store the current (aka original) R-URI because if # we set call forwarding and the forwarded number is busy then we # need to use this original R-URI to determine which voicemail # box we should go to # # flag 31 means they are in the "voicemail" group (ie, they have # voicemail enabled) if (isflagset(31)) { avp_write("$ruri", "$voicemail"); };
if (avp_db_load("$ruri/username", "s:callfwd")) {
avp_pushto("$ruri", "s:callfwd");
# lookup the call fowarding number to see if it is a served # sip number or a PSTN number
# check forwarding number rules route(1);
if (avp_check("$calltype", "eq/-/i")) {
sl_send_reply("503", "Service Unavailable"); break; };
# test for domestic PSTN gateway if (avp_check("$calltype", "eq/dom/i")) {
route(3); break; };
# test for international PSTN gateway if (avp_check("$calltype", "eq/int/i")) {
route(6); break; };
} else {
# save R-URI in a temp AVP for later use avp_write("$ruri", "i:99");
# only load the forward no answer option if voice mail is not enabled if (!isflagset(31)) {
if (avp_db_load("$ruri/username", "s:fwdnoanswer")) {
route(1);
if (!avp_check("$calltype", "eq/-/i")) {
if (avp_check("$calltype", "eq/dom/i")) { avp_write("dom", "$fwd_no_answer_type"); } else if (avp_check("$calltype", "eq/int/i")) { avp_write("int", "$fwd_no_answer_type"); } else { avp_write("sip", "$fwd_no_answer_type"); }
setflag(27); }; }; };
if (avp_db_load("$ruri/username", "s:fwdbusy")) {
route(1);
if (!avp_check("$calltype", "eq/-/i")) {
if (avp_check("$calltype", "eq/dom/i")) { avp_write("dom", "$fwd_busy_type"); } else if (avp_check("$calltype", "eq/int/i")) { avp_write("int", "$fwd_busy_type"); } else { avp_write("sip", "$fwd_busy_type"); }
setflag(26); }; };
avp_pushto("$ruri", "i:99"); }; };
# route as normal ... blah blah blah t_on_failure("1"); ... relay the message now with t_relay(); }
route[1] {
# Here we have route checks for all the call forwarding stuff. The return # values are passed as AVP $calltype as follows: # # "-" = R-URI is not allowed # "dom" = R-RURI is a domestic call # "int" = R-RURI is an international call # "sip" = R-RURI is a sip call # # I use AVPs to return values from this "function"
avp_write("-", "$calltype");
if (uri=~"^sip:1[0-9]{10}@") { strip(1); };
# deny **ALL** access to forwarding to 411, 911, 900, and 976 numbers if ((uri=~"^sip:411@.*") || (uri=~"^sip:911@.*") || (uri=~"^sip:900[0-9]{7}@") || (uri=~"^sip:976[0-9]{7}@")) { break; };
lookup("aliases"); if (!lookup("location")) {
if (uri=~"^sip:[0-9]{10}@") {
# test for domestic PSTN number
# flag 28 means they are in the "free-pstn" group if (isflagset(28)) { avp_write("dom", "$calltype"); };
} else if (uri=~"^sip:011[0-9]*@") {
# test for international PSTN number
# flag 29 means they are in the "int" group if (isflagset(29)) { avp_write("int", "$calltype"); }; };
break; };
avp_write("sip", "$calltype"); }
failure_route[1] {
# if caller hung up then don't sent to voicemail if (t_check_status("487")) { break; };
# flag 26 means that a "forward busy" number is set if (isflagset(26) && t_check_status("486")) {
# forward busy is flag 26 if (avp_pushto("$ruri", "s:fwdbusy")) { avp_delete("s:fwdbusy"); append_branch(); resetflag(26);
# test for domestic PSTN gateway if (avp_check("$fwd_busy_type", "eq/dom/i")) { # test for domestic PSTN gateway route(3); } else if (avp_check("$fwd_busy_type", "eq/int/i")) { # test for international PSTN gateway route(6); } else { # default to sip call route(2); };
break; }; };
# here we can have either voicemail __OR__ forward no answer # flag 27 means that a "forward no answer" number is set # NOTE: "forward no answer" only applies to users that __DO NOT__ # have voicemail enabled if (isflagset(27) && t_check_status("408")) {
# forward no answer is flag 27
if (avp_pushto("$ruri", "s:fwdnoanswer")) { avp_delete("s:fwdnoanswer"); append_branch(); resetflag(27);
if (avp_check("$fwd_no_answer_type", "eq/dom/i")) { # test for domestic PSTN gateway route(3); } else if (avp_check("$fwd_no_answer_type", "eq/int/i")) { # test for international PSTN gateway route(6); } else { # default to sip call route(2); break; };
} else if (isflagset(31) && avp_pushto("$ruri", "$voicemail")) {
# flag 31 means the user has voicemail enabled
avp_delete("$voicemail");
# send to the voicemail server route(4); break; }; }
--- Maria Yndefors Maria.Yndefors@bredband.com wrote:
Hi,
Is it possible to configure SER to forward calls that are busy only for subscribers that have ordered the service? I can't see that subscriber's forwarding information is stored in the database.
Also does SER support privacy standards: RFC 3323, RFC 3325?
Regards /Maria
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
__________________________________ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com