In my dialplan, for incoming calls placed via DID, caller number (CID) and the time of the call are sent out by email.
Then, the call, SIP session and dial plan are to be terminated.
Code: Select all
localTime = System::DateTime.UtcNow.AddMinutes(sys.GetTimezoneOffsetMinutes()).ToString("HH:mm")
caller = req.Header.From.FromURI.User.Trim('1').to_s
sys.Email("user@gmail.com", "Incoming call", "from #{caller}, #{localTime}")
sys.Respond(503, "unavailable")
How to fix it?
I tried sys.Respond() with 403, 480, 486, 487, 503, 603. Code ‘503’ seems to work slightly better than others (or it may be just a random coincidence), but still, for some calls, DP is executed repeatedly.
.............................................................................................
DialPlan 06:09:20:596 sip1(5232): Call failed with a failure status of TemporarilyUnavailable and Forbidden.
DialPlan 06:09:20:596 sip1(5232): UAS call failed with a response status of 480 and Forbidden.
DialPlan 06:09:20:612 sip1(5232): Dialplan cleanup for <user_name>.
DialPlan 06:09:20:736 sip1(5232): Dial plan execution completed with normal clearing.
DialPlan 06:09:21:516 sip1(5232): Using dialplan default for In call to sip:<user_name>@sipsorcery.com.
NewCall 06:09:21:548 sip1(5232): Executing script dial plan for call to <user_name>
.............................................................................................