Voicemail - CALLERID and AMPUSER - app-vmmain

All,

I understand that there was the following change in the Voicemail module since v 2.0.2:

2.0.2: changed ${CALLERID(number)} to ${AMPUSER} to accomodate CID number masquerading

This is OK for internal extensions. However, if you are using Trixbox as a voicemail server for another system then this a subtle but bad change.

It seems the new Voicemail versions has the following code for app-vmmain:

[app-vmmain]
include => app-vmmain-custom
exten => *97,1,Answer
exten => *97,n,Wait(1)
exten => *97,n,Macro(user-callerid,)
exten => *97,n,Macro(get-vmcontext,${AMPUSER})
exten => *97,n(check),MailBoxExists(${AMPUSER}@${VMCONTEXT})
exten => *97,n,GotoIf($["${VMBOXEXISTSSTATUS}" = “SUCCESS”]?mbexist)
exten => *97,n,VoiceMailMain()
exten => *97,n,Macro(hangupcall,)
exten => *97,check+101(mbexist),VoiceMailMain(${CALLERID(num)}@${VMCONTEXT})
exten => *97,n,Macro(hangupcall,)

; end of [app-vmmain]

However, prior to 2.0.2 it used the following code (in extensions_additional.conf) :

[app-vmmain]
include => app-vmmain-custom
exten => *97,1,Answer
exten => *97,n,Wait(1)
exten => *97,n,Macro(user-callerid,)
exten => *97,n,Macro(get-vmcontext,${CALLERID(num)})
exten => *97,n(check),MailBoxExists(${CALLERID(num)}@${VMCONTEXT})
exten => *97,n,GotoIf($["${VMBOXEXISTSSTATUS}" = “SUCCESS”]?mbexist)
exten => *97,n,VoiceMailMain()
exten => *97,n,Macro(hangupcall,)
exten => *97,check+101(mbexist),VoiceMailMain(${CALLERID(num)}@${VMCONTEXT})
exten => *97,n,Macro(hangupcall,)

; end of [app-vmmain]

The difference, as per the changelog is to use AMPUSER instead of CALLERID. I understand the reason for the change. However, I would like a way to keep the old settings. It seems extensions_additional.conf and the [app-vmmain] code is automatically generated - so it reverts to this code whenever the Trixbox is to to save and apply any changes.

Is there any way to change the Voicemail system to look for CALLERID (apart from manually changing the extensions_additional.conf file - since this will be reverted back when Trixbox next apply the settings)?

Regards,

Mon

What is your specific configuration and scenario that this is breaking? Can you explain how the particular voicemail box in question is being configured and then how it is being accessed that this breaks?

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

All,

I used the following workaround…

extensions_custom.conf is not automatically gernarated/updated - thus, custom extensions config should/could go here.

I added the following context:

[app-vmmain-custom]
exten => *96,1,Answer
exten => *96,n,Wait(1)
exten => *96,n,Macro(user-callerid,)
exten => *96,n,Macro(get-vmcontext,${CALLERID(num)})
exten => *96,n(check),MailBoxExists(${CALLERID(num)}@${VMCONTEXT})
exten => *96,n,GotoIf($["${VMBOXEXISTSSTATUS}" = “SUCCESS”]?mbexist)
exten => *96,n,VoiceMailMain()
exten => *96,n,Macro(hangupcall,)
exten => *96,check+101(mbexist),VoiceMailMain(${CALLERID(num)}@${VMCONTEXT})
exten => *96,n,Macro(hangupcall,)

; end of [app-vmmain-custom]

Note the following:

  1. The context name - [app-vmmain-custom]. This is reference by the original [app-vmmain] context by the following line:

include => app-vmmain-custom

I think this has to be the same name - but I not 100%

  1. I’ve had to use a different feature code - *96. Thus access to this must use this featurecode instead - including any custom apps configured in Misc Destinations.

The above seems to work OK and my external access to voicemail works and authenticates based on CALLERID instead of AMPUSER.

I hope this helps!

Mon

P.S:

