ControlPlayBack combined with Features

I have features up and running within a normal phone call but when playing a recording with ControlPlayBack() the feature isn’t working. Is this just “the way things are” or is there a way to combine ControlPlayBack() with the use of features? Thanks in advance for pointers, suggestions and answers.

This is what I have in features.conf

[applicationmap]
testfeature       => 99,callee/caller,System,echo "x" >>  /var/tmp/aap.txt,default 

I use “default” at the end because it generates output in the cli when it is working. I plan to use it as a kind of Like for listeners to a recording. Every “x” added to aap.txt is a thumb up for the recording.

This is in extensions.conf for the part that isn’t working.

exten => 1,n, SET(__DYNAMIC_FEATURES=testfeature)
exten => 1,n, ControlPlayback(luisterboek/${BOEK}/${BLADZIJDE}/${BLADZIJDE},7500,#,*,1,2,3)

This is in extensions.conf for the part where testfeature is working

exten => _XXXX,1,Answer()
exten => _XXXX,n,SET(__DYNAMIC_FEATURES=testfeature)
exten => _XXXX,n,Dial(SIP/${EXTEN},30)

Dynamic features only apply to Dial(). They are not triggerable outside of a Dial(). You could get around it by using a Local channel to call the ControlPlayback instead.

2 Likes

Thanks for the pointer jcolp. It seems, the way I have it implemented, that your pointer is halve of the answer. This is what my dial plan looks like now. Option one in the menu is the routine to listen to a page of a book. After choosen option one one has to enter a page number and the # key. After that there is a check if the page is already recorded and then ControlPlayBack is doing its job. The control keys of ControlPlayBack are working all the time. 99 is not working at first but if I let the routine play all the pages and return to hoofdmenu,s,1 and start listening again then the 99 combination is working as planned while the recording of the page is played. When it is working it keeps on working. What is wrong with this solution and what causes it to work after returning to hoofdmenu,s,1 (main menu) after listening to the last page recorded. Thanks for any advice, examples and/or suggestions

[local-channel-bellen]
exten => 100,1,NoOp()
exten => 100,n,Goto(hoofdmenu,s,verder-met-hoofdmenu)

[hoofdmenu]
exten => s,1, Answer()
exten => s,n, Dial(local/100@local-channel-bellen/nj,30,r)

;exten => s,n,SET(__DYNAMIC_FEATURES=testfeature#pitch_up_them#pitch_lower_them#pitch_reset_them#raise-value-variable#show-value-variable)
exten => s,n(verder-met-hoofdmenu), Set(BOEK=nooitaf) ; bij meer boeken menu toevoegen
exten => s,n, Wait(1)
exten => s,n(start_hoofdmenu), Read(KEUS,luisterboek/hoofdmenu,1)

exten => s,n, GotoIf($[ “${KEUS}” : “1”]?luisteren,1,1) ; luisteren
exten => s,n, GotoIf($[ “${KEUS}” : “2”]?opnemen,2,1) ; inspreken
exten => s,n, GotoIf($[ “${KEUS}” : “3”]?eerstvolgende-bladzijde,3,1) ; eerste in te lezen pagina
exten => s,n, GotoIf($[ “${KEUS}” : “4”]?instructie,4,1) ; instructie
exten => s,n, GotoIf($[ “${KEUS}” : “5”]?ophangen,5,1) ; ophangen/verbreken verbinding
exten => s,n, Playback(luisterboek/ongeldige-menu-invoer)
exten => s,n, Goto(start_hoofdmenu)

[luisteren]
exten => 1,1, NoOp("De hoofdmenekeus is "${KEUS})
exten => 1,n, Read(BLADZIJDE,luisterboek/startpagina_luisteren)
exten => 1,n(luisteren), Set(PAD=/var/lib/asterisk/sounds/luisterboek/${BOEK}/${BLADZIJDE}/${BLADZIJDE}.gsm)
exten => 1,n, Set(FILE_EXISTS=${STAT(e,${PAD})})
exten => 1,n, NoOp("bij waarde 1 bestaat het bestand " ${FILE_EXISTS})
exten => 1,n, GotoIf($[ “${FILE_EXISTS}” : “0”]?opname_nog_niet_beschikbaar)

exten => 1,n, NoOp(“xx”)
;exten => 1,n, Set(PITCH_SHIFT(tx)=0.6); raises pitch an octave
exten => 1,n, SET(__DYNAMIC_FEATURES=like_feature)
exten => 1,n, ControlPlayback(luisterboek/${BOEK}/${BLADZIJDE}/${BLADZIJDE},7500,#,*,1,2,3)
;exten => 1,n, SET(__DYNAMIC_FEATURES=)
exten => 1,n, SET(BLADZIJDE=$[ ${BLADZIJDE}+1])

exten => 1,n, NoOp(“XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”)
exten => 1,n, NoOp("De waarde van variabele BLADZIJDE is " ${BLADZIJDE})
exten => 1,n, NoOp(“XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”)
exten => 1,n, PlayBack(luisterboek/de-volgende-bladzijde-is-bladzijde)
exten => 1,n, SayNumber(${BLADZIJDE},m)
exten => 1,n, Goto(luisteren) ; in oneindige loop tot eind van boek of laatste bladzijde die ingelezen is

exten => 1,n(opname_nog_niet_beschikbaar), PlayBack(luisterboek/opname_nog_niet_beschikbaar)
exten => 1,n,Goto(hoofdmenu,s,1)

This is the cli output when it is working. For a split second musiconhold is turn on and this generates cli output.

– Started music on hold, class ‘default’, on channel ‘Local/100@local-channel-bellen-00000012;2’
– Stopped music on hold on Local/100@local-channel-bellen-00000012;2
– Started music on hold, class ‘default’, on channel ‘Local/100@local-channel-bellen-00000012;2’
– Stopped music on hold on Local/100@local-channel-bellen-00000012;2

This is the cli output when returning to hoofdmenu (main menu). This seems to add another local channel (from sip channel -> local channel to sip channel -> local channel -> local channel. Can

– <Local/100@local-channel-bellen-00000017;2> Playing ‘luisterboek/opname_nog_niet_beschikbaar.gsm’ (language ‘en’)
– Executing [1@luisteren:18] Goto(“Local/100@local-channel-bellen-00000017;2”, “hoofdmenu,s,1”) in new stack
– Goto (hoofdmenu,s,1)
– Executing [s@hoofdmenu:1] Answer(“Local/100@local-channel-bellen-00000017;2”, “”) in new stack
– Executing [s@hoofdmenu:2] Dial(“Local/100@local-channel-bellen-00000017;2”, “local/100@local-channel-bellen/nj,30,r”) in new stack
– Called local/100@local-channel-bellen/nj
– Executing [100@local-channel-bellen:1] NoOp(“Local/100@local-channel-bellen-00000018;2”, “”) in new stack
– Executing [100@local-channel-bellen:2] Goto(“Local/100@local-channel-bellen-00000018;2”, “hoofdmenu,s,verder-met-hoofdmenu”) in new stack

When the 99 isn’t working there isn’t any cli output related to the key combination.

There’s nothing that sticks out for why it would not work at first glance. You could enable “rtp set debug on” to see if DTMF is actually being received. Enabling dtmf logging in logger.conf would also confirm that part.

Thanks again for the extremely fast respons. This is what the logging looks like when the 99 combination isn’t working:

[Oct 28 00:36:30] DTMF[21478][C-00000015] channel.c: DTMF begin passthrough ‘9’ on SIP/5555-00000015
[Oct 28 00:36:30] DTMF[21479][C-00000015] channel.c: DTMF begin ‘9’ received on Local/100@local-channel-bellen-00000008;2
[Oct 28 00:36:30] DTMF[21479][C-00000015] channel.c: DTMF begin ignored ‘9’ on Local/100@local-channel-bellen-00000008;2
[Oct 28 00:36:30] DTMF[21478][C-00000015] channel.c: DTMF end ‘9’ received on SIP/5555-00000015, duration 120 ms
[Oct 28 00:36:30] DTMF[21478][C-00000015] channel.c: DTMF end accepted with begin ‘9’ on SIP/5555-00000015
[Oct 28 00:36:30] DTMF[21478][C-00000015] channel.c: DTMF end passthrough ‘9’ on SIP/5555-00000015
[Oct 28 00:36:30] DTMF[21479][C-00000015] channel.c: DTMF end ‘9’ received on Local/100@local-channel-bellen-00000008;2, duration 120 ms
[Oct 28 00:36:30] DTMF[21479][C-00000015] channel.c: DTMF end passthrough ‘9’ on Local/100@local-channel-bellen-00000008;2
[Oct 28 00:36:30] DTMF[21478][C-00000015] channel.c: DTMF begin ‘9’ received on SIP/5555-00000015
[Oct 28 00:36:30] DTMF[21478][C-00000015] channel.c: DTMF begin passthrough ‘9’ on SIP/5555-00000015
[Oct 28 00:36:30] DTMF[21479][C-00000015] channel.c: DTMF begin ‘9’ received on Local/100@local-channel-bellen-00000008;2
[Oct 28 00:36:30] DTMF[21479][C-00000015] channel.c: DTMF begin ignored ‘9’ on Local/100@local-channel-bellen-00000008;2
[Oct 28 00:36:30] DTMF[21478][C-00000015] channel.c: DTMF end ‘9’ received on SIP/5555-00000015, duration 120 ms
[Oct 28 00:36:30] DTMF[21478][C-00000015] channel.c: DTMF end accepted with begin ‘9’ on SIP/5555-00000015
[Oct 28 00:36:30] DTMF[21478][C-00000015] channel.c: DTMF end passthrough ‘9’ on SIP/5555-00000015
[Oct 28 00:36:30] DTMF[21479][C-00000015] channel.c: DTMF end ‘9’ received on Local/100@local-channel-bellen-00000008;2, duration 120 ms
[Oct 28 00:36:30] DTMF[21479][C-00000015] channel.c: DTMF end passthrough ‘9’ on Local/100@local-channel-bellen-00000008;2

This what the logging looks like after returning to hoofdmenu after finishing the last recorded page and 99 is working as planned:

[Oct 28 00:41:18] DTMF[21535][C-00000018] channel.c: DTMF begin ‘9’ received on SIP/5555-00000018
[Oct 28 00:41:18] DTMF[21535][C-00000018] channel.c: DTMF begin passthrough ‘9’ on SIP/5555-00000018
[Oct 28 00:41:18] DTMF[21536][C-00000018] channel.c: DTMF begin ‘9’ received on Local/100@local-channel-bellen-00000009;2
[Oct 28 00:41:18] DTMF[21536][C-00000018] channel.c: DTMF begin passthrough ‘9’ on Local/100@local-channel-bellen-00000009;2
[Oct 28 00:41:18] DTMF[21535][C-00000018] channel.c: DTMF end ‘9’ received on SIP/5555-00000018, duration 120 ms
[Oct 28 00:41:18] DTMF[21535][C-00000018] channel.c: DTMF end accepted with begin ‘9’ on SIP/5555-00000018
[Oct 28 00:41:18] DTMF[21535][C-00000018] channel.c: DTMF end passthrough ‘9’ on SIP/5555-00000018
[Oct 28 00:41:18] DTMF[21536][C-00000018] channel.c: DTMF end ‘9’ received on Local/100@local-channel-bellen-00000009;2, duration 120 ms
[Oct 28 00:41:18] DTMF[21536][C-00000018] channel.c: DTMF end accepted with begin ‘9’ on Local/100@local-channel-bellen-00000009;2
[Oct 28 00:41:18] DTMF[21536][C-00000018] channel.c: DTMF end passthrough ‘9’ on Local/100@local-channel-bellen-00000009;2
[Oct 28 00:41:18] DTMF[21535][C-00000018] channel.c: DTMF begin ‘9’ received on SIP/5555-00000018
[Oct 28 00:41:18] DTMF[21535][C-00000018] channel.c: DTMF begin passthrough ‘9’ on SIP/5555-00000018
[Oct 28 00:41:18] DTMF[21536][C-00000018] channel.c: DTMF begin ‘9’ received on Local/100@local-channel-bellen-00000009;2
[Oct 28 00:41:18] DTMF[21536][C-00000018] channel.c: DTMF begin passthrough ‘9’ on Local/100@local-channel-bellen-00000009;2
[Oct 28 00:41:19] DTMF[21535][C-00000018] channel.c: DTMF end ‘9’ received on SIP/5555-00000018, duration 120 ms
[Oct 28 00:41:19] DTMF[21535][C-00000018] channel.c: DTMF end accepted with begin ‘9’ on SIP/5555-00000018
[Oct 28 00:41:19] DTMF[21535][C-00000018] channel.c: DTMF end passthrough ‘9’ on SIP/5555-00000018
[Oct 28 00:41:19] DTMF[21536][C-00000018] channel.c: DTMF end ‘9’ received on Local/100@local-channel-bellen-00000009;2, duration 120 ms
[Oct 28 00:41:19] DTMF[21536][C-00000018] channel.c: DTMF end accepted with begin ‘9’ on Local/100@local-channel-bellen-00000009;2
[Oct 28 00:41:19] DTMF[21536][C-00000018] channel.c: DTMF end passthrough ‘9’ on Local/100@local-channel-bellen-00000009;2

It looks pretty much the same to me at first sight, but at the first part where 99 isn’t working there is this line
Oct 28 00:36:30] DTMF[21479][C-00000015] channel.c: DTMF begin ignored ‘9’ on Local/100@local-channel-bellen-00000008;2

The dtmf seems to be ignored while, when it is working, the line looks like

[Oct 28 00:41:19] DTMF[21536][C-00000018] channel.c: DTMF end accepted with begin ‘9’ on Local/100@local-channel-bellen-00000009;2

The question is what is causing this difference and can it be solved in some way.

I tried to route the dial plan in a way that if it comes to dealing and redialing local channels the sameas is happening when returning from the last page to the main menu by calling an extra local channel after the first one, but it isn’t working :frowning:

Does altering the featuredigittimeout in features.conf change the results at all?

I managed to make a workaround by adding the same route to the dial plan as what makes the feature works but then without any Playback(). (coming back into the main menu after the last available page is played and start at hoofdmenu,s,1 with dialing the local channel again. I have no idea why it works and why it first failed but it is working so now I can start thinking about doing something useful with it like adding Likes to a recorded page and/or reporting a bad or wrong recording and have a mail send to me or any other useful feature. Thanks for helping me out and giving me input that makes me going to find a working solution. Btw: it was by accident that it started to work after playing the last page and returning to the main menu.

exten => 888,1,Goto(workaround-dtmf,s,1) ; this is where call starts

[workaround-dtmf]
; this is the extra local channel that is called
;;;;;;;;;;;;;;;;;;;;;;;
; feature under keys 99 was only working after the last page was
; played and option 1 was choose again in the mainmenu
; there isn’t really a reasonble explanation but it worked.
; The workaround gimmicks listening to the last page and return
; to the main menu. And luckely it works
; Don’t ask me why :slight_smile:
;;;;;;;;;;;;;;;;;;;;;;

exten => s,1, Answer()
exten => s,n, Set(BLADZIJD=5) ; nu de laatset bladzijde, als het werkt de laatste bladzijde van het boek + 1.
exten => s,n, Dial(local/100@local2-channel-bellen/nj,30,r)

[local2-channel-bellen]
exten => 100,1,NoOp()
exten => 100,n,Wait(2)
exten => 100,n,Goto(workaround-dtmf2,1,1)

[workaround-dtmf2]
exten => 1,1, SET(__DYNAMIC_FEATURES=like_feature)
exten => 1,n, ControlPlayback(luisterboek/${BOEK}/${BLADZIJDE}/${BLADZIJDE},7500,#,*,1,2,3)
exten => 1,n, SET(BLADZIJDE=$[ ${BLADZIJDE}+1])
exten => 1,n,Goto(hoofdmenu,s,1)

[hoofdmenu]
exten => s,1, Answer()
exten => s,n, Dial(local/100@local-channel-bellen/nj,30,r)

exten => s,n(verder-met-hoofdmenu), NoOp() ;
etc. etc. etc.

[local-channel-bellen]
exten => 100,1,NoOp()
exten => 100,n,Wait(2)
exten => 100,n,Goto(hoofdmenu,s,start-hoofdmenu)