Hello,
Let' me describe the scenario:
<UE>---------><SEMS>-----------><ASTERISK>
The UE tries to make calls, The first INVITE message is without an Authentication header. The Asterisk server returns 401 Unauthorized.
The UE sends again INVITE messages to the asterisk server. The second INVITE message has an Authentication header. Because both INVITE messages have the same CSeq, the asterisk server thinks this is a LOOP message and sends 401 Unautirozed messages again.
In both cases, the Sems set "CSeq: 10 INVITE" header, while the second the INVITE message is not re-invite message and the CSeq should be set incremental.