0. About

A description of how FreeSWITCH processes a typical SIP call.

1. Typical SIP Call Between Registered Extensions

title Typical SIP Call From Registered Extension

start

-> INVITE;
partition CS_NEW {
:Create new channel\n A-leg;

if (Match ACL?) then (match)
  :sip_authorized\n = true;
else
  :Digest authenticate;
  if (Authenticated?) then (auth)
    :sip_authorized\n = true;
  else (reject)
    end
  endif
endif
}

partition CS_INIT {
:Initialize channel\n A-leg;

:parse SDP<
:Send BREAK>
:Lookup caller's context in\n user directory entry;
note right: Context = "default" in\n vanilla configs
}

partition CS_ROUTING {
#LightGreen:Hunt XML\nDialplan;

repeat 
  if (extension condition) then (true)
    :add actions to\n to-do list;
  else (false)
    :add anti-actions to\n to-do list;
  endif
repeat while (Next extension exists\n AND\n continue = true?)
}

partition CS_EXECUTE {
:Execute to-do list;

:Set channel variables;

if (bridge or\n transfer?) then (bridge)
  :Create new channel\n B-leg;
  note left: State CS_NEW
  :Initialize channel\n B-leg;
  note left: State CS_INIT
  :Send invite>
  :Send SDP>
  :Send BREAK>
  note left: CS_ROUTING
  :Consume media<
  :Select codec;
  if (early media) then (true)
    :Play early media>
  endif
else (transfer)
  #LightGreen:Begin new pass through\n specified dialplan context;
  detach
endif

-> Someone answers;
:Receive\n 200 OK<
:Send ACK>
}

partition CS_EXCHANGE_MEDIA {
repeat
  :Exchange media;
repeat while (BYE?)
}

partition CS_HANGUP {
-> BYE;
:Send KILL>
:Clear the bridge;
:Send clearance code>
}

partition CS_REPORTING {
:Write CDR;
}

partition CS_DESTROY {
:Destroy B-leg;
:Destroy A-leg;
}

stop

2. See Also