[Home]

Summary:ASTERISK-02843: [patch] Mailbox getting lost with realtime config
Reporter:ruok (ruok)Labels:
Date Opened:2004-11-17 12:12:27.000-0600Date Closed:2008-01-15 15:19:26.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_voicemail
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) strlen_fix.patch.txt
Description:When you pass the mailbox to VoiceMailMain, and incorrectly login during the first attempt, the second and further attempts use the wrong mailbox.

It appears as though the mailbox gets lost after the first incorrect login, because it starts to use the calleridnum instead of what was passed to VoicemailMain after an incorrect login.


Executing VoiceMailMain("SIP/5551212-0a5b", "1000@default") in new stack
.
.
(real time debug)
.
.
Playing 'vm-password' (language 'en')
   -- Incorrect password '666' for user '1000' (context = default)
   -- Playing 'vm-incorrect' (language 'en')
   -- Playing 'vm-password' (language 'en')
   -- Incorrect password '1111' for user '5551212' (context = default)
   -- Playing 'vm-incorrect' (language 'en')



In the above case, I logged in incorrectly to mailbox 1000, then tried to login correctly 'using pin 1111', but by the second attempt, somehow its trying to use mailbox 5551212 (my callerid num) instead of the passed in mailbox number (1000). If I use pin '1111' during the first attempt, I can login ok.


I have a very simple realtime config setup:

extconfig.conf:

[settings]

voicemail => odbc,mysql,voicemail


res_odbc.conf:

[mysql]
dsn => MySQL-asterisk
username => asterisk
password => password
pre-connect => yes
Comments:By: Brian West (bkw918) 2004-11-17 17:12:32.000-0600

Post your voicemail.conf please this might be a config issue:

If the password is prefixed by '-' then it is considered to be unchangable

but it seems the if (prefix) is zapping the mailbox

bkw

By: Brian West (bkw918) 2004-11-17 17:16:12.000-0600

Yep thats EXACTLY what is going on:

if (prefix)
   strncpy(mailbox, "", mailbox_size -1);

You must be using the - prefix... that zaps the mailbox.. then on the next go around it does this:

       if (ast_strlen_zero(mailbox)) {
           if (chan->cid.cid_num) {
               strncpy(mailbox, chan->cid.cid_num, mailbox_size);


hrm... patch to follow.

By: ruok (ruok) 2004-11-17 17:31:18.000-0600

My voicemail.conf is 100% default. I am using res_config, so I have not touched voicemail.conf. All my users are from odbc "voicemail" table. I am not, at least I don't think, using prefixes.

Pretty straight forward setup,

snippit from extensions.conf:

[apps]

exten => *100,1,VoicemailMain(${CALLERIDNUM}@default)
exten => *100,2,Hangup


Here is a sample row from the database:


+----------+---------+---------+----------+------------+-------------+-------+--------+--------+----------+--------+
| uniqueid | mailbox | context | password | fullname   | email       | pager | attach | saycid | callback | review |
+----------+---------+---------+----------+------------+-------------+-------+--------+--------+----------+--------+
|        2 | 1001    | default | 2222     | John Smith | joe@aol.com |       |      1 |      1 |        1 |      1 |
+----------+---------+---------+----------+------------+-------------+-------+--------+--------+----------+--------+


No 'p' in front of mailbox; in database or in call to VoicemailMain

By: ruok (ruok) 2004-11-17 17:54:08.000-0600

I should probably add that during the tests I am doing, I am actually using a litteral value to the call to VoicemailMain and not ${CALLERIDNUM}. ${CALLERIDNUM} would have worked because during the first failure, it would have switched back to using cidnum, and still authenticated.

So the problem seems to be when using a value for the mailbox that is NOT the callerid num.



[testing]

exten => *101,1,VoicemailMain(1000@default)


And the current caller ID being something other than 1000 when dialing *101.

By: Brian West (bkw918) 2004-11-17 18:04:52.000-0600

I need more info because you say you don't want it to use your callerid but you call voicemailmain with ${CALLERIDNUM}@default which WOULD use your callerid I need to know how you got 1000 in there in the first place.  You're not giving me anything to go on here.. I can't recreate this so I must assume that this is a config error on your part .. find me on IRC.

bkw_

By: Brian West (bkw918) 2004-11-17 18:05:59.000-0600

Find me on IRC this is a config issue... I need to look at your setup.

bkw

By: Brian West (bkw918) 2004-11-17 18:20:45.000-0600

Finally found it ;)

By: Brian West (bkw918) 2004-11-24 12:37:32.000-0600

yo mark :P  here's another one.

bkw

By: Olle Johansson (oej) 2004-12-13 02:01:19.000-0600

Can we assume that this patch is on hold because lack of disclaimer???? :-)

Does it still apply to CVS? Is it a bug fix for CVS stable?

--housekeeping

By: Brian West (bkw918) 2004-12-13 12:01:57.000-0600

No mark says its not the right fix.

bkw

By: twisted (twisted) 2004-12-28 10:34:13.000-0600

So where are we at here then?

By: twisted (twisted) 2005-01-01 22:55:38.000-0600

patch added to solve this issue - it actually does it in all instances - including non-realtime systems.

By: Mark Spencer (markster) 2005-01-02 19:09:51.000-0600

Fixed in CVS, thanks twisted!

By: Russell Bryant (russell) 2005-01-04 22:44:59.000-0600

fixed in 1.0

By: Digium Subversion (svnbot) 2008-01-15 15:19:26.000-0600

Repository: asterisk
Revision: 4637

U   trunk/apps/app_voicemail.c

------------------------------------------------------------------------
r4637 | markster | 2008-01-15 15:19:25 -0600 (Tue, 15 Jan 2008) | 2 lines

Merge josh's strlen fix (thanks!) (bug ASTERISK-2843)

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

http://svn.digium.com/view/asterisk?view=rev&revision=4637