Summary: | ASTERISK-13888: [patch] "setvar" configuration option for mgcp | ||
Reporter: | Eduardo Ferro (eferro) | Labels: | |
Date Opened: | 2009-04-02 21:29:39 | Date Closed: | 2009-10-21 18:51:25 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Channels/chan_mgcp |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) chan_mgcp-setvars-svn-1.4-r186169.patch ( 1) chan_mgcp-setvars-svn-trunk-r186228.patch ( 2) chan_mgcp-setvars-svn-trunk-r219899.patch | |
Description: | Support for add "setvar" conf options for outgoing calls created from mgcp endpoint. The defined vars/values will be created as channel vars when the corresponding user create a new channel. The format for this option is (same as setvar at sip.conf): setvar[space]=[space]<name>=<value> (spaces are optional) Only the servar for lines are accepted, the setvar options set for wild char endpoint will be discarded.... So if we define a mta with the following data: [mta285.lab.voip] setvar = WRONG1=value1 setvar = WRONG2=value2 wcardep = aaln/* host = dynamic context = pbx4-from-ext-vm callerid = "" <918298119> setvar = PBX=main_pbx line = aaln/1 context = pbx4-from-ext callerid = "" <4119> setvar = PBX=main_pbx setvar = PBXSERV=gold line = aaln/2 WRONG1 and WRONG2 will be discarded, only are correct "PBX" at aaln/1 line and "PBX" and "PBXSERV" at aaln/2 ****** ADDITIONAL INFORMATION ****** For example, if we have the following lines at mgcp.conf: --------------------------------- [mta285.lab.voip] wcardep = aaln/* singlepath = no nat = never singlepath = no host = dynamic context = pbx4-from-ext-vm callerid = "" <918298119> setvar = PBX=main_pbx line = aaln/1 dtmfmode = hybrid context = pbx4-from-ext language = es callerid = "" <4119> setvar = PBX=main_pbx setvar = PBXSERV=gold line = aaln/2 ---------------------------- If the MGCP/aaln/1@mta285.lab.voip endpoint create a channel, this channel will have the var ${PBX} defined with the value "main_pbx" furthermore, if the channel is created by MGCP/aaln/2@mta285.lab.voip the channels var created will be ${PBX} and ${PBXSERV} | ||
Comments: | By: Eduardo Ferro (eferro) 2009-04-02 21:33:11 chan_mgcp-setvars-svn-trunk-r186228.patch (patch for svn trunk 1.6.x (svn release 186228)) chan_mgcp-setvars-svn-1.4-r186169.patch (backport version of the patch. For svn 1.4 brach (svn release 186169)) By: Eduardo Ferro (eferro) 2009-04-02 21:40:50 The patch contains the chan_sip::add_var funct replicated at chan_mgcp.c. IMHO, in order to avoid duplication this function should be moved from chan_sip (and from this patch). I suggest move add_var to main/chanvars.c (to be used as helper to work with chanvar) By: Tilghman Lesher (tilghman) 2009-07-09 13:19:22 The way that this works is kind of odd and potentially buggy. Of course, the way that the MGCP config file is parsed is likewise odd. Basically, the configfile is parsed the same way as zapata.conf, with endpoint declarations being instantiations of previous values. So, the current method is: [gateway] foo=1 bar=2 line=line1 line=line2 So both lines get the values of both foo and bar, set to their respective values. Enter in setvar, as you have here, and it gets really wonky: [gateway] setvar=foo=1 setvar=bar=2 line=line1 line=line2 In your code, the first line would get the variables set, but the second would not. I think that's not really expected. That you have implicitly cleared the variables between the 2 lines is problematic. Even stranger is what happens if you have a wcardep declaration in there. [gateway] setvar=foo=1 setvar=bar=2 wcardep=aaln/* line=line1 line=line2 Now, nothing gets variables, which looks very wrong, as well. I would suggest that for a reasonable interpretation, you do the following: 1) Allow wildcard endpoints to obtain variables. It may not serve your purposes, but it's reasonable to expect that it would work. 2) Upon instantiating variables, COPY the list of variables (with a deep copy), instead of just appending it to the current list. 3) Create a new option to clear previous variables under a definition, if that's really what the administrator wants. By: Eduardo Ferro (eferro) 2009-07-12 03:19:11 I'll change the code, following your instruction in a few days, and of course upgrade it to svn trunk. Thanks for the advice By: Leif Madsen (lmadsen) 2009-09-22 08:12:15 Is there any interest from the reporter to move this issue forward? By: Eduardo Ferro (eferro) 2009-09-23 01:38:02 Sorry, I just forgot the issue. :( I'll begin the changes today... By: Eduardo Ferro (eferro) 2009-09-23 13:02:13 chan_mgcp-setvars-svn-trunk-r219899.patch try to follow the tilghman's comments and to update the code to trunk version. The keyword used to reset the vars (point 3 of the tilghman's note) is "clearvar" I would appreciate it if someone can review the code... By: Tilghman Lesher (tilghman) 2009-09-23 18:24:55 Yep, I'm good with this. By: Digium Subversion (svnbot) 2009-09-23 18:40:34 Repository: asterisk Revision: 219952 U trunk/CHANGES U trunk/channels/chan_mgcp.c U trunk/configs/mgcp.conf.sample ------------------------------------------------------------------------ r219952 | tilghman | 2009-09-23 18:40:34 -0500 (Wed, 23 Sep 2009) | 6 lines Add ability to preset channel variables on lines. (closes issue ASTERISK-13888) Reported by: alea-soluciones Patches: chan_mgcp-setvars-svn-trunk-r219899.patch uploaded by alea (license 514) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=219952 By: Digium Subversion (svnbot) 2009-09-24 11:28:36 Repository: asterisk Revision: 219952 U trunk/CHANGES U trunk/channels/chan_mgcp.c U trunk/configs/mgcp.conf.sample ------------------------------------------------------------------------ r219952 | tilghman | 2009-09-23 18:38:19 -0500 (Wed, 23 Sep 2009) | 6 lines Add support for 'setvar=' for MGCP device lines, like other channel drivers provide. (closes issue ASTERISK-13888) Reported by: alea-soluciones Patches: chan_mgcp-setvars-svn-trunk-r219899.patch uploaded by alea (license 514) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=219952 |