dialog: add wait-for-ack callback before response unref

- in case of a sipral for ending in a negative response from initial
  state, ack to second iteration can unref prematurely the dialog
- reported by Pawel Sternal, FS#427

(cherry picked from commit d81fd1bf067b78b55ad348db2531c4ba9b10dddb)