p_lindheimer in answer to you queries. The current [app-vmmain] config is breaking my setup because it is now using AMPUSER instead of CALLERID to authenticate the voicemal call. Thus, if I want to access voicemail and not have to put in the extension number it will not work. Since, the SIP call coming outside to check the voicemail may not have a SIP URI that has AMPUSER in it.

For example, I set up extension 123456789 in asterisk - but when make a call to the voicemail from externally the SIP call will have CALLERID ID as 123456789 - but it’s SIP address may be "[email protected]". Thus, this will not match since the extension ‘bob’ does not exist in Asterisk.

Basicall, pre voicemail module 2.0.2 it was authtenticating using CALLERID - but now it is using AMPUSER - but I require CALLERID since it breaks my setup. My workaround basically reverts back to the original settings but using a new feature code instead.

I hope that makes sense.

Mon

Mon,
can you post a CLI trace as well as the corresponding log trace of the broken scenario using the standard voicemail access (not your new one)? Please turn up the verbosity to 5. I’d like to see what the variables look like to see if it is possible to automatically accomodate your scenario with some potential changes. The log trace can be found in /var/log/asterisk/full.

thanks

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

Philippe,

Please find below the call log - from “asterisk -r” console - debug is set to 5:
asterisk1*CLI>
– Executing NoOp(“SIP/demo50443-09ee74a0”, “Received incoming SIP connection from unknown peer to 979797”) in new stack
– Executing Set(“SIP/demo50443-09ee74a0”, “DID=979797”) in new stack
– Executing Goto(“SIP/demo50443-09ee74a0”, “s|1”) in new stack
– Goto (from-sip-external,s,1)
– Executing GotoIf(“SIP/demo50443-09ee74a0”, “1?from-trunk|979797|1”) in new stack
– Goto (from-trunk,979797,1)
– Executing Set(“SIP/demo50443-09ee74a0”, “__FROM_DID=979797”) in new stack
– Executing Gosub(“SIP/demo50443-09ee74a0”, “app-blacklist-check|s|1”) in new stack
– Executing LookupBlacklist(“SIP/demo50443-09ee74a0”, “”) in new stack
– Executing GotoIf(“SIP/demo50443-09ee74a0”, “0?blacklisted”) in new stack
– Executing Return(“SIP/demo50443-09ee74a0”, “”) in new stack
– Executing GotoIf(“SIP/demo50443-09ee74a0”, “0 ?cidok”) in new stack
– Executing Set(“SIP/demo50443-09ee74a0”, “CALLERID(name)=442071771077”) in new stack
– Executing NoOp(“SIP/demo50443-09ee74a0”, “CallerID is “442071771077” <442071771077>”) in new stack
– Executing Goto(“SIP/demo50443-09ee74a0”, “ext-miscdests|1|1”) in new stack
– Goto (ext-miscdests,1,1)
– Executing NoOp(“SIP/demo50443-09ee74a0”, “MiscDest: My Voicemail”) in new stack
– Executing Goto(“SIP/demo50443-09ee74a0”, “from-internal|*97|1”) in new stack
– Goto (from-internal,97,1)
– Executing Answer(“SIP/demo50443-09ee74a0”, “”) in new stack
– Executing Wait(“SIP/demo50443-09ee74a0”, “1”) in new stack
– Executing Macro(“SIP/demo50443-09ee74a0”, “user-callerid|”) in new stack
– Executing NoOp(“SIP/demo50443-09ee74a0”, “user-callerid: 442071771077 442071771077”) in new stack
– Executing Set(“SIP/demo50443-09ee74a0”, “AMPUSER=442071771077”) in new stack
– Executing GotoIf(“SIP/demo50443-09ee74a0”, “0?report”) in new stack
– Executing GotoIf(“SIP/demo50443-09ee74a0”, “0?start”) in new stack
– Executing Set(“SIP/demo50443-09ee74a0”, “REALCALLERIDNUM=442071771077”) in new stack
– Executing NoOp(“SIP/demo50443-09ee74a0”, “REALCALLERIDNUM is 442071771077”) in new stack
– Executing Set(“SIP/demo50443-09ee74a0”, “AMPUSER=”) in new stack
– Executing Set(“SIP/demo50443-09ee74a0”, “AMPUSERCIDNAME=”) in new stack
– Executing GotoIf(“SIP/demo50443-09ee74a0”, “1?report”) in new stack
– Goto (macro-user-callerid,s,13)
– Executing NoOp(“SIP/demo50443-09ee74a0”, "TTL: ARG1: ") in new stack
– Executing GotoIf(“SIP/demo50443-09ee74a0”, “0?continue”) in new stack
– Executing Set(“SIP/demo50443-09ee74a0”, “__TTL=64”) in new stack
– Executing GotoIf(“SIP/demo50443-09ee74a0”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,23)
– Executing NoOp(“SIP/demo50443-09ee74a0”, “Using CallerID “442071771077” <442071771077>”) in new stack
– Executing Macro(“SIP/demo50443-09ee74a0”, “get-vmcontext|”) in new stack
– Executing Set(“SIP/demo50443-09ee74a0”, “VMCONTEXT=”) in new stack
– Executing GotoIf(“SIP/demo50443-09ee74a0”, “1?200:300”) in new stack
– Goto (macro-get-vmcontext,s,200)
– Executing Set(“SIP/demo50443-09ee74a0”, “VMCONTEXT=default”) in new stack
– Executing MailboxExists(“SIP/demo50443-09ee74a0”, “@default”) in new stack
– Executing GotoIf(“SIP/demo50443-09ee74a0”, “0?mbexist”) in new stack
– Executing VoiceMailMain(“SIP/demo50443-09ee74a0”, “”) in new stack
– Playing ‘vm-login’ (language ‘en’)
asterisk1
CLI>

