Is there any way to make call fail after # of rings?

Home » Asterisk Users » Is there any way to make call fail after # of rings?
Asterisk Users 4 Comments

My customer needs to set a forwarding based on number of rings,i.e.,
if the phone rings 5 times (user-selectable), then try another number.
Is there a way to do such a thing with Asterisk? I could not find way
to do it based on the documentation of the Dial function. The protocol
is SIP only, however, I could use a different one if it provided a
workaround. If this is the wrong tool for the job, what technology
would do this?

4 thoughts on - Is there any way to make call fail after # of rings?

  • ‘Phone rings’ are not a standard unit of measurement. Is there a problem
    with defining the time in seconds? If not then Dial can do this for you.

    Regards

    Ish

  • Simply, without checking for BUSY, DND or TIMEOUT
    I’m assuming each ring period is 3 seconds.

    exten => 8512,1,Dial(SIP/8512,15)
    exten => 8512,n,Dial(DAHDI/GO/101233456,15)

    Or another way.

    Maybe the FollowMe application, allow multiple numbers to be tried, each
    after a configured timeout.

    from followme.conf

    [default]
    musicclass=>default
    ; The moh class that should be used for the caller while they are waiting to
    be connected.
    context=>default
    ; The context to dial the numbers from
    number=>01233456,25
    ; The a follow-me number to call. The format is:
    ; number=> [, [,

    Numebr

    Thus followme
    number=>8512,15 ; try local extension for 15 seconds
    number=>101233456,15 ; then try outside number for 15

    Alec

  • You have to do it by timing, not by number of rings. Asterisk simply doesn’t
    know how long each “ring, ring, pause” cycle takes (it’s a configurable
    property, and only analogue phones on an FXS port can be trusted to honour it
    anyway).

    If one ringing cycle takes 3 seconds, then 5 rings would be 15 seconds. So
    just use something like
    Dial(SIP/${EXTEN},15)
    in your dialplan.

    If the call was not answered, then the step number will get an extra 100 added
    to it. So, if your Dial() command was at step 2, it will move on to step 3 if
    the call was answered and hung up; or step 103 if the line was busy or timeout
    occurred.

    Hope that makes sense.

  • Try this

    exten=> yournumberhere,1,Dial(SIP/peern1,60)

    exten=> yournumberhere,n,GotoIf($[“${DIALSTATUS}” != “ANSWER”]?4)

    exten=> yournumberhere,n,Hangup

    exten=> yournumberhere,n,Dial(SIP/peer2,60)

    exten=> yournumberhere,n,GotoIf($[“${DIALSTATUS}” != “ANSWER”]?9)

    exten=> yournumberhere,n,Hangup

    you can add more conditions in the same way

    Regards,
    Zohair Raza