Play recording before connecting outbound calls

agidi

Joined
Jan 13, 2008
Messages
152
Likes
0
Points
0
#1
Hello

Hopefully someone with coding experience can point me in the right direction.

I need any dialing out user from our PBX to listen to a pre recorded msg before their call connects.

ie, the user dials, listens to msg, then he can hear the tone of the call ringing the other ext or number.

I was recommended to mod the macro-dialout-trunk in extensions_additional.conf, and after modding place it in extensions_override_freepbx.conf

at the moment I tried placing a simple Playback(filename) command in between lines. With and without the no answer option. also tried Progress(filename)

Like so at the beggining:
Code:
[macro-dialout-trunk]
include => macro-dialout-trunk-custom
exten => s,1,Set(DIAL_TRUNK=${ARG1})
exten => s,n Playback(advised-to-seek-shelter,noanswer)
exten => s,n,ExecIf($[$["${ARG3}" != ""] & $["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]],Authenticate,${ARG3})
exten => s,n,GotoIf($["x${OUTDISABLE_${DIAL_TRUNK}}" = "xon"]?disabletrunk,1)
exten => s,n,Set(DIAL_NUMBER=${ARG2})
exten => s,n,Set(DIAL_TRUNK_OPTIONS=${DIAL_OPTIONS})
and also tried in the middle before Dial :
Code:
exten => s,n,GotoIf($["${custom}" = "AMP"]?customtrunk)
exten => s,n Playback(advised-to-seek-shelter)
exten => s,n,Dial(${OUT_${DIAL_TRUNK}}/${OUTNUM},300,${DIAL_TRUNK_OPTIONS})
exten => s,n,Goto(s-${DIALSTATUS},1)
I restarted amportal, and tried.
but it does not play. or I'm doing something wrong.

any ideas, pointers or suggestions are welcomed.
thanks
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#2
Agidi:
Just a pointer for what it's worth,

Any question here is welcome, we care to help you, yet you post (as many do) very lopsidedly, you post what you changed but not what happened/went wrong.

you can change anything you care to in asterisk/FreePBX, but on the other side you have to know how debug what you did.

I suggest that at the asterisk CLI you watch a call as it is made, at a verbosity of 3 or more you will be able to trace your logic completely.

If there is a problem with that debug session that you don't understand, please repost with more informative information, We (I presume I speak for the community here) will be glad to help.
 

agidi

Joined
Jan 13, 2008
Messages
152
Likes
0
Points
0
#3
You are right Dicko

I forgot the CLI dump.

At the moment I have the playback line as shown:
Code:
exten => s,n,GotoIf($[$["${MOHCLASS}" = "default"] | $["foo${MOHCLASS}" = "foo"]]?gocall)
exten => s,n,Set(DIAL_TRUNK_OPTIONS=M(setmusic^${MOHCLASS})${DIAL_TRUNK_OPTIONS})
exten => s,n Playback(tt-weasels)
exten => s,n(gocall),Macro(dialout-trunk-predial-hook,)
exten => s,n,GotoIf($["${PREDIAL_HOOK_RET}" = "BYPASS"]?bypass,1)
The CLI verbose 7 first an ext to ext call, then out thru the PSTN

Code:
Connected to Asterisk 1.4.22-rc5 currently running on agidipbx (pid = 16959)
Verbosity was 3 and is now 7
    -- Executing [304@from-internal:1] Macro("SIP/202-09e72ba8", "exten-vm|304|304") in new stack
    -- Executing [s@macro-exten-vm:1] Macro("SIP/202-09e72ba8", "user-callerid") in new stack
    -- Executing [s@macro-user-callerid:1] NoOp("SIP/202-09e72ba8", "user-callerid: device 202") in new stack
    -- Executing [s@macro-user-callerid:2] Set("SIP/202-09e72ba8", "AMPUSER=202") in new stack
    -- Executing [s@macro-user-callerid:3] GotoIf("SIP/202-09e72ba8", "0?report") in new stack
    -- Executing [s@macro-user-callerid:4] ExecIf("SIP/202-09e72ba8", "1|Set|REALCALLERIDNUM=202") in new stack
    -- Executing [s@macro-user-callerid:5] NoOp("SIP/202-09e72ba8", "REALCALLERIDNUM is 202") in new stack
    -- Executing [s@macro-user-callerid:6] Set("SIP/202-09e72ba8", "AMPUSER=202") in new stack
    -- Executing [s@macro-user-callerid:7] Set("SIP/202-09e72ba8", "AMPUSERCIDNAME=A.Gidi") in new stack
    -- Executing [s@macro-user-callerid:8] GotoIf("SIP/202-09e72ba8", "0?report") in new stack
    -- Executing [s@macro-user-callerid:9] Set("SIP/202-09e72ba8", "AMPUSERCID=202") in new stack
    -- Executing [s@macro-user-callerid:10] Set("SIP/202-09e72ba8", "CALLERID(all)="A.Gidi" <202>") in new stack
    -- Executing [s@macro-user-callerid:11] Set("SIP/202-09e72ba8", "REALCALLERIDNUM=202") in new stack
    -- Executing [s@macro-user-callerid:12] ExecIf("SIP/202-09e72ba8", "0|Set|CHANNEL(language)=") in new stack
    -- Executing [s@macro-user-callerid:13] NoOp("SIP/202-09e72ba8", "TTL:  ARG1: 304") in new stack
    -- Executing [s@macro-user-callerid:14] GotoIf("SIP/202-09e72ba8", "0?continue") in new stack
    -- Executing [s@macro-user-callerid:15] Set("SIP/202-09e72ba8", "__TTL=64") in new stack
    -- Executing [s@macro-user-callerid:16] GotoIf("SIP/202-09e72ba8", "1?continue") in new stack
    -- Goto (macro-user-callerid,s,23)
    -- Executing [s@macro-user-callerid:23] NoOp("SIP/202-09e72ba8", "Using CallerID "A.Gidi" <202>") in new stack
    -- Executing [s@macro-exten-vm:2] Set("SIP/202-09e72ba8", "FROMCONTEXT=exten-vm") in new stack
    -- Executing [s@macro-exten-vm:3] Set("SIP/202-09e72ba8", "VMBOX=304") in new stack
    -- Executing [s@macro-exten-vm:4] Set("SIP/202-09e72ba8", "EXTTOCALL=304") in new stack
    -- Executing [s@macro-exten-vm:5] Set("SIP/202-09e72ba8", "CFUEXT=") in new stack
    -- Executing [s@macro-exten-vm:6] Set("SIP/202-09e72ba8", "CFBEXT=") in new stack
    -- Executing [s@macro-exten-vm:7] Set("SIP/202-09e72ba8", "RT=15") in new stack
    -- Executing [s@macro-exten-vm:8] Macro("SIP/202-09e72ba8", "record-enable|304|IN") in new stack
    -- Executing [s@macro-record-enable:1] GotoIf("SIP/202-09e72ba8", "0?2:4") in new stack
    -- Goto (macro-record-enable,s,4)
    -- Executing [s@macro-record-enable:4] AGI("SIP/202-09e72ba8", "recordingcheck|20090324-100901|1237910941.39") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
  recordingcheck|20090324-100901|1237910941.39: Inbound recording enabled.
  recordingcheck|20090324-100901|1237910941.39: CALLFILENAME=IN-304-1237910941.39
    -- AGI Script recordingcheck completed, returning 0
    -- Executing [s@macro-record-enable:999] MixMonitor("SIP/202-09e72ba8", "IN-304-1237910941.39.wav") in new stack
    -- Executing [s@macro-exten-vm:9] Macro("SIP/202-09e72ba8", "dial|15|tr|304") in new stack
    -- Executing [s@macro-dial:1] GotoIf("SIP/202-09e72ba8", "1?dial") in new stack
    -- Goto (macro-dial,s,3)
    -- Executing [s@macro-dial:3] AGI("SIP/202-09e72ba8", "dialparties.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
  == Begin MixMonitor Recording SIP/202-09e72ba8
  dialparties.agi: Starting New Dialparties.agi
  == Parsing '/etc/asterisk/manager.conf': Found
  == Parsing '/etc/asterisk/manager_additional.conf': Found
  == Parsing '/etc/asterisk/manager_custom.conf': Found
  == Manager 'admin' logged on from 127.0.0.1
  dialparties.agi: Caller ID name is 'A.Gidi' number is '202'
  dialparties.agi: USE_CONFIRMATION:  'FALSE'
  dialparties.agi: RINGGROUP_INDEX:   ''
  dialparties.agi: Methodology of ring is  'none'
    --  dialparties.agi: Added extension 304 to extension map
    --  dialparties.agi: Extension 304 cf is disabled
    --  dialparties.agi: Extension 304 do not disturb is disabled
       >  dialparties.agi: extnum 304 has:  cw: 1; hascfb: 0 [] hascfu: 0 []
       >  dialparties.agi: ExtensionState: 0
    --  dialparties.agi: dbset CALLTRACE/304 to 202
    --  dialparties.agi: Filtered ARG3: 304
  == Manager 'admin' logged off from 127.0.0.1
    -- AGI Script dialparties.agi completed, returning 0
    -- Executing [s@macro-dial:7] Dial("SIP/202-09e72ba8", "SIP/304|15|tr") in new stack
    -- Called 304
    -- SIP/304-09e74138 is ringing
    -- SIP/304-09e74138 answered SIP/202-09e72ba8
  == Spawn extension (macro-dial, s, 7) exited non-zero on 'SIP/202-09e72ba8' in macro 'dial'
  == Spawn extension (macro-dial, s, 7) exited non-zero on 'SIP/202-09e72ba8' in macro 'exten-vm'
  == Spawn extension (macro-dial, s, 7) exited non-zero on 'SIP/202-09e72ba8'
    -- Executing [h@macro-dial:1] Macro("SIP/202-09e72ba8", "hangupcall") in new stack
    -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/202-09e72ba8", "w") in new stack
    -- Executing [s@macro-hangupcall:2] NoCDR("SIP/202-09e72ba8", "") in new stack
    -- Executing [s@macro-hangupcall:3] GotoIf("SIP/202-09e72ba8", "1?skiprg") in new stack
    -- Goto (macro-hangupcall,s,6)
    -- Executing [s@macro-hangupcall:6] GotoIf("SIP/202-09e72ba8", "1?skipblkvm") in new stack
    -- Goto (macro-hangupcall,s,9)
    -- Executing [s@macro-hangupcall:9] GotoIf("SIP/202-09e72ba8", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,11)
    -- Executing [s@macro-hangupcall:11] Hangup("SIP/202-09e72ba8", "") in new stack
  == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/202-09e72ba8' in macro 'hangupcall'
  == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/202-09e72ba8'
  == End MixMonitor Recording SIP/202-09e72ba8

agidipbx*CLI> 
agidipbx*CLI> 
agidipbx*CLI> 
agidipbx*CLI> 
    -- Executing [7202370@from-internal:1] Macro("SIP/202-09e74138", "user-callerid|SKIPTTL|") in new stack
    -- Executing [s@macro-user-callerid:1] NoOp("SIP/202-09e74138", "user-callerid: device 202") in new stack
    -- Executing [s@macro-user-callerid:2] Set("SIP/202-09e74138", "AMPUSER=202") in new stack
    -- Executing [s@macro-user-callerid:3] GotoIf("SIP/202-09e74138", "0?report") in new stack
    -- Executing [s@macro-user-callerid:4] ExecIf("SIP/202-09e74138", "1|Set|REALCALLERIDNUM=202") in new stack
    -- Executing [s@macro-user-callerid:5] NoOp("SIP/202-09e74138", "REALCALLERIDNUM is 202") in new stack
    -- Executing [s@macro-user-callerid:6] Set("SIP/202-09e74138", "AMPUSER=202") in new stack
    -- Executing [s@macro-user-callerid:7] Set("SIP/202-09e74138", "AMPUSERCIDNAME=A.Gidi") in new stack
    -- Executing [s@macro-user-callerid:8] GotoIf("SIP/202-09e74138", "0?report") in new stack
    -- Executing [s@macro-user-callerid:9] Set("SIP/202-09e74138", "AMPUSERCID=202") in new stack
    -- Executing [s@macro-user-callerid:10] Set("SIP/202-09e74138", "CALLERID(all)="A.Gidi" <202>") in new stack
    -- Executing [s@macro-user-callerid:11] Set("SIP/202-09e74138", "REALCALLERIDNUM=202") in new stack
    -- Executing [s@macro-user-callerid:12] ExecIf("SIP/202-09e74138", "0|Set|CHANNEL(language)=") in new stack
    -- Executing [s@macro-user-callerid:13] NoOp("SIP/202-09e74138", "TTL:  ARG1: SKIPTTL") in new stack
    -- Executing [s@macro-user-callerid:14] GotoIf("SIP/202-09e74138", "1?continue") in new stack
    -- Goto (macro-user-callerid,s,23)
    -- Executing [s@macro-user-callerid:23] NoOp("SIP/202-09e74138", "Using CallerID "A.Gidi" <202>") in new stack
    -- Executing [7202370@from-internal:2] Set("SIP/202-09e74138", "_NODEST=") in new stack
    -- Executing [7202370@from-internal:3] Macro("SIP/202-09e74138", "record-enable|202|OUT|") in new stack
    -- Executing [s@macro-record-enable:1] GotoIf("SIP/202-09e74138", "0?2:4") in new stack
    -- Goto (macro-record-enable,s,4)
    -- Executing [s@macro-record-enable:4] AGI("SIP/202-09e74138", "recordingcheck|20090324-100913|1237910953.41") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
  recordingcheck|20090324-100913|1237910953.41: Outbound recording enabled.
  recordingcheck|20090324-100913|1237910953.41: CALLFILENAME=OUT-202-1237910953.41
    -- AGI Script recordingcheck completed, returning 0
    -- Executing [s@macro-record-enable:999] MixMonitor("SIP/202-09e74138", "OUT-202-1237910953.41.wav") in new stack
    -- Executing [7202370@from-internal:4] Macro("SIP/202-09e74138", "dialout-trunk|2|7202370||") in new stack
    -- Executing [s@macro-dialout-trunk:1] Set("SIP/202-09e74138", "DIAL_TRUNK=2") in new stack
    -- Executing [s@macro-dialout-trunk:2] ExecIf("SIP/202-09e74138", "0|Authenticate|") in new stack
    -- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/202-09e74138", "0?disabletrunk|1") in new stack
    -- Executing [s@macro-dialout-trunk:4] Set("SIP/202-09e74138", "DIAL_NUMBER=7202370") in new stack
    -- Executing [s@macro-dialout-trunk:5] Set("SIP/202-09e74138", "DIAL_TRUNK_OPTIONS=tr") in new stack
    -- Executing [s@macro-dialout-trunk:6] Set("SIP/202-09e74138", "GROUP()=OUT_2") in new stack
    -- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/202-09e74138", "1?nomax") in new stack
    -- Goto (macro-dialout-trunk,s,9)
    -- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/202-09e74138", "0?skipoutcid") in new stack
    -- Executing [s@macro-dialout-trunk:10] Set("SIP/202-09e74138", "DIAL_TRUNK_OPTIONS=") in new stack
    -- Executing [s@macro-dialout-trunk:11] Macro("SIP/202-09e74138", "outbound-callerid|2") in new stack
    -- Executing [s@macro-outbound-callerid:1] GotoIf("SIP/202-09e74138", "1?start") in new stack
    -- Goto (macro-outbound-callerid,s,3)
    -- Executing [s@macro-outbound-callerid:3] NoOp("SIP/202-09e74138", "REALCALLERIDNUM is 202") in new stack
    -- Executing [s@macro-outbound-callerid:4] GotoIf("SIP/202-09e74138", "1?normcid") in new stack
    -- Goto (macro-outbound-callerid,s,9)
    -- Executing [s@macro-outbound-callerid:9] Set("SIP/202-09e74138", "USEROUTCID=") in new stack
    -- Executing [s@macro-outbound-callerid:10] Set("SIP/202-09e74138", "EMERGENCYCID=") in new stack
    -- Executing [s@macro-outbound-callerid:11] Set("SIP/202-09e74138", "TRUNKOUTCID=") in new stack
    -- Executing [s@macro-outbound-callerid:12] GotoIf("SIP/202-09e74138", "1?trunkcid") in new stack
    -- Goto (macro-outbound-callerid,s,16)
    -- Executing [s@macro-outbound-callerid:16] GotoIf("SIP/202-09e74138", "1?usercid") in new stack
    -- Goto (macro-outbound-callerid,s,18)
    -- Executing [s@macro-outbound-callerid:18] GotoIf("SIP/202-09e74138", "1?report") in new stack
    -- Goto (macro-outbound-callerid,s,22)
    -- Executing [s@macro-outbound-callerid:22] NoOp("SIP/202-09e74138", "CallerID set to "A.Gidi" <202>") in new stack
    -- Executing [s@macro-dialout-trunk:12] AGI("SIP/202-09e74138", "fixlocalprefix") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/fixlocalprefix
  == Begin MixMonitor Recording SIP/202-09e74138
    -- AGI Script fixlocalprefix completed, returning 0
    -- Executing [s@macro-dialout-trunk:13] Set("SIP/202-09e74138", "OUTNUM=7202370") in new stack
    -- Executing [s@macro-dialout-trunk:14] Set("SIP/202-09e74138", "custom=ZAP/1") in new stack
    -- Executing [s@macro-dialout-trunk:15] GotoIf("SIP/202-09e74138", "1?gocall") in new stack
    -- Goto (macro-dialout-trunk,s,17)
    -- Executing [s@macro-dialout-trunk:17] Macro("SIP/202-09e74138", "dialout-trunk-predial-hook|") in new stack
    -- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/202-09e74138", "0?bypass|1") in new stack
    -- Executing [s@macro-dialout-trunk:19] GotoIf("SIP/202-09e74138", "0?customtrunk") in new stack
    -- Executing [s@macro-dialout-trunk:20] Dial("SIP/202-09e74138", "ZAP/1/7202370|300|") in new stack
    -- Called 1/7202370
    -- Zap/1-1 answered SIP/202-09e74138
    -- Hungup 'Zap/1-1'
  == Spawn extension (macro-dialout-trunk, s, 20) exited non-zero on 'SIP/202-09e74138' in macro 'dialout-trunk'
  == Spawn extension (macro-dialout-trunk, s, 20) exited non-zero on 'SIP/202-09e74138'
    -- Executing [h@macro-dialout-trunk:1] Macro("SIP/202-09e74138", "hangupcall|") in new stack
    -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/202-09e74138", "w") in new stack
    -- Executing [s@macro-hangupcall:2] NoCDR("SIP/202-09e74138", "") in new stack
    -- Executing [s@macro-hangupcall:3] GotoIf("SIP/202-09e74138", "1?skiprg") in new stack
    -- Goto (macro-hangupcall,s,6)
    -- Executing [s@macro-hangupcall:6] GotoIf("SIP/202-09e74138", "1?skipblkvm") in new stack
    -- Goto (macro-hangupcall,s,9)
    -- Executing [s@macro-hangupcall:9] GotoIf("SIP/202-09e74138", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,11)
    -- Executing [s@macro-hangupcall:11] Hangup("SIP/202-09e74138", "") in new stack
  == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/202-09e74138' in macro 'hangupcall'
  == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/202-09e74138'
  == End MixMonitor Recording SIP/202-09e74138
    -- Remote UNIX connection
    -- Remote UNIX connection disconnected
agidipbx*CLI>

I hope this helps. I see no error, nor do know how to use the debug features, just the CLI
thanks
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#4
from extensions.conf

.
.
;************************** -WARNING- ****************************************
; *
; This include file is to be used with extreme caution. In almost all cases *
; any custom dialplan SHOULD be put in extensions_custom.conf which will *
; not hurt a FreePBX generated dialplan. In some very rare and custom *
; situations users may have a need to override what freepbx automatically *
; generates. If so anything in this file will do that. If you come up with a *
; situation where you need to modify the existing dialplan or macro, please *
; put it here and also notify the FreePBX development team so they can take it *
; into account in the future. *
; *
#include extensions_override_freepbx.conf
; *
;************************** -WARNING- ****************************************

yet it is not calling your macro, just the original, (are the permissions correct on the file?)

given this warning, I suggest you go to the freepbx forums.

Maybe start here:
http://www.freepbx.org/forum/freepbx/in ... tions-file
 

wiseoldowl

Joined
Aug 19, 2008
Messages
251
Likes
0
Points
0
#5
agidi said:
Hello

Hopefully someone with coding experience can point me in the right direction.

I need any dialing out user from our PBX to listen to a pre recorded msg before their call connects.

ie, the user dials, listens to msg, then he can hear the tone of the call ringing the other ext or number.

I was recommended to mod the macro-dialout-trunk in extensions_additional.conf, and after modding place it in extensions_override_freepbx.conf
Whoever recommended THAT sure likes to do things the hard way (you weren't taking advice from someone in an IRC channel, were you?). Anyway, this document was custom-made for your situation:

How to execute a custom dial plan fragment before sending a call to a trunk (for playing an announcement, etc.)
 

agidi

Joined
Jan 13, 2008
Messages
152
Likes
0
Points
0
#6
Wiseoldowl, thanks!

Read it and tried, it, it worked.

I just have a doubt about changing the last line of the macro to have it send a "failing trunk" error on purpose. I made a post about it
http://www.freepbx.org/forum/freepbx/us ... stinations

thanks for your help, much appreciated
Alejandro Gidi
AlexGC
 

Members online

Latest posts

Forum statistics

Threads
30,902
Messages
130,888
Members
17,568
Latest member
mehdii_igi
Top