Let me explain a few things:

  1. 442071771077 is a configured extension on Asterisk. It is also the CLI used by the external system when calling the Asterisk voicemail.
  2. Inbound route 979797 is the DID we are using to identify it is a voicemail attempt from outside.
  3. This 979797 call directed to Misc Destinations “My Voicemail”
  4. Misc Destinations “My Voicemail” is configured to dial “{voicemail:myvoicemail}” - i.e. *97

As you can see from the log trace that it seems fails at the following line (because it cannot find any AMPUSER info):

-- Executing Macro("SIP/demo50443-09ee74a0", "get-vmcontext|") in new stack
-- Executing Set("SIP/demo50443-09ee74a0", "VMCONTEXT=") in new stack

Since

A log of a successfull voicemail call - when I change the 979797 Inbound Route to point to Misc Destinations to “External - My Voicemail” which dials *96:

asterisk1*CLI>
– Executing NoOp(“SIP/demo50443-09df42a8”, “Received incoming SIP connection from unknown peer to 979797”) in new stack
– Executing Set(“SIP/demo50443-09df42a8”, “DID=979797”) in new stack
– Executing Goto(“SIP/demo50443-09df42a8”, “s|1”) in new stack
– Goto (from-sip-external,s,1)
– Executing GotoIf(“SIP/demo50443-09df42a8”, “1?from-trunk|979797|1”) in new stack
– Goto (from-trunk,979797,1)
– Executing Set(“SIP/demo50443-09df42a8”, “__FROM_DID=979797”) in new stack
– Executing Gosub(“SIP/demo50443-09df42a8”, “app-blacklist-check|s|1”) in new stack
– Executing LookupBlacklist(“SIP/demo50443-09df42a8”, “”) in new stack
– Executing GotoIf(“SIP/demo50443-09df42a8”, “0?blacklisted”) in new stack
– Executing Return(“SIP/demo50443-09df42a8”, “”) in new stack
– Executing GotoIf(“SIP/demo50443-09df42a8”, “0 ?cidok”) in new stack
– Executing Set(“SIP/demo50443-09df42a8”, “CALLERID(name)=442071771077”) in new stack
– Executing NoOp(“SIP/demo50443-09df42a8”, “CallerID is “442071771077” <442071771077>”) in new stack
– Executing Goto(“SIP/demo50443-09df42a8”, “ext-miscdests|3|1”) in new stack
– Goto (ext-miscdests,3,1)
– Executing NoOp(“SIP/demo50443-09df42a8”, “MiscDest: External - My Voicemail”) in new stack
– Executing Goto(“SIP/demo50443-09df42a8”, “from-internal|*96|1”) in new stack
– Goto (from-internal,96,1)
– Executing Answer(“SIP/demo50443-09df42a8”, “”) in new stack
– Executing Wait(“SIP/demo50443-09df42a8”, “1”) in new stack
– Executing Macro(“SIP/demo50443-09df42a8”, “user-callerid|”) in new stack
– Executing NoOp(“SIP/demo50443-09df42a8”, “user-callerid: 442071771077 442071771077”) in new stack
– Executing Set(“SIP/demo50443-09df42a8”, “AMPUSER=442071771077”) in new stack
– Executing GotoIf(“SIP/demo50443-09df42a8”, “0?report”) in new stack
– Executing GotoIf(“SIP/demo50443-09df42a8”, “0?start”) in new stack
– Executing Set(“SIP/demo50443-09df42a8”, “REALCALLERIDNUM=442071771077”) in new stack
– Executing NoOp(“SIP/demo50443-09df42a8”, “REALCALLERIDNUM is 442071771077”) in new stack
– Executing Set(“SIP/demo50443-09df42a8”, “AMPUSER=”) in new stack
– Executing Set(“SIP/demo50443-09df42a8”, “AMPUSERCIDNAME=”) in new stack
– Executing GotoIf(“SIP/demo50443-09df42a8”, “1?report”) in new stack
– Goto (macro-user-callerid,s,13)
– Executing NoOp(“SIP/demo50443-09df42a8”, "TTL: ARG1: ") in new stack
– Executing GotoIf(“SIP/demo50443-09df42a8”, “0?continue”) in new stack
– Executing Set(“SIP/demo50443-09df42a8”, “__TTL=64”) in new stack
– Executing GotoIf(“SIP/demo50443-09df42a8”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,23)
– Executing NoOp(“SIP/demo50443-09df42a8”, “Using CallerID “442071771077” <442071771077>”) in new stack
– Executing Macro(“SIP/demo50443-09df42a8”, “get-vmcontext|442071771077”) in new stack
– Executing Set(“SIP/demo50443-09df42a8”, “VMCONTEXT=default”) in new stack
– Executing GotoIf(“SIP/demo50443-09df42a8”, “0?200:300”) in new stack
– Goto (macro-get-vmcontext,s,300)
– Executing NoOp(“SIP/demo50443-09df42a8”, “”) in new stack
– Executing MailboxExists(“SIP/demo50443-09df42a8”, “[email protected]”) in new stack
– Executing VoiceMailMain(“SIP/demo50443-09df42a8”, “[email protected]”) in new stack
– Playing ‘vm-password’ (language ‘en’)
asterisk1
CLI>

