Hotline - play message in Queue/Dial before connect call

Hi, I need to create a hotline for my customers.
Once the customer calls, Asterisk hands the call over to the first technician. If he is not available, then the next one. Each customer has their own PIN. Without PIN, there will be no connection to the technician.
That works for me.

After connecting the call to the technician, I want to play the text with the customer’s name/PIN (so that the technician knows who is calling) and then connect the call. But, unfortunately, I don’t know how to do it.

My config:

# -------------------------------------------
# cat /etc/asterisk/queues.conf
[general]
persistentmembers = yes
monitor-type = MixMonitor

[queue_template](!)
musicclass=company
strategy=linear
joinempty=yes
leavewhenempty=no
ringinuse=no

[techsupport](queue_template)
member = SIP/00420111111111@trunk
member = SIP/00420222222222@trunk

# -------------------------------------------
# cat /etc/asterisk/extensions.conf
[incomming]
exten => s,1,MixMonitor("/var/log/hotline/${STRFTIME(${EPOCH},,%Y-%m-%d-%H-%M-%S)}_${CALLERID(num)}.wav")
exten => s,n,Playback(hello)
exten => s,n,DBdeltree(customer)
exten => s,n,Set(DB(customer/12345)=1)
exten => s,n,Set(DB(customer/54321)=1)
exten => s,n,Playback(conf-getpin)
exten => s,n,Read(CUSTOMER,,0,,1,60)
exten => s,n,GotoIf(${DB_EXISTS(customer/${CUSTOMER})}?:customer,s,100)
exten => s,n,Queue(techsupport)
exten => s,n,Playback(goodbye)
exten => s,n,Hangup
exten => s,100,Playback(conf-invalidpin)
exten => s,101,Hangup

I used this for a while:

; extensions.conf
[macro-announce-to-queue-member]
exten => s,1,NoOp(announce-to-queue-member)
same  => n,Wait(0.5)
same  => n,Flite("Time in Queue: ${QEHOLDTIME} seconds.")
same  => n,MacroExit

Along with:

; queues.conf
[my-queue]
musicclass=ours
joinempty=no
leavewhenempty=no
ringinuse=no
reportholdtime = no
strategy=ringall	
... more stuff ...
membermacro=announce-to-queue-member
setqueuevar=yes
setqueueentryvar=yes
... members ...

This turned out to be more irritating than useful:

  • caller has to wait in silence while the text is being spoken to the agent
  • agent’s habit is to answer the phone stating name and company, not to await such a message
  • times are usually too short to warrant such an info anyway

But your mileage may, of course, vary :wink:

@wusel Hello, it works great. Thanks.

You were right. That silence sounds strange.
Can I keep playing musicclass to the caller until the membermacro finishes?

Hi @tuxmartin,

  1. Macro() has been deprecated. Instead, use membergosub [1]
  2. IIRC, if you use the announce option, it will not stop MOH, but I may be wrong on that. [2] [3]

[1]

[2]
Set the announcement in the queue config:

[3]
Pass the announcement dynamically

exten => s,n,Queue(techsupport,,,custom/${customer_name})

https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Application_Queue

Hi @PitzKey it works great:

exten => s,n,Queue(techsupport,,,/etc/asterisk/sounds/incoming-call-from)

Is it possible to play two files in Queue?

In the documentation, I found the following (Asterisk 19 Application_Queue - Asterisk Project - Asterisk Project Wiki):

announceoverride
filename - Announcement file(s) to play to agent before bridging call, overriding the announcement(s) configured in queues.conf, if any.
filename2[,filename2…]

But it doesn’t work for me:

exten => s,n,Set(GLOBAL(CUSTOMER_NAME)=test)
exten => s,n,Queue(techsupport,,,/etc/asterisk/sounds/incomming-call-from,/etc/asterisk/sounds/customer-${CUSTOMER_NAME})

