Skip to main content

Transfer to Voice Mail

Posted by George on Tue, 01/22/2008

This seems like it should be pretty simple..

2007-11-13 Added tl-transfer-to-voicemail script that allows to transfer a call directly to a voicemail mailbox.

It requires a feature extension in the form _*6. (*6 is just an example), so that the call can be transferred to a mailbox (say 201), by transferring to *6201

I created a feauter code exactly as discribed above using the same format.. _*6.

call is made to an extension, call answered, blind transfer to *6301, after a moment of silence, a short busy signal and the call is terminated.. see below for results..

------------------------------------------------------

-- SIP/301-axint-00ce16a0 answered SIP/401-axint-a002fb70
[Jan 22 20:32:37] NOTICE[32268]: cdr.c:434 ast_cdr_free: CDR on channel 'SIP/801-axint-0096a900' not posted
-- Started music on hold, class 'Chris-axint', on SIP/401-axint-a002fb70
-- Stopped music on hold on SIP/401-axint-a002fb70
== Spawn extension (from-inside-axint, *6301, 0) exited non-zero on 'SIP/401-axint-a002fb70' in macro 'tl-userexten-base'
== Spawn extension (from-inside-axint, *6301, 0) exited non-zero on 'SIP/401-axint-a002fb70' in macro 'tl-multidevice-exten'
== Spawn extension (from-inside-axint, *6301, 0) exited non-zero on 'SIP/401-axint-a002fb70'
-- Executing [*6301@from-inside-axint:1] Macro("SIP/401-axint-a002fb70", "tl-set-variables2|from-inside-redir-axint|axint") in new stack
-- Executing [s@macro-tl-set-variables2:1] Set("SIP/401-axint-a002fb70", "__tenant=axint") in new stack
-- Executing [s@macro-tl-set-variables2:2] Set("SIP/401-axint-a002fb70", "CDR(userfield)=axint") in new stack
-- Executing [s@macro-tl-set-variables2:3] Set("SIP/401-axint-a002fb70", "__MOH=Chris-axint") in new stack
-- Executing [s@macro-tl-set-variables2:4] GotoIf("SIP/401-axint-a002fb70", "1 ?setmoh") in new stack
-- Goto (macro-tl-set-variables2,s,6)
-- Executing [s@macro-tl-set-variables2:6] SetMusicOnHold("SIP/401-axint-a002fb70", "Chris-axint") in new stack
-- Executing [s@macro-tl-set-variables2:7] Goto("SIP/401-axint-a002fb70", "from-inside-redir-axint|*6301|1") in new stack
-- Goto (from-inside-redir-axint,*6301,1)
== Channel 'SIP/401-axint-a002fb70' jumping out of macro 'tl-set-variables2'
-- Executing [*6301@from-inside-redir-axint:1] Macro("SIP/401-axint-a002fb70", "tl-transfer-to-voicemail|u||") in new stack
-- Executing [s@macro-tl-transfer-to-voicemail:1] GotoIf("SIP/401-axint-a002fb70", "1?vm") in new stack
-- Goto (macro-tl-transfer-to-voicemail,s,3)
-- Executing [s@macro-tl-transfer-to-voicemail:3] VoiceMail("SIP/401-axint-a002fb70", "*6301@default-axint") in new stack
[Jan 22 20:32:46] WARNING[32268]: app_voicemail.c:2806 leave_voicemail: No entry in voicemail config file for '*6301'
-- Timeout on SIP/401-axint-a002fb70
== CDR updated on SIP/401-axint-a002fb70
-- Executing [t@from-inside-redir-axint:1] Hangup("SIP/401-axint-a002fb70", "") in new stack
== Spawn extension (from-inside-redir-axint, t, 1) exited non-zero on 'SIP/401-axint-a002fb70'
-- Executing [h@from-inside-redir-axint:1] Hangup("SIP/401-axint-a002fb70", "") in new stack
== Spawn extension (from-inside-redir-axint, h, 1) exited non-zero on 'SIP/401-axint-a002fb70'

is this working for anyone..?

Thanks
George


Submitted by mattdarnell on Thu, 01/24/2008 Permalink

George,

Here is the line from my /etc/asterisk/extensions.include

exten => _8.,1,Macro(tl-transfer-to-voicemail,1,u,) ; Transfer Directly to Voicemail

I use 8+ext

I would bet you don't have a "2" in the 'Voicemail prefix length (default 1)' field.

If you look at my output:

[Jan 24 13:53:25] VERBOSE[19191] logger.c: -- Executing [8104@from-inside-Acme:1] Macro("SIP/102-Acme-b71019f0", "tl-set-variables2|from-inside-redir-Acme|Acme") in new stack

[Jan 24 13:53:25] VERBOSE[19191] logger.c: -- Executing [s@macro-tl-set-variables2:1] Set("SIP/102-Acme-b71019f0", "__tenant=Acme") in new stack

[Jan 24 13:53:25] DEBUG[19191] app_macro.c: Executed application: Set

