Ring back to transferrer instead of going to voicemail?

I have a client who prefers not to use voicemail all the time. Rather than a voicemail message, they would prefer that when a call is transferred, and no one picks up, it will ring back to the person who originally transferred the call. Any ideas on how to do this?

I did find an old post (http://www.freepbx.org/forum/blind-transfer) that explains how to do it on blind transfer, but I’d like to do this for both types of transfer. The code posted in that thread is a bit out of date too.

Thanks!
Justin

When I went to that link it looks like it’s written in a different language. I have a client that is about to pull the phone system (we just sold it) if we can’t get this fixed soon… this means I would have to buy back about 15 polycom IP501s and I really don’t want to do that.

There HAS to be a workable solution for this.

-Rich

I thought this would be a quick few lines of code to help you out. It ended up taking all of a Sunday morning. You may have to play with it a little, but it works on my machine and I like it enough to keep using it.

Put it in extensions_custom.conf. Then put your extensions in custom-from_internal from FreePBX. I am also going to submit this as a feature request for the next FreePBX.

[custom-test_transfer]

; This code will transfer a call and if it is not answered in the time set
; below, it will ring back the original transferor with the call. The time set
; below must be less than the voicemail timeout on the called extension.
; This code will require modification if you have differing extension number lengths
; ie; you have some 3 digit extensions and some four digit extensions.
;
; To use it, put the extensions that you want to have this behaviour in a special context
; of custom-from_internal

exten => _X.,1,NOOP(entering custom-test_transfer)
exten => _X.,n,set(timeoutd=20) ; set timeout in seconds
exten => _X.,n,set(extLeng=${LEN(${EXTEN})})
exten => _X.,n,noop(the extenlength is ${extLeng}
exten => _x.,n,dial(local/${EXTEN}@from-internal,${timeoutd})
exten => _X.,n,Gotoif($["${DIALSTATUS}" = “ANSWER”]?hangup,callback)
exten => _X.,n(callback),dial(local/${BLINDTRANSFER:4:${extLeng}}@from-internal)
exten => _X.,n(hangup),hangup()

[custom-from_internal]

; This context sets a custom transfer context in Asterisk to use the code in
; custom-test_transfer

exten => _x.,1,NOOP(here tiz in custom-from_internal)
exten => _x.,n,set(__TRANSFER_CONTEXT=custom-test_transfer|${EXTEN}|1)
exten => _x.,n,goto(from-internal,${EXTEN},1)

You will also need to include the following line in from-pstn-custom in extensions_custom.conf to make this work with incoming calls.

exten => _x.,n,set(__TRANSFER_CONTEXT=custom-test_transfer|${EXTEN}|1)

Great! Thanks for spending time on this! It excites me enough that I think I will drive to my client tonight and test this.

There might be a typo in the following line:

exten => _X.,n,noop(the extenlength is ${extLeng}

It’s missing a closing parenthesis. It should be:

exten => _X.,n,noop(the extenlength is ${extLeng})

That explains why that wasn’t showing up in the CLI output. Nice catch. Let me know if you have any trouble with it.

Might want to add these to make it so you can transfer to a voicemail box.

exten => _*X.,1,dial(local/${EXTEN}@from-internal,15)
exten => _*X.,n,hangup()

Where would I put those? I’m a bit of an asterisk-config-novice.

I put them in the right place at the bottom of this context.

{{{
[custom-test_transfer]

; This code will transfer a call and if it is not answered in the time set
; below, it will ring back the original transferor with the call. The time set
; below must be less than the voicemail timeout on the called extension.
; This code will require modification if you have differing extension number lengths
; ie; you have some 3 digit extensions and some four digit extensions.
;
; To use it, put the extensions that you want to have this behaviour in a special context
; of custom-from_internal

exten => _X.,1,NOOP(entering custom-test_transfer)
exten => _X.,n,set(timeoutd=20) ; set timeout in seconds
exten => _X.,n,set(extLeng=${LEN(${EXTEN})})
exten => _X.,n,noop(the extenlength is ${extLeng}
exten => _x.,n,dial(local/${EXTEN}@from-internal,${timeoutd})
exten => _X.,n,Gotoif($["${DIALSTATUS}" = “ANSWER”]?hangup,callback)
exten => _X.,n(callback),dial(local/${BLINDTRANSFER:4:${extLeng}}@from-internal)
exten => _X.,n(hangup),hangup()
exten => _*X.,1,dial(local/${EXTEN}@from-internal,15)
exten => _*X.,n,hangup()
}}}

I’m at the client, testing it. It’s not working, so. I’ll past the relevant debug lines and my config:

[Aug 10 16:59:52] VERBOSE[23585] logger.c: -- Started music on hold, class 'default', on Zap/1-1 [Aug 10 16:59:53] WARNING[23561] rtp.c: Unable to set TOS to 184 [Aug 10 16:59:53] VERBOSE[23590] logger.c: -- Executing [127@custom-from_internal:1] NoOp("SIP/121-b790efd0", "here tiz in custom-from_internal") in new stack [Aug 10 16:59:53] VERBOSE[23590] logger.c: -- Executing [127@custom-from_internal:2] Set("SIP/121-b790efd0", "__TRANSFER_CONTEXT=custom-test_transfer|127|1") in new stack [Aug 10 16:59:53] WARNING[23590] pbx.c: Setting multiple variables at once within Set is deprecated. Please separate each name/value pair into its own line. [Aug 10 16:59:53] WARNING[23590] pbx.c: Ignoring entry '127' with no = (and not last 'options' entry) [Aug 10 16:59:53] VERBOSE[23590] logger.c: -- Executing [127@custom-from_internal:3] Goto("SIP/121-b790efd0", "from-internal|127|1") in new stack [Aug 10 16:59:53] VERBOSE[23590] logger.c: -- Goto (from-internal,127,1) [Aug 10 16:59:53] VERBOSE[23590] logger.c: -- Executing [127@from-internal:1] GotoIf("SIP/121-b790efd0", "1?ext-local|127|1") in new stack [Aug 10 16:59:53] VERBOSE[23590] logger.c: -- Goto (ext-local,127,1) [Aug 10 16:59:53] VERBOSE[23590] logger.c: -- Executing [127@ext-local:1] Macro("SIP/121-b790efd0", "exten-vm|127|127") in new stack [Aug 10 16:59:53] VERBOSE[23590] logger.c: -- Executing [s@macro-exten-vm:1] Macro("SIP/121-b790efd0", "user-callerid") in new stack

[code][custom-test_transfer]

exten => _X.,1,NOOP(entering custom-test_transfer)
exten => _X.,n,set(timeoutd=10) ; set timeout in seconds
exten => _X.,n,set(extLeng=${LEN(${EXTEN})})
exten => _X.,n,noop(the extenlength is ${extLeng})
exten => _x.,n,dial(local/${EXTEN}@from-internal,${timeoutd})
exten => _X.,n,Gotoif($["${DIALSTATUS}" = “ANSWER”]?hangup,callback)
exten => _X.,n(callback),dial(local/${BLINDTRANSFER:4:${extLeng}}@from-internal)
exten => _X.,n(hangup),hangup()
exten => _*X.,1,dial(local/${EXTEN}@from-internal,15)
exten => _*X.,n,hangup()

[custom-from_internal]

exten => _x.,1,NOOP(here tiz in custom-from_internal)
exten => _x.,n,set(__TRANSFER_CONTEXT=custom-test_transfer|${EXTEN}|1)
exten => _x.,n,goto(from-internal,${EXTEN},1)

[from-pstn-custom]
exten => _x.,n,set(__TRANSFER_CONTEXT=custom-test_transfer|${EXTEN}|1)
[/code]

In freepbx, I disabled followme for the extensions that I’m testing it on. And for each extension i set the context to custom-from_internal. That’s everything I did. The phones are set to go to voicemail in 15 seconds, so I changed timeoutd to 10 seconds.

To test it, I called in with my cell phone and answered the call. Then I tried both a blind transfer and a semi-attended transfer (don’t know what to call this) to another extension. It is just going to voicemail.

Any ideas?

Justin

Actually, those logs are only displayed when I do an attended transfer. I don’t see anything with custom-from_internal (except during asterisk initialization) when doing a blind xfer.

Did you add this line to from-pstn-custom in extensions_customs.conf?

[from-pstn-custom]
exten => _x.,n,set(__TRANSFER_CONTEXT=custom-test_transfer|${EXTEN}|1)

Also make sure the extensions are in the context custom-from_internal

I will be available until 1900 Eastern time (2300 UTC) if you want to call. We have friends coming over for dinner.

Yes, I added the from-pstn-custom addition to extensions_custom.conf. I’ll give you a ring now!

Justin

John - here is the CLI output:

Asterisk 1.4.18.1, Copyright © 1999 - 2008 Digium, Inc. and others.
Created by Mark Spencer [email protected]
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘core show license’ for details.

== Parsing ‘/etc/asterisk/asterisk.conf’: Found
Connected to Asterisk 1.4.18.1 currently running on voip (pid = 30056)
Verbosity is at least 8
– Starting simple switch on ‘Zap/1-1’
– Executing [s@from-zaptel:1] NoOp(“Zap/1-1”, "Entering from-zaptel with DID == ") in new stack
– Executing [s@from-zaptel:2] Ringing(“Zap/1-1”, “”) in new stack
– Executing [s@from-zaptel:3] Set(“Zap/1-1”, “DID=s”) in new stack
– Executing [s@from-zaptel:4] NoOp(“Zap/1-1”, “DID is now s”) in new stack
– Executing [s@from-zaptel:5] GotoIf(“Zap/1-1”, “1?zapok:notzap”) in new stack
– Goto (from-zaptel,s,8)
– Executing [s@from-zaptel:8] NoOp(“Zap/1-1”, “Is a Zaptel Channel”) in new stack
– Executing [s@from-zaptel:9] Set(“Zap/1-1”, “CHAN=1-1”) in new stack
– Executing [s@from-zaptel:10] Set(“Zap/1-1”, “CHAN=1”) in new stack
– Executing [s@from-zaptel:11] Macro(“Zap/1-1”, “from-zaptel-1|s|1”) in new stack
– Executing [s@macro-from-zaptel-1:1] NoOp(“Zap/1-1”, “Entering macro-from-zaptel-1 with DID = s and setting to: 9195551212”) in new stack
– Executing [s@macro-from-zaptel-1:2] Set(“Zap/1-1”, “__FROM_DID=9195551212”) in new stack
– Executing [s@macro-from-zaptel-1:3] Goto(“Zap/1-1”, “from-trunk|9195551212|1”) in new stack
– Goto (from-trunk,9195551212,1)
== Channel ‘Zap/1-1’ jumping out of macro ‘from-zaptel-1’
– Executing [9195551212@from-trunk:1] NoOp(“Zap/1-1”, “Catch-All DID Match - Found 9195551212 - You probably want a DID for this.”) in new stack
– Executing [9195551212@from-trunk:2] Goto(“Zap/1-1”, “ext-did|s|1”) in new stack
– Goto (ext-did,s,1)
– Executing [s@ext-did:1] Set(“Zap/1-1”, “__FROM_DID=s”) in new stack
– Executing [s@ext-did:2] GotoIf(“Zap/1-1”, “0 ?cidok”) in new stack
– Executing [s@ext-did:3] Set(“Zap/1-1”, “CALLERID(name)=”) in new stack
– Executing [s@ext-did:4] NoOp(“Zap/1-1”, “CallerID is “” <>”) in new stack
– Executing [s@ext-did:5] Set(“Zap/1-1”, “FAX_RX=disabled”) in new stack
– Executing [s@ext-did:6] Set(“Zap/1-1”, “__CALLINGPRES_SV=allowed_not_screened”) in new stack
– Executing [s@ext-did:7] SetCallerPres(“Zap/1-1”, “allowed_not_screened”) in new stack
– Executing [s@ext-did:8] Set(“Zap/1-1”, “__ALERT_INFO=External”) in new stack
– Executing [s@ext-did:9] Goto(“Zap/1-1”, “ext-group|601|1”) in new stack
– Goto (ext-group,601,1)
– Executing [601@ext-group:1] Macro(“Zap/1-1”, “user-callerid|”) in new stack
– Executing [s@macro-user-callerid:1] NoOp(“Zap/1-1”, "user-callerid: ") in new stack
– Executing [s@macro-user-callerid:2] Set(“Zap/1-1”, “AMPUSER=”) in new stack
– Executing [s@macro-user-callerid:3] GotoIf(“Zap/1-1”, “0?report”) in new stack
– Executing [s@macro-user-callerid:4] ExecIf(“Zap/1-1”, “1|Set|REALCALLERIDNUM=”) in new stack
– Executing [s@macro-user-callerid:5] NoOp(“Zap/1-1”, "REALCALLERIDNUM is ") in new stack
– Executing [s@macro-user-callerid:6] Set(“Zap/1-1”, “AMPUSER=”) in new stack
– Executing [s@macro-user-callerid:7] Set(“Zap/1-1”, “AMPUSERCIDNAME=”) in new stack
– Executing [s@macro-user-callerid:8] GotoIf(“Zap/1-1”, “1?report”) in new stack
– Goto (macro-user-callerid,s,13)
– Executing [s@macro-user-callerid:13] NoOp(“Zap/1-1”, "TTL: ARG1: ") in new stack
– Executing [s@macro-user-callerid:14] GotoIf(“Zap/1-1”, “0?continue”) in new stack
– Executing [s@macro-user-callerid:15] Set(“Zap/1-1”, “__TTL=64”) in new stack
– Executing [s@macro-user-callerid:16] GotoIf(“Zap/1-1”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,23)
– Executing [s@macro-user-callerid:23] NoOp(“Zap/1-1”, “Using CallerID “” <>”) in new stack
– Executing [601@ext-group:2] GotoIf(“Zap/1-1”, “1?skipdb”) in new stack
– Goto (ext-group,601,4)
– Executing [601@ext-group:4] Set(“Zap/1-1”, “__NODEST=”) in new stack
– Executing [601@ext-group:5] Set(“Zap/1-1”, “__BLKVM_OVERRIDE=BLKVM/601/Zap/1-1”) in new stack
– Executing [601@ext-group:6] Set(“Zap/1-1”, “__BLKVM_BASE=601”) in new stack
– Executing [601@ext-group:7] Set(“Zap/1-1”, “DB(BLKVM/601/Zap/1-1)=TRUE”) in new stack
– Executing [601@ext-group:8] Set(“Zap/1-1”, “RRNODEST=”) in new stack
– Executing [601@ext-group:9] Set(“Zap/1-1”, “__NODEST=601”) in new stack
– Executing [601@ext-group:10] Set(“Zap/1-1”, “__ALERT_INFO=External”) in new stack
– Executing [601@ext-group:11] Set(“Zap/1-1”, “RecordMethod=Group”) in new stack
– Executing [601@ext-group:12] Macro(“Zap/1-1”, “record-enable|110-111-112-114-115-116-117-118-119-120-121-122-123-124-125-126-127-128-129-130|Group”) in new stack
– Executing [s@macro-record-enable:1] GotoIf(“Zap/1-1”, “0?2:4”) in new stack
– Goto (macro-record-enable,s,4)
– Executing [s@macro-record-enable:4] AGI(“Zap/1-1”, “recordingcheck|20080810-181933|1218406765.39”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
– AGI Script recordingcheck completed, returning 0
– Executing [s@macro-record-enable:5] NoOp(“Zap/1-1”, “No recording needed”) in new stack
– Executing [601@ext-group:13] Set(“Zap/1-1”, “RingGroupMethod=ringall”) in new stack
– Executing [601@ext-group:14] Macro(“Zap/1-1”, “dial|20|tr|110-111-112-114-115-116-117-118-119-120-121-122-123-124-125-126-127-128-129-130”) in new stack
– Executing [s@macro-dial:1] GotoIf(“Zap/1-1”, “1?dial”) in new stack
– Goto (macro-dial,s,3)
– Executing [s@macro-dial:3] AGI(“Zap/1-1”, “dialparties.agi”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
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 ‘unknown’ number is ‘unknown’
> dialparties.agi: Setting Alert-Info: External
– AGI Script Executing Application: (SIPAddHeader) Options: (Alert-Info:External)
dialparties.agi: USE_CONFIRMATION: 'FALSE’
dialparties.agi: RINGGROUP_INDEX: ''
dialparties.agi: Methodology of ring is ‘ringall’
– dialparties.agi: Added extension 110 to extension map
– dialparties.agi: Added extension 111 to extension map
– dialparties.agi: Added extension 112 to extension map
– dialparties.agi: Added extension 114 to extension map
– dialparties.agi: Added extension 115 to extension map
– dialparties.agi: Added extension 116 to extension map
– dialparties.agi: Added extension 117 to extension map
– dialparties.agi: Added extension 118 to extension map
– dialparties.agi: Added extension 119 to extension map
– dialparties.agi: Added extension 120 to extension map
– dialparties.agi: Added extension 121 to extension map
– dialparties.agi: Added extension 122 to extension map
– dialparties.agi: Added extension 123 to extension map
– dialparties.agi: Added extension 124 to extension map
– dialparties.agi: Added extension 125 to extension map
– dialparties.agi: Added extension 126 to extension map
– dialparties.agi: Added extension 127 to extension map
– dialparties.agi: Added extension 128 to extension map
– dialparties.agi: Added extension 129 to extension map
– dialparties.agi: Added extension 130 to extension map
– dialparties.agi: Extension 110 cf is disabled
– dialparties.agi: Extension 111 cf is disabled
– dialparties.agi: Extension 112 cf is disabled
– dialparties.agi: Extension 114 cf is disabled
– dialparties.agi: Extension 115 cf is disabled
– dialparties.agi: Extension 116 cf is disabled
– dialparties.agi: Extension 117 cf is disabled
– dialparties.agi: Extension 118 cf is disabled
– dialparties.agi: Extension 119 cf is disabled
– dialparties.agi: Extension 120 cf is disabled
– dialparties.agi: Extension 121 cf is disabled
– dialparties.agi: Extension 122 cf is disabled
– dialparties.agi: Extension 123 cf is disabled
– dialparties.agi: Extension 124 cf is disabled
– dialparties.agi: Extension 125 cf is disabled
– dialparties.agi: Extension 126 cf is disabled
– dialparties.agi: Extension 127 cf is disabled
– dialparties.agi: Extension 128 cf is disabled
– dialparties.agi: Extension 129 cf is disabled
– dialparties.agi: Extension 130 cf is disabled
– dialparties.agi: Extension 110 do not disturb is disabled
– dialparties.agi: Extension 111 do not disturb is disabled
– dialparties.agi: Extension 112 do not disturb is disabled
– dialparties.agi: Extension 114 do not disturb is disabled
– dialparties.agi: Extension 115 do not disturb is disabled
– dialparties.agi: Extension 116 do not disturb is disabled
– dialparties.agi: Extension 117 do not disturb is disabled
– dialparties.agi: Extension 118 do not disturb is disabled
– dialparties.agi: Extension 119 do not disturb is disabled
– dialparties.agi: Extension 120 do not disturb is disabled
– dialparties.agi: Extension 121 do not disturb is disabled
– dialparties.agi: Extension 122 do not disturb is disabled
– dialparties.agi: Extension 123 do not disturb is disabled
– dialparties.agi: Extension 124 do not disturb is disabled
– dialparties.agi: Extension 125 do not disturb is disabled
– dialparties.agi: Extension 126 do not disturb is disabled
– dialparties.agi: Extension 127 do not disturb is disabled
– dialparties.agi: Extension 128 do not disturb is disabled
– dialparties.agi: Extension 129 do not disturb is disabled
– dialparties.agi: Extension 130 do not disturb is disabled
> dialparties.agi: extnum 110 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/110 - Caller ID is not defined
> dialparties.agi: extnum 111 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/111 - Caller ID is not defined
> dialparties.agi: extnum 112 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/112 - Caller ID is not defined
> dialparties.agi: extnum 114 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/114 - Caller ID is not defined
> dialparties.agi: extnum 115 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/115 - Caller ID is not defined
> dialparties.agi: extnum 116 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/116 - Caller ID is not defined
> dialparties.agi: extnum 117 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/117 - Caller ID is not defined
> dialparties.agi: extnum 118 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/118 - Caller ID is not defined
> dialparties.agi: extnum 119 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/119 - Caller ID is not defined
> dialparties.agi: extnum 120 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/120 - Caller ID is not defined
> dialparties.agi: extnum 121 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/121 - Caller ID is not defined
> dialparties.agi: extnum 122 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/122 - Caller ID is not defined
> dialparties.agi: extnum 123 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/123 - Caller ID is not defined
> dialparties.agi: extnum 124 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/124 - Caller ID is not defined
> dialparties.agi: extnum 125 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/125 - Caller ID is not defined
> dialparties.agi: extnum 126 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/126 - Caller ID is not defined
> dialparties.agi: extnum 127 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/127 - Caller ID is not defined
> dialparties.agi: extnum 128 has: cw: 0; hascfb: 0 [] hascfu: 0 []
> dialparties.agi: ExtensionState: 0
dialparties.agi: Extension 128 has ExtensionState: 0
– dialparties.agi: Checking CW and CFB status for extension 128
– dialparties.agi: DbDel CALLTRACE/128 - Caller ID is not defined
> dialparties.agi: extnum 129 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/129 - Caller ID is not defined
> dialparties.agi: extnum 130 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/130 - Caller ID is not defined
– dialparties.agi: Filtered ARG3: 110-111-112-114-115-116-117-118-119-120-121-122-123-124-125-126-127-128-129-130
> dialparties.agi: NODEST: 601 adding M(auto-blkvm) to dialopts: trM(auto-blkvm)
> dialparties.agi: NODEST: 601 blkvm enabled macro already in dialopts: trM(auto-blkvm)
== Manager ‘admin’ logged off from 127.0.0.1
– AGI Script dialparties.agi completed, returning 0
– Executing [s@macro-dial:7] Dial(“Zap/1-1”, “SIP/110&SIP/111&SIP/112&SIP/114&SIP/115&SIP/116&SIP/117&SIP/118&SIP/119&SIP/120&SIP/121&SIP/122&SIP/123&SIP/124&SIP/125&SIP/126&SIP/127&SIP/128&SIP/129&SIP/130|20|trM(auto-blkvm)”) in new stack
– Called 110
– Called 111
– Called 112
– Called 114
– Called 115
– Called 116
– Called 117
– Called 118
– Called 119
– Called 120
– Called 121
– Called 122
– Called 123
– Called 125
– Called 126
– Called 127
– Called 128
– Called 129
– SIP/110-08af9ff0 is ringing
– SIP/114-08a76268 is ringing
– SIP/117-08a84aa0 is ringing
– SIP/118-08ade5c8 is ringing
– SIP/116-08a7f6d0 is ringing
– SIP/120-08ae8dd0 is ringing
– SIP/115-08a7a2e0 is ringing
– SIP/122-08af3620 is ringing
– SIP/112-08b02628 is ringing
– SIP/119-08ae39a8 is ringing
– SIP/125-08b0e0f0 is ringing
– SIP/123-08b08cc0 is ringing
– SIP/121-08aee1f8 is ringing
– SIP/127-08b17a70 is ringing
– SIP/126-08b12db0 is ringing
– SIP/128-08b1c730 is ringing
– SIP/129-08b213f0 is ringing
– SIP/111-08afdf68 is ringing
– SIP/121-08aee1f8 answered Zap/1-1
– Executing [s@macro-auto-blkvm:1] Set(“SIP/121-08aee1f8”, “__MACRO_RESULT=”) in new stack
– Executing [s@macro-auto-blkvm:2] Set(“SIP/121-08aee1f8”, “__CWIGNORE=”) in new stack
– Executing [s@macro-auto-blkvm:3] DBdel(“SIP/121-08aee1f8”, “BLKVM/601/Zap/1-1”) in new stack
– DBdel: family=BLKVM, key=601/Zap/1-1
– Started music on hold, class ‘default’, on Zap/1-1
– Stopped music on hold on Zap/1-1
== Spawn extension (from-internal-xfer, 127, 0) exited non-zero on ‘Zap/1-1’ in macro ‘dial’
== Spawn extension (from-internal-xfer, 127, 0) exited non-zero on ‘Zap/1-1’
– Executing [127@from-internal-xfer:1] GotoIf(“Zap/1-1”, “1?ext-local|127|1”) in new stack
– Goto (ext-local,127,1)
– Executing [127@ext-local:1] Macro(“Zap/1-1”, “exten-vm|127|127”) in new stack
– Executing [s@macro-exten-vm:1] Macro(“Zap/1-1”, “user-callerid”) in new stack
– Executing [s@macro-user-callerid:1] NoOp(“Zap/1-1”, "user-callerid: ") in new stack
– Executing [s@macro-user-callerid:2] Set(“Zap/1-1”, “AMPUSER=”) in new stack
– Executing [s@macro-user-callerid:3] GotoIf(“Zap/1-1”, “0?report”) in new stack
– Executing [s@macro-user-callerid:4] ExecIf(“Zap/1-1”, “1|Set|REALCALLERIDNUM=”) in new stack
– Executing [s@macro-user-callerid:5] NoOp(“Zap/1-1”, "REALCALLERIDNUM is ") in new stack
– Executing [s@macro-user-callerid:6] Set(“Zap/1-1”, “AMPUSER=”) in new stack
– Executing [s@macro-user-callerid:7] Set(“Zap/1-1”, “AMPUSERCIDNAME=”) in new stack
– Executing [s@macro-user-callerid:8] GotoIf(“Zap/1-1”, “1?report”) in new stack
– Goto (macro-user-callerid,s,13)
– Executing [s@macro-user-callerid:13] NoOp(“Zap/1-1”, “TTL: 64 ARG1: 127”) in new stack
– Executing [s@macro-user-callerid:14] GotoIf(“Zap/1-1”, “0?continue”) in new stack
– Executing [s@macro-user-callerid:15] Set(“Zap/1-1”, “__TTL=63”) in new stack
– Executing [s@macro-user-callerid:16] GotoIf(“Zap/1-1”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,23)
– Executing [s@macro-user-callerid:23] NoOp(“Zap/1-1”, “Using CallerID “” <>”) in new stack
– Executing [s@macro-exten-vm:2] Set(“Zap/1-1”, “FROMCONTEXT=exten-vm”) in new stack
– Executing [s@macro-exten-vm:3] Set(“Zap/1-1”, “VMBOX=127”) in new stack
– Executing [s@macro-exten-vm:4] Set(“Zap/1-1”, “EXTTOCALL=127”) in new stack
– Executing [s@macro-exten-vm:5] Set(“Zap/1-1”, “CFUEXT=”) in new stack
– Executing [s@macro-exten-vm:6] Set(“Zap/1-1”, “CFBEXT=”) in new stack
– Executing [s@macro-exten-vm:7] Set(“Zap/1-1”, “RT=15”) in new stack
– Executing [s@macro-exten-vm:8] Macro(“Zap/1-1”, “record-enable|127|IN”) in new stack
– Executing [s@macro-record-enable:1] GotoIf(“Zap/1-1”, “1?2:4”) in new stack
– Goto (macro-record-enable,s,2)
– Executing [s@macro-record-enable:2] ResetCDR(“Zap/1-1”, “w”) in new stack
– Executing [s@macro-record-enable:3] StopMonitor(“Zap/1-1”, “”) in new stack
– Executing [s@macro-record-enable:4] AGI(“Zap/1-1”, “recordingcheck|20080810-181943|1218406765.39”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
– Incoming call: Got SIP response 500 “Internal Server Error” back from 192.168.3.195
recordingcheck|20080810-181943|1218406765.39: Inbound recording not enabled
– AGI Script recordingcheck completed, returning 0
– Executing [s@macro-record-enable:5] NoOp(“Zap/1-1”, “No recording needed”) in new stack
– Executing [s@macro-exten-vm:9] Macro(“Zap/1-1”, “dial|15|tr|127”) in new stack
– Executing [s@macro-dial:1] GotoIf(“Zap/1-1”, “1?dial”) in new stack
– Goto (macro-dial,s,3)
– Executing [s@macro-dial:3] AGI(“Zap/1-1”, “dialparties.agi”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
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 ‘unknown’ number is ‘unknown’
> dialparties.agi: Setting Alert-Info: External
– AGI Script Executing Application: (SIPAddHeader) Options: (Alert-Info:External)
dialparties.agi: USE_CONFIRMATION: 'FALSE’
dialparties.agi: RINGGROUP_INDEX: ''
dialparties.agi: Methodology of ring is ‘ringall’
– dialparties.agi: Added extension 127 to extension map
– dialparties.agi: Extension 127 cf is disabled
– dialparties.agi: Extension 127 do not disturb is disabled
> dialparties.agi: extnum 127 has: cw: 1; hascfb: 0 [] hascfu: 0 []
– dialparties.agi: DbDel CALLTRACE/127 - Caller ID is not defined
– dialparties.agi: Filtered ARG3: 127
> dialparties.agi: NODEST: 601 adding M(auto-blkvm) to dialopts: trM(auto-blkvm)
> dialparties.agi: NODEST: 601 blkvm enabled macro already in dialopts: trM(auto-blkvm)
== Manager ‘admin’ logged off from 127.0.0.1
– AGI Script dialparties.agi completed, returning 0
– Executing [s@macro-dial:7] Dial(“Zap/1-1”, “SIP/127|15|trM(auto-blkvm)”) in new stack
– Called 127
– SIP/127-08b08cc0 is ringing
– Nobody picked up in 15000 ms
– Executing [s@macro-dial:8] Set(“Zap/1-1”, “DIALSTATUS=NOANSWER”) in new stack
– Executing [s@macro-exten-vm:10] Set(“Zap/1-1”, “SV_DIALSTATUS=NOANSWER”) in new stack
– Executing [s@macro-exten-vm:11] GosubIf(“Zap/1-1”, “0?docfu|1”) in new stack
– Executing [s@macro-exten-vm:12] GosubIf(“Zap/1-1”, “0?docfb|1”) in new stack
– Executing [s@macro-exten-vm:13] Set(“Zap/1-1”, “DIALSTATUS=NOANSWER”) in new stack
– Executing [s@macro-exten-vm:14] NoOp(“Zap/1-1”, “Voicemail is 127”) in new stack
– Executing [s@macro-exten-vm:15] GotoIf(“Zap/1-1”, “0?s-NOANSWER|1”) in new stack
– Executing [s@macro-exten-vm:16] NoOp(“Zap/1-1”, “Sending to Voicemail box 127”) in new stack
– Executing [s@macro-exten-vm:17] Macro(“Zap/1-1”, “vm|127|NOANSWER”) in new stack
– Executing [s@macro-vm:1] Macro(“Zap/1-1”, “user-callerid|SKIPTTL”) in new stack
– Executing [s@macro-user-callerid:1] NoOp(“Zap/1-1”, "user-callerid: ") in new stack
– Executing [s@macro-user-callerid:2] Set(“Zap/1-1”, “AMPUSER=”) in new stack
– Executing [s@macro-user-callerid:3] GotoIf(“Zap/1-1”, “0?report”) in new stack
– Executing [s@macro-user-callerid:4] ExecIf(“Zap/1-1”, “1|Set|REALCALLERIDNUM=”) in new stack
– Executing [s@macro-user-callerid:5] NoOp(“Zap/1-1”, “REALCALLERIDNUM is “) in new stack
– Executing [s@macro-user-callerid:6] Set(“Zap/1-1”, “AMPUSER=”) in new stack
– Executing [s@macro-user-callerid:7] Set(“Zap/1-1”, “AMPUSERCIDNAME=”) in new stack
– Executing [s@macro-user-callerid:8] GotoIf(“Zap/1-1”, “1?report”) in new stack
– Goto (macro-user-callerid,s,13)
– Executing [s@macro-user-callerid:13] NoOp(“Zap/1-1”, “TTL: 63 ARG1: SKIPTTL”) in new stack
– Executing [s@macro-user-callerid:14] GotoIf(“Zap/1-1”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,23)
– Executing [s@macro-user-callerid:23] NoOp(“Zap/1-1”, “Using CallerID “” <>”) in new stack
– Executing [s@macro-vm:2] Set(“Zap/1-1”, “VMGAIN=”””) in new stack
– Executing [s@macro-vm:3] GotoIf(“Zap/1-1”, “1?vmx|1”) in new stack
– Goto (macro-vm,vmx,1)
– Executing [vmx@macro-vm:1] GotoIf(“Zap/1-1”, “0?s-NOANSWER|1”) in new stack
– Executing [vmx@macro-vm:2] Set(“Zap/1-1”, “MODE=unavail”) in new stack
– Executing [vmx@macro-vm:3] GotoIf(“Zap/1-1”, “1?notdirect”) in new stack
– Goto (macro-vm,vmx,5)
– Executing [vmx@macro-vm:5] NoOp(“Zap/1-1”, "Checking if ext 127 is enabled: ") in new stack
– Executing [vmx@macro-vm:6] GotoIf(“Zap/1-1”, “1?s-NOANSWER|1”) in new stack
– Goto (macro-vm,s-NOANSWER,1)
– Executing [s-NOANSWER@macro-vm:1] Macro(“Zap/1-1”, “get-vmcontext|127”) in new stack
– Executing [s@macro-get-vmcontext:1] Set(“Zap/1-1”, “VMCONTEXT=default”) in new stack
– Executing [s@macro-get-vmcontext:2] GotoIf(“Zap/1-1”, “0?200:300”) in new stack
– Goto (macro-get-vmcontext,s,300)
– Executing [s@macro-get-vmcontext:300] NoOp(“Zap/1-1”, “”) in new stack
– Executing [s-NOANSWER@macro-vm:2] VoiceMail(“Zap/1-1”, “127@default|u”) in new stack
– <Zap/1-1> Playing ‘/var/spool/asterisk/voicemail/default/127/unavail’ (language ‘en’)
== Spawn extension (macro-vm, s-NOANSWER, 2) exited non-zero on ‘Zap/1-1’ in macro ‘vm’
== Spawn extension (macro-vm, s-NOANSWER, 2) exited non-zero on ‘Zap/1-1’ in macro ‘exten-vm’
== Spawn extension (macro-vm, s-NOANSWER, 2) exited non-zero on ‘Zap/1-1’
– Hungup ‘Zap/1-1’

Justin,

For some reason, it is not entering the custom code. Do me a favor. On your machine put this in from-internal-custom

exten => 4455,1,noop(Entering Test number)
exten => 4455,n,set(testvar=JohnWasHere)
exten => 4455,n,noop(the contents are $testvar})
exten => 4455,n,setvar(testing=FredWasHere)
exten => 4455,n,noop(testing is ${testing})
exten => 4455,n,hangup()

then dial 4455 and send me the cli output.

Here ya go:

-- Executing [4455@custom-from_internal:1] NoOp("SIP/121-0928b4a8", "here tiz in custom-from_internal") in new stack
-- Executing [4455@custom-from_internal:2] Set("SIP/121-0928b4a8", "__TRANSFER_CONTEXT=custom-test_transfer|4455|1") in new stack
-- Executing [4455@custom-from_internal:3] Goto("SIP/121-0928b4a8", "from-internal|4455|1") in new stack
-- Goto (from-internal,4455,1)
-- Executing [4455@from-internal:1] NoOp("SIP/121-0928b4a8", "Entering Test number") in new stack
-- Executing [4455@from-internal:2] Set("SIP/121-0928b4a8", "testvar=JohnWasHere") in new stack
-- Executing [4455@from-internal:3] NoOp("SIP/121-0928b4a8", "the contents are $testvar}") in new stack

== Spawn extension (from-internal, 4455, 4) exited non-zero on ‘SIP/121-0928b4a8’
– Executing [h@from-internal:1] Macro(“SIP/121-0928b4a8”, “hangupcall”) in new stack
– Executing [s@macro-hangupcall:1] ResetCDR(“SIP/121-0928b4a8”, “w”) in new stack
– Executing [s@macro-hangupcall:2] NoCDR(“SIP/121-0928b4a8”, “”) in new stack
– Executing [s@macro-hangupcall:3] GotoIf(“SIP/121-0928b4a8”, “1?skiprg”) in new stack
– Goto (macro-hangupcall,s,6)
– Executing [s@macro-hangupcall:6] GotoIf(“SIP/121-0928b4a8”, “1?skipblkvm”) in new stack
– Goto (macro-hangupcall,s,9)
– Executing [s@macro-hangupcall:9] GotoIf(“SIP/121-0928b4a8”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,11)
– Executing [s@macro-hangupcall:11] Hangup(“SIP/121-0928b4a8”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 11) exited non-zero on ‘SIP/121-0928b4a8’ in macro ‘hangupcall’
== Spawn extension (macro-hangupcall, s, 11) exited non-zero on ‘SIP/121-0928b4a8’

I think there was an error in the above code - a missing {. I edited it and got this output:

-- Executing [4455@custom-from_internal:1] NoOp("SIP/121-08298890", "here tiz in custom-from_internal") in new stack
-- Executing [4455@custom-from_internal:2] Set("SIP/121-08298890", "__TRANSFER_CONTEXT=custom-test_transfer|4455|1") in new stack
-- Executing [4455@custom-from_internal:3] Goto("SIP/121-08298890", "from-internal|4455|1") in new stack
-- Goto (from-internal,4455,1)
-- Executing [4455@from-internal:1] NoOp("SIP/121-08298890", "Entering Test number") in new stack
-- Executing [4455@from-internal:2] Set("SIP/121-08298890", "testvar=JohnWasHere") in new stack
-- Executing [4455@from-internal:3] NoOp("SIP/121-08298890", "the contents are JohnWasHere") in new stack

== Spawn extension (from-internal, 4455, 4) exited non-zero on ‘SIP/121-08298890’
– Executing [h@from-internal:1] Macro(“SIP/121-08298890”, “hangupcall”) in new stack
– Executing [s@macro-hangupcall:1] ResetCDR(“SIP/121-08298890”, “w”) in new stack
– Executing [s@macro-hangupcall:2] NoCDR(“SIP/121-08298890”, “”) in new stack
– Executing [s@macro-hangupcall:3] GotoIf(“SIP/121-08298890”, “1?skiprg”) in new stack
– Goto (macro-hangupcall,s,6)
– Executing [s@macro-hangupcall:6] GotoIf(“SIP/121-08298890”, “1?skipblkvm”) in new stack
– Goto (macro-hangupcall,s,9)
– Executing [s@macro-hangupcall:9] GotoIf(“SIP/121-08298890”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,11)
– Executing [s@macro-hangupcall:11] Hangup(“SIP/121-08298890”, “”) in new stack

OK, you can delete my 4455 code. Set works and SetVar doesn’t. The extension is entering my context, so it must be the PSTN that is not getting into my context. Take a look and see what context your incoming calls are coming in on and get that one line of code into that context somehow.

On my machine, the custom code for inbound is from-pstn-custom, but yours may be different.

Off to light the grill and open the wine.

Have a great evening.

I was wondering if that was the problem. I think they are coming in on from-trunk. If I add your line to [from-trunk] in extensions.conf, then it works.

However, I wonder if from-trunk is some all-encompassing context. I know it’s not safe to put anything in extensions.conf, so if from-trunk is the correct context, then I’ll just have to figure out another way to get it in there.

By the way, I upgraded asterisk to 1.4.21. Towards the end of the PBXIAF update script I got a lovely kernel panic, and fully expected many horrors to ensue. however, everything seems to work well. I’m hoping that it panic’d after everything was done updating.

Thanks again for your help!

[from-trunk] simply includes [from-pstn]

Would it work if you added a new context in extensions_custom, ended the code with a goto(from_trunk) and then change the context of your inbound trunk?

Just an idea.

from-trunk is just a placeholder and includes from-pstn. Here is the snippet from my extensions.conf

[from-trunk] ; just an alias since VoIP shouldn’t be called PSTN
include => from-pstn

[from-pstn]
include => from-pstn-custom ; create this context in extensions_custom.conf to include customizations
include => ext-did
include => from-did-direct ; MODIFICATOIN (PL) for findmefollow if enabled, should be bofore ext-local
include => ext-did-catchall ; THIS MUST COME AFTER ext-did
exten => fax,1,Goto(ext-fax,in_fax,1)

As you see, [from-pstn] has an include for from-pstn-custom. You should be able to put the following in extensions_custom.conf

[from-pstn-custom]

exten => _x.,n,set(__TRANSFER_CONTEXT=custom-test_transfer|${EXTEN}|1)

and that should do it. If you leave it in from-trunk in extensions.conf, it will get overwritten the next time you reload FreePBX. If this doesn’t fix it, try Scott’s way. Create a context in extensions_custom.conf and call it say from-trunk-special. Put this in it.

[from-trunk-special]

exten => _x.,n,set(__TRANSFER_CONTEXT=custom-test_transfer|${EXTEN}|1)
exten => _X.,n,goto(from-pstn,${EXTEN},1)

Then put your trunks in the context from-trunk-special.

While typing this, I noticed a potential mistake. My line:

[from-pstn-custom]

exten => _x.,n,set(__TRANSFER_CONTEXT=custom-test_transfer|${EXTEN}|1)

should be:

[from-pstn-custom]

exten => _x.,1,set(__TRANSFER_CONTEXT=custom-test_transfer|${EXTEN}|1) ;note change n to 1

Might want to try this change first. It won’t be the first time I have fat-fingered code.

Have a great day and feel free to call if you have questions.