Phone alias and Active Agent Server = N

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Phone alias and Active Agent Server = N

Postby okli » Wed Aug 20, 2014 9:39 am

Hi, glad to be around again, it's been a while : )

It's a fresh, stock ViciBox 6.0.1 cluster install.
1 Web Server
1 DB Server
2 Telephone servers - 192.168.200.21 (T1) and 192.168.200.22 (T2).
SVN 2163, vicidial.php 2.10-412c 140811-1219, admin.php 2.10-448a 140706-0927.

Crated 2 new SIP phones- 11101 and 21101.
Created a new phone alias, named 102, with a list of phones 11101,21101.

Noone else is loged in.
When for both telephone servers Active Agent Server = Y, and for agent login the alias 102 is used, T2 accepts the call. This seems normal looking at vicidial.php as results from the SQL query are traversed in reverse order.

However, if T2 is set to Active Agent Server = N, while T1 is set to Y, a login error appears, rather failing over to T1.
If T2 is set to Active Agent Server = Y, while T1 is set to N, T2 accepts the call and no error appears.

My idea is to use phone alias, and if anything goes wrong with any of the telephone servers, to set it to Active Agent Server = N and Active Asterisk Server = N and pull it off the cluster while being rebuilt or whatever, at the same time expecting phone alias logins to ignore/skip the removed/disabled server.

My question is is the above described an expected behaviour, or I am missing something.
If it's expected behaviour, what would be the best practise to take temporarily a telephone server off the cluster, without breaking or editing phone alias logins?
Or maybe it's a candidate for a future request?
okli
 
Posts: 671
Joined: Mon Oct 01, 2007 5:09 pm

Re: Phone alias and Active Agent Server = N

Postby mflorell » Thu Aug 21, 2014 5:19 am

I can't duplicate this problem on our test cluster as you have defined. With the $mel=2 SQL statement logging enabled, the statement appears to be constructed as it should be and it finds the one server active, no matter which one is active if only one of the two is active.
mflorell
Site Admin
 
Posts: 18387
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Re: Phone alias and Active Agent Server = N

Postby okli » Thu Aug 21, 2014 5:29 am

Hi Matt,

The issue as far as I tracked it is in vicidial.php, line 2160 for the mentioned SVN version:

Code: Select all
$desc = ($phones_auto_ct - $pa); # traverse in reverse order


Changing it to :

Code: Select all
$desc = ($phones_auto_ct - $pa - 1); # traverse in reverse order
seems to do the trick.

In brief,
Code: Select all
$phones_auto = explode(',',$phone_login);
returns 0 based array, whereas
Code: Select all
$phones_auto_ct = count($phones_auto);
returns 2 for the count.

$desc = 2 - 0 = 0 on the first loop, but there is no $phones_auto[2], there is only 0 and 1, thus for the first server in backwards order,first login = '', and if this server happens to be the only active one as in the above scenario, login fails.

Here is the broken query with $DB=1
Code: Select all
SELECT count(*) from phones,servers where ((login='' and pass='XXXXXX') or (login='21101' and pass='XXXXXX')) and phones.active = 'Y' and active_agent_login_server='Y' and phones.server_ip=servers.server_ip;
Please note the first login=''.
okli
 
Posts: 671
Joined: Mon Oct 01, 2007 5:09 pm

Re: Phone alias and Active Agent Server = N

Postby mflorell » Fri Aug 22, 2014 8:02 am

Thank you very much for the detailed explanation, I have fixed this in svn/trunk.
mflorell
Site Admin
 
Posts: 18387
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Re: Phone alias and Active Agent Server = N

Postby okli » Sat Aug 23, 2014 9:18 am

Thanks Matt.

Appologies for the lengthy answer, you'd be the last person who'd need all the details, just didn't have the time to shorten it to a reasonable length.
okli
 
Posts: 671
Joined: Mon Oct 01, 2007 5:09 pm


Return to Support

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 87 guests