Custom Call-back functionality.

General discussions about Asterisk.

Moderators: Moderator, Support

Custom Call-back functionality.

Postby volodyaivanets » Mon Aug 10, 2015 8:19 am

Hello everyone,

I was wondering if it is possible to put line like Local/some-number@some-context to specific position in the queue.

So it should work something like this:
    - Caller gets in the queue
    - Caller presses some button to to jump to different context
    - That context will use ${QUEUEPOSITION} and ${CALLERID(num)} to generate Local/some-number@some-context line. Question is if it possible to sent some extra value to Queue() that will tell Asterisk the position where to put this channel. I want to use it as a trigger for custom call back context.

I was not able to find confirmation yet, so I'm hoping some one will tell me if it's even possible. Or maybe there is better way to achieve the goal.

Thanks a lot!
volodyaivanets
Newsterisk
 
Posts: 21
Joined: Thu Jul 11, 2013 6:59 am

Re: Custom Call-back functionality.

Postby volodyaivanets » Mon Aug 10, 2015 8:34 am

Hello again,

My friend told that Queue() has option called position:
Queue(queuename[,options[,URL[,announceoverride[,timeout[,AGI[,macro[,gosub[,rule[,position]]]]]]]]])

Going to try this first thing tomorrow morning.
volodyaivanets
Newsterisk
 
Posts: 21
Joined: Thu Jul 11, 2013 6:59 am

Re: Custom Call-back functionality.

Postby volodyaivanets » Tue Aug 11, 2015 11:34 am

Hello,

I have some progress on this. Turned out it is pretty simple. I'll reply with configuration examples when will have time to finish and test this.
volodyaivanets
Newsterisk
 
Posts: 21
Joined: Thu Jul 11, 2013 6:59 am

Re: Custom Call-back functionality.

Postby volodyaivanets » Tue Aug 18, 2015 12:53 pm

Hello. So here is my solution. Hope it will help someone.

My queue name is 120. It includes context=break.

Than there is next in dial plan:
[break]
exten => 6,1,Goto(go-ofline-queue-120,s,1)

Next context generates Asterisk call file. Than initiates call by moving it to /var/spool/asterisk/outgoing/:
[go-ofline-queue-120]
exten => s,1,Answer()
exten => s,n,Set(timestamp=${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})
exten => s,n,NoOp(${timestamp})
exten => s,n, System(/bin/echo "Channel: Local/"${queueposition}"@get-to-the-queue-120-with-defined-position" > /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call) ;Generates channel that will be putted to the queue 120 with rules from get-to-the-queue-120-with-defined-position context.
exten => s,n, System(/bin/echo "MaxRetries: 1" >> /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call)
exten => s,n, System(/bin/echo "WaitTime: 30" >> /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call)
exten => s,n, System(/bin/echo "CallerID: "Offline queue 120" <"${CALLERID(num)}">" >> /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call)
exten => s,n, System(/bin/echo "Context: agent-confirmation-to-accept-offline-caller-from-queue-120" >> /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call)
exten => s,n, System(/bin/echo "Extension: 100" >> /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call)
exten => s,n, System(/bin/echo "Priority: 1" >> /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call)
exten => s,n, System(/bin/echo "Set: number-position="${CALLERID(num)}"-"${QUEUEPOSITION} >> /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call) ;Sends variable with callers number and original queue position information (end up not using second)
;Makes loop on channel that will ask agent to press 1 over and over again.
exten => s,n, System(/bin/mv /usr/src/asterisk_call_files/queue_120_offline_${timestamp}.call /var/spool/asterisk/outgoing/)
exten => s,n,Hangup

This context is used by call file described above. It puts channel to appropriate queue position by using "EXTEN" variable:
[get-to-the-queue-120-with-defined-position]
exten => _X,1,Answer()
exten => _X,n,Set(CHANNEL(language)=ua)
exten => _X,n,Queue(120,t,,,,,,,,${EXTEN})
exten => _X,n,Hangup
exten => _X.,1,Answer()
exten => _X.,n,Set(CHANNEL(language)=ua)
exten => _X.,n,Queue(120,t,,,,,,,,${EXTEN})
exten => _X.,n,Hangup

And here is what will be going on on "callers" channel in the queue:
[agent-confirmation-to-accept-offline-caller-from-queue-120]
exten => 100,1,Answer()
exten => 100,n,Set(EXT=0)
exten => 100,n(noinput),Read(EXT,ua/offline-caller-press-1-to-confirm,,,,1)
exten => 100,n,GotoIf($["${EXT}" = "1"]?proceed:noinput)
exten => 100,n(proceed),Playback(ua/will-connect-right-now)
exten => 100,n,Dial(Local/${CUT(number-position,,1)}@from-internal)
exten => 100,n,Hangup


Next step will be to add couple more of voice prompts, caller ID number check just in case and few lines to write logs here and there.

I'll appreciate any suggestion and ideas.

Thanks!
volodyaivanets
Newsterisk
 
Posts: 21
Joined: Thu Jul 11, 2013 6:59 am


Return to Asterisk General

Who is online

Users browsing this forum: No registered users and 1 guest