How are channel IDs assigned in Asterisk?

When calling someone , the Asterisk CLI usually displays the channel as “SIP/CallerName-NumberID” .
For example , the channel may be something like “SIP/Sergiu-00000000” . Afterwards , the channels seem to be assigned consecutively, and the counter restarts as the Asterisk server restarts .

I’d like to know for sure how those NumberIDs at the end are assigned as searching the internet has given me no results as of yet !

P.S: I’m using Asterisk 1.8.X on a Debian Linux virtual machine , in case it matters

Depends on the version and the channel technology. For SIP, it was originally the address of the technology specific data structure (struct sip_pvt). It is now a serial number.

You should treat this as opaque and not try and read anything into it, except for forensic purposes.

I think chan_local uses pseudo random numbers.