15000ms wait for call forward when extension is offline

I am looking to use an Android handset (running cSipSimple) as an extension. I have followed the good advice from this post to reduce the frequency of keep-alive requests my phone and disabling the qualify parameter from the extension settings within FreePBX. These tweaks should provide much improved battery life on the phone, but with a slight problem…

I am looking to forward the android extension to a landline number when the extension is unavailable. Unfortunately, because the “qualify” feature has been disabled, Asterisk never realises that this extension has gone out of WiFi range and it no longer available.

As a result Asterisk continue to try and call the extension, this is understandable, but I can’t figure out how long it should try to call the offline extension before giving up and dialling the landline diversion. From the log, you can see that Asterisk waited exactly 15000ms before calling the landline.

So I guess my question is… How do I configure the wait time of 15000ms?

This is what my log looks like:

[size=12] == Using SIP RTP CoS mark 5 -- Called SIP/1002 -- Connected line update to SIP/1001-000000e9 prevented. [b]-- Nobody picked up in 15000 ms[/b] -- Executing [s@macro-dial-one:43] ExecIf("SIP/1001-000000e9", "0?MacroExit()") in new stack -- Executing [s@macro-dial-one:44] ExecIf("SIP/1001-000000e9", "0?Set(DIALSTATUS=)") in new stack -- Executing [s@macro-dial-one:45] GosubIf("SIP/1001-000000e9", "0?s-NOANSWER,1()") in new stack -- Executing [s@macro-dial-one:46] MacroExit("SIP/1001-000000e9", "") in new stack -- Executing [s@macro-exten-vm:8] Set("SIP/1001-000000e9", "SV_DIALSTATUS=NOANSWER") in new stack -- Executing [s@macro-exten-vm:9] GosubIf("SIP/1001-000000e9", "1?docfu,1()") in new stack -- Executing [docfu@macro-exten-vm:1] ExecIf("SIP/1001-000000e9", "0?StackPop()") in new stack -- Executing [docfu@macro-exten-vm:2] GotoIf("SIP/1001-000000e9", "0?from-internal,02070000000,1") in new stack -- Executing [docfu@macro-exten-vm:3] Set("SIP/1001-000000e9", "RTCF=15") in new stack -- Executing [docfu@macro-exten-vm:4] Dial("SIP/1001-000000e9", "Local/02070000000@from-internal/n,15,tr") in new stack -- Called Local/02070000000@from-internal/n -- Executing [02070000000@from-internal:1] Macro("Local/02070000000@from-internal-00000015;2", "user-callerid,LIMIT,EXTERNAL,") in new stack -- Executing [s@macro-user-callerid:1] Set("Local/02070000000@from-internal-00000015;2", "TOUCH_MONITOR=1390105371.298") in new stack -- Executing [s@macro-user-callerid:2] Set("Local/02070000000@from-internal-00000015;2", "AMPUSER=1001") in new stack -- Executing [s@macro-user-callerid:3] GotoIf("Local/02070000000@from-internal-00000015;2", "0?report") in new stack -- Executing [s@macro-user-callerid:4] ExecIf("Local/02070000000@from-internal-00000015;2", "1?Set(REALCALLERIDNUM=1001)") in new stack -- Executing [s@macro-user-callerid:5] Set("Local/02070000000@from-internal-00000015;2", "AMPUSER=1001") in new stack -- Executing [s@macro-user-callerid:6] Set("Local/02070000000@from-internal-00000015;2", "AMPUSERCIDNAME=1001") in new stack -- Executing [s@macro-user-callerid:7] GotoIf("Local/02070000000@from-internal-00000015;2", "0?report") in new stack -- Executing [s@macro-user-callerid:8] Set("Local/02070000000@from-internal-00000015;2", "AMPUSERCID=1001") in new stack -- Executing [s@macro-user-callerid:9] Set("Local/02070000000@from-internal-00000015;2", "__DIAL_OPTIONS=tr") in new stack -- Executing [s@macro-user-callerid:10] Set("Local/02070000000@from-internal-00000015;2", "CALLERID(all)="1001" <1001>") in new stack -- Executing [s@macro-user-callerid:11] GotoIf("Local/02070000000@from-internal-00000015;2", "0?limit") in new stack -- Executing [s@macro-user-callerid:12] ExecIf("Local/02070000000@from-internal-00000015;2", "1?Set(GROUP(concurrency_limit)=1001)") in new stack -- Executing [s@macro-user-callerid:13] GotoIf("Local/02070000000@from-internal-00000015;2", "1?continue") in new stack -- Goto (macro-user-callerid,s,26) -- Executing [s@macro-user-callerid:26] Set("Local/02070000000@from-internal-00000015;2", "CALLERID(number)=1001") in new stack -- Executing [s@macro-user-callerid:27] Set("Local/02070000000@from-internal-00000015;2", "CALLERID(name)=1001") in new stack -- Executing [s@macro-user-callerid:28] Set("Local/02070000000@from-internal-00000015;2", "CDR(cnum)=1001") in new stack -- Executing [s@macro-user-callerid:29] Set("Local/02070000000@from-internal-00000015;2", "CDR(cnam)=1001") in new stack -- Executing [s@macro-user-callerid:30] Set("Local/02070000000@from-internal-00000015;2", "CHANNEL(language)=en") in new stack -- Executing [02070000000@from-internal:2] Set("Local/02070000000@from-internal-00000015;2", "MOHCLASS=default") in new stack -- Executing [02070000000@from-internal:3] Set("Local/02070000000@from-internal-00000015;2", "_NODEST=") in new stack -- Executing [02070000000@from-internal:4] Gosub("Local/02070000000@from-internal-00000015;2", "sub-record-check,s,1(out,02070000000,)") in new stack -- Executing [s@sub-record-check:1] Set("Local/02070000000@from-internal-00000015;2", "REC_POLICY_MODE_SAVE=dontcare") in new stack -- Executing [s@sub-record-check:2] GotoIf("Local/02070000000@from-internal-00000015;2", "1?check") in new stack -- Goto (sub-record-check,s,7) -- Executing [s@sub-record-check:7] Set("Local/02070000000@from-internal-00000015;2", "__MON_FMT=wav") in new stack -- Executing [s@sub-record-check:8] GotoIf("Local/02070000000@from-internal-00000015;2", "1?next") in new stack -- Goto (sub-record-check,s,11) -- Executing [s@sub-record-check:11] ExecIf("Local/02070000000@from-internal-00000015;2", "0?Return()") in new stack -- Executing [s@sub-record-check:12] ExecIf("Local/02070000000@from-internal-00000015;2", "0?Set(__REC_POLICY_MODE=)") in new stack -- Executing [s@sub-record-check:13] GotoIf("Local/02070000000@from-internal-00000015;2", "1?out,1") in new stack -- Goto (sub-record-check,out,1) -- Executing [out@sub-record-check:1] ExecIf("Local/02070000000@from-internal-00000015;2", "0?Set(__REC_POLICY_MODE=dontcare)") in new stack -- Executing [out@sub-record-check:2] GosubIf("Local/02070000000@from-internal-00000015;2", "0?record,1(exten,02070000000,1001)") in new stack -- Executing [out@sub-record-check:3] Return("Local/02070000000@from-internal-00000015;2", "") in new stack -- Executing [02070000000@from-internal:5] Macro("Local/02070000000@from-internal-00000015;2", "dialout-trunk,1,02070000000,,off") in new stack -- Executing [s@macro-dialout-trunk:1] Set("Local/02070000000@from-internal-00000015;2", "DIAL_TRUNK=1") in new stack -- Executing [s@macro-dialout-trunk:2] GosubIf("Local/02070000000@from-internal-00000015;2", "0?sub-pincheck,s,1()") in new stack -- Executing [s@macro-dialout-trunk:3] GotoIf("Local/02070000000@from-internal-00000015;2", "0?disabletrunk,1") in new stack -- Executing [s@macro-dialout-trunk:4] Set("Local/02070000000@from-internal-00000015;2", "DIAL_NUMBER=02070000000") in new stack -- Executing [s@macro-dialout-trunk:5] Set("Local/02070000000@from-internal-00000015;2", "DIAL_TRUNK_OPTIONS=tr") in new stack -- Executing [s@macro-dialout-trunk:6] Set("Local/02070000000@from-internal-00000015;2", "OUTBOUND_GROUP=OUT_1") in new stack -- Executing [s@macro-dialout-trunk:7] GotoIf("Local/02070000000@from-internal-00000015;2", "0?nomax") in new stack -- Executing [s@macro-dialout-trunk:8] GotoIf("Local/02070000000@from-internal-00000015;2", "0?chanfull") in new stack -- Executing [s@macro-dialout-trunk:9] GotoIf("Local/02070000000@from-internal-00000015;2", "0?skipoutcid") in new stack -- Executing [s@macro-dialout-trunk:10] Set("Local/02070000000@from-internal-00000015;2", "DIAL_TRUNK_OPTIONS=") in new stack -- Executing [s@macro-dialout-trunk:11] Macro("Local/02070000000@from-internal-00000015;2", "outbound-callerid,1") in new stack2222 -- Executing [s@macro-outbound-callerid:1] ExecIf("Local/02070000000@from-internal-00000015;2", "0?Set(CALLERPRES()=)") in new stack -- Executing [s@macro-outbound-callerid:2] ExecIf("Local/02070000000@from-internal-00000015;2", "0?Set(REALCALLERIDNUM=1001)") in new stack -- Executing [s@macro-outbound-callerid:3] GotoIf("Local/02070000000@from-internal-00000015;2", "0?normcid") in new stack -- Executing [s@macro-outbound-callerid:4] Set("Local/02070000000@from-internal-00000015;2", "USEROUTCID=1001") in new stack -- Executing [s@macro-outbound-callerid:5] GotoIf("Local/02070000000@from-internal-00000015;2", "0?bypass") in new stack -- Executing [s@macro-outbound-callerid:6] Set("Local/02070000000@from-internal-00000015;2", "USEROUTCID=") in new stack -- Executing [s@macro-outbound-callerid:7] Set("Local/02070000000@from-internal-00000015;2", "EMERGENCYCID=") in new stack -- Executing [s@macro-outbound-callerid:8] Set("Local/02070000000@from-internal-00000015;2", "TRUNKOUTCID=") in new stack -- Executing [s@macro-outbound-callerid:9] GotoIf("Local/02070000000@from-internal-00000015;2", "1?trunkcid") in new stack -- Goto (macro-outbound-callerid,s,14) -- Executing [s@macro-outbound-callerid:14] ExecIf("Local/02070000000@from-internal-00000015;2", "0?Set(CALLERID(all)=)") in new stack -- Executing [s@macro-outbound-callerid:15] ExecIf("Local/02070000000@from-internal-00000015;2", "0?Set(CALLERID(all)=)") in new stack -- Executing [s@macro-outbound-callerid:16] ExecIf("Local/02070000000@from-internal-00000015;2", "0?Set(CALLERID(all)=)") in new stack -- Executing [s@macro-outbound-callerid:17] ExecIf("Local/02070000000@from-internal-00000015;2", "0?Set(CALLERPRES()=prohib_passed_screen)") in new stack -- Executing [s@macro-outbound-callerid:18] Set("Local/02070000000@from-internal-00000015;2", "CDR(outbound_cnum)=1001") in new stack -- Executing [s@macro-outbound-callerid:19] Set("Local/02070000000@from-internal-00000015;2", "CDR(outbound_cnam)=1001") in new stack -- Executing [s@macro-dialout-trunk:12] GosubIf("Local/02070000000@from-internal-00000015;2", "0?sub-flp-1,s,1()") in new stack -- Executing [s@macro-dialout-trunk:13] Set("Local/02070000000@from-internal-00000015;2", "OUTNUM=02070000000") in new stack -- Executing [s@macro-dialout-trunk:14] Set("Local/02070000000@from-internal-00000015;2", "custom=SIP/x200") in new stack -- Executing [s@macro-dialout-trunk:15] ExecIf("Local/02070000000@from-internal-00000015;2", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default))") in new stack -- Executing [s@macro-dialout-trunk:16] ExecIf("Local/02070000000@from-internal-00000015;2", "0?Set(DIAL_TRUNK_OPTIONS=M(confirm))") in new stack -- Executing [s@macro-dialout-trunk:17] Macro("Local/02070000000@from-internal-00000015;2", "dialout-trunk-predial-hook,") in new stack -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("Local/02070000000@from-internal-00000015;2", "") in new stack -- Executing [s@macro-dialout-trunk:18] GotoIf("Local/02070000000@from-internal-00000015;2", "0?bypass,1") in new stack -- Executing [s@macro-dialout-trunk:19] ExecIf("Local/02070000000@from-internal-00000015;2", "1?Set(CONNECTEDLINE(num,i)=02070000000)") in new stack -- Executing [s@macro-dialout-trunk:20] ExecIf("Local/02070000000@from-internal-00000015;2", "1?Set(CONNECTEDLINE(name,i)=CID:1001)") in new stack -- Executing [s@macro-dialout-trunk:21] GotoIf("Local/02070000000@from-internal-00000015;2", "0?customtrunk") in new stack -- Executing [s@macro-dialout-trunk:22] Dial("Local/02070000000@from-internal-00000015;2", "SIP/x200/02070000000,300,") in new stack == Using SIP RTP TOS bits 184 == Using SIP RTP CoS mark 5 -- Called SIP/x200/02070000000 -- SIP/x200-000000eb is making progress passing it to Local/02070000000@from-internal-00000015;2 -- Local/02070000000@from-internal-00000015;1 is making progress passing it to SIP/1001-000000e9 [/size]

