Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#35 do_routing is not allowed in FAILURE_ROUTE

trunk
closed-fixed
modules (454)
5
2008-10-27
2008-10-22
Jason Shugart
No

Hi,
The README for the drouting module says the do_routing function can be used in failure routes, but the code is not there to handle this. This is the message I get when checking my config:

Oct 22 15:40:06 [25024] DBG:core:find_cmd_export_t: <do_routing> not found
Oct 22 15:40:06 [25024] DBG:core:find_cmd_export_t: found <do_routing>(1) in module drouting [/lib/opensips/modules/]
Oct 22 15:40:06 [25024] CRITICAL:core:yyerror: parse error in config file, line 423, column 19-20: Command cannot be used in the block

Thanks.

Discussion

    • assigned_to: nobody --> bogdan_iancu
    • status: open --> closed-fixed
     
  • Hi Jason,

    it is fixed now on SVN trunk - please update and test again.

    Thanks and regards,
    Bogdan

     
  • Jason Shugart
    Jason Shugart
    2008-10-24

    Your fix was not what I was expecting. Based on the LCR module, and my past use of other functions in the FAILURE_ROUTE, I was expecting a function that would pop the next URI off the AVP and do an append_branch. This function can be accomplished using the tools available in other modules, so it is not entirely needed. However I think most people who use this module would find it easier to use a single function. I would be happy to send write the code and send a patch.

     
  • Jason Shugart
    Jason Shugart
    2008-10-24

    • status: closed-fixed --> open-fixed
     
  • Jason Shugart
    Jason Shugart
    2008-10-24

    Patch to drouting trunk

     
    Attachments
  • Jason Shugart
    Jason Shugart
    2008-10-24

    I attached a patch that works how I would like. It adds a next_routing function that pops the next avp from the message and appends it to the list. It would return 1 if it appended a new branch, 0 if nothing was left, and -1 on error. This function could also be merged into the do_routing function. Thanks for taking a look at this.

     
  • Hi Jason,

    Thanks for the patch - I made some changes into the function implementation:
    1) do not return 0 ever - this will stop the script execution
    2) skip bogus AVPs that might have numerical values (be more safe)
    3) instead of creating a branch, the function just sets the new RURI (gives you more liberty in script - like setting a socket or other params for the new branch)
    4) use a more flexible function (rewrite_uri) instead of heavy do_action.

    Please test it and let me know if everything ok.

    Thanks and regards,
    Bogdan

     
    • status: open-fixed --> closed-fixed