The structured comments actually say to use & not comma. It looks like the help generator is broken, or the markup syntax is wrong. The code treats the value exactly the same as announce in queues.conf, and, although I couldn’t find anything that allows multiple file names there, it is possible. NB, only enough space is reserved for one long path name.

			<parameter name="announceoverride" argsep="&amp;">
				<argument name="filename" required="true">
					<para>Announcement file(s) to play to agent before bridging call, overriding the announcement(s)
					configured in <filename>queues.conf</filename>, if any.</para>
				</argument>
				<argument name="filename2" multiple="true" />
			</parameter>

@david551

I changed it to

exten => s,n,Queue(techsupport,,,/etc/asterisk/sounds/incomming-call-from&/etc/asterisk/sounds/customer-${CUSTOMER_NAME})

and it still doesn’t work.

Which version are you using? This first appeared in: 16.20.0, 18.6.0, 19.0.0, and 20.0.0.

See:

https://issues.asterisk.org/jira/browse/ASTERISK-29528

Note that versions 16 and 19 are in security fixes only state.

@david551 I have Asterisk 16.16.1. Which version do I need?

The minimum sub-versions were listed in my previous posting. 16.20.0 for Asterisk 16.

If you have any Asterisk 16, you should be upgrading, probably to Asterisk 20.1.0.

1 Like

@david551 I used Asterisk 18.15.0-r0 (Alpine Linux v3.17), and it works great. Thank you.

Tested with 18.15.1

same => n,Queue(4110,,,SIP_Test_Failure&SIP_Test_Success)

Log:

[2023-01-03 07:09:21] VERBOSE[56180][C-00000006] pbx.c: Executing [*8803@from-internal:7] Queue("PJSIP/10111-00000006", "4110,,,SIP_Test_Failure&SIP_Test_Success") in new stack
[2023-01-03 07:09:21] VERBOSE[56180][C-00000006] res_musiconhold.c: Started music on hold, class 'default', on channel 'PJSIP/10111-00000006'
[2023-01-03 07:09:21] VERBOSE[56180][C-00000006] app_queue.c: Called PJSIP/2547
[2023-01-03 07:09:21] VERBOSE[54538] netsock2.c: Using SIP RTP Audio TOS bits 184
[2023-01-03 07:09:21] VERBOSE[54538] netsock2.c: Using SIP RTP Audio TOS bits 184 in TCLASS field.
[2023-01-03 07:09:21] VERBOSE[54538] netsock2.c: Using SIP RTP Audio CoS mark 5
[2023-01-03 07:09:21] VERBOSE[56180][C-00000006] app_queue.c: PJSIP/2547-00000007 connected line has changed. Saving it until answer for PJSIP/10111-00000006
[2023-01-03 07:09:22] VERBOSE[56180][C-00000006] app_queue.c: PJSIP/2547-00000007 is ringing
[2023-01-03 07:09:26] VERBOSE[54538] res_rtp_asterisk.c: 0x7f479807f780 -- Strict RTP learning after remote address set to: XX.XX.XXX.XX:17549
[2023-01-03 07:09:26] VERBOSE[56180][C-00000006] app_queue.c: PJSIP/2547-00000007 answered PJSIP/10111-00000006
[2023-01-03 07:09:26] VERBOSE[56180][C-00000006] file.c: <PJSIP/2547-00000007> Playing 'SIP_Test_Failure.ulaw' (language 'en')
[2023-01-03 07:09:28] VERBOSE[56180][C-00000006] file.c: <PJSIP/2547-00000007> Playing 'SIP_Test_Success.ulaw' (language 'en')
[2023-01-03 07:09:39] VERBOSE[56180][C-00000006] res_musiconhold.c: Stopped music on hold on PJSIP/10111-00000006
[2023-01-03 07:09:39] VERBOSE[56251][C-00000006] bridge_channel.c: Channel PJSIP/2547-00000007 joined 'simple_bridge' basic-bridge <e636b45d-c16d-402b-86ff-0c0f562f4760>
[2023-01-03 07:09:39] VERBOSE[56180][C-00000006] bridge_channel.c: Channel PJSIP/10111-00000006 joined 'simple_bridge' basic-bridge <e636b45d-c16d-402b-86ff-0c0f562f4760>

As you can see, it plays fine and MOH continues to play.

Edit - jinks :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.