role changing in xbee

I want to change the master/slave role of the sensor nodes based on the received signal stregth(RSS).Which mode will be effective to work with?And how can I confugure master and slave role each time?

I think the first question that needs to be asked is if there is an external processor or application that is going to be running or connected to the XBee?