[OpenSIPS-Users] DIferent call Status when base on user Preference
pjgonzalez
pgonzalez at dgtec.net.do
Wed Jan 14 02:19:57 CET 2009
Hi every body, i want to be able route calls from my sip, depending on his
status, For example when the user is online he can change his status to
ringOndevice to ring on his sip-phone, voice-mail to route to asterisk
voicemail, and callforward to forward the call to a given number, the two
first escerany are ok bu, i need to know how can i make a call forward base
on users prefenrece.
i alredy load the user preference from the usr_preference table.
here my script part:
if(nat_uac_test("19"))
{
setbflag(6);
fix_nated_contact();
xlog("L_INFO", "Fixing NAT AGAIN- M=$rm RURI=$ru F=$fu USR=$tU
T=$tu IP=$si ID=$ci\n");
};
if(!lookup("location")){
avp_db_query("SELECT count(*) FROM usr_preferences WHERE
uuid='$tU'","$avp(s:hasPreference)");
xlog("L_INFO", "User Preference:
atributo:'$avp(s:hasPreference)'\n");
CHECH IF USR is on preference DB to forward to voice Mail server.
if($avp(s:hasPreference)){
route(9);
exit;
}
#OUTBOUNT CALLS/
if (uri=~"^sip:[0-9]*@") {
route(3);
route(6);
exit;
};
}
else
{
route(13);
}
route[11]
{
xlog("L_INFO","Here on route 11");
avp_pushto("$ru", "$avp(s:callForward)");
rewritehostport("XXX.XXX.XXX.XXX:5070");
append_branch();
xlog("L_INFO", "The call was forwarded to: $avp(s:callForward) - M=$rm
RURI=$ru F=$fu USR=$tU T=$tu IP=$si ID=$ci\n");
#t_on_failure("1");
#t_on_reply("1");
#t_relay();
#xlog("L_INFO", "The call was relay to: $avp(s:callForward) - M=$rm RURI=$ru
F=$fu USR=$tU T=$tu IP=$si ID=$ci\n");
#route(6);
#t_on_branch("1");
route(12);
}
route[12]{
xlog("L_INFO","Here on route 12");
t_on_failure("3");
t_on_reply("1");
if (!t_relay()) {
sl_reply_error();
xlog("L_INFO", "The error: - M=$rm RURI=$ru F=$fu USR=$tU T=$tu
IP=$si ID=$ci\n");
};
exit;
}
My script is base on sipwise sample.
thanks a lot.
route[13]
{
xlog("L_INFO", "User is Online - M=$rm RURI=$ru F=$fu
USR=$tU T=$tu IP=$si ID=$ci\n");
if(avp_db_load("$ru/username","$avp(s:callForward)"))
{
#xlog("L_INFO", "The call was forwarded to:
$avp(s:callForward) - M=$rm RURI=$ru F=$fu USR=$tU T=$tu IP=$si ID=$ci\n");
#avp_pushto("$tu", "$avp(s:callForward)");
route(11);
exit;
}
else if(avp_db_load("$ru/username","$avp(s:ringOnDevice)"))
{
xlog("L_INFO"," The call is ringing on: $ruri");
route(3);
route(8);
exit;
}
else if(avp_db_load("$ru/username","$avp(s:voiceMail)"))
{
xlog("L_INFO", "Voice Mail HERE!! - M=$rm RURI=$ru
F=$fu T=$tu IP=$si ID=$ci\n");
route(9);
exit;
};
exit;
}
--
View this message in context: http://n2.nabble.com/DIferent-call-Status-when-base-on-user-Preference-tp2154604p2154604.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
More information about the Users
mailing list