<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks is working but when i try to send the forward I’m
doing the following:<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>$rU = $avp(s:callForward)<span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'><o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>rewritehostport("XXX:XXX:XXX:5070");<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> append_branch();<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>t_on_failure("1");<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>
t_on_reply("1");<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> if (!t_relay()) {<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>
sl_reply_error();<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> };<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>And I get the following response on replay 1:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>opensips[2049]: Reply 1 - M=INVITE RURI=<null> S=100
D=Trying F=sip:CallingNumber@SenderGW:5060 T=sip:calledNumber@receiverGW:5060
IP=NAT_IP ID=<CALLID><o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>opensips[2039]: Reply 1 - M=INVITE RURI=<null> S=100
D=Trying F=sip:CallingNumber@SenderGW:5060 T=sip:calledNumber@receiverGW:5060
IP=NAT_IP ID=<CALLID><o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>opensips[2054]: Reply 1 - M=INVITE RURI=<null> S=180
D=Ringing F=sip:CallingNumber@SenderGW:5060 T=sip:calledNumber@receiverGW:5060
IP=NAT_IP ID=<CALLID><o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>opensips[2041]: Reply 1 - M=INVITE RURI=<null> S=403
D=Forbidden F=sip:CallingNumber@SenderGW:5060
T=sip:calledNumber@receiverGW:5060 IP=NAT_IP ID=<CALLID><o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>thanks.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Gustavo Mistrinelli
(via Nabble) [mailto:<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2157067&i=0" target="_top" rel="nofollow">ml-user+125057-519850071@...</a>] <br>
<b>Sent:</b> Tuesday, January 13, 2009 9:52 PM<br>
<b>To:</b> pjgonzalez<br>
<b>Subject:</b> Re: [OpenSIPS-Users] DIferent call Status when base on user
Preference<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal style='margin-bottom:12.0pt'>Hi, <br>
<br>
You can use one line to load all user preferences to avps<br>
<br>
avp_db_load("$ru/username","*")<br>
<br>
Assuming that usr_preferences table have records like that:<br>
<br>
<span style='font-family:"Courier New"'>username | attribute |
value <br>
------------------------------<br>
abcd | callForward | </span>123456<br>
<span style='font-family:"Courier New"'>dcba |
voicemail | true</span><br>
<br>
Then you can check user settings asking:<br>
<br>
if (is_avp_set($avp(s:callForward)) {<br>
$rU = $avp(s:callForward)<br>
}<br>
if (is_avp_set($avp(s:voicemail)) {<br>
if ($avp(s:voicemail)=="true" {<br>
# Redirect to voicemail server<br>
rewritehostport("XXX.XXX.XXX.XXX:5070");<br>
}<br>
}<br>
<br>
I hope you get the idea, if not please review documentation
usr_preferences and avpops module:<br>
<a href="http://www.opensips.org/html/docs/db/db-schema-1.4.x.html#AEN581" target="_top" rel="nofollow">http://www.opensips.org/html/docs/db/db-schema-1.4.x.html#AEN581</a><br>
<a href="http://www.opensips.org/html/docs/modules/1.4.x/avpops.html" target="_top" rel="nofollow">http://www.opensips.org/html/docs/modules/1.4.x/avpops.html</a><br>
<br>
Cheers,<br>
<br>
Gustavo<o:p></o:p></p>
<div>
<p class=MsoNormal>On Tue, Jan 13, 2009 at 11:19 PM, pjgonzalez <<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2154691&i=0" target="_top" rel="nofollow">pgonzalez@...</a>> wrote:<o:p></o:p></p>
<p class=MsoNormal><br>
Hi every body, i want to be able route calls from my sip, depending on his<br>
status, For example when the user is online he can change his status to<br>
ringOndevice to ring on his sip-phone, voice-mail to route to asterisk<br>
voicemail, and callforward to forward the call to a given number, the two<br>
first escerany are ok bu, i need to know how can i make a call forward base<br>
on users prefenrece.<br>
<br>
i alredy load the user preference from the usr_preference table.<br>
<br>
here my script part:<br>
<br>
if(nat_uac_test("19"))<br>
{<br>
setbflag(6);<br>
fix_nated_contact();<br>
xlog("L_INFO", "Fixing
NAT AGAIN- M=$rm RURI=$ru F=$fu USR=$tU<br>
T=$tu IP=$si ID=$ci\n");<br>
};<br>
<br>
if(!lookup("location")){<br>
avp_db_query("SELECT count(*) FROM usr_preferences WHERE<br>
uuid='$tU'","$avp(s:hasPreference)");<br>
xlog("L_INFO",
"User Preference:<br>
atributo:'$avp(s:hasPreference)'\n");<br>
<br>
CHECH IF USR is on preference DB to forward to voice Mail server.<br>
if($avp(s:hasPreference)){<br>
route(9);<br>
exit;<br>
}<br>
#OUTBOUNT CALLS/<br>
if (uri=~"^sip:[0-9]*@") {<br>
route(3);<br>
route(6);<br>
exit;<br>
};<br>
}<br>
else<br>
{<br>
route(13);<br>
}<br>
<br>
route[11]<br>
{<br>
xlog("L_INFO","Here on route 11");<br>
avp_pushto("$ru", "$avp(s:callForward)");<br>
<br>
rewritehostport("XXX.XXX.XXX.XXX:5070");<br>
append_branch();<br>
<br>
xlog("L_INFO", "The call was forwarded to: $avp(s:callForward) -
M=$rm<br>
RURI=$ru F=$fu USR=$tU T=$tu IP=$si ID=$ci\n");<br>
#t_on_failure("1");<br>
#t_on_reply("1");<br>
#t_relay();<br>
#xlog("L_INFO", "The call was relay to: $avp(s:callForward) -
M=$rm RURI=$ru<br>
F=$fu USR=$tU T=$tu IP=$si ID=$ci\n");<br>
#route(6);<br>
#t_on_branch("1");<br>
route(12);<br>
}<br>
<br>
route[12]{<br>
xlog("L_INFO","Here on route
12");<br>
t_on_failure("3");<br>
t_on_reply("1");<br>
if (!t_relay()) {<br>
sl_reply_error();<br>
xlog("L_INFO", "The error:
- M=$rm RURI=$ru F=$fu USR=$tU T=$tu<br>
IP=$si ID=$ci\n");<br>
<br>
};<br>
exit;<br>
}<br>
<br>
My script is base on sipwise sample.<br>
<br>
thanks a lot.<br>
<br>
route[13]<br>
{<br>
<br>
xlog("L_INFO",
"User is Online - M=$rm RURI=$ru F=$fu<br>
USR=$tU T=$tu IP=$si ID=$ci\n");<br>
<br>
if(avp_db_load("$ru/username","$avp(s:callForward)"))<br>
{<br>
#xlog("L_INFO", "The call was forwarded to:<br>
$avp(s:callForward) - M=$rm RURI=$ru F=$fu USR=$tU T=$tu IP=$si
ID=$ci\n");<br>
#avp_pushto("$tu", "$avp(s:callForward)");<br>
route(11);<br>
exit;<br>
}<br>
else
if(avp_db_load("$ru/username","$avp(s:ringOnDevice)"))<br>
{<br>
xlog("L_INFO"," The call is ringing on: $ruri");<br>
route(3);<br>
route(8);<br>
exit;<br>
}<br>
else
if(avp_db_load("$ru/username","$avp(s:voiceMail)"))<br>
{<br>
xlog("L_INFO", "Voice Mail HERE!! - M=$rm RURI=$ru<br>
F=$fu T=$tu IP=$si ID=$ci\n");<br>
route(9);<br>
exit;<br>
};<br>
<br>
exit;<br>
}<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://n2.nabble.com/DIferent-call-Status-when-base-on-user-Preference-tp2154604p2154604.html" target="_blank" rel="nofollow">http://n2.nabble.com/DIferent-call-Status-when-base-on-user-Preference-tp2154604p2154604.html</a><br>
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.<br>
<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2154691&i=1" target="_top" rel="nofollow">Users@...</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank" rel="nofollow">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></p>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><br>
<br clear=all>
<br>
-- <br>
Gustavo Mistrinelli<br>
<br>
_______________________________________________ <br>
Users mailing list <br>
<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2154691&i=2" target="_top" rel="nofollow">Users@...</a> <br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_top" rel="nofollow">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
<o:p></o:p></p>
<div class=MsoNormal align=center style='text-align:center'>
<hr size=1 width="100%" noshade style='color:#CCCCCC' align=center>
</div>
<div>
<p class=MsoNormal><span style='font-size:8.5pt;font-family:"Tahoma","sans-serif";
color:#666666'>This email is a reply to your post @ <a href="http://n2.nabble.com/DIferent-call-Status-when-base-on-user-Preference-tp2154604p2154691.html" target="_top" rel="nofollow">http://n2.nabble.com/DIferent-call-Status-when-base-on-user-Preference-tp2154604p2154691.html</a><br>
You can reply by email or by visting the link above.<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<br><hr align="left" width="300">
View this message in context: <a href="http://n2.nabble.com/DIferent-call-Status-when-base-on-user-Preference-tp2154604p2157067.html">RE: [OpenSIPS-Users] DIferent call Status when base on user Preference</a><br>
Sent from the <a href="http://n2.nabble.com/OpenSIPS---Users-f1449235.html">OpenSIPS - Users mailing list archive</a> at Nabble.com.<br>