OK - I’ve realised I can change the 15000ms via “Settings > Advanced settings > Ringtime Default” but lowering this doesn’t work because it affects the extension when it is online too.

Is there no way for Asterisk to realise that it is calling and waiting for an answer from an extension which has gone offline? I have noticed these lines in my log each time too (but strangely these weren’t in the original one I posted):

Would it be possible to have Asterisk ignore the default ringtime when it spots a “No route to host” error and therefore the forwarded number would be connected immediately?

[size=12] ERROR[11360]: tcptls.c:446 ast_tcptls_client_start: Unable to connect SIP socket to 10.7.2.221:57419: No route to host [/size]

Yes, you have to set qualify to yes

Thanks Skyking, that’s a shame. The battery saving tips from the post I mentioned above do seem sensible, but disabling “qualify” will cause too many problems in terms of call forwarding for me :frowning:

Couldn’t you use follow me and tweak the paramaters until you you simulate the results you want?

That is what I tried initially, but this particular extension is part of a ring group and when I used follow-me the ring group wouldn’t ring the extension at all (including the follow-me numbers) if Asterisk knew the extension is offline).

Essentially, what I am trying to achieve is this:

Incoming calls go to a call group containing the two extensions (1001 & 1002)

x1001 - A wired IP phone (assume always online)
x1002 - An android handset which I don’t want to qualify regularly to save bettery, but when the android handset is out of WiFi range (away from the house) X1002 is forwarded to the android’s cell-phone number (so it can continue to pick up calls).

Not sure if this clears things up or makes it worse! :slight_smile: