Master Slave Determination in H245/H323

Discussion related to the ITU-T Recommendation H.323
Post Reply
pratiksachdeva
Posts: 3
Joined: Wed Oct 23, 2013 11:56 pm

Master Slave Determination in H245/H323

Post by pratiksachdeva »

I tried searching for the exact mechanism which determines master & slave while H245 signaling but I couldn't find a precise answer. When terminal type of 2 systems is same, how would it happen. Suppose these are the only systems on call, no conference.

Please use the following details to explain:

System A
Terminaltype: 190
SDN_A: 9329435

System B
Terminaltype: 190
SDN_B: 9945613

I saw system A becoming the master in this case however I couldn't understand the mechanism.
User avatar
paulej
Posts: 595
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: Master Slave Determination in H245/H323

Post by paulej »

pratiksachdeva
Posts: 3
Joined: Wed Oct 23, 2013 11:56 pm

Re: Master Slave Determination in H245/H323

Post by pratiksachdeva »

Thank you for your reply. This is the link I came across while searching on Google but I am not able to comprehend it completely.

I would appreciate if you can elaborate using an example (you can refer the values I gave above).

Respectfully,
Pratik
User avatar
paulej
Posts: 595
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: Master Slave Determination in H245/H323

Post by paulej »

The key is H.245 Figure C.4 (Sheet 5 of 5). What it says is that the endpoint computes:

Result = (MasterSlaveDetermination.statusDeterminationNumber - sv_SDNUM + 2^24) mod 2^24

If the value of Result is 0 or 2^23, the process has to be done again by sending a Master/Slave Determination Reject and the two devices restart the master/slave determination process.

If the value of Result is < 2^23, then the endpoint becomes master.

If the value of Result is > 2^23, then the endpoint becomes slave.

In the example you provide:

System B computes:
(9329435 - 9945613 + 2^24) mod 2^24 == 16,161,038
This is > 2^23 (8,388,608), thus System B will declare itself to be slave.

System A computes:
(9945613 - 9329435 + 2^24) mod 2^24 == 616,178
This is < 2^23 (8,388,608), thus System A will declare itself to be master.
pratiksachdeva
Posts: 3
Joined: Wed Oct 23, 2013 11:56 pm

Re: Master Slave Determination in H245/H323

Post by pratiksachdeva »

Awesome, thank you so much for such a nice clarification.

PS: I wonder what made ITU to use this complex formula in the first place. :P
User avatar
paulej
Posts: 595
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: Master Slave Determination in H245/H323

Post by paulej »

I don't really know the answer to that, but my assumption is that it was to try to get endpoints to "play fair" in performing master/slave negotiation. Some manufacturers might prefer to always be the master and if the formula was simply "the bigger number wins", they would select the largest possible number all the time.

Using this formula perhaps encourages random selection of numbers and, thus, equal chances of being master.

That said, it's still possible to cheat. One side could easily wait for the opposite device's status determination value before selecting its own value in order to ensure it is master.

But, this is just speculation on my part. The decision to use this formula is before my time. It's really not that complicated of a formula, but the written description in H.245 makes it seem much more complex than it really is. In computer code, it's just:

Code: Select all

    msd_result = ((remote_sdn - local_sdn + 2^24) % 2^24);
    if ((msd_result == 0) || (msd_result == 2^23))
    {
        msd_status = indeterminate;
    }
    else if (msd_result > 2^23)
    {
        msd_status = slave;
    }
    else
    {
        msd_status = master;
    }
In the case of "indeterminate", then the process has to be attempted again. This kind of conflict is no different than if two devices picked the same integer if the formula was "pick the biggest number".

Seeing it this way, perhaps it seems less complex.
User avatar
paulej
Posts: 595
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: Master Slave Determination in H245/H323

Post by paulej »

Just an update on the previous comment, I checked with the original editor of H.245 and, indeed, "cheating" was the reason for selecting this formula. It's not a difficult procedure to follow, especially once you see it written out like I have it above. However, had the mechanism to become master been merely a process of selecting the largest integer, likely devices would just pick the largest integer in an effort to become the master.
Post Reply