#85 sipmsg_validate multiple return values

trunk
closed
modules (91)
5
2012-03-29
2012-03-27
No

It would be helpful if sipmsg_validate returned a different value based on flags used and what in the message was no compliant.

For instance, calling sipmsg_validate("sh") could return -1 if the request is not RFC3261 Compliant, -2 if header validation failed, and -3 if SDP body validation failed. This way the script writer could use a switch statement to return a more exact response without multiple calls to sipmsg_validate().

Example idea of usage:

if (!sipmsg_validate("sh")) {
switch($retcode) {
case -1:
send_reply("400", "Not RFC3261 Compliant");
break;
case -2:
send_reply("400", "Bad Header Body");
break;
case -3:
send_reply("400", "Bad SDP");
break;
default:
send_reply("400", "Bad Request");
}

exit;
}

Discussion

  • Bogdan-Andrei Iancu

    • assigned_to: nobody --> razvancrainea
     
  • Razvan Crainea

    Razvan Crainea - 2012-03-29

    Hi, Ryan!

    I have just added this enhancement in the trunk svn, revision #8880.

    Regards,
    Răzvan

     
  • Razvan Crainea

    Razvan Crainea - 2012-03-29
    • status: open --> closed
     

Log in to post a comment.