[OpenSER-Users] uac_replace_from and CANCEL

Bai Shi baishi at nus.edu.sg
Thu Mar 13 16:59:46 CET 2008


Hi Thomas,
First I think in ur config, rewritehostport won't work, coz t_relay will keep the same uri within one transaction, no matter what you do with it. Actually what I mean is if you modify to something different, it won't work. But for most of the cases, it won't cause problem, but it is simply redundant.

To Thomas and Bogdan:

I tested with 1.3.1 again, while 1.2.3 working perfectly, the 1.3.1 still refuse to do my trick. My openser.cfg contains something like this:
route {
...
if (method=="BYE" || method=="CANCEL") {
          xlog("L_NOTICE", "NON-LOOSEROUTE CANCLE OR BYE\n");

          route(3);
          uac_replace_from("hello", "sip:1234 at 4567.com");
#          remove_hf("From");
          t_relay();
        } 
}
route(3) is my script to update sth in the db. Should have nothing to do with sip signaling.
And my ngrep capture is as follows (I'm sorry I need to replace my gw addr to AABBCC according to company rule):

/* from my uac to openser */
U 172.19.171.63:51176 -> 172.19.172.101:5070
  CANCEL sip:85281663973 at 172.19.172.101:5070 SIP/2.0..Via: SIP/2.0/UDP 172.19.171.63:51176;branch=z9hG4bK-d87543-
  a5171d5ac15be72b-1--d87543-;rport..To: "85281663973"<sip:85281663973 at 172.19.172.101:5070>..From: "laobai"<sip:12
  34 at 172.19.172.101:5070>;tag=4a6c2236..Call-ID: 6a10b93eeb394e09YmQxNjQ4NDA1OTU1ZDgwYjg0ZTNmYjEzNjY2NWU5MGY...C
  Seq: 1 CANCEL..User-Agent: eyeBeam release 1003s stamp 31159..Content-Length: 0....

/* debug info here */
NON-LOOSEROUTE CANCLE OR BYE

/* automatic 1xx response by TM */
#
U 172.19.172.101:5070 -> 172.19.171.63:51176
  SIP/2.0 200 canceling..Via: SIP/2.0/UDP 172.19.171.63:51176;branch=z9hG4bK-d87543-a5171d5ac15be72b-1--d87543-;
  rport=51176..To: "85281663973"<sip:85281663973 at 172.19.172.101:5070>;tag=06c52d26462d9835792f0cb3537991da-7274..F
  rom: "laobai"<sip:1234 at 172.19.172.101:5070>;tag=4a6c2236..Call-ID: 6a10b93eeb394e09YmQxNjQ4NDA1OTU1ZDgwYjg0ZTN
  mYjEzNjY2NWU5MGY...CSeq: 1 CANCEL..Server: OpenSER (1.3.1-notls (i386/linux))..Content-Length: 0....

/* sending out by openser */
#
U 172.19.172.101:5070 -> AABBCC:5060
  CANCEL sip:85281663973 at AABBCC:5060 SIP/2.0..Via: SIP/2.0/UDP 172.19.172.101:5070;branch=z9hG4bK4714.e86c
  9a35.0..From: "laobai"<sip:1234 at 172.19.172.101:5070>;tag=4a6c2236..Call-ID: 6a10b93eeb394e09YmQxNjQ4NDA1OTU1ZD
  gwYjg0ZTNmYjEzNjY2NWU5MGY...To: "85281663973"<sip:85281663973 at 172.19.172.101:5070>..CSeq: 1 CANCEL..Max-Forwards
  : 70..User-Agent: OpenSER (1.3.1-notls (i386/linux))..Content-Length: 0....

Sorry for attach so much irritating dump, but if you can spare sometime, I'll appreciate your help very very much.

As you can see, the openser is sending out exactly the same From regardless the uac_replace_from(). "NON-LOOSEROUTE CANCLE OR BYE" should prove the execution of this block.
The difference between mine and Thomas script is I'm not using append_branch(), to be frank, I'm quite blur when to use append_branch(), but I just tested with append_branch() added.
It is the same result.

I'm quite frustrated now. Bogdan, I do beg ur reconfirmation about this. I know I may have made stupid mistake, if you find it please kindly point it out. Thank you very much for your time and effort.

Best Rgds,
Bai shi

-----Original Message-----
From: users-bounces at lists.openser.org [mailto:users-bounces at lists.openser.org] On Behalf Of Thomas Gelf
Sent: 2008年3月13日 4:26
To: users at openser.org
Subject: Re: [OpenSER-Users] uac_replace_from and CANCEL

Hi Bai Shi,

I have been running some post-1.3 SVN release for a while, and 1.3.1
since yesterday on my test system. CANCEL behaves fine - even when
combined with uac_replace_from. But note that in my setup I'm also
authenticating each forwarded call with uac_auth - which may result
in different behaviour, even if CANCEL is obviously not "uac_auth'ed".

Cheers,
Thomas


Bai Shi schrieb:
> Hi, Thomas,
> This will do in openser 1.2, however, in openser 1.3 it won't do any help. The CANCEL will be sent out regardless what you have done to the request, but follow the information in the original INVITE. I tested it and suffered a lot ;(
> Rgds,
> BS
> 
> -----Original Message-----
> From: users-bounces at lists.openser.org [mailto:users-bounces at lists.openser.org] On Behalf Of Andreas Granig
> Sent: 2008年3月13日 2:54
> To: Thomas Gelf
> Cc: users at openser.org
> Subject: Re: [OpenSER-Users] uac_replace_from and CANCEL
> 
> Hi Thomas,
> 
> Yes, I'm doing it that way now (without that "append_branch()" though), 
> but if you have an uuid-based setup where you fetch the uuid from the 
> subscriber table during authentication of the INVITE and then with that 
> uuid fetch dynamic data from the usr_preferences table to be used for 
> "uac_rewrite_host()", then you have to do some work-arounds and hacks to 
> get that data for the CANCEL as well, which could be quite a pain.
> 
> So yes, it would be really great if this could be done automatically 
> *hint hint* :)
> 
> Andreas
> 
> Thomas Gelf wrote:
>> Applying uac_replace_from() to the CANCEL request should do the job,
>> it sadly doesn't happen automagically :'-(
>>
>> Try something like:
>>
>>      if(is_method("CANCEL") && uri =~ "^sip:...")
>>      {
>>          if(t_check_trans())
>>          {
>>              rewritehostport("...");
>>              uac_replace_from("...");
>>              append_branch();
>>          }
>>          if(!t_relay())
>>          {
>>              sl_reply_error();
>>          }
>>      }
>>
>> Cheers,
>> Thomas Gelf
>>
>> Andreas Granig schrieb:
>>> Hi,
>>>
>>> I hit another problem with a Cisco PGW in combination with CANCEL, and 
>>> I'm not sure which fault it is. If I do uac_replace_from in the INVITE, 
>>> the From-Header is altered somehow and sent to the PGW. So if A calls B 
>>> where B is a PGW, the From from A to OpenSER is for example 
>>> sip:a at somedomain and from OpenSER to B it's sip:other-a at somedomain.
>>>
>>> If the call is cancelled, the From-header isn't altered, so the From 
>>> from A to OpenSER is sip:a at somedomain and from OpenSER to B it's 
>>> sip:a at somedomain as well.
>>>
>>> Now the PGW seems to ignore this CANCEL, and I guess it's because of the 
>>> different From-usernames, since it works if I don't do any uac_replace_from.
>>>
>>> RFC3261 says in §9.1:
>>> The Request-URI, Call-ID, To, the numeric part of CSeq, and From header
>>> fields in the CANCEL request MUST be identical to those in the
>>> request being cancelled, including tags.
>>>
>>> So is it correct behavior of the PGW because the From header in the 
>>> CANCEL is different from the From header in the INVITE? Should OpenSER 
>>> alter the From in the CANCEL as well? Or should the PGW just check the 
>>>  From tags, but not the From URI?
>>>
>>> Andreas


_______________________________________________
Users mailing list
Users at lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/users


More information about the Users mailing list