[Kamailio-Users] [OpenSER-Users] Problem getting redirect reason in uac_redirect
Ruchir
ruchir.lists at gmail.com
Wed Aug 13 17:18:29 CEST 2008
Here it is my failure route where I handle 302 response.
failure_route[1]
{
xlog("------- failure_route[1] ----- \n ");
t_on_branch("1");
if(t_check_status("302"))
{
xlog("------- t_check_status(302) ----- \n ");
get_redirects("4:1","
Redirected");
route(1);
}
if( t_check_status("486") && isbflagset(17))
{
xlog("------- t_check_status(486) -- isflagset(17) ----- \n ");
end_media_session();
#resetbflag(6);
append_hf("SRC-USER: $rU\r\n");
if(avp_pushto("$ruri","$avp(s:cfwdbusy)"))
{
append_hf("SRC-CALL-TYPE: cfwdbusy\r\n");
append_hf("CFWD: YES\r\n");
avp_delete("$avp(s:cfwdbusy)");
resetbflag(17);
append_branch();
append_hf("PREV_STATUS: $T_reply_code\r\n");
#route(5);
$avp(i:120) = $avp(s:inv_timeout);
route(1);
exit;
}
}
if( t_check_status("408") && isbflagset(18))
{
xlog("------- t_check_status(408) -- isflagset(18) ----- \n ");
end_media_session();
#resetbflag(6);
append_hf("SRC-USER: $rU\r\n");
if(avp_pushto("$ruri","$avp(s:cfwdnoanswer)"))
{
append_hf("SRC-CALL-TYPE: cfwdnoanswer\r\n");
append_hf("CFWD: YES\r\n");
avp_delete("$avp(s:cfwdnoanswer)");
resetbflag(18);
append_branch();
append_hf("PREV_STATUS: $T_reply_code\r\n");
route(5);
$avp(i:120) = $avp(s:inv_timeout);
route(1);
exit;
}
else if(isbflagset(4))
{
xlog("------- t_check_status(408) -- Voicemail ----- \n ");
if(!t_write_unix("/tmp/sems_sock","voicemail/voicemail_headers"))
{
xlog("----------------- Error--- not
communicating----------- \n ");
exit;
}
exit;
}
}
}
On Fri, Aug 1, 2008 at 3:05 PM, Ruchir <ruchir.lists at gmail.com> wrote:
> It seems it is not possible?
>
>
> On Fri, Jul 25, 2008 at 4:20 PM, Ruchir <ruchir.lists at gmail.com> wrote:
>
>> Now I'm getting the forward reason. But still there's problem with CDR.
>> I have set onreply avp by
>>
>> modparam("tm", "onreply_avp_mode", 1)
>>
>>
>> I've set following in onreply route
>>
>> if($hdr(Diversion)!=null)
>>> {
>>> avp_delete("$avp(s:src_call_type)");
>>> $avp(s:src_call_type) = $hdr(Diversion);
>>> xlog("Client call forwarding to $avp(s:src_user_reply)\n ");
>>>
>> avp_subst("$avp(s:src_user_reply)",
>>> "/(.*)<sip:(.*)@(.*)>;reason=(.*)/\4/");
>>>
>>
>>>
>>> switch($avp(s:src_call_type))
>>> {
>>> case "unconditional":
>>> $avp(s:call_type) = "cwfd";
>>> break;
>>> case "user-busy":
>>> $avp(s:call_type) = "cwfdbusy";
>>> break;
>>> case "no-answer":
>>> $avp(s:call_type) = "cwfdnoanswer";
>>> break;
>>> default:
>>> log("no forwarding\n");
>>> }
>>>
>>> }
>>>
>>> But the problem is that records are not generated the way we expect and
>> the way it works in normal forwarding using usr_preferences. For example
>> call is forwarded from one user to another, the first leg of the call should
>> be logged as it should normally be($fU in leg source, $rU in leg destination
>> & calltype=call) and in next cdr log, it should log with forwarding
>> details(Forwarding user in leg source, forwarded user in leg destination &
>> calltype=cfwd). But it actually generates 5 records(1 failed invite, 2 ok
>> invites & 2 byes, instead of 2 invites & 2 byes) of the call. Also as we set
>> calltype and leg source in onreply route, it'll store that date for the
>> first leg of the CDR which should not happen.
>> Any advice how to forward the details to next call leg?
>>
>>
>> On Tue, Jul 22, 2008 at 3:59 PM, Ruchir <ruchir.lists at gmail.com> wrote:
>>
>>> I tried this but no luck. I'm storing avp in onreply route. That avp is
>>> set in radius_extra param.
>>>
>>>
>>> On Mon, Jul 21, 2008 at 10:32 PM, Bogdan-Andrei Iancu <
>>> bogdan at voice-system.ro> wrote:
>>>
>>>> Ruchir wrote:
>>>>
>>>>> I added "modparam("tm", "onreply_avp_mode", 1)" in config file. I've
>>>>> stored the diversion header in reply route using following code.
>>>>>
>>>>> if($hdr(Diversion)!=null)
>>>>> {
>>>>> avp_delete("$avp(s:src_user_reply)");
>>>>> $avp(s:src_user_reply) = $hdr(Diversion);
>>>>> xlog("Client call forwarding to
>>>>> $avp(s:src_user_reply)\n ");
>>>>> }
>>>>>
>>>>>
>>>>> But I always get NUll value in $avp(s:src_user_reply) when I check in
>>>>> script when new invite arrives.
>>>>>
>>>> The AVP will not be visible in a different transaction (for another
>>>> invite). The AVP will be present only when doing acc for the transaction you
>>>> set the AVP for.
>>>>
>>>> Regards,
>>>> Bogdan
>>>>
>>>>>
>>>>> On Mon, Jul 21, 2008 at 1:48 PM, Bogdan-Andrei Iancu <
>>>>> bogdan at voice-system.ro <mailto:bogdan at voice-system.ro>> wrote:
>>>>>
>>>>> Hi Ruchir,
>>>>>
>>>>> You may try the following approach:
>>>>>
>>>>> 1) in onreply_route, if 3xx, store the info from the reply in an
>>>>> AVP (be sure an enable onreply_avp_mode -
>>>>> http://www.openser.org/docs/modules/1.3.x/tm.html#AEN313)
>>>>>
>>>>> 2) in failure route, if the 3xx was selected as final response,
>>>>> use the AVP for extra accouting.
>>>>>
>>>>> regards,
>>>>> Bogdan
>>>>>
>>>>> Ruchir wrote:
>>>>>
>>>>> I'm using uac_redirect module to handle redirect and
>>>>> accounting from openser. Redirect works fine so as cdr but I'm
>>>>> not getting how to write redirect reason in cdr. I didn't find
>>>>> any way to find and store redirect reason(call forward, busy,
>>>>> no answer) in CDR. Does anyone know how to do it?
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at lists.openser.org <mailto:Users at lists.openser.org>
>>>>> http://lists.openser.org/cgi-bin/mailman/listinfo/users
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kamailio.org/pipermail/users/attachments/20080813/0b437f14/attachment.htm
More information about the Users
mailing list