Summary: | ASTERISK-00500: [patch] add support for sending calls to different contexts based on the distinctive ring | ||
Reporter: | Benjamin Koenig (phsdshft) | Labels: | |
Date Opened: | 2003-11-09 06:10:58.000-0600 | Date Closed: | 2004-09-25 02:52:04 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) distinctiveringpatch.diff ( 1) zapata.conf.sample.diff | |
Description: | This patch allows you to specify up to 3 distinctive rings in zapata.conf per channel, and a separate context for each ring received. You put something like the following in zapata.conf: dring1=95,0,0 dring1context=internal1 dring2=325,95,0 dring2context=internal2 context=devonshire channel => 1 If the ring matches either one of the 2 distinctive rings, it goes to the associated context, otherwise it goes to the default context. dringN and dringNcontext are the two new config lines added, where N is an integer from 1 to 3. The value for dring is up to 3 integers (comma separated).. I got the integers from what p->ringt is in ssthread.. Perhaps there is a better way to do this, but this works for me.. ****** ADDITIONAL INFORMATION ****** Requires callerid stuff.. it probably shouldn't though. | ||
Comments: | By: Paul Cadach (pcadach) 2003-11-09 13:54:18.000-0600 May be better to make technology-independed context selection by distinctive ring and leave ring type identification in channel drivers? As I can see distinctive rings supports for at least by 3 diffirent channel drivers: 1) Zap (patch is here); 2) Sip (patch appeared some time ago in this bugtracker); 3) H.323 (not ready yet but theoretically support can be added). By: Paul Cadach (pcadach) 2003-11-09 21:19:39.000-0600 May be to try to go to context specified for channel with suffix, for example, '-ring<distinctive ring type' and, if such context isn't exist, go to default context without suffix. For example, if channel-specific context named as 'ctx' and you have distinctive ring type 1, try to go to context named 'ctx-ring1', otherwise, if one not exist, go to context 'ctx'. By: Benjamin Koenig (phsdshft) 2003-11-09 21:38:52.000-0600 If I implemented that, it would mean a couple of things: Good: You don't need to specify the contexts themselves in zapata.conf Bad: It won't be as efficient.. for example, if I ring1 to goto the "residential" menu, which is used by other things as well, I would need to have a Context called ctx-ring1, which has a Goto directing it to residential-menu or whatever. So, everytime someone calls in that GOTO is used, vs. the contexts being read from zapata.conf on the module loading if the contexts are specified in zapata.conf. If you allow the context names to be chosen, IMHO it would be more efficient, and also allow things to be a bit more readable. Are there other good/bad things I haven't mentioned? Those are just my thoughts on it anyway.. By: Paul Cadach (pcadach) 2003-11-09 22:11:42.000-0600 Solution for bad - make support for context aliases in extensions.conf. So, you will just assign an alias from ctx-ring1 to residential and don't need to create special context ctx-ring1 with Goto to residential context. Also, context aliases can be supported more efficiently within PBX core than execution of Goto application... One good thing more: This is technology-independed (so, for example, channel just sets variable like ${DISTINCTRING} and when you call ast_pbx_run() it will try to go to context with -ring${DISTINCTRING} suffix first (if variable ${DISTINCTDING} is exists and not empty), then, if not such context - to context without suffix. So, channel driver must just set ${DISTINCTRING} variable and PBX will handle all of work to go to ring-depended context). By: Brian West (bkw918) 2003-11-10 17:29:24.000-0600 Would this work with an X100P? By: Benjamin Koenig (phsdshft) 2003-11-10 18:54:25.000-0600 Thats what it was made for, I have an X100P card connected to a line which has 2 distinctive ring numbers + the normal number and it works great (so far). By: Brian West (bkw918) 2003-11-11 22:22:08.000-0600 ok i'm gonna order two distinctive ring numbers and test this out. By: Brian West (bkw918) 2003-11-11 23:16:03.000-0600 I see this supports up to 3 drings? 1 normal and 3 additional? By: Benjamin Koenig (phsdshft) 2003-11-11 23:42:49.000-0600 3 drings, and one default (if it doesn't match a dring) By: Brian West (bkw918) 2003-11-12 16:59:38.000-0600 OMG this works perfect.. but need a better way to find the ring patterns. :P Had to put some ast_verbose action in to find them. By: Brian West (bkw918) 2003-11-12 17:24:15.000-0600 With a little bit of thought.. this can be done without dring1,dring2,dring3 0,0,0 = Default XXX,0,0 = dring1 XXX,XXX,0 = dring2 XXX,XXX,XXX = dring3 Use that as the default method of finding the ring tones. Also maybe have the option to specify them. So both methods are in there. so with just a small bit of logic you can kill the settings in the zapata.conf and make it learn the ring tones. and add a setting to print the ring chan_zap is seeing. edited on: 11-12-03 18:52 By: rommer (rommer) 2003-11-18 09:22:59.000-0600 Been using the patch for a few days and while it works very well I see a few issues: 1) Ring detection sometimes fails if the first ring is not caught in time. Is it possible to grab the ring after CID detection perhaps. 2) Not sure if this is a biggie or not but if you do a "zap show channel X" one of the items shown is "Fax Handled: no" This normally gets set to "yes" if a fax is in progress but not if the fax call is handled via the distinctive ring code. Does anyone know if this is a big deal? edited on: 11-18-03 12:15 By: Brian West (bkw918) 2003-11-18 23:18:34.000-0600 I have had no problems out of this patch... Might wanna double check your ring settings. By: Brian West (bkw918) 2003-11-20 12:35:07.000-0600 I think this is ready for CVS. I have attached a new diff with a few changes for finding the ring patterns and a diff for zapata.conf.sample By: Mark Spencer (markster) 2003-11-20 22:48:35.000-0600 Can't use strtok. Rewrite with strsep, or better yet, just use sscanf. By: Benjamin Koenig (phsdshft) 2003-11-20 23:00:59.000-0600 The first patch had tok, the second one (written 11-09-03 16:53) I rewrote to not use strtok.. and chan_zap_dring_verbose.diff.txt (7,967 bytes) 11-20-03 12:30 (which bkw submitted) doesn't use strtok either.. I just accidently used it at first (and later removed it) :) By: Benjamin Koenig (phsdshft) 2003-11-21 00:35:18.000-0600 Ok, here is a new patch which uses sscanf instead of strsep.. It also introduces "usedistinctiveringdetect=yes" into zapata.conf to enable things. By: Benjamin Koenig (phsdshft) 2003-11-21 00:56:17.000-0600 I also updated an updated version of the zapata.conf sample which has the usedistinctiveringdetect=yes line in it.. I will try to make this more generic when I have time, and improve this.. but for now things seem to work. By: Brian West (bkw918) 2003-11-21 12:09:26.000-0600 yes it works perfect. By: ww (ww) 2003-11-28 20:42:31.000-0600 I have had good success with this patch. Well done and thanks! By: Brian West (bkw918) 2003-11-28 21:22:21.000-0600 Can we make "zap show channels" show each context and ring as its own channel? By: ww (ww) 2004-01-12 11:36:50.000-0600 i think this can be imported into cvs now. By: Brian West (bkw918) 2004-01-12 11:37:27.000-0600 Fixed in CVS |