As you can see the suspect two lines above are now populated with the CALLERID info:

-- Executing Macro("SIP/demo50443-09df42a8", "get-vmcontext|442071771077") in new stack
-- Executing Set("SIP/demo50443-09df42a8", "VMCONTEXT=default") in new stack

I hope these log traces help.

What I would suggest is that there is an option to select whether you want to authenticate on AMPUSER or CALLERID (or even both?)

Regards,

Mon

Sorry to threadjack, but would this explain why voicemail is working fine for extensions on the same LAN as our Asterisk server, but for SIP phones connecting in via ADSL they get cut off after about 20 seconds when they try to retrieve messages? I have been looking at this for a few days but it’s stretching my current level of experience.

this would not have anything to do with what you describe.

Mon - I’m going to produce a patch for you to test out that would fix the exiting feature code. I’m just trying to decide upon two options of implementing it but should have something a bit later today.

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

Mon,

I’ve been looking over this code to make the fix I wanted to try but I’ve first got a question to make sure I really understand your situation. Are you running in FreePBX extensions mode or deviceanduser mode? knowing the answer to this is important for me to understand if I really understand all angles of the issue so that we can decide if there is a proper fix we can put in place for this situation.

Thanks

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

Philippe,

I am using deviceanduser mode. However, this is just in our current setup, for testing the solution on our existing office Trixbox server. I would expect I would just use extensions mode if I were to setup a standalone Trixbox server just for voicemail services for other softswitch/PBX systems.

