Menu

#366 [CPL] <otherwise> not taken if not "Subject" header

ver devel
open-accepted
modules (357)
5
2008-02-01
2007-12-24
No

The following script takes the default action if no "Subject" header exits, but it should take "otherwise" action:

<cpl>
<incoming>
<string-switch field="subject">
<string contains="hello">
<reject status="reject" reason="Subjet = hello" />
</string>
<otherwise>
<location url="sip:voicemail@domain" />
<proxy />
</location>
</otherwise>
</string-switch>
</incoming>
</cpl>

Three cases:

a) "Subject" header containing "hello": The call is rejected (ok).

b) "Subject" header doesn't contain "hello": The call is proxied to "sip:voicemail@domain" (ok).

c) No "Subject" header: default action is triggered, so CPL returns 1 and OpenSER script continues (¿?¿?¿).

RFC 3880 says:

4. Switches

[...]

The output "otherwise", which MUST be the last
output specified if it is present, matches if no
other condition matched.

If no condition matches and no "otherwise" output
was present in the script, the default script
behavior is taken.

So I consider the actual behaviour a bug since "otherwise" should be matched when "Subject" header doesn't exist because **no other condition matched**.

Default script should not be taken since **no condition matches and "otherwise" output DOES be present**.

This issue causes a problem in case of matching a "Subject" header, since I must clone <notpresent> and <otherwise> contents and it shouldn't be necessary according to RFC.

Discussion

  • Bogdan-Andrei Iancu

    • assigned_to: nobody --> bogdan_iancu
     
  • Bogdan-Andrei Iancu

    Logged In: YES
    user_id=1275325
    Originator: NO

    Hi Inaki,

    I went through the RFC and to e honest I'm not 100% sure that your interpretation is the correct one. Actually the RFC seams to me a bit ambiguous in explaining if the "not-present" node is took over by "otherwise" if missing. Basically this is was you say - if the "not-present" node is absent, its case will be took over by "otherwise"..

    Just to clarify the case before getting into code, could you push this question on the "sip-implementers" mailing list? "if 'Subject' is missing and no 'not-present' is present, then the 'otherwise' must be caller? "

    Thanks and regards,
    Bogdan

     
  • Iñaki Baz Castillo

    Logged In: YES
    user_id=1844020
    Originator: YES

    I'll ask it there and comment here the received explanations.
    Thanks.

     
  • Bogdan-Andrei Iancu

    Logged In: YES
    user_id=1275325
    Originator: NO

    I saw the answer from Jonathan Lennox. It looks like I need to make a fix ;)

    Regards,
    Bogdan

     
  • Bogdan-Andrei Iancu

    • status: open --> open-accepted
     

Log in to post a comment.

MongoDB Logo MongoDB