[Kamailio-Users] from replace

Gentrice's kaiser kaiser at gentrice.net
Tue Apr 21 17:40:05 CEST 2009


Daniel,

Thanks for your suggest,
the code has run for years, it's time to update ... thank again.

I try the code with latest 1.4x

I used to test uac_replace_from in request route then failure_route,
it makes two from hdr connect together. That's totally wrong.

If I have no replace_from in route, only in failure_route,
and this faiure route repeat 2+ time (for serial call) , the from get  
"repeated"...

best regards
kk





在 2009/4/21 下午 11:29 時,Daniel-Constantin Mierla 寫到:

>
>
> On 04/21/2009 04:31 PM, Gentrice's kaiser wrote:
>> Dear Sir:
>>
>>
>> I  wrote a failure route  for serial call mechanism, it help for  
>> no  answer call ...
>>   but all these serial calls need to have a new CallerID,
>>   so I use replace_from for this purpose.
>>
>>
>>
>> modparam("uac","from_restore_mode","auto")
>>
>>
>> failure_route[3]
>> {
>> log(1,"******* I'm failure_route[3] *******\n");
>>
>>         if (avp_pushto("$ru", "$avp(forward)"))
>>          {
>>                  append_branch();
>>                  avp_delete("$avp(forward)");
>>                  uac_replace_from("sip:1234@$fd");   # change  
>> from  header
>>                  t_on_failure("3");    # try next , recursive
>>
>>                  t_relay();
>>
>>          }
>>
>> }
>>
>>
>>
>> If  only one forward number in AVP array , this code working fine,
>> the issue will happen if multiple forward number trying,  
>> ( forward  2nd,3rd ...number)
>> the UAC module will restore from header in 200 OK of its  
>> following  message when a UA answered,
>> we will have a duplicated "from header" in 200 OK
> can you paste here the sip trace? Do you call uac_replace_from() in  
> main route as well?
>
> It is strange that you have two From headers.
>
> Also, note that with latest Kamailio (OpenSER) you can do directly  
> script operations instead of using avpops module:
>
> $ru = $avp(forward);
> $avp(forward) = null;
> uac_replace_from("sip:1234@$fd");
> append_branch();
>
> Also, you can write URI directly to the branch:
>
> $br = $avp(forward);
>
> instead of:
>
> $ru = $avp(forward);
> append_branch();
>
>
> See docs about PVs: http://www.kamailio.org/dokuwiki/doku.php/ 
> pseudovariables:1.5.x#request_s_first_branch
>
> Cheers,
> Daniel
>
> -- 
> Daniel-Constantin Mierla
> http://www.asipto.com/




More information about the Users mailing list