[Jan 24 13:53:25] VERBOSE[19191] logger.c: -- Executing [s@macro-tl-set-variables2:2] Set("SIP/102-Acme-b71019f0", "CDR(userfield)=Acme") in new stack

[Jan 24 13:53:25] DEBUG[19191] app_macro.c: Executed application: Set

[Jan 24 13:53:25] VERBOSE[19191] logger.c: -- Executing [s@macro-tl-set-variables2:3] Set("SIP/102-Acme-b71019f0", "__MOH=default-Acme") in new stack

[Jan 24 13:53:25] DEBUG[19191] app_macro.c: Executed application: Set

[Jan 24 13:53:25] VERBOSE[19191] logger.c: -- Executing [s@macro-tl-set-variables2:4] GotoIf("SIP/102-Acme-b71019f0", "1 ?setmoh") in new stack

[Jan 24 13:53:25] VERBOSE[19191] logger.c: -- Goto (macro-tl-set-variables2,s,6)

[Jan 24 13:53:25] DEBUG[19191] app_macro.c: Executed application: GotoIf

[Jan 24 13:53:25] VERBOSE[19191] logger.c: -- Executing [s@macro-tl-set-variables2:6] SetMusicOnHold("SIP/102-Acme-b71019f0", "default-Acme") in new stack

[Jan 24 13:53:25] DEBUG[19191] app_macro.c: Executed application: SetMusicOnHold

[Jan 24 13:53:25] VERBOSE[19191] logger.c: -- Executing [s@macro-tl-set-variables2:7] Goto("SIP/102-Acme-b71019f0", "from-inside-redir-Acme|8104|1") in new stack

[Jan 24 13:53:25] VERBOSE[19191] logger.c: -- Goto (from-inside-redir-Acme,8104,1)

[Jan 24 13:53:25] DEBUG[19191] app_macro.c: Executed application: Goto

[Jan 24 13:53:25] VERBOSE[19191] logger.c: == Channel 'SIP/102-Acme-b71019f0' jumping out of macro 'tl-set-variables2'

[Jan 24 13:53:25] VERBOSE[19191] logger.c: -- Executing [8104@from-inside-redir-Acme:1] Macro("SIP/102-Acme-b71019f0", "tl-transfer-to-voicemail|1|u|") in new stack

[Jan 24 13:53:25] VERBOSE[19191] logger.c: -- Executing [s@macro-tl-transfer-to-voicemail:1] GotoIf("SIP/102-Acme-b71019f0", "1?vm") in new stack

[Jan 24 13:53:25] VERBOSE[19191] logger.c: -- Goto (macro-tl-transfer-to-voicemail,s,3)

[Jan 24 13:53:25] DEBUG[19191] app_macro.c: Executed application: GotoIf

[Jan 24 13:53:25] VERBOSE[19191] logger.c: -- Executing [s@macro-tl-transfer-to-voicemail:3] VoiceMail("SIP/102-Acme-b71019f0", "u104@default-Acme") in new stack

[Jan 24 13:53:25] VERBOSE[19191] logger.c: -- Playing 'vm-theperson' (language 'en')

Specifically:

Executing [8104@from-inside-redir-Acme:1] Macro("SIP/102-Acme-b71019f0", "tl-transfer-to-voicemail|1|u|") in new stack

You have:

Executing [*6301@from-inside-redir-axint:1] Macro("SIP/401-axint-a002fb70", "tl-transfer-to-voicemail|u||") in new stack

Notice the two pipes after voicemail.

Another nice thing is that you can dial it directly, you don't have to go through the hassle of doing a transfer.

-Matt

Submitted by George on Thu, 01/24/2008 Permalink

Hey Matt,

Thanks a lot Matt, seeing your code I found the problem..

I had the u on the wrong line which caused the problem..

yours - tl-transfer-to-voicemail,1,u,)

mine - tl-transfer-to-voicemail|u||

so the one (default) was over written voiding out the command..

working perfectly now

questions though, whats changing the voicemail prefix length from 1 to 2 do..?

funny how you can look at something 20 times and not see the simplest of things causing a problem..

Thanks Again

George

Submitted by mattdarnell on Fri, 01/25/2008 Permalink

Glad you got it working.

If a field only has numeric values, there should be a drop down box to help validate inputs.

tl-transfer-to-voicemail,X,u,)

The X must be passed to the script. Judging from the interface, if nothing is passed it must assume a value of 1.

B/c you had a 'u' in that field I figured you didn't a numeric value in the GUI.

I still want Alex or someone to do a screen cast on how to edit/create the scripts. I bet fixing the caller-ID issue with FMFM would be simple for someone that was an expert in the scripts.

-Matt

Submitted by thirdlane on Sat, 01/26/2008 Permalink

I've been totally overloaded lately, but you will see some nice new features in Thirdlane PBX soon.

Once I have a bit more time I would like to do a webinar /questions and answers session on more of an in depth use of Thirdlane PBX and scripts in particular.

Please send me the topics you would like covered. Hopefully we could also record some of that and create a screencast, etc.