Limit Channels Outbound

does anyone know how to limit outbound call per did when fowarding to another asterisk box


exten => _1234567 [0-9}, 1, Dial(iax2/guest@ipnumber)

so to limit each did to 3 channels how is this done ??

not sure how this might scale, but how about checking, then incrementing a global variable for the DID at the start of each call and decrementing it again at tear-down ?

Basicly all i what to do is only allow 2 channels per did on outgoing when sending to another asterisk server