OK, Daniel and thanks for your help,

I see that you don't append brach but you are calling route(RELAY) instead of t_relay() directly. I have tryed with this configuration within failure route:

if (t_check_status("486|408")) {
               
        #revert_uri();       
        prefix("voicemail");       
        remove_hf("P-App-Name");
        append_hf("P-App-Name: voicemail\r\n");
        append_hf("P-App-Param: mod=box;usr= $rU;dom=sipproxy.a.com;uid=$rU;did=sipproxy.a.com;\r\n");        
        rewritehostport("192.168.0.197:5080");
        $du = $null;
        #append_branch();
        route(RELAY);
        #t_relay();
       
    }
}

And kamailio gets into a strange behavior

|Time     | 192.168.3.20                          | 192.168.0.167                         |
|         |                   | 192.168.0.197     |                  
|3,366    |         INVITE SDP ( telephone-event)          |                   |SIP From: sip:4095@192.168.0.197 To:sip:4440@192.168.0.197
|         |(5060)   ------------------>  (5060)   |                   |
|3,370    |         407 Proxy Authentication Required          |                   |SIP Status
|         |(5060)   <------------------  (5060)   |                   |
|3,380    |         ACK       |                   |                   |SIP Request
|         |(5060)   ------------------>  (5060)   |                   |
|3,382    |         INVITE SDP ( telephone-event)          |                   |SIP From: sip:4095@192.168.0.197 To:sip:4440@192.168.0.197
|         |(5060)   ------------------>  (5060)   |                   |
|3,393    |         100 trying -- your call is important to us          |                   |SIP Status
|         |(5060)   <------------------  (5060)   |                   |
|3,394    |                   |         INVITE SDP ( telephone-event)          |SIP Request
|         |                   |(5060)   ------------------>  (5060)   |
|3,395    |                   |         100 Trying|                   |SIP Status
|         |                   |(5060)   <------------------  (5060)   |
|3,395    |                   |         486 Busy Here                 |SIP Status
|         |                   |(5060)   <------------------  (5060)   |
|3,398    |                   |         ACK       |                   |SIP Request
|         |                   |(5060)   ------------------>  (5060)   |
|3,416    |         500 I'm terribly sorry, server error occurred ...SL)          |                   |SIP Status
|         |(5060)   <------------------  (5060)   |                   |
|3,416    |         486 Busy Here                 |                   |SIP Status
|         |(5060)   <------------------  (5060)   |                   |
|3,418    |         ACK       |                   |                   |SIP Request
|         |(5060)   ------------------>  (5060)   |                   |
|3,418    |         ACK       |                   |                   |SIP Request
|         |(5060)   ------------------>  (5060)   |                   |
|3,872    |         486 Busy Here                 |                   |SIP Status
|         |(5060)   <------------------  (5060)   |                   |
|3,873    |         ACK       |                   |                   |SIP Request
|         |(5060)   ------------------>  (5060)   |                   |
|4,875    |         486 Busy Here                 |                   |SIP Status
|         |(5060)   <------------------  (5060)   |                   |
|4,876    |         ACK       |                   |                   |SIP Request
|         |(5060)   ------------------>  (5060)   |                   |


Are you using this sequence within failure route? or in the call routing section? I'm using this sequence in the route section that is working OK:

if ($rU=~"^voicemail.*")  {
        remove_hf("P-App-Name");
        append_hf("P-App-Name: voicemail\r\n");
        append_hf("P-App-Param: mod=box;usr=$rU;dom=sipproxy.a.com;uid=$rU;did=sipproxy.a.com;\r\n");
        $ru = "sip:" + $rU + "@" + "192.168.0.197:5080";
        route(RELAY);
        exit;
    }

The problem is when I try to get a call forwarded by kamailio to voice mail when it gets a busy message to the destination message. In your implementation are you expecting a 302 (temporary unavailable) message from the destination UAC?

Regards.

L.




2013/7/25 Daniel Tryba <daniel@pocos.nl>
On Thursday 25 July 2013 16:30:21 you wrote:

> if (t_check_status("486|408")) {
>
>         revert_uri();
>         prefix("voicemail");
>         remove_hf("P-App-Name");
>         append_hf("P-App-Name: voicemail\r\n");
>         append_hf("P-App-Param: mod=box;usr= $rU;dom=sipproxy.a.com
> ;uid=$rU;did=sipproxy.a.com;\r\n");
>         rewritehostport("192.168.0.197:5080");
>         $du = $null;
>         #$du = "sip:192.168.0.197";
>         #append_branch();
>         t_relay();

Taking a look at my config which I found to work after the long struggle you
are experiencing right now.

if($avp(dst_voicemail))
{
  $du=$null;
  $ru = "sip:tovm-" + $avp(dst_voicemail) + "@" +
$sel(cfg_get.voicemail.srv_ip) + ":" + $sel(cfg_get.voicemail.srv_port);
  route(RELAY);

  exit;
}

Which effectively sets $du to null (if not null the message would get relayed
to the original destination (the proxy itself)) and rewrites $ru to something
like
"sip:tovm-0123456789@voicemail:5060"
and then just do the normal relay route to deliver the message. Your *_hf
shouldn't have any effect on routing.

--

POCOS B.V. - Croy 9c - 5653 LC Eindhoven
Telefoon: 040 293 8661 - Fax: 040 293 8658
http://www.pocos.nl/   - http://www.sipo.nl/
K.v.K. Eindhoven 17097024