Let me know if there is anything else you need to know.

Regards,

Mon

Phillipe,

I saw you had released a new version of the Voicemail module - 2.0.3.3. I don;t know if this new versions is meant to fix my problem or not.

However, I notice the [vm-vmmain] function has been changed to:

[app-vmmain]
include => app-vmmain-custom
exten => *97,1,Answer
exten => *97,n,Wait(1)
exten => *97,n,Macro(user-callerid,)
exten => *97,n,Macro(get-vmcontext,${AMPUSER})
exten => *97,n(check),MailBoxExists(${AMPUSER}@${VMCONTEXT})
exten => *97,n,GotoIf($["${VMBOXEXISTSSTATUS}" = “SUCCESS”]?mbexist)
exten => *97,n,VoiceMailMain()
exten => *97,n,Macro(hangupcall,)
exten => *97,check+101(mbexist),VoiceMailMain(${AMPUSER}@${VMCONTEXT})
exten => *97,n,Macro(hangupcall,)

; end of [app-vmmain]

The new change being the line:

exten => *97,check+101(mbexist),VoiceMailMain(${AMPUSER}@${VMCONTEXT})

Previously, in 2.0.3.2 it was:

exten => *97,check+101(mbexist),VoiceMailMain(${CALLERID(num)}@${VMCONTEXT})

Thus, CALLERID(num) has been replaced by AMPUSER.

However, this still has not fixed my particular problem because this functions is still looking for AMPUSER instead of CALLERID.

This is the console log:

asterisk1*CLI>
– Executing NoOp(“SIP/demo50443-b7a3ef18”, “Received incoming SIP connection from unknown peer to 979797”) in new stack
– Executing Set(“SIP/demo50443-b7a3ef18”, “DID=979797”) in new stack
– Executing Goto(“SIP/demo50443-b7a3ef18”, “s|1”) in new stack
– Goto (from-sip-external,s,1)
– Executing GotoIf(“SIP/demo50443-b7a3ef18”, “1?from-trunk|979797|1”) in new stack
– Goto (from-trunk,979797,1)
– Executing Set(“SIP/demo50443-b7a3ef18”, “__FROM_DID=979797”) in new stack
– Executing Gosub(“SIP/demo50443-b7a3ef18”, “app-blacklist-check|s|1”) in new stack
– Executing LookupBlacklist(“SIP/demo50443-b7a3ef18”, “”) in new stack
– Executing GotoIf(“SIP/demo50443-b7a3ef18”, “0?blacklisted”) in new stack
– Executing Return(“SIP/demo50443-b7a3ef18”, “”) in new stack
– Executing GotoIf(“SIP/demo50443-b7a3ef18”, “0 ?cidok”) in new stack
– Executing Set(“SIP/demo50443-b7a3ef18”, “CALLERID(name)=442071771077”) in new stack
– Executing NoOp(“SIP/demo50443-b7a3ef18”, “CallerID is “442071771077” <442071771077>”) in new stack
– Executing Goto(“SIP/demo50443-b7a3ef18”, “ext-miscdests|1|1”) in new stack
– Goto (ext-miscdests,1,1)
– Executing NoOp(“SIP/demo50443-b7a3ef18”, “MiscDest: My Voicemail”) in new stack
– Executing Goto(“SIP/demo50443-b7a3ef18”, “from-internal|*97|1”) in new stack
– Goto (from-internal,97,1)
– Executing Answer(“SIP/demo50443-b7a3ef18”, “”) in new stack
– Executing Wait(“SIP/demo50443-b7a3ef18”, “1”) in new stack
– Executing Macro(“SIP/demo50443-b7a3ef18”, “user-callerid|”) in new stack
– Executing NoOp(“SIP/demo50443-b7a3ef18”, “user-callerid: 442071771077 442071771077”) in new stack
– Executing Set(“SIP/demo50443-b7a3ef18”, “AMPUSER=442071771077”) in new stack
– Executing GotoIf(“SIP/demo50443-b7a3ef18”, “0?report”) in new stack
– Executing GotoIf(“SIP/demo50443-b7a3ef18”, “0?start”) in new stack
– Executing Set(“SIP/demo50443-b7a3ef18”, “REALCALLERIDNUM=442071771077”) in new stack
– Executing NoOp(“SIP/demo50443-b7a3ef18”, “REALCALLERIDNUM is 442071771077”) in new stack
– Executing Set(“SIP/demo50443-b7a3ef18”, “AMPUSER=”) in new stack
– Executing Set(“SIP/demo50443-b7a3ef18”, “AMPUSERCIDNAME=”) in new stack
– Executing GotoIf(“SIP/demo50443-b7a3ef18”, “1?report”) in new stack
– Goto (macro-user-callerid,s,13)
– Executing NoOp(“SIP/demo50443-b7a3ef18”, "TTL: ARG1: ") in new stack
– Executing GotoIf(“SIP/demo50443-b7a3ef18”, “0?continue”) in new stack
– Executing Set(“SIP/demo50443-b7a3ef18”, “__TTL=64”) in new stack
– Executing GotoIf(“SIP/demo50443-b7a3ef18”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,23)
– Executing NoOp(“SIP/demo50443-b7a3ef18”, “Using CallerID “442071771077” <442071771077>”) in new stack
– Executing Macro(“SIP/demo50443-b7a3ef18”, “get-vmcontext|”) in new stack
– Executing Set(“SIP/demo50443-b7a3ef18”, “VMCONTEXT=”) in new stack
– Executing GotoIf(“SIP/demo50443-b7a3ef18”, “1?200:300”) in new stack
– Goto (macro-get-vmcontext,s,200)
– Executing Set(“SIP/demo50443-b7a3ef18”, “VMCONTEXT=default”) in new stack
– Executing MailboxExists(“SIP/demo50443-b7a3ef18”, “@default”) in new stack
– Executing GotoIf(“SIP/demo50443-b7a3ef18”, “0?mbexist”) in new stack
– Executing VoiceMailMain(“SIP/demo50443-b7a3ef18”, “”) in new stack
– Playing ‘vm-login’ (language ‘en’)
asterisk1
CLI>

