Hello,

I'm trying to append a branch, assign it a q value so it has priority and serialize the new branch and the main branch.

The goal is to send the new branch off to our CNAM provider, capture the CNAM in their reply to a $var then drop the branch, stick the cnam in the main branch and allow the call to continue as normal. We do this currently using OpenSIPS and the serialize_branches(1) but the of load_contacts() seems to be different than serialize_branches.

route[CNAM_DIPS]
  t_on_branch("CNAM_DIPS");
  t_on_reply("CNAM_DIPS");
  t_on_failure("CNAM_DIPS");
  t_load_contacts();
  t_next_contacts();
  append_branch("sip:2223334444@22.33.444.55:5600;trans-type=5", "0.5");
  relay();
  break;

Two problems. First when t_next_contacts is called I get the following error:
ERROR: pv [pv_branch.c:58]: pv_get_branchx(): error accessing branch [0]

Second problem is that my call goes out on the branch I appended and I get a reply from the CNAM provider but Kamailio forwards that reply back to the phone causing the phone to send a second invite. In OpenSIPs we just called drop, to drop the branch and let the main branch continue but this doesn't seem to work in Kamailio.

I've read and reread the documentaion but it doesn't seem to behave the way the documentation says it should. Is there something I'm missing? Is there a better way to accomplish this in Kamailio?

Thank You,
  

___

John Petrini