Dialplan transaction support (for MikeT)

Three new dialplan methods are now available:

  • sys.StartTransaction()
  • sys.CommitTransaction()
  • sys.RollbackTransaction()

These methods are for dealing with the values that can be stored using the sys.DBWrite and sys.DBRead methods.

If you’re not sure what any of this means for your own sipsorcery dialplan don’t worry about it, only a few people have a requirement to store values in the database.

And I’ve even managed to spend a bit of time investigating gems but haven’t got that working yet.

  1. Mike Telis’s avatar


    thanks a lot! Any chance of getting a brief description / usage examples of new methods? I don’t think I immediately need the roll-back; what I actually need is to “lock” a database record to make sure it can’t be accessed / modified by the other session (instance of dialplan).




  2. Mike Telis’s avatar

    What I actually wanted to know, would this code serialize DB access:

    rec = sys.DBRead(“Key”)
    # … record processing
    sys.DBWrite(“Key”, rec)



    1. sipsorcery’s avatar

      I’m not sure what you mena by serialise access. If you mean would they happen in sequence then the answer is yes.

      When you say lock a row what do you mean? An update (DBWrite) operation will lock the row for the duration of the operation. It only makes sense to lock a row for a sequence of operations.


    2. Mike Telis’s avatar

      > When you say lock a row what do you mean?

      I mean that a concurrent transaction (initiated by the other instance of my dialplan) won’t be able to read the row “Key” until I end the transaction with either Commit or Rollback.

      An example: suppose the row contains a counter and I’d like to increment it. I need to read the row, bump the counter and write it back. If counter’s value is 25, I read it and write 26 back, and the other transaction’s read operation is allowed to access the row, resulting counter’s value would be 26 and not 27, as it should be.



Your email address will not be published. Required fields are marked *