diff options
Diffstat (limited to 'net/asterisk/files')
-rw-r--r-- | net/asterisk/files/codecnego-patch-Makefile | 45 | ||||
-rw-r--r-- | net/asterisk/files/nocodecnego-patch-Makefile | 45 | ||||
-rw-r--r-- | net/asterisk/files/patch-apps::app_dial.c | 88 | ||||
-rw-r--r-- | net/asterisk/files/patch-channels::chan_sip.c | 64 | ||||
-rw-r--r-- | net/asterisk/files/patch-include::asterisk::features.h | 57 | ||||
-rw-r--r-- | net/asterisk/files/patch-res::res_features.c | 144 |
6 files changed, 355 insertions, 88 deletions
diff --git a/net/asterisk/files/codecnego-patch-Makefile b/net/asterisk/files/codecnego-patch-Makefile index 7a39f24fcd66..f474578c3a35 100644 --- a/net/asterisk/files/codecnego-patch-Makefile +++ b/net/asterisk/files/codecnego-patch-Makefile @@ -1,6 +1,6 @@ ---- Makefile.orig Mon Sep 17 11:42:04 2007 -+++ Makefile Mon Sep 17 11:43:10 2007 -@@ -119,7 +119,7 @@ +--- Makefile.orig Mon Dec 24 11:53:33 2007 ++++ Makefile Mon Dec 24 11:53:33 2007 +@@ -127,7 +127,7 @@ ASTMANDIR=$(mandir) ifneq ($(findstring BSD,$(OSARCH)),) ASTVARLIBDIR=$(prefix)/share/asterisk @@ -9,7 +9,7 @@ else ASTVARLIBDIR=$(localstatedir)/lib/asterisk endif -@@ -210,7 +210,7 @@ +@@ -222,7 +222,7 @@ ifeq ($(OSARCH),FreeBSD) # -V is understood by BSD Make, not by GNU make. @@ -18,7 +18,7 @@ ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi) AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi) endif -@@ -379,15 +379,15 @@ +@@ -402,15 +402,15 @@ # Should static HTTP be installed during make samples or even with its own target ala # webvoicemail? There are portions here that *could* be customized but might also be # improved a lot. I'll put it here for now. @@ -39,7 +39,7 @@ $(MAKE) -C sounds install update: -@@ -408,45 +408,45 @@ +@@ -431,45 +431,45 @@ OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h))) bininstall: _all @@ -115,7 +115,7 @@ fi $(SUBDIRS_INSTALL): -@@ -473,7 +473,7 @@ +@@ -496,7 +496,7 @@ echo " WARNING WARNING WARNING" ;\ fi @@ -124,7 +124,7 @@ @if [ -x /usr/sbin/asterisk-post-install ]; then \ /usr/sbin/asterisk-post-install $(DESTDIR) . ; \ fi -@@ -511,31 +511,23 @@ +@@ -534,31 +534,23 @@ upgrade: bininstall adsi: @@ -164,7 +164,7 @@ ( \ echo "[directories]" ; \ echo "astetcdir => $(ASTETCDIR)" ; \ -@@ -597,20 +589,23 @@ +@@ -643,20 +635,23 @@ echo "; Default: strict"; \ echo ";"; \ echo ";translation_algorithm = strict"; \ @@ -192,7 +192,7 @@ done @echo " +--------- Asterisk Web Voicemail ----------+" @echo " + +" -@@ -637,10 +632,10 @@ +@@ -683,10 +678,10 @@ __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec rm -rf /tmp/asterisk ; \ @@ -205,28 +205,3 @@ cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \ rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec -@@ -651,19 +646,19 @@ - config: - @if [ "${OSARCH}" = "linux-gnu" ]; then \ - if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \ -- $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \ -+ $(BSD_INSTALL_SCRIPT) contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \ - /sbin/chkconfig --add asterisk; \ - elif [ -f /etc/debian_version ]; then \ -- $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \ -+ $(BSD_INSTALL_SCRIPT) contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \ - /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \ - elif [ -f /etc/gentoo-release ]; then \ -- $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \ -+ $(BSD_INSTALL_SCRIPT) contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \ - /sbin/rc-update add asterisk default; \ - elif [ -f /etc/mandrake-release ]; then \ -- $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \ -+ $(BSD_INSTALL_SCRIPT) contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \ - /sbin/chkconfig --add asterisk; \ - elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \ -- $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \ -+ $(BSD_INSTALL_SCRIPT) contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \ - /sbin/chkconfig --add asterisk; \ - elif [ -f /etc/slackware-version ]; then \ - echo "Slackware is not currently supported, although an init script does exist for it." \ diff --git a/net/asterisk/files/nocodecnego-patch-Makefile b/net/asterisk/files/nocodecnego-patch-Makefile index 680c226dc42d..f73c3d83bcde 100644 --- a/net/asterisk/files/nocodecnego-patch-Makefile +++ b/net/asterisk/files/nocodecnego-patch-Makefile @@ -1,6 +1,6 @@ ---- Makefile.orig Thu Aug 9 16:10:46 2007 -+++ Makefile Mon Sep 17 11:40:51 2007 -@@ -119,7 +119,7 @@ +--- Makefile.orig Mon Dec 17 08:44:51 2007 ++++ Makefile Mon Dec 24 11:54:52 2007 +@@ -127,7 +127,7 @@ ASTMANDIR=$(mandir) ifneq ($(findstring BSD,$(OSARCH)),) ASTVARLIBDIR=$(prefix)/share/asterisk @@ -9,7 +9,7 @@ else ASTVARLIBDIR=$(localstatedir)/lib/asterisk endif -@@ -210,7 +210,7 @@ +@@ -222,7 +222,7 @@ ifeq ($(OSARCH),FreeBSD) # -V is understood by BSD Make, not by GNU make. @@ -18,7 +18,7 @@ ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi) AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi) endif -@@ -379,15 +379,15 @@ +@@ -402,15 +402,15 @@ # Should static HTTP be installed during make samples or even with its own target ala # webvoicemail? There are portions here that *could* be customized but might also be # improved a lot. I'll put it here for now. @@ -39,7 +39,7 @@ $(MAKE) -C sounds install update: -@@ -408,45 +408,45 @@ +@@ -431,45 +431,45 @@ OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h))) bininstall: _all @@ -115,7 +115,7 @@ fi $(SUBDIRS_INSTALL): -@@ -473,7 +473,7 @@ +@@ -496,7 +496,7 @@ echo " WARNING WARNING WARNING" ;\ fi @@ -124,7 +124,7 @@ @if [ -x /usr/sbin/asterisk-post-install ]; then \ /usr/sbin/asterisk-post-install $(DESTDIR) . ; \ fi -@@ -511,31 +511,23 @@ +@@ -534,31 +534,23 @@ upgrade: bininstall adsi: @@ -164,7 +164,7 @@ ( \ echo "[directories]" ; \ echo "astetcdir => $(ASTETCDIR)" ; \ -@@ -556,20 +548,23 @@ +@@ -602,20 +594,23 @@ echo ";astctlowner = root" ; \ echo ";astctlgroup = apache" ; \ echo ";astctl = asterisk.ctl" ; \ @@ -192,7 +192,7 @@ done @echo " +--------- Asterisk Web Voicemail ----------+" @echo " + +" -@@ -596,10 +591,10 @@ +@@ -642,10 +637,10 @@ __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec rm -rf /tmp/asterisk ; \ @@ -205,28 +205,3 @@ cp -f contrib/init.d/rc.redhat.asterisk /tmp/asterisk/etc/rc.d/init.d/asterisk ; \ rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec -@@ -610,19 +605,19 @@ - config: - @if [ "${OSARCH}" = "linux-gnu" ]; then \ - if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \ -- $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \ -+ $(BSD_INSTALL_SCRIPT) contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \ - /sbin/chkconfig --add asterisk; \ - elif [ -f /etc/debian_version ]; then \ -- $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \ -+ $(BSD_INSTALL_SCRIPT) contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk; \ - /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \ - elif [ -f /etc/gentoo-release ]; then \ -- $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \ -+ $(BSD_INSTALL_SCRIPT) contrib/init.d/rc.gentoo.asterisk /etc/init.d/asterisk; \ - /sbin/rc-update add asterisk default; \ - elif [ -f /etc/mandrake-release ]; then \ -- $(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \ -+ $(BSD_INSTALL_SCRIPT) contrib/init.d/rc.mandrake.asterisk /etc/rc.d/init.d/asterisk; \ - /sbin/chkconfig --add asterisk; \ - elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \ -- $(INSTALL) -m 755 contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \ -+ $(BSD_INSTALL_SCRIPT) contrib/init.d/rc.suse.asterisk /etc/init.d/asterisk; \ - /sbin/chkconfig --add asterisk; \ - elif [ -f /etc/slackware-version ]; then \ - echo "Slackware is not currently supported, although an init script does exist for it." \ diff --git a/net/asterisk/files/patch-apps::app_dial.c b/net/asterisk/files/patch-apps::app_dial.c new file mode 100644 index 000000000000..6abe48a17d9f --- /dev/null +++ b/net/asterisk/files/patch-apps::app_dial.c @@ -0,0 +1,88 @@ +--- apps/app_dial.c.orig Wed Feb 6 18:45:30 2008 ++++ apps/app_dial.c Wed Feb 6 18:51:59 2008 +@@ -297,6 +297,8 @@ AST_APP_OPTIONS(dial_exec_options, { + OPT_CALLER_HANGUP | OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER | \ + OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR | OPT_CALLEE_PARK | OPT_CALLER_PARK)) + ++static int detect_disconnect(struct ast_channel *chan, char code); ++ + /* We define a custom "local user" structure because we + use it not only for keeping track of what is in use but + also for keeping track of who we're dialing. */ +@@ -402,6 +404,7 @@ static struct ast_channel *wait_for_answ + struct ast_channel *peer = NULL; + /* single is set if only one destination is enabled */ + int single = outgoing && !outgoing->next && !ast_test_flag(outgoing, OPT_MUSICBACK | OPT_RINGBACK); ++ + + if (single) { + /* Turn off hold music, etc */ +@@ -716,9 +719,9 @@ static struct ast_channel *wait_for_answ + } + + if (ast_test_flag(peerflags, OPT_CALLER_HANGUP) && +- (f->subclass == '*')) { /* hmm it it not guaranteed to be '*' anymore. */ ++ detect_disconnect(in, f->subclass)) { /* hmm it it not guaranteed to be '*' anymore. */ + if (option_verbose > 2) +- ast_verbose(VERBOSE_PREFIX_3 "User hit %c to disconnect call.\n", f->subclass); ++ ast_verbose(VERBOSE_PREFIX_3 "User requested call disconnect.\n"); + *to=0; + ast_cdr_noanswer(in->cdr); + strcpy(status, "CANCEL"); +@@ -776,6 +779,56 @@ static struct ast_channel *wait_for_answ + + return peer; + } ++ ++static char featurecode[FEATURE_MAX_LEN + 1] = ""; ++ ++static int detect_disconnect(struct ast_channel *chan, char code) ++{ ++ struct feature_interpret_result result; ++ int x; ++ struct ast_flags features; ++ int res = FEATURE_RETURN_PASSDIGITS; ++ struct ast_call_feature *feature; ++ char *cptr; ++ int len; ++ ++ len = strlen(featurecode); ++ if (len >= FEATURE_MAX_LEN) { ++ featurecode[0] = '\0'; ++ } ++ cptr = &featurecode[strlen(featurecode)]; ++ cptr[0] = code; ++ cptr[1] = '\0'; ++ ++ memset(&features, 0, sizeof(struct ast_flags)); ++ ast_set_flag(&features, AST_FEATURE_DISCONNECT); ++ ++ ast_features_lock(); ++ ++ res = ast_feature_detect(chan, &features, featurecode, &result); ++ ++ if (res != FEATURE_RETURN_STOREDIGITS) ++ featurecode[0] = '\0'; ++ ++ if (result.builtin_feature && result.builtin_feature->feature_mask & AST_FEATURE_DISCONNECT) { ++ ast_features_unlock(); ++ return 1; ++ } ++ ++ for (x = 0; x < result.num_dyn_features; ++x) { ++ feature = result.dynamic_features[x]; ++ if (feature->feature_mask & AST_FEATURE_DISCONNECT) { ++ ast_features_unlock(); ++ return 1; ++ } ++ } ++ ++ ast_features_unlock(); ++ ++ return 0; ++} ++ ++ + + static void replace_macro_delimiter(char *s) + { diff --git a/net/asterisk/files/patch-channels::chan_sip.c b/net/asterisk/files/patch-channels::chan_sip.c index 06bb9c822545..916cc7ffa0ac 100644 --- a/net/asterisk/files/patch-channels::chan_sip.c +++ b/net/asterisk/files/patch-channels::chan_sip.c @@ -1,6 +1,6 @@ ---- channels/chan_sip.c.orig Wed Mar 28 11:23:42 2007 -+++ channels/chan_sip.c Wed Mar 28 11:36:27 2007 -@@ -484,7 +484,7 @@ static const struct cfsip_options { +--- channels/chan_sip.c.orig Mon Dec 24 11:59:46 2007 ++++ channels/chan_sip.c Mon Dec 24 11:58:47 2007 +@@ -493,7 +493,7 @@ #define DEFAULT_MOHINTERPRET "default" #define DEFAULT_MOHSUGGEST "" #define DEFAULT_VMEXTEN "asterisk" @@ -9,7 +9,7 @@ #define DEFAULT_NOTIFYMIME "application/simple-message-summary" #define DEFAULT_MWITIME 10 #define DEFAULT_ALLOWGUEST TRUE -@@ -3822,6 +3823,8 @@ static struct ast_channel *sip_new(struc +@@ -3985,6 +3985,8 @@ ast_codec_pref_remove2(&tmp->nativeformats, ~i->usercapability); fmt = ast_codec_pref_index_audio(&tmp->nativeformats, 0); @@ -18,18 +18,46 @@ /* If we have a prefcodec setting, we have an inbound channel that set a preferred format for this call. Otherwise, we check the jointcapability We also check for vrtp. If it's not there, we are not allowed do any video anyway. -@@ -11203,6 +11215,13 @@ static int build_reply_digest(struct sip - secret = p->peersecret; - md5secret = p->peermd5secret; - } -+ /* No authentication. Try to get auth info from channel vars */ -+ if (ast_strlen_zero(username)) -+ { -+ username = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_NAME"); -+ secret = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_SECRET"); -+ md5secret = pbx_builtin_getvar_helper(p->owner, "SIP_AUTH_MD5SECRET"); -+ } - if (ast_strlen_zero(username)) /* We have no authentication */ - return -1; +@@ -15845,6 +15847,9 @@ + char *ext, *host; + char tmp[256]; + char *dest = data; ++ char *secret = NULL; ++ char *md5secret = NULL; ++ char *authname = NULL; - + if (!(p = sip_alloc(NULL, NULL, 0, SIP_INVITE))) { + ast_log(LOG_ERROR, "Unable to build sip pvt data for '%s' (Out of memory or socket error)\n", (char *)data); +@@ -15866,6 +15871,17 @@ + if (host) { + *host++ = '\0'; + ext = tmp; ++ secret = strchr(ext, ':'); ++ if (secret) { ++ *secret++ = '\0'; ++ md5secret = strchr(secret, ':'); ++ if (md5secret) { ++ *md5secret++ = '\0'; ++ authname = strchr(md5secret, ':'); ++ if (authname) ++ *authname++ = '\0'; ++ } ++ } + } else { + ext = strchr(tmp, '/'); + if (ext) +@@ -15898,6 +15914,14 @@ + ast_string_field_set(p, username, ext); + ast_string_field_free(p, fullcontact); + } ++ if (secret && !ast_strlen_zero(secret)) ++ ast_string_field_set(p, peersecret, secret); ++ ++ if (md5secret && !ast_strlen_zero(md5secret)) ++ ast_string_field_set(p, peermd5secret, md5secret); ++ ++ if (authname && !ast_strlen_zero(authname)) ++ ast_string_field_set(p, authname, authname); + #if 0 + printf("Setting up to call extension '%s' at '%s'\n", ext ? ext : "<none>", host); + #endif diff --git a/net/asterisk/files/patch-include::asterisk::features.h b/net/asterisk/files/patch-include::asterisk::features.h new file mode 100644 index 000000000000..fa5c747eb316 --- /dev/null +++ b/net/asterisk/files/patch-include::asterisk::features.h @@ -0,0 +1,57 @@ +--- include/asterisk/features.h.orig Thu Aug 23 23:16:41 2007 ++++ include/asterisk/features.h Tue Dec 11 17:13:52 2007 +@@ -31,6 +31,20 @@ + #define FEATURE_EXTEN_LEN 32 + #define FEATURE_MOH_LEN 80 /* same as MAX_MUSICCLASS from channel.h */ + ++#define FEATURE_RETURN_HANGUP -1 ++#define FEATURE_RETURN_SUCCESSBREAK 0 ++#define FEATURE_RETURN_PBX_KEEPALIVE AST_PBX_KEEPALIVE ++#define FEATURE_RETURN_NO_HANGUP_PEER AST_PBX_NO_HANGUP_PEER ++#define FEATURE_RETURN_PASSDIGITS 21 ++#define FEATURE_RETURN_STOREDIGITS 22 ++#define FEATURE_RETURN_SUCCESS 23 ++#define FEATURE_RETURN_KEEPTRYING 24 ++ ++#define FEATURE_SENSE_CHAN (1 << 0) ++#define FEATURE_SENSE_PEER (1 << 1) ++ ++typedef int (*feature_operation)(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data); ++ + /*! \brief main call feature structure */ + struct ast_call_feature { + int feature_mask; +@@ -38,7 +52,7 @@ + char sname[FEATURE_SNAME_LEN]; + char exten[FEATURE_MAX_LEN]; + char default_exten[FEATURE_MAX_LEN]; +- int (*operation)(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data); ++ feature_operation operation; + unsigned int flags; + char app[FEATURE_APP_LEN]; + char app_args[FEATURE_APP_ARGS_LEN]; +@@ -47,6 +61,12 @@ + }; + + ++struct feature_interpret_result { ++ struct ast_call_feature *builtin_feature; ++ struct ast_call_feature *dynamic_features[20]; ++ int num_dyn_features; ++}; ++ + + /*! \brief Park a call and read back parked location + * \param chan the channel to actually be parked +@@ -93,5 +113,11 @@ + /*! \brief unregister feature from feature_set + \param feature the ast_call_feature object which was registered before*/ + void ast_unregister_feature(struct ast_call_feature *feature); ++ ++int ast_feature_detect(struct ast_channel *chan, const struct ast_flags *features, char *code, struct feature_interpret_result *result); ++ ++void ast_features_lock(void); ++void ast_features_unlock(void); ++ + + #endif /* _AST_FEATURES_H */ diff --git a/net/asterisk/files/patch-res::res_features.c b/net/asterisk/files/patch-res::res_features.c new file mode 100644 index 000000000000..c21775f1690d --- /dev/null +++ b/net/asterisk/files/patch-res::res_features.c @@ -0,0 +1,144 @@ +--- res/res_features.c.orig Wed Feb 6 16:55:29 2008 ++++ res/res_features.c Wed Feb 6 17:02:00 2008 +@@ -477,18 +477,6 @@ int ast_masq_park_call(struct ast_channe + } + + +-#define FEATURE_RETURN_HANGUP -1 +-#define FEATURE_RETURN_SUCCESSBREAK 0 +-#define FEATURE_RETURN_PBX_KEEPALIVE AST_PBX_KEEPALIVE +-#define FEATURE_RETURN_NO_HANGUP_PEER AST_PBX_NO_HANGUP_PEER +-#define FEATURE_RETURN_PASSDIGITS 21 +-#define FEATURE_RETURN_STOREDIGITS 22 +-#define FEATURE_RETURN_SUCCESS 23 +-#define FEATURE_RETURN_KEEPTRYING 24 +- +-#define FEATURE_SENSE_CHAN (1 << 0) +-#define FEATURE_SENSE_PEER (1 << 1) +- + /*! \brief + * set caller and callee according to the direction + */ +@@ -1052,32 +1040,35 @@ static int remap_feature(const char *nam + return res; + } + +-static int ast_feature_interpret(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense) ++void ast_features_lock(void) ++{ ++ ast_rwlock_rdlock(&features_lock); ++ AST_LIST_LOCK(&feature_list); ++} ++ ++void ast_features_unlock(void) ++{ ++ AST_LIST_UNLOCK(&feature_list); ++ ast_rwlock_unlock(&features_lock); ++} ++ ++int ast_feature_detect(struct ast_channel *chan, const struct ast_flags *features, char *code, struct feature_interpret_result *result) + { + int x; +- struct ast_flags features; + int res = FEATURE_RETURN_PASSDIGITS; + struct ast_call_feature *feature; +- const char *dynamic_features; ++ const char *dynamic_features = pbx_builtin_getvar_helper(chan, "DYNAMIC_FEATURES"); + char *tmp, *tok; + +- if (sense == FEATURE_SENSE_CHAN) { +- ast_copy_flags(&features, &(config->features_caller), AST_FLAGS_ALL); +- dynamic_features = pbx_builtin_getvar_helper(chan, "DYNAMIC_FEATURES"); +- } else { +- ast_copy_flags(&features, &(config->features_callee), AST_FLAGS_ALL); +- dynamic_features = pbx_builtin_getvar_helper(peer, "DYNAMIC_FEATURES"); +- } +- if (option_debug > 2) +- ast_log(LOG_DEBUG, "Feature interpret: chan=%s, peer=%s, sense=%d, features=%d dynamic=%s\n", chan->name, peer->name, sense, features.flags, dynamic_features); ++ result->builtin_feature = NULL; ++ result->num_dyn_features = 0; + +- ast_rwlock_rdlock(&features_lock); + for (x = 0; x < FEATURES_COUNT; x++) { +- if ((ast_test_flag(&features, builtin_features[x].feature_mask)) && ++ if ((ast_test_flag(features, builtin_features[x].feature_mask)) && + !ast_strlen_zero(builtin_features[x].exten)) { + /* Feature is up for consideration */ + if (!strcmp(builtin_features[x].exten, code)) { +- res = builtin_features[x].operation(chan, peer, config, code, sense, NULL); ++ result->builtin_feature = &builtin_features[x]; + break; + } else if (!strncmp(builtin_features[x].exten, code, strlen(code))) { + if (res == FEATURE_RETURN_PASSDIGITS) +@@ -1085,7 +1076,6 @@ static int ast_feature_interpret(struct + } + } + } +- ast_rwlock_unlock(&features_lock); + + if (ast_strlen_zero(dynamic_features)) + return res; +@@ -1093,9 +1083,7 @@ static int ast_feature_interpret(struct + tmp = ast_strdupa(dynamic_features); + + while ((tok = strsep(&tmp, "#"))) { +- AST_LIST_LOCK(&feature_list); + if (!(feature = find_dynamic_feature(tok))) { +- AST_LIST_UNLOCK(&feature_list); + continue; + } + +@@ -1103,18 +1091,49 @@ static int ast_feature_interpret(struct + if (!strcmp(feature->exten, code)) { + if (option_verbose > 2) + ast_verbose(VERBOSE_PREFIX_3 " Feature Found: %s exten: %s\n",feature->sname, tok); +- res = feature->operation(chan, peer, config, code, sense, feature); +- if (res != FEATURE_RETURN_KEEPTRYING) { +- AST_LIST_UNLOCK(&feature_list); ++ result->dynamic_features[result->num_dyn_features++] = feature; ++ if (result->num_dyn_features >= (sizeof(result->dynamic_features) / sizeof(result->dynamic_features[0]))) { + break; + } + res = FEATURE_RETURN_PASSDIGITS; + } else if (!strncmp(feature->exten, code, strlen(code))) + res = FEATURE_RETURN_STOREDIGITS; + +- AST_LIST_UNLOCK(&feature_list); + } + ++ return res; ++} ++ ++static int ast_feature_interpret(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense) ++{ ++ struct feature_interpret_result result; ++ int x; ++ struct ast_flags features; ++ int res = FEATURE_RETURN_PASSDIGITS; ++ struct ast_call_feature *feature; ++ ++ if (sense == FEATURE_SENSE_CHAN) ++ ast_copy_flags(&features, &(config->features_caller), AST_FLAGS_ALL); ++ else ++ ast_copy_flags(&features, &(config->features_callee), AST_FLAGS_ALL); ++ if (option_debug > 2) ++ ast_log(LOG_DEBUG, "Feature interpret: chan=%s, peer=%s, sense=%d, features=%d\n", chan->name, peer->name, sense, features.flags); ++ ++ ast_features_lock(); ++ res = ast_feature_detect(chan, &features, code, &result); ++ ++ if (result.builtin_feature) ++ res = result.builtin_feature->operation(chan, peer, config, code, sense, NULL); ++ ++ for (x = 0; x < result.num_dyn_features; ++x) { ++ feature = result.dynamic_features[x]; ++ res = feature->operation(chan, peer, config, code, sense, feature); ++ if (res != FEATURE_RETURN_KEEPTRYING) ++ break; ++ res = FEATURE_RETURN_PASSDIGITS; ++ } ++ ++ ast_features_unlock(); + return res; + } + |