Question bout sip channels

hi folks .
i have phone registered as “ahmad/ahmad” in sip.conf
[ahmad]
type=user
secret=ahmad
context=ahmad
host=dynamic

and i have a dial pan like
[ahmad]
exten => 111,1,NoOp(This is a hello )
exten => 111,n,Playback(tt-monkeys)
same => n,Background(enter-ext-of-person)

here is the result on console ;
== Using SIP RTP CoS mark 5
– Executing [111@ahmad:1] NoOp(“SIP/ahmad-0000001a”, "This is just a piece of shit ") in new stack
– Executing [111@ahmad:2] Playback(“SIP/ahmad-0000001a”, “tt-monkeys”) in new stack
– <SIP/ahmad-0000001a> Playing ‘tt-monkeys.gsm’ (language ‘en’)
localhostCLI>
localhost
CLI> sip show channels
Peer User/ANR Call ID Format Hold Last Message Expiry Peer
172.16.160.1 ahmad LdCCO6~w23 0x4 (ulaw) No Rx: ACK ahmad
1 active SIP dialog
– Executing [111@ahmad:3] BackGround(“SIP/ahmad-0000001a”, “enter-ext-of-person”) in new stack
– <SIP/ahmad-0000001a> Playing ‘enter-ext-of-person.gsm’ (language ‘en’)
– Auto fallthrough, channel ‘SIP/ahmad-0000001a’ status is 'UNKNOWN’
localhostCLI> sip show channels
Peer User/ANR Call ID Format Hold Last Message Expiry Peer
0 active SIP dialogs
localhost
CLI>

now I’m trying to understand … asterisk deal with everything as channels .
so i understood that the phone when dialled 111 , it made a channel and asterisk authenticated that channel and put it in the context "ahmad"
and ran the code of dial plan .

but i want to understand
what is the channels that was opened on the system
is it ;
SIP/ahmad-0000001a

or
localhost*CLI> sip show channels
Peer User/ANR Call ID Format Hold Last Message Expiry Peer
172.16.160.1 ahmad LdCCO6~w23 0x4 (ulaw) No Rx: ACK ahmad
1 active SIP dialog

??

i mean see channel name on console and also can see other channel ID on asterisk console using cmd ==> sip show channels

thanks for helping

The Asterisk channel name is the Asterisk identifier for the session, the one you see in “sip show channels” is the SIP protocol specific session identifier.

is there a difference between session & channel ?

Not really, they are different names to mean the same thing.

Asterisk handles channels at two levels.

The top level is a device independent one, and all dialplan operations are performed on that. core show channels reports on those channels.

Each device technology also has state information. In cases, like SIP, it has its own identifiers. This is what sip show peers gives.

Note that the data structure that represents the SIP level is created before the channel, for incoming sessions. For some sessions, like those associated with registration, there is no Asterisk channel created, so they only show in sip show channels and cannot be manipulated by the dialplan.

did you mean that we have channels created from dial plan
and channels out of dial plan ?

do you have a source that i can read those stuff in more details ?

thank you

The source code of Asterisk is available from their GIT server.

My impression is that your gap in your understanding is too large to fill in a few minutes over a peer support forum.