I’ve been getting 503 responses to REGISTER requests from phones, and looking at the source code, the only way that could happen is task processor overload (pjsip_distributor.c). I found that these log messages appear for almost every call:
WARNING[C-00000001] taskprocessor.c: The 'stasis/m:manager:core-00000007' task processor queue reached 3000 scheduled tasks. WARNING[C-00000008] taskprocessor.c: The 'stasis/p:endpoint:PJSIP/XXX-0000001c' task processor queue reached 500 scheduled tasks.
The dialplan is rather complex, so I suspected that the first message is caused by excessive VarSet and Newexten events. Indeed, after I disabled their creation in source and recompiled, the first warning disappeared.
I have no clue about the second, though, and I would appreciate some guidance. If I dial one PJSIP endpoint from another, the warning usually appears for both, but more often for the calling one.