Summary:ASTERISK-01165: [patch] ast_context_add_switch2 fix for allowing multiple switches from one context
Reporter:Matteo Brancaleoni (mbrancaleoni)Labels:
Date Opened:2004-03-05 16:02:49.000-0600Date Closed:2008-01-15 14:46:13.000-0600
Versions:Frequency of
Environment:Attachments:( 0) pbx.patch
Description:since the pbx_find_extension walks context switches, I assume
that multiple swicthes are allowed from a context to N remote servers, for example:

switch => IAX2/user:pw@serverA/somecontext
switch => IAX2/user:pw@serverB/someothercontext
switch => IAX2/user:pw@serverC/somenicecontext

but ast_context_add_switch2 compare the sw name... which
is always IAX (or IAX2)... why that? that leads
to having only 1 swicth per context and per type...
I assume that the comparision must be done between
sw data... patch attached.

I'm using it and seems ok.

Comments:By: James Golovich (jamesgolovich) 2004-03-06 02:59:18.000-0600

This patch is most of the way there, but we need a combination of both.  We should be checking the name and data, so if there is an IAX and IAX2 switch with the same info it will add both.  Easy enough to patch

By: Matteo Brancaleoni (mbrancaleoni) 2004-03-06 05:09:36.000-0600

mmmh... why?
I won't switch to the same server with different technolgies... is like polling it 2 times... it can be polled 2 times if I use different contexts, so data
is different and that's enough.

but the patch is trivial, lemme know and i'll change it.

By: James Golovich (jamesgolovich) 2004-03-06 15:09:24.000-0600

No need to change it.  I've already come up with the patch, I was just waiting on confirmation from Mark.

I think with switches we are locked into thinking about what we already have, which is only IAX and IAX2 switches.  but what if there was a SIP switch or something else that would pass the same data, then we would be limiting ourselves to just one switch with the same data.  Rather unlikely in most scenarios I know.

I just thought of one scenario.  What if someone did the crazy thing like creating a PGSql and Mysql switch that used the same credentials.

switch => PGSql/host=localhost|user=dbuser|pass=dbpass
switch => MySQL/host=localhost|user=dbuser|pass=dbpass

I'm not encouraging this behavior, it seems extremely bad, but we should support it.

By: James Golovich (jamesgolovich) 2004-03-06 15:29:25.000-0600

Fixed in CVS

By: Digium Subversion (svnbot) 2008-01-15 14:46:12.000-0600

Repository: asterisk
Revision: 2360

U   trunk/pbx.c

r2360 | citats | 2008-01-15 14:46:12 -0600 (Tue, 15 Jan 2008) | 2 lines

Allow multiple switches in the same context (bug ASTERISK-1165)



By: Digium Subversion (svnbot) 2008-01-15 14:46:13.000-0600

Repository: asterisk
Revision: 2361

U   branches/v1-0_stable/pbx.c

r2361 | citats | 2008-01-15 14:46:12 -0600 (Tue, 15 Jan 2008) | 2 lines

Allow multiple switches in the same context (bug ASTERISK-1165)