To simplify, the problem seems to come down to the following: how do you cancel/end an early state dialog between the caller and callee after `fr_inv_timeout` occurs? Kam self-generates a proper CANCEL towards the callee, while the caller gets a `408 Request Timeout' with a different To-tag.

I've tried:
dlg_bye("all") - throws an error, non-confirmed dialogs can't be terminated with this function
t_cancel_callid("$dlg(callid)", "$dlg(from_cseq)", "22", "200") - doesn't seem to produce any action

Suggestions?

On Sat, Apr 6, 2019 at 11:25 AM Sergiu Pojoga <pojogas@gmail.com> wrote:
Hi ppl,

Scenario: invite from upstream is t_relayed to a client gateway. After `fr_inv_timeout` occurs, in a failure route I simply t_reply with "503 - Service unavailable", then exit(). 

However, the upstream provider simply ignores this reply, call doesn't hang up. This doesn't happen when the client's gateway generates identical 503 or other negative replies.

I suspect this is happening because the To-tag in the Kam generated 503 reply doesn't match with the To-tag that previously was forwarded from the client's gateway to the upstream provider in the `180 Ringing`.

Any suggestions what can be done about it?


2019/04/06 10:42:46.127177 65.39.xxx.xxx:5060 -> 208.72.xxx.xxx:5060                                                                                                                                                           
SIP/2.0 180 Ringing                                                                                                                                                                                                                         
Via: SIP/2.0/UDP 208.72.xxx.xxx:5060;received=208.72.xxx.xxx;rport=5060;branch=z9hG4bK1982422573                                                                                                        
Record-Route: <sip:65.39.xxx.xxx;lr=on;did=915.8af1>                                                                                                                                                                                        
From: "SERGIU" <sip:514XXXXXXX@208.72.xxx.xxx>;isup-oli=00;tag=1975755942                                                                                                                              
To: <sip:514XXXXXXX@65.39.xxx.xxx>;tag=as2ab54180                                                                                                                                                                                      
Call-ID: DID-28270826@208.72.xxx.xx                                                                                                                                                                                                         
CSeq: 477023 INVITE                                                                                                                                                                                                                         
Supported: replaces, timer, path                                                                                                                                                                                                            
Contact: <sip:1514XXXXXXX@65.39.xxx.xxx:5060>                                                                                                                                                                                               
Content-Length: 0                                                                                                                                                                                                                           
                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                          
2019/04/06 10:42:51.072516 65.39.xxx.xxx:5060 -> 208.72.xxx.xxx:5060                                                                                                                                                            
SIP/2.0 503 Service Unavailable                                                                                                                                                                                                             
Call-ID: DID-28270826@208.72.xxx.xx                                                                                                                                                                                                         
Via: SIP/2.0/UDP 208.72.xxx.xxx:5060;rport=5060;branch=z9hG4bK1982422573;received=208.72.xxx.xxx                                                                                                        
From: "SERGIU" <sip:514XXXXXXX@208.72.xxx.xxx>;isup-oli=00;tag=1975755942                                                                                                                              
To: <sip:514XXXXXXX@65.39.xxx.xxx>;tag=a6a1c5f60faecf035a1ae5b6e96e979a-8e82                                                                                                                                  
CSeq: 477023 INVITE                                                                                                                                                                                                                         
Server: KAM                                                                                                                                                                                                                                 
Content-Length: 0 

Thanks,
--Sergiu