As you can see the following two lines state AMPUSER as blank:

-- Executing Set("SIP/demo50443-b7a3ef18", "AMPUSER=") in new stack
-- Executing Set("SIP/demo50443-b7a3ef18", "AMPUSERCIDNAME=") in new stack

As stated previously, [app-vmmain] function in pre 2.0.2 versions used CALLERID(num) instead of AMPUSER in the following lines:

exten => *97,n,Macro(get-vmcontext,${CALLERID(num)})
exten => *97,n(check),MailBoxExists(${CALLERID(num)}@${VMCONTEXT})

The current two lines uses AMPUSER instead:

exten => *97,n,Macro(get-vmcontext,${AMPUSER})
exten => *97,n(check),MailBoxExists(${AMPUSER}@${VMCONTEXT})

When these two lines are using CALLERID(num) it works for me. When it uses AMPUSER it does not work.

Regards,

Mon

Philippe,

I think I may have confused things by not making clear what I meant by ‘not working’. I want to clarify just in case there is/was a misunderstanding.

When you dial *97 you expect to be just asked for the PIN number and not be asked for you ‘mailbox’ number. To check voicemail for a particular mailbox you should dial *98 instead. The new voicemail module does not work for me in the sense that it always asks for the mailbox number when I dial *97 - because it does not get a (valid) value for AMPUSER, since the call is coming from an external system which will have a valid CLI which is the same as the Asterisk extension but the SIP user address may not have same name as this extension number.

I hope this clears it up, if it wasn’t so clear previously.

Regards,

Mon

Mon,

the new change was not meant to fix your problem. I noticed that bug was there because of this thread and put that fix in. I wanted to confirm that you were using deviceanduser mode to make sure we really understood the problem. You would not have encountered this if you were using extensions mode from the beginning. That does not imply the solution is to user extensions mode, it is not.

A couple of us developers discussed this as there are other implications and other similar feature codes that this could effect. We now will decide how we want to address this.

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

Philippe,

OK - thanks for the update. I’ll await further feedback once you decide how you want to proceed forward.

At least for now I do have a work around.

Regards,

Mon