diff options
68 files changed, 3288 insertions, 1408 deletions
diff --git a/net/asterisk/Makefile b/net/asterisk/Makefile index f972ca541c79..c1c8e5eaa5c1 100644 --- a/net/asterisk/Makefile +++ b/net/asterisk/Makefile @@ -6,8 +6,7 @@ # PORTNAME= asterisk -PORTVERSION= 1.4.18.1 -PORTREVISION= 1 +PORTVERSION= 1.4.19.2 CATEGORIES= net MASTER_SITES= http://ftp.digium.com/pub/asterisk/ \ http://ftp.digium.com/pub/asterisk/old-releases/ @@ -50,7 +49,8 @@ OPTIONS= OGGVORBIS "Enable Ogg Vorbis support" on \ FREETDS "Enable FreeTDS support" on \ JABBER "Enable Jabber and Gtalk support" on \ SQLITE "Enable SQLITE support" on \ - CODEC_PATCH "Apply codec negotiation patch" off + CODEC_PATCH "Apply codec negotiation patch" off \ + MISC_PATCHES "Apply additional patches" off .include <bsd.port.pre.mk> @@ -159,13 +159,23 @@ LIB_DEPENDS+= sqlite:${PORTSDIR}/databases/sqlite2 .endif .if defined(WITH_CODEC_PATCH) -PATCHFILES= asterisk-1.4.18-codec-negotiation-20080313.diff.gz +PATCHFILES= asterisk-1.4.19-codec-negotiation-20080408.diff.gz PATCH_SITES= http://b2bua.org/chrome/site/ EXTRA_PATCHES+= ${PATCHDIR}/codecnego-patch-Makefile .else EXTRA_PATCHES+= ${PATCHDIR}/nocodecnego-patch-Makefile .endif +.if defined(WITH_MISC_PATCHES) +EXTRA_PATCHES+= ${PATCHDIR}/dtmf_debug.diff +EXTRA_PATCHES+= ${PATCHDIR}/feature_disconnect.diff +EXTRA_PATCHES+= ${PATCHDIR}/sip_force_callid.diff +.if defined(WITH_CODEC_PATCH) +EXTRA_PATCHES+= ${PATCHDIR}/rtp_force_dtmf-codecnego.diff +.else +EXTRA_PATCHES+= ${PATCHDIR}/rtp_force_dtmf-nocodecnego.diff +.endif +.endif post-patch: ${REINPLACE_CMD} -e 's|/var/lib|${PREFIX}/share|g' ${WRKSRC}/configs/musiconhold.conf.sample diff --git a/net/asterisk/distinfo b/net/asterisk/distinfo index c65a3a6dbea6..64a1135cfcd3 100644 --- a/net/asterisk/distinfo +++ b/net/asterisk/distinfo @@ -1,6 +1,6 @@ -MD5 (asterisk-1.4.18.1.tar.gz) = a0d7ee4054a04529b745e60dd4e750c4 -SHA256 (asterisk-1.4.18.1.tar.gz) = 5ed2e8b66fc8ac96e516b0ddfea065012e39ef51c8f35ed69c6d7cd74e180d78 -SIZE (asterisk-1.4.18.1.tar.gz) = 11488923 -MD5 (asterisk-1.4.18-codec-negotiation-20080313.diff.gz) = c2bc3b82217383936961a61b239e4635 -SHA256 (asterisk-1.4.18-codec-negotiation-20080313.diff.gz) = 6a6ec9436de24e8c35d5922f7116e65e08052bc6bef6ecc12790736bcf058af5 -SIZE (asterisk-1.4.18-codec-negotiation-20080313.diff.gz) = 38966 +MD5 (asterisk-1.4.19.2.tar.gz) = a942367e20a364510881c086a3517321 +SHA256 (asterisk-1.4.19.2.tar.gz) = b3248b84ec824c3c21861607fdc0c71e4acee16edc570004ee6c9e2f712705c4 +SIZE (asterisk-1.4.19.2.tar.gz) = 11496546 +MD5 (asterisk-1.4.19-codec-negotiation-20080408.diff.gz) = 12db6a4bc354d3eeeee7a900a6060b2f +SHA256 (asterisk-1.4.19-codec-negotiation-20080408.diff.gz) = 55290639455b1117541c5bf560ef8326c3e9414d266459293893b0e3d36c64f9 +SIZE (asterisk-1.4.19-codec-negotiation-20080408.diff.gz) = 39004 diff --git a/net/asterisk/files/codecnego-patch-Makefile b/net/asterisk/files/codecnego-patch-Makefile index f474578c3a35..c94aad32f623 100644 --- a/net/asterisk/files/codecnego-patch-Makefile +++ b/net/asterisk/files/codecnego-patch-Makefile @@ -1,6 +1,6 @@ ---- Makefile.orig Mon Dec 24 11:53:33 2007 -+++ Makefile Mon Dec 24 11:53:33 2007 -@@ -127,7 +127,7 @@ +--- Makefile.orig 2008-04-08 14:50:57.000000000 +0300 ++++ Makefile 2008-04-08 14:52:01.000000000 +0300 +@@ -129,7 +129,7 @@ ASTMANDIR=$(mandir) ifneq ($(findstring BSD,$(OSARCH)),) ASTVARLIBDIR=$(prefix)/share/asterisk @@ -9,7 +9,7 @@ else ASTVARLIBDIR=$(localstatedir)/lib/asterisk endif -@@ -222,7 +222,7 @@ +@@ -224,7 +224,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 -@@ -402,15 +402,15 @@ +@@ -404,15 +404,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: -@@ -431,45 +431,45 @@ +@@ -433,45 +433,45 @@ OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h))) bininstall: _all @@ -115,16 +115,16 @@ fi $(SUBDIRS_INSTALL): -@@ -496,7 +496,7 @@ - echo " WARNING WARNING WARNING" ;\ - fi +@@ -505,7 +505,7 @@ + @exit 1 + endif --install: datafiles bininstall $(SUBDIRS_INSTALL) -+install: datafiles bininstall $(SUBDIRS_INSTALL) samples +-install: badshell datafiles bininstall $(SUBDIRS_INSTALL) ++install: badshell datafiles bininstall $(SUBDIRS_INSTALL) samples @if [ -x /usr/sbin/asterisk-post-install ]; then \ /usr/sbin/asterisk-post-install $(DESTDIR) . ; \ fi -@@ -534,31 +534,23 @@ +@@ -543,31 +543,23 @@ upgrade: bininstall adsi: @@ -164,7 +164,7 @@ ( \ echo "[directories]" ; \ echo "astetcdir => $(ASTETCDIR)" ; \ -@@ -643,20 +635,23 @@ +@@ -653,20 +645,23 @@ echo "; Default: strict"; \ echo ";"; \ echo ";translation_algorithm = strict"; \ @@ -192,7 +192,7 @@ done @echo " +--------- Asterisk Web Voicemail ----------+" @echo " + +" -@@ -683,10 +678,10 @@ +@@ -693,10 +688,10 @@ __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec rm -rf /tmp/asterisk ; \ diff --git a/net/asterisk/files/dtmf_debug.diff b/net/asterisk/files/dtmf_debug.diff new file mode 100644 index 000000000000..81205d40dd46 --- /dev/null +++ b/net/asterisk/files/dtmf_debug.diff @@ -0,0 +1,225 @@ +--- channels/chan_sip.c.orig 2008-03-18 16:42:59.000000000 +0200 ++++ channels/chan_sip.c 2008-03-18 17:08:34.000000000 +0200 +@@ -3768,6 +3768,7 @@ + ast_log(LOG_WARNING, "old channel wasn't %p but was %p\n", oldchan, p->owner); + else { + p->owner = newchan; ++ ast_rtp_set_chan_name(p->rtp, newchan->name); + ret = 0; + } + if (option_debug > 2) +@@ -4032,6 +4035,7 @@ + if (i->rtp) { + tmp->fds[0] = ast_rtp_fd(i->rtp); + tmp->fds[1] = ast_rtcp_fd(i->rtp); ++ ast_rtp_set_chan_id(i->rtp, i->callid); + } + if (needvideo && i->vrtp) { + tmp->fds[2] = ast_rtp_fd(i->vrtp); +@@ -4059,6 +4063,8 @@ + if (!ast_strlen_zero(i->language)) + ast_string_field_set(tmp, language, i->language); + i->owner = tmp; ++ ast_rtp_set_chan_name(i->rtp, tmp->name); ++ + ast_module_ref(ast_module_info->self); + ast_copy_string(tmp->context, i->context, sizeof(tmp->context)); + /*Since it is valid to have extensions in the dialplan that have unescaped characters in them +@@ -4479,8 +4485,10 @@ + build_via(p); + if (!callid) + build_callid_pvt(p); +- else ++ else { + ast_string_field_set(p, callid, callid); ++ ast_rtp_set_chan_id(p->rtp, p->callid); ++ } + /* Assign default music on hold class */ + ast_string_field_set(p, mohinterpret, default_mohinterpret); + ast_string_field_set(p, mohsuggest, default_mohsuggest); +--- include/asterisk/rtp.h.orig 2008-03-18 13:35:42.000000000 +0200 ++++ include/asterisk/rtp.h 2008-03-18 13:35:58.000000000 +0200 +@@ -251,6 +251,9 @@ + + int ast_rtp_codec_getformat(int pt); + ++void ast_rtp_set_chan_name(struct ast_rtp *, const char *); ++void ast_rtp_set_chan_id(struct ast_rtp *, const char *); ++ + /*! \brief Set rtp timeout */ + void ast_rtp_set_rtptimeout(struct ast_rtp *rtp, int timeout); + /*! \brief Set rtp hold timeout */ +--- main/rtp.c.orig 2008-04-08 14:53:18.000000000 +0300 ++++ main/rtp.c 2008-04-08 14:54:14.000000000 +0300 +@@ -81,6 +81,7 @@ + static int rtpstart; /*!< First port for RTP sessions (set in rtp.conf) */ + static int rtpend; /*!< Last port for RTP sessions (set in rtp.conf) */ + static int rtpdebug; /*!< Are we debugging? */ ++static int rtpdebugdtmf; /*!< Are we debugging DTMFs? */ + static int rtcpdebug; /*!< Are we debugging RTCP? */ + static int rtcpstats; /*!< Are we debugging RTCP? */ + static int rtcpinterval = RTCP_DEFAULT_INTERVALMS; /*!< Time between rtcp reports in millisecs */ +@@ -168,6 +169,8 @@ + struct ast_codec_pref pref; + struct ast_rtp *bridged; /*!< Who we are Packet bridged to */ + int set_marker_bit:1; /*!< Whether to set the marker bit or not */ ++ char chan_name[100]; ++ char chan_id[100]; + }; + + /* Forward declarations */ +@@ -669,8 +672,8 @@ + struct ast_frame *f = NULL; + event = ntohl(*((unsigned int *)(data))); + event &= 0x001F; +- if (option_debug > 2 || rtpdebug) +- ast_log(LOG_DEBUG, "Cisco DTMF Digit: %08x (len = %d)\n", event, len); ++ if (option_debug > 2 || rtpdebug || rtpdebugdtmf) ++ ast_log(LOG_DEBUG, "Channel: %s %s Cisco DTMF packet: %08x (len = %d)\n", rtp->chan_name, rtp->chan_id, event, len); + if (event < 10) { + resp = '0' + event; + } else if (event < 11) { +@@ -684,12 +687,24 @@ + } + if (rtp->resp && (rtp->resp != resp)) { + f = send_dtmf(rtp, AST_FRAME_DTMF_END); ++ ast_log(LOG_DEBUG, "Channel: %s %s Cisco DTMF event: %c\n", rtp->chan_name, rtp->chan_id, rtp->resp); + } + rtp->resp = resp; + rtp->dtmfcount = dtmftimeout; + return f; + } + ++void ast_rtp_set_chan_id(struct ast_rtp *rtp, const char *chan_id) { ++ if (rtp == NULL || chan_id == NULL) ++ return; ++ snprintf(rtp->chan_id, sizeof(rtp->chan_id), "%s", chan_id); ++} ++ ++void ast_rtp_set_chan_name(struct ast_rtp *rtp, const char *chan_name) { ++ if (rtp == NULL || chan_name == NULL) ++ return; ++ snprintf(rtp->chan_name, sizeof(rtp->chan_name), "%s", chan_name); ++} + /*! + * \brief Process RTP DTMF and events according to RFC 2833. + * +@@ -1051,6 +1066,10 @@ + struct rtpPayloadType rtpPT; + int reconstruct = ntohl(rtpheader[0]); + ++ /* If we are listening for DTMF - then feed all packets into the core to keep the RTP stream consistent when relaying DTMFs */ ++ if (ast_test_flag(rtp, FLAG_P2P_NEED_DTMF)) ++ return -1; ++ + /* Get fields from packet */ + payload = (reconstruct & 0x7f0000) >> 16; + mark = (((reconstruct & 0x800000) >> 23) != 0); +@@ -1062,10 +1081,6 @@ + if (!bridged->current_RTP_PT[payload].code) + return -1; + +- /* If the payload is DTMF, and we are listening for DTMF - then feed it into the core */ +- if (ast_test_flag(rtp, FLAG_P2P_NEED_DTMF) && !rtpPT.isAstFormat && rtpPT.code == AST_RTP_DTMF) +- return -1; +- + /* Otherwise adjust bridged payload to match */ + bridged_payload = ast_rtp_lookup_code(bridged, rtpPT.isAstFormat, rtpPT.code); + +@@ -1254,11 +1269,12 @@ + /* This is special in-band data that's not one of our codecs */ + if (rtpPT.code == AST_RTP_DTMF) { + /* It's special -- rfc2833 process it */ +- if (rtp_debug_test_addr(&sin)) { ++ if (rtp_debug_test_addr(&sin) || rtpdebugdtmf) { + unsigned char *data; + unsigned int event; + unsigned int event_end; + unsigned int duration; ++ + data = rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen; + event = ntohl(*((unsigned int *)(data))); + event >>= 24; +@@ -1267,9 +1283,12 @@ + event_end >>= 24; + duration = ntohl(*((unsigned int *)(data))); + duration &= 0xFFFF; +- ast_verbose("Got RTP RFC2833 from %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d) \n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration); ++ ++ ast_verbose("Channel: %s %s Got RTP RFC2833 from %s:%u to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d)\n", rtp->chan_name, rtp->chan_id, ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), ast_inet_ntoa(rtp->us.sin_addr), ntohs(rtp->us.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration); + } + f = process_rfc2833(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen, seqno, timestamp); ++ if (rtpdebugdtmf && f) ++ ast_verbose("Channel: %s %s Got RFC2833 DTMF event %c of type %s\n", rtp->chan_name, rtp->chan_id, f->subclass, (f->frametype == AST_FRAME_DTMF_BEGIN ? "DTMF BEGIN" : (f->frametype == AST_FRAME_DTMF_END ? "DTMF_END" : "UNKNOWN"))); + } else if (rtpPT.code == AST_RTP_CISCO_DTMF) { + /* It's really special -- process it the Cisco way */ + if (rtp->lastevent <= seqno || (rtp->lastevent >= 65530 && seqno <= 6)) { +@@ -2198,8 +2217,9 @@ + ast_log(LOG_ERROR, "RTP Transmission error to %s:%u: %s\n", + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), strerror(errno)); +- if (rtp_debug_test_addr(&rtp->them)) +- ast_verbose("Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ if (rtp_debug_test_addr(&rtp->them) || rtpdebugdtmf) ++ ast_verbose("Channel: %s %s Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ rtp->chan_name, rtp->chan_id, + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), payload, rtp->seqno, rtp->lastdigitts, res - hdrlen); + /* Increment sequence number */ +@@ -2242,8 +2262,9 @@ + ast_log(LOG_ERROR, "RTP Transmission error to %s:%d: %s\n", + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), strerror(errno)); +- if (rtp_debug_test_addr(&rtp->them)) +- ast_verbose("Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ if (rtp_debug_test_addr(&rtp->them) || rtpdebugdtmf) ++ ast_verbose("Channel: %s %s Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ rtp->chan_name, rtp->chan_id, + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), rtp->send_payload, rtp->seqno, rtp->lastdigitts, res - hdrlen); + +@@ -3481,6 +3502,16 @@ + return RESULT_SUCCESS; + } + ++static int rtp_do_debug_dtmf(int fd, int argc, char *argv[]) ++{ ++ if (argc != 3) ++ return RESULT_SHOWUSAGE; ++ ++ rtpdebugdtmf = 1; ++ ast_cli(fd, "RTP DTMF debugging enabled\n"); ++ return RESULT_SUCCESS; ++} ++ + static int rtp_do_debug(int fd, int argc, char *argv[]) + { + if (argc != 2) { +@@ -3541,6 +3572,7 @@ + if (argc != 3) + return RESULT_SHOWUSAGE; + rtpdebug = 0; ++ rtpdebugdtmf = 0; + ast_cli(fd,"RTP Debugging Disabled\n"); + return RESULT_SUCCESS; + } +@@ -3601,7 +3633,7 @@ + } + + static char debug_usage[] = +- "Usage: rtp debug [ip host[:port]]\n" ++ "Usage: rtp debug [ip host[:port] | dtmf]\n" + " Enable dumping of all RTP packets to and from host.\n"; + + static char no_debug_usage[] = +@@ -3676,6 +3708,10 @@ + rtp_do_debug, "Enable RTP debugging", + debug_usage }, + ++ { { "rtp", "debug", "dtmf", NULL }, ++ rtp_do_debug_dtmf, "Enable RTP debugging on DTMFs", ++ debug_usage }, ++ + { { "rtp", "debug", "off", NULL }, + rtp_no_debug, "Disable RTP debugging", + no_debug_usage, NULL, &cli_rtp_no_debug_deprecated }, diff --git a/net/asterisk/files/feature_disconnect.diff b/net/asterisk/files/feature_disconnect.diff new file mode 100644 index 000000000000..5be713b0da13 --- /dev/null +++ b/net/asterisk/files/feature_disconnect.diff @@ -0,0 +1,292 @@ +--- 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) + { +--- 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 */ +--- res/res_features.c.orig 2008-04-08 14:55:25.000000000 +0300 ++++ res/res_features.c 2008-04-08 14:59:59.000000000 +0300 +@@ -485,18 +485,6 @@ + } + + +-#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 + */ +@@ -1061,32 +1049,35 @@ + 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, code=%s, sense=%d, features=%d dynamic=%s\n", chan->name, peer->name, code, 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) +@@ -1094,7 +1085,6 @@ + } + } + } +- ast_rwlock_unlock(&features_lock); + + if (ast_strlen_zero(dynamic_features)) + return res; +@@ -1102,9 +1092,7 @@ + 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; + } + +@@ -1112,21 +1100,52 @@ + 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; ++} ++ + static void set_config_flags(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config) + { + int x; diff --git a/net/asterisk/files/nocodecnego-patch-Makefile b/net/asterisk/files/nocodecnego-patch-Makefile index f73c3d83bcde..1d9675f1d664 100644 --- a/net/asterisk/files/nocodecnego-patch-Makefile +++ b/net/asterisk/files/nocodecnego-patch-Makefile @@ -1,6 +1,6 @@ ---- Makefile.orig Mon Dec 17 08:44:51 2007 -+++ Makefile Mon Dec 24 11:54:52 2007 -@@ -127,7 +127,7 @@ +--- Makefile.orig 2008-03-25 16:37:35.000000000 +0200 ++++ Makefile 2008-04-08 15:02:12.000000000 +0300 +@@ -129,7 +129,7 @@ ASTMANDIR=$(mandir) ifneq ($(findstring BSD,$(OSARCH)),) ASTVARLIBDIR=$(prefix)/share/asterisk @@ -9,7 +9,7 @@ else ASTVARLIBDIR=$(localstatedir)/lib/asterisk endif -@@ -222,7 +222,7 @@ +@@ -224,7 +224,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 -@@ -402,15 +402,15 @@ +@@ -404,15 +404,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: -@@ -431,45 +431,45 @@ +@@ -433,45 +433,45 @@ OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h))) bininstall: _all @@ -115,16 +115,16 @@ fi $(SUBDIRS_INSTALL): -@@ -496,7 +496,7 @@ - echo " WARNING WARNING WARNING" ;\ - fi +@@ -505,7 +505,7 @@ + @exit 1 + endif --install: datafiles bininstall $(SUBDIRS_INSTALL) -+install: datafiles bininstall $(SUBDIRS_INSTALL) samples +-install: badshell datafiles bininstall $(SUBDIRS_INSTALL) ++install: badshell datafiles bininstall $(SUBDIRS_INSTALL) samples @if [ -x /usr/sbin/asterisk-post-install ]; then \ /usr/sbin/asterisk-post-install $(DESTDIR) . ; \ fi -@@ -534,31 +534,23 @@ +@@ -543,31 +543,23 @@ upgrade: bininstall adsi: @@ -164,7 +164,7 @@ ( \ echo "[directories]" ; \ echo "astetcdir => $(ASTETCDIR)" ; \ -@@ -602,20 +594,23 @@ +@@ -612,20 +604,23 @@ echo ";astctlowner = root" ; \ echo ";astctlgroup = apache" ; \ echo ";astctl = asterisk.ctl" ; \ @@ -192,7 +192,7 @@ done @echo " +--------- Asterisk Web Voicemail ----------+" @echo " + +" -@@ -642,10 +637,10 @@ +@@ -652,10 +647,10 @@ __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec rm -rf /tmp/asterisk ; \ diff --git a/net/asterisk/files/patch-apps::app_dial.c b/net/asterisk/files/patch-apps::app_dial.c deleted file mode 100644 index 6abe48a17d9f..000000000000 --- a/net/asterisk/files/patch-apps::app_dial.c +++ /dev/null @@ -1,88 +0,0 @@ ---- 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 916cc7ffa0ac..e54df0eb1bf1 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 Mon Dec 24 11:59:46 2007 -+++ channels/chan_sip.c Mon Dec 24 11:58:47 2007 -@@ -493,7 +493,7 @@ +--- channels/chan_sip.c.orig 2008-03-18 16:42:59.000000000 +0200 ++++ channels/chan_sip.c 2008-03-18 17:08:34.000000000 +0200 +@@ -495,7 +495,7 @@ #define DEFAULT_MOHINTERPRET "default" #define DEFAULT_MOHSUGGEST "" #define DEFAULT_VMEXTEN "asterisk" @@ -9,16 +9,7 @@ #define DEFAULT_NOTIFYMIME "application/simple-message-summary" #define DEFAULT_MWITIME 10 #define DEFAULT_ALLOWGUEST TRUE -@@ -3985,6 +3985,8 @@ - ast_codec_pref_remove2(&tmp->nativeformats, ~i->usercapability); - fmt = ast_codec_pref_index_audio(&tmp->nativeformats, 0); - -+ pbx_builtin_setvar_helper(tmp, "SIP_CODEC_USED", ast_getformatname(fmt)); -+ - /* 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. -@@ -15845,6 +15847,9 @@ +@@ -15873,6 +15881,9 @@ char *ext, *host; char tmp[256]; char *dest = data; @@ -26,9 +17,9 @@ + 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 @@ + oldformat = format; + if (!(format &= ((AST_FORMAT_MAX_AUDIO << 1) - 1))) { +@@ -15903,6 +15914,17 @@ if (host) { *host++ = '\0'; ext = tmp; @@ -46,7 +37,7 @@ } else { ext = strchr(tmp, '/'); if (ext) -@@ -15898,6 +15914,14 @@ +@@ -15933,6 +15955,14 @@ ast_string_field_set(p, username, ext); ast_string_field_free(p, fullcontact); } diff --git a/net/asterisk/files/patch-channels::h323::ast_h323.cxx b/net/asterisk/files/patch-channels::h323::ast_h323.cxx new file mode 100644 index 000000000000..bfc819452128 --- /dev/null +++ b/net/asterisk/files/patch-channels::h323::ast_h323.cxx @@ -0,0 +1,29 @@ +--- channels/h323/ast_h323.cxx.orig 2008-04-08 15:08:37.000000000 +0300 ++++ channels/h323/ast_h323.cxx 2008-04-08 15:08:51.000000000 +0300 +@@ -81,8 +81,6 @@ + /** PWLib entry point */ + static MyProcess *localProcess = NULL; + +-static int _timerChangePipe[2]; +- + static unsigned traceOptions = PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine; + + class PAsteriskLog : public PObject, public iostream { +@@ -191,8 +189,6 @@ + + MyProcess::~MyProcess() + { +- _timerChangePipe[0] = timerChangePipe[0]; +- _timerChangePipe[1] = timerChangePipe[1]; + } + + void MyProcess::Main() +@@ -2460,8 +2456,6 @@ + if (localProcess) { + delete localProcess; + localProcess = NULL; +- close(_timerChangePipe[0]); +- close(_timerChangePipe[1]); + } + if (logstream) { + PTrace::SetLevel(0); diff --git a/net/asterisk/files/patch-include::asterisk::features.h b/net/asterisk/files/patch-include::asterisk::features.h deleted file mode 100644 index fa5c747eb316..000000000000 --- a/net/asterisk/files/patch-include::asterisk::features.h +++ /dev/null @@ -1,57 +0,0 @@ ---- 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-main::Makefile b/net/asterisk/files/patch-main::Makefile index 3d1365ea46fa..56624065f61f 100644 --- a/net/asterisk/files/patch-main::Makefile +++ b/net/asterisk/files/patch-main::Makefile @@ -1,8 +1,5 @@ - -$FreeBSD$ - ---- main/Makefile.orig -+++ main/Makefile +--- main/Makefile.orig 2008-01-29 19:43:41.000000000 +0200 ++++ main/Makefile 2008-03-13 13:57:48.000000000 +0200 @@ -102,8 +102,8 @@ cd editline && test -f config.h || CFLAGS="$(PTHREAD_CFLAGS) $(subst $(ASTTOPDIR),../../,$(ASTCFLAGS:-Werror=))" LDFLAGS="$(ASTLDFLAGS)" ./configure --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) --with-ncurses=$(NCURSES_DIR) --with-curses=$(CURSES_DIR) --with-termcap=$(TERMCAP_DIR) --with-tinfo=$(TINFO_DIR) $(MAKE) -C editline libedit.a diff --git a/net/asterisk/files/patch-main::manager.c b/net/asterisk/files/patch-main::manager.c new file mode 100644 index 000000000000..686068b09e09 --- /dev/null +++ b/net/asterisk/files/patch-main::manager.c @@ -0,0 +1,31 @@ +--- main/manager.c.orig 2008-04-02 15:49:38.000000000 +0300 ++++ main/manager.c 2008-04-02 15:42:18.000000000 +0300 +@@ -176,6 +176,7 @@ + struct eventqent *eventq; + /* Timeout for ast_carefulwrite() */ + int writetimeout; ++ int pending_event; + AST_LIST_ENTRY(mansession) list; + }; + +@@ -2214,6 +2215,11 @@ + fds[0].events = POLLIN; + do { + ast_mutex_lock(&s->__lock); ++ if (s->pending_event) { ++ s->pending_event = 0; ++ ast_mutex_unlock(&s->__lock); ++ return 0; ++ } + s->waiting_thread = pthread_self(); + ast_mutex_unlock(&s->__lock); + +@@ -2475,6 +2481,8 @@ + ast_mutex_lock(&s->__lock); + if (s->waiting_thread != AST_PTHREADT_NULL) + pthread_kill(s->waiting_thread, SIGURG); ++ else ++ s->pending_event = 1; + ast_mutex_unlock(&s->__lock); + } + AST_LIST_UNLOCK(&sessions); diff --git a/net/asterisk/files/patch-res::res_features.c b/net/asterisk/files/patch-res::res_features.c deleted file mode 100644 index c21775f1690d..000000000000 --- a/net/asterisk/files/patch-res::res_features.c +++ /dev/null @@ -1,144 +0,0 @@ ---- 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; - } - diff --git a/net/asterisk/files/rtp_force_dtmf-codecnego.diff b/net/asterisk/files/rtp_force_dtmf-codecnego.diff new file mode 100644 index 000000000000..7cd43e08d238 --- /dev/null +++ b/net/asterisk/files/rtp_force_dtmf-codecnego.diff @@ -0,0 +1,86 @@ +--- channels/chan_sip.c.orig 2008-03-12 17:37:00.000000000 +0200 ++++ channels/chan_sip.c 2008-03-12 18:17:33.000000000 +0200 +@@ -554,6 +554,9 @@ + static unsigned int global_tos_sip; /*!< IP type of service for SIP packets */ + static unsigned int global_tos_audio; /*!< IP type of service for audio RTP packets */ + static unsigned int global_tos_video; /*!< IP type of service for video RTP packets */ ++static int global_force_dtmf_relay = 0; ++static int global_force_dtmf_relay_pt = 101; ++ + static int compactheaders; /*!< send compact sip headers */ + static int recordhistory; /*!< Record SIP history. Off by default */ + static int dumphistory; /*!< Dump history to verbose before destroying SIP dialog */ +@@ -4983,6 +4986,8 @@ + int codec_index = 0; + int codec_pt_order[256]; + ++ int dtmf_present = 0; ++ + if (!p->rtp) { + ast_log(LOG_ERROR, "Got SDP but have no RTP session allocated.\n"); + return -1; +@@ -5408,12 +5413,20 @@ + for (x = 0; x < codec_index; ++x) { + struct rtpPayloadType pt; + pt = ast_rtp_lookup_pt(p->rtp, codec_pt_order[x]); ++ if (pt.code == AST_RTP_DTMF) ++ dtmf_present = 1; + if (!pt.isAstFormat && !pt.code && p->vrtp) + pt = ast_rtp_lookup_pt(p->vrtp, codec_pt_order[x]); + if (pt.isAstFormat) + ast_codec_pref_append(&p->formats, pt.code); + } + ast_codec_pref_remove2(&p->formats, ~p->usercapability); ++ if (!dtmf_present && global_force_dtmf_relay) { ++ newnoncodeccapability |= AST_RTP_DTMF; ++ ast_rtp_set_m_type(newaudiortp, global_force_dtmf_relay_pt); ++ codec_pt_order[codec_index++] = global_force_dtmf_relay_pt; ++ ast_rtp_set_rtpmap_type(newaudiortp, global_force_dtmf_relay_pt, "audio", "telephone-event", 0); ++ } + + /* Now gather all of the codecs that we are asked for: */ + ast_rtp_get_current_formats(newaudiortp, &peercapability, &peernoncodeccapability); +@@ -16845,6 +16858,9 @@ + + global_matchexterniplocally = FALSE; + ++ global_force_dtmf_relay = 0; ++ global_force_dtmf_relay_pt = 101; ++ + /* Copy the default jb config over global_jbconf */ + memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf)); + +@@ -16901,6 +16917,18 @@ + } + } else if (!strcasecmp(v->name, "vmexten")) { + ast_copy_string(default_vmexten, v->value, sizeof(default_vmexten)); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay")) { ++ if ((global_force_dtmf_relay = ast_true(v->value))) ++ ast_verbose("RTP DTMF relaying will be enforced\n"); ++ else ++ ast_verbose("RTP DTMF relaying will not be enforced\n"); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay_pt")) { ++ sscanf(v->value, "%d", &global_force_dtmf_relay_pt); ++ if (global_force_dtmf_relay_pt < 96 || global_force_dtmf_relay_pt > 255) { ++ ast_verbose("RTP forced DTMF relay payload type is not valid: %d. Using default (101)\n", global_force_dtmf_relay_pt); ++ global_force_dtmf_relay_pt = 101; ++ } else ++ ast_log(LOG_WARNING, "RTP forced DTMF relay payload type is %d\n", global_force_dtmf_relay_pt); + } else if (!strcasecmp(v->name, "rtptimeout")) { + if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) { + ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno); +--- configs/sip.conf.sample.orig 2008-03-12 17:57:19.000000000 +0200 ++++ configs/sip.conf.sample 2008-03-12 18:13:03.000000000 +0200 +@@ -53,6 +53,12 @@ + ; and multiline formatted headers for strict + ; SIP compatibility (defaults to "no") + ++;rtp_force_dtmf_relay=no ; Enable RFC2833 DTMFs to be sent even if peer ++ ; hasn't announced support for it. Default: no ++ ++;rtp_force_dtmf_relay_pt=101 ; RTP payload type value for enforced RFC2833 ++ ; DTMFs. Default: 101 ++ + ; See doc/README.tos for a description of these parameters. + ;tos_sip=cs3 ; Sets TOS for SIP packets. + ;tos_audio=ef ; Sets TOS for RTP audio packets. diff --git a/net/asterisk/files/rtp_force_dtmf-nocodecnego.diff b/net/asterisk/files/rtp_force_dtmf-nocodecnego.diff new file mode 100644 index 000000000000..776422b34645 --- /dev/null +++ b/net/asterisk/files/rtp_force_dtmf-nocodecnego.diff @@ -0,0 +1,70 @@ +--- channels/chan_sip.c.orig 2008-01-31 21:52:49.000000000 +0200 ++++ channels/chan_sip.c 2008-03-14 17:50:57.000000000 +0200 +@@ -556,6 +556,9 @@ + static unsigned int global_tos_sip; /*!< IP type of service for SIP packets */ + static unsigned int global_tos_audio; /*!< IP type of service for audio RTP packets */ + static unsigned int global_tos_video; /*!< IP type of service for video RTP packets */ ++static int global_force_dtmf_relay = 0; ++static int global_force_dtmf_relay_pt = 101; ++ + static int compactheaders; /*!< send compact sip headers */ + static int recordhistory; /*!< Record SIP history. Off by default */ + static int dumphistory; /*!< Dump history to verbose before destroying SIP dialog */ +@@ -5392,6 +5395,13 @@ + + /* Now gather all of the codecs that we are asked for: */ + ast_rtp_get_current_formats(newaudiortp, &peercapability, &peernoncodeccapability); ++ /* Add telephone-event */ ++ if (global_force_dtmf_relay && !(peernoncodeccapability & AST_RTP_DTMF)) { ++ ast_rtp_set_m_type(newaudiortp, global_force_dtmf_relay_pt); ++ found_rtpmap_codecs[last_rtpmap_codec++] = global_force_dtmf_relay_pt; ++ ast_rtp_set_rtpmap_type(newaudiortp, global_force_dtmf_relay_pt, "audio", "telephone-event", 0); ++ peernoncodeccapability |= AST_RTP_DTMF; ++ } + ast_rtp_get_current_formats(newvideortp, &vpeercapability, &vpeernoncodeccapability); + + newjointcapability = p->capability & (peercapability | vpeercapability); +@@ -16833,6 +16843,9 @@ + + global_matchexterniplocally = FALSE; + ++ global_force_dtmf_relay = 0; ++ global_force_dtmf_relay_pt = 101; ++ + /* Copy the default jb config over global_jbconf */ + memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf)); + +@@ -16889,6 +16902,18 @@ + } + } else if (!strcasecmp(v->name, "vmexten")) { + ast_copy_string(default_vmexten, v->value, sizeof(default_vmexten)); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay")) { ++ if ((global_force_dtmf_relay = ast_true(v->value))) ++ ast_verbose("RTP DTMF relaying will be enforced\n"); ++ else ++ ast_verbose("RTP DTMF relaying will not be enforced\n"); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay_pt")) { ++ sscanf(v->value, "%d", &global_force_dtmf_relay_pt); ++ if (global_force_dtmf_relay_pt < 96 || global_force_dtmf_relay_pt > 255) { ++ ast_verbose("RTP forced DTMF relay payload type is not valid: %d. Using default (101)\n", global_force_dtmf_relay_pt); ++ global_force_dtmf_relay_pt = 101; ++ } else ++ ast_log(LOG_WARNING, "RTP forced DTMF relay payload type is %d\n", global_force_dtmf_relay_pt); + } else if (!strcasecmp(v->name, "rtptimeout")) { + if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) { + ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno); +--- configs/sip.conf.sample.orig 2008-03-12 17:57:19.000000000 +0200 ++++ configs/sip.conf.sample 2008-03-12 18:13:03.000000000 +0200 +@@ -53,6 +53,12 @@ + ; and multiline formatted headers for strict + ; SIP compatibility (defaults to "no") + ++;rtp_force_dtmf_relay=no ; Enable RFC2833 DTMFs to be sent even if peer ++ ; hasn't announced support for it. Default: no ++ ++;rtp_force_dtmf_relay_pt=101 ; RTP payload type value for enforced RFC2833 ++ ; DTMFs. Default: 101 ++ + ; See doc/README.tos for a description of these parameters. + ;tos_sip=cs3 ; Sets TOS for SIP packets. + ;tos_audio=ef ; Sets TOS for RTP audio packets. diff --git a/net/asterisk/files/sip_force_callid.diff b/net/asterisk/files/sip_force_callid.diff new file mode 100644 index 000000000000..67a3e0192633 --- /dev/null +++ b/net/asterisk/files/sip_force_callid.diff @@ -0,0 +1,12 @@ +--- channels/chan_sip.c.orig 2008-04-09 11:39:09.000000000 +0300 ++++ channels/chan_sip.c 2008-04-09 11:40:28.000000000 +0300 +@@ -2998,6 +2998,9 @@ + p->t38.state = T38_LOCAL_DIRECT; + if (option_debug) + ast_log(LOG_DEBUG,"T38State change to %d on channel %s\n", p->t38.state, ast->name); ++ } else if (!strcasecmp(ast_var_name(current), "SIP_FORCE_CALLID")) { ++ ++ ast_string_field_set(p, callid, ast_var_value(current)); + } + + } diff --git a/net/asterisk/pkg-plist b/net/asterisk/pkg-plist index 7bcd9f5265f4..85ea7e48e505 100644 --- a/net/asterisk/pkg-plist +++ b/net/asterisk/pkg-plist @@ -295,7 +295,6 @@ lib/asterisk/modules/codec_adpcm.so lib/asterisk/modules/codec_alaw.so lib/asterisk/modules/codec_g726.so lib/asterisk/modules/codec_gsm.so -lib/asterisk/modules/codec_ilbc.so lib/asterisk/modules/codec_lpc10.so lib/asterisk/modules/codec_speex.so lib/asterisk/modules/codec_ulaw.so @@ -380,8 +379,9 @@ share/asterisk/moh/LICENSE-asterisk-moh-freeplay-wav share/asterisk/moh/fpm-calm-river.wav share/asterisk/moh/fpm-sunshine.wav share/asterisk/moh/fpm-world-mix.wav -share/asterisk/sounds/.asterisk-core-sounds-en-gsm-1.4.8 -share/asterisk/sounds/CREDITS-asterisk-core-en-1.4.8 +share/asterisk/sounds/.asterisk-core-sounds-en-gsm-1.4.9 +share/asterisk/sounds/CHANGES-asterisk-core-en-1.4.9 +share/asterisk/sounds/CREDITS-asterisk-core-en-1.4.9 share/asterisk/sounds/agent-alreadyon.gsm share/asterisk/sounds/agent-incorrect.gsm share/asterisk/sounds/agent-loggedoff.gsm @@ -526,15 +526,19 @@ share/asterisk/sounds/digits/thousand.gsm share/asterisk/sounds/digits/today.gsm share/asterisk/sounds/digits/tomorrow.gsm share/asterisk/sounds/digits/yesterday.gsm +share/asterisk/sounds/dir-first.gsm +share/asterisk/sounds/dir-firstlast.gsm share/asterisk/sounds/dir-instr.gsm share/asterisk/sounds/dir-intro-fn.gsm share/asterisk/sounds/dir-intro.gsm +share/asterisk/sounds/dir-last.gsm share/asterisk/sounds/dir-multi1.gsm share/asterisk/sounds/dir-multi2.gsm share/asterisk/sounds/dir-multi3.gsm share/asterisk/sounds/dir-multi9.gsm share/asterisk/sounds/dir-nomatch.gsm share/asterisk/sounds/dir-nomore.gsm +share/asterisk/sounds/dir-pls-enter.gsm share/asterisk/sounds/followme/call-from.gsm share/asterisk/sounds/followme/no-recording.gsm share/asterisk/sounds/followme/options.gsm @@ -669,12 +673,20 @@ share/asterisk/sounds/silence/7.gsm share/asterisk/sounds/silence/8.gsm share/asterisk/sounds/silence/9.gsm share/asterisk/sounds/spy-agent.gsm +share/asterisk/sounds/spy-console.gsm share/asterisk/sounds/spy-h323.gsm share/asterisk/sounds/spy-iax.gsm share/asterisk/sounds/spy-iax2.gsm +share/asterisk/sounds/spy-jingle.gsm +share/asterisk/sounds/spy-local.gsm share/asterisk/sounds/spy-mgcp.gsm +share/asterisk/sounds/spy-misdn.gsm +share/asterisk/sounds/spy-mobile.gsm +share/asterisk/sounds/spy-nbs.gsm share/asterisk/sounds/spy-sip.gsm share/asterisk/sounds/spy-skinny.gsm +share/asterisk/sounds/spy-unistim.gsm +share/asterisk/sounds/spy-usbradio.gsm share/asterisk/sounds/spy-zap.gsm share/asterisk/sounds/ss-noservice.gsm share/asterisk/sounds/transfer.gsm @@ -716,6 +728,7 @@ share/asterisk/sounds/vm-incorrect-mailbox.gsm share/asterisk/sounds/vm-incorrect.gsm share/asterisk/sounds/vm-instructions.gsm share/asterisk/sounds/vm-intro.gsm +share/asterisk/sounds/vm-invalidpassword.gsm share/asterisk/sounds/vm-isonphone.gsm share/asterisk/sounds/vm-isunavail.gsm share/asterisk/sounds/vm-last.gsm @@ -738,8 +751,10 @@ share/asterisk/sounds/vm-nomore.gsm share/asterisk/sounds/vm-nonumber.gsm share/asterisk/sounds/vm-num-i-have.gsm share/asterisk/sounds/vm-onefor.gsm +share/asterisk/sounds/vm-onefor-full.gsm share/asterisk/sounds/vm-options.gsm share/asterisk/sounds/vm-opts.gsm +share/asterisk/sounds/vm-opts-full.gsm share/asterisk/sounds/vm-passchanged.gsm share/asterisk/sounds/vm-password.gsm share/asterisk/sounds/vm-press.gsm @@ -767,6 +782,7 @@ share/asterisk/sounds/vm-tempgreeting2.gsm share/asterisk/sounds/vm-tempremoved.gsm share/asterisk/sounds/vm-then-pound.gsm share/asterisk/sounds/vm-theperson.gsm +share/asterisk/sounds/vm-tmpexists.gsm share/asterisk/sounds/vm-tocallback.gsm share/asterisk/sounds/vm-tocallnum.gsm share/asterisk/sounds/vm-tocancel.gsm diff --git a/net/asterisk10/Makefile b/net/asterisk10/Makefile index f972ca541c79..c1c8e5eaa5c1 100644 --- a/net/asterisk10/Makefile +++ b/net/asterisk10/Makefile @@ -6,8 +6,7 @@ # PORTNAME= asterisk -PORTVERSION= 1.4.18.1 -PORTREVISION= 1 +PORTVERSION= 1.4.19.2 CATEGORIES= net MASTER_SITES= http://ftp.digium.com/pub/asterisk/ \ http://ftp.digium.com/pub/asterisk/old-releases/ @@ -50,7 +49,8 @@ OPTIONS= OGGVORBIS "Enable Ogg Vorbis support" on \ FREETDS "Enable FreeTDS support" on \ JABBER "Enable Jabber and Gtalk support" on \ SQLITE "Enable SQLITE support" on \ - CODEC_PATCH "Apply codec negotiation patch" off + CODEC_PATCH "Apply codec negotiation patch" off \ + MISC_PATCHES "Apply additional patches" off .include <bsd.port.pre.mk> @@ -159,13 +159,23 @@ LIB_DEPENDS+= sqlite:${PORTSDIR}/databases/sqlite2 .endif .if defined(WITH_CODEC_PATCH) -PATCHFILES= asterisk-1.4.18-codec-negotiation-20080313.diff.gz +PATCHFILES= asterisk-1.4.19-codec-negotiation-20080408.diff.gz PATCH_SITES= http://b2bua.org/chrome/site/ EXTRA_PATCHES+= ${PATCHDIR}/codecnego-patch-Makefile .else EXTRA_PATCHES+= ${PATCHDIR}/nocodecnego-patch-Makefile .endif +.if defined(WITH_MISC_PATCHES) +EXTRA_PATCHES+= ${PATCHDIR}/dtmf_debug.diff +EXTRA_PATCHES+= ${PATCHDIR}/feature_disconnect.diff +EXTRA_PATCHES+= ${PATCHDIR}/sip_force_callid.diff +.if defined(WITH_CODEC_PATCH) +EXTRA_PATCHES+= ${PATCHDIR}/rtp_force_dtmf-codecnego.diff +.else +EXTRA_PATCHES+= ${PATCHDIR}/rtp_force_dtmf-nocodecnego.diff +.endif +.endif post-patch: ${REINPLACE_CMD} -e 's|/var/lib|${PREFIX}/share|g' ${WRKSRC}/configs/musiconhold.conf.sample diff --git a/net/asterisk10/distinfo b/net/asterisk10/distinfo index c65a3a6dbea6..64a1135cfcd3 100644 --- a/net/asterisk10/distinfo +++ b/net/asterisk10/distinfo @@ -1,6 +1,6 @@ -MD5 (asterisk-1.4.18.1.tar.gz) = a0d7ee4054a04529b745e60dd4e750c4 -SHA256 (asterisk-1.4.18.1.tar.gz) = 5ed2e8b66fc8ac96e516b0ddfea065012e39ef51c8f35ed69c6d7cd74e180d78 -SIZE (asterisk-1.4.18.1.tar.gz) = 11488923 -MD5 (asterisk-1.4.18-codec-negotiation-20080313.diff.gz) = c2bc3b82217383936961a61b239e4635 -SHA256 (asterisk-1.4.18-codec-negotiation-20080313.diff.gz) = 6a6ec9436de24e8c35d5922f7116e65e08052bc6bef6ecc12790736bcf058af5 -SIZE (asterisk-1.4.18-codec-negotiation-20080313.diff.gz) = 38966 +MD5 (asterisk-1.4.19.2.tar.gz) = a942367e20a364510881c086a3517321 +SHA256 (asterisk-1.4.19.2.tar.gz) = b3248b84ec824c3c21861607fdc0c71e4acee16edc570004ee6c9e2f712705c4 +SIZE (asterisk-1.4.19.2.tar.gz) = 11496546 +MD5 (asterisk-1.4.19-codec-negotiation-20080408.diff.gz) = 12db6a4bc354d3eeeee7a900a6060b2f +SHA256 (asterisk-1.4.19-codec-negotiation-20080408.diff.gz) = 55290639455b1117541c5bf560ef8326c3e9414d266459293893b0e3d36c64f9 +SIZE (asterisk-1.4.19-codec-negotiation-20080408.diff.gz) = 39004 diff --git a/net/asterisk10/files/codecnego-patch-Makefile b/net/asterisk10/files/codecnego-patch-Makefile index f474578c3a35..c94aad32f623 100644 --- a/net/asterisk10/files/codecnego-patch-Makefile +++ b/net/asterisk10/files/codecnego-patch-Makefile @@ -1,6 +1,6 @@ ---- Makefile.orig Mon Dec 24 11:53:33 2007 -+++ Makefile Mon Dec 24 11:53:33 2007 -@@ -127,7 +127,7 @@ +--- Makefile.orig 2008-04-08 14:50:57.000000000 +0300 ++++ Makefile 2008-04-08 14:52:01.000000000 +0300 +@@ -129,7 +129,7 @@ ASTMANDIR=$(mandir) ifneq ($(findstring BSD,$(OSARCH)),) ASTVARLIBDIR=$(prefix)/share/asterisk @@ -9,7 +9,7 @@ else ASTVARLIBDIR=$(localstatedir)/lib/asterisk endif -@@ -222,7 +222,7 @@ +@@ -224,7 +224,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 -@@ -402,15 +402,15 @@ +@@ -404,15 +404,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: -@@ -431,45 +431,45 @@ +@@ -433,45 +433,45 @@ OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h))) bininstall: _all @@ -115,16 +115,16 @@ fi $(SUBDIRS_INSTALL): -@@ -496,7 +496,7 @@ - echo " WARNING WARNING WARNING" ;\ - fi +@@ -505,7 +505,7 @@ + @exit 1 + endif --install: datafiles bininstall $(SUBDIRS_INSTALL) -+install: datafiles bininstall $(SUBDIRS_INSTALL) samples +-install: badshell datafiles bininstall $(SUBDIRS_INSTALL) ++install: badshell datafiles bininstall $(SUBDIRS_INSTALL) samples @if [ -x /usr/sbin/asterisk-post-install ]; then \ /usr/sbin/asterisk-post-install $(DESTDIR) . ; \ fi -@@ -534,31 +534,23 @@ +@@ -543,31 +543,23 @@ upgrade: bininstall adsi: @@ -164,7 +164,7 @@ ( \ echo "[directories]" ; \ echo "astetcdir => $(ASTETCDIR)" ; \ -@@ -643,20 +635,23 @@ +@@ -653,20 +645,23 @@ echo "; Default: strict"; \ echo ";"; \ echo ";translation_algorithm = strict"; \ @@ -192,7 +192,7 @@ done @echo " +--------- Asterisk Web Voicemail ----------+" @echo " + +" -@@ -683,10 +678,10 @@ +@@ -693,10 +688,10 @@ __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec rm -rf /tmp/asterisk ; \ diff --git a/net/asterisk10/files/dtmf_debug.diff b/net/asterisk10/files/dtmf_debug.diff new file mode 100644 index 000000000000..81205d40dd46 --- /dev/null +++ b/net/asterisk10/files/dtmf_debug.diff @@ -0,0 +1,225 @@ +--- channels/chan_sip.c.orig 2008-03-18 16:42:59.000000000 +0200 ++++ channels/chan_sip.c 2008-03-18 17:08:34.000000000 +0200 +@@ -3768,6 +3768,7 @@ + ast_log(LOG_WARNING, "old channel wasn't %p but was %p\n", oldchan, p->owner); + else { + p->owner = newchan; ++ ast_rtp_set_chan_name(p->rtp, newchan->name); + ret = 0; + } + if (option_debug > 2) +@@ -4032,6 +4035,7 @@ + if (i->rtp) { + tmp->fds[0] = ast_rtp_fd(i->rtp); + tmp->fds[1] = ast_rtcp_fd(i->rtp); ++ ast_rtp_set_chan_id(i->rtp, i->callid); + } + if (needvideo && i->vrtp) { + tmp->fds[2] = ast_rtp_fd(i->vrtp); +@@ -4059,6 +4063,8 @@ + if (!ast_strlen_zero(i->language)) + ast_string_field_set(tmp, language, i->language); + i->owner = tmp; ++ ast_rtp_set_chan_name(i->rtp, tmp->name); ++ + ast_module_ref(ast_module_info->self); + ast_copy_string(tmp->context, i->context, sizeof(tmp->context)); + /*Since it is valid to have extensions in the dialplan that have unescaped characters in them +@@ -4479,8 +4485,10 @@ + build_via(p); + if (!callid) + build_callid_pvt(p); +- else ++ else { + ast_string_field_set(p, callid, callid); ++ ast_rtp_set_chan_id(p->rtp, p->callid); ++ } + /* Assign default music on hold class */ + ast_string_field_set(p, mohinterpret, default_mohinterpret); + ast_string_field_set(p, mohsuggest, default_mohsuggest); +--- include/asterisk/rtp.h.orig 2008-03-18 13:35:42.000000000 +0200 ++++ include/asterisk/rtp.h 2008-03-18 13:35:58.000000000 +0200 +@@ -251,6 +251,9 @@ + + int ast_rtp_codec_getformat(int pt); + ++void ast_rtp_set_chan_name(struct ast_rtp *, const char *); ++void ast_rtp_set_chan_id(struct ast_rtp *, const char *); ++ + /*! \brief Set rtp timeout */ + void ast_rtp_set_rtptimeout(struct ast_rtp *rtp, int timeout); + /*! \brief Set rtp hold timeout */ +--- main/rtp.c.orig 2008-04-08 14:53:18.000000000 +0300 ++++ main/rtp.c 2008-04-08 14:54:14.000000000 +0300 +@@ -81,6 +81,7 @@ + static int rtpstart; /*!< First port for RTP sessions (set in rtp.conf) */ + static int rtpend; /*!< Last port for RTP sessions (set in rtp.conf) */ + static int rtpdebug; /*!< Are we debugging? */ ++static int rtpdebugdtmf; /*!< Are we debugging DTMFs? */ + static int rtcpdebug; /*!< Are we debugging RTCP? */ + static int rtcpstats; /*!< Are we debugging RTCP? */ + static int rtcpinterval = RTCP_DEFAULT_INTERVALMS; /*!< Time between rtcp reports in millisecs */ +@@ -168,6 +169,8 @@ + struct ast_codec_pref pref; + struct ast_rtp *bridged; /*!< Who we are Packet bridged to */ + int set_marker_bit:1; /*!< Whether to set the marker bit or not */ ++ char chan_name[100]; ++ char chan_id[100]; + }; + + /* Forward declarations */ +@@ -669,8 +672,8 @@ + struct ast_frame *f = NULL; + event = ntohl(*((unsigned int *)(data))); + event &= 0x001F; +- if (option_debug > 2 || rtpdebug) +- ast_log(LOG_DEBUG, "Cisco DTMF Digit: %08x (len = %d)\n", event, len); ++ if (option_debug > 2 || rtpdebug || rtpdebugdtmf) ++ ast_log(LOG_DEBUG, "Channel: %s %s Cisco DTMF packet: %08x (len = %d)\n", rtp->chan_name, rtp->chan_id, event, len); + if (event < 10) { + resp = '0' + event; + } else if (event < 11) { +@@ -684,12 +687,24 @@ + } + if (rtp->resp && (rtp->resp != resp)) { + f = send_dtmf(rtp, AST_FRAME_DTMF_END); ++ ast_log(LOG_DEBUG, "Channel: %s %s Cisco DTMF event: %c\n", rtp->chan_name, rtp->chan_id, rtp->resp); + } + rtp->resp = resp; + rtp->dtmfcount = dtmftimeout; + return f; + } + ++void ast_rtp_set_chan_id(struct ast_rtp *rtp, const char *chan_id) { ++ if (rtp == NULL || chan_id == NULL) ++ return; ++ snprintf(rtp->chan_id, sizeof(rtp->chan_id), "%s", chan_id); ++} ++ ++void ast_rtp_set_chan_name(struct ast_rtp *rtp, const char *chan_name) { ++ if (rtp == NULL || chan_name == NULL) ++ return; ++ snprintf(rtp->chan_name, sizeof(rtp->chan_name), "%s", chan_name); ++} + /*! + * \brief Process RTP DTMF and events according to RFC 2833. + * +@@ -1051,6 +1066,10 @@ + struct rtpPayloadType rtpPT; + int reconstruct = ntohl(rtpheader[0]); + ++ /* If we are listening for DTMF - then feed all packets into the core to keep the RTP stream consistent when relaying DTMFs */ ++ if (ast_test_flag(rtp, FLAG_P2P_NEED_DTMF)) ++ return -1; ++ + /* Get fields from packet */ + payload = (reconstruct & 0x7f0000) >> 16; + mark = (((reconstruct & 0x800000) >> 23) != 0); +@@ -1062,10 +1081,6 @@ + if (!bridged->current_RTP_PT[payload].code) + return -1; + +- /* If the payload is DTMF, and we are listening for DTMF - then feed it into the core */ +- if (ast_test_flag(rtp, FLAG_P2P_NEED_DTMF) && !rtpPT.isAstFormat && rtpPT.code == AST_RTP_DTMF) +- return -1; +- + /* Otherwise adjust bridged payload to match */ + bridged_payload = ast_rtp_lookup_code(bridged, rtpPT.isAstFormat, rtpPT.code); + +@@ -1254,11 +1269,12 @@ + /* This is special in-band data that's not one of our codecs */ + if (rtpPT.code == AST_RTP_DTMF) { + /* It's special -- rfc2833 process it */ +- if (rtp_debug_test_addr(&sin)) { ++ if (rtp_debug_test_addr(&sin) || rtpdebugdtmf) { + unsigned char *data; + unsigned int event; + unsigned int event_end; + unsigned int duration; ++ + data = rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen; + event = ntohl(*((unsigned int *)(data))); + event >>= 24; +@@ -1267,9 +1283,12 @@ + event_end >>= 24; + duration = ntohl(*((unsigned int *)(data))); + duration &= 0xFFFF; +- ast_verbose("Got RTP RFC2833 from %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d) \n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration); ++ ++ ast_verbose("Channel: %s %s Got RTP RFC2833 from %s:%u to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d)\n", rtp->chan_name, rtp->chan_id, ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), ast_inet_ntoa(rtp->us.sin_addr), ntohs(rtp->us.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration); + } + f = process_rfc2833(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen, seqno, timestamp); ++ if (rtpdebugdtmf && f) ++ ast_verbose("Channel: %s %s Got RFC2833 DTMF event %c of type %s\n", rtp->chan_name, rtp->chan_id, f->subclass, (f->frametype == AST_FRAME_DTMF_BEGIN ? "DTMF BEGIN" : (f->frametype == AST_FRAME_DTMF_END ? "DTMF_END" : "UNKNOWN"))); + } else if (rtpPT.code == AST_RTP_CISCO_DTMF) { + /* It's really special -- process it the Cisco way */ + if (rtp->lastevent <= seqno || (rtp->lastevent >= 65530 && seqno <= 6)) { +@@ -2198,8 +2217,9 @@ + ast_log(LOG_ERROR, "RTP Transmission error to %s:%u: %s\n", + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), strerror(errno)); +- if (rtp_debug_test_addr(&rtp->them)) +- ast_verbose("Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ if (rtp_debug_test_addr(&rtp->them) || rtpdebugdtmf) ++ ast_verbose("Channel: %s %s Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ rtp->chan_name, rtp->chan_id, + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), payload, rtp->seqno, rtp->lastdigitts, res - hdrlen); + /* Increment sequence number */ +@@ -2242,8 +2262,9 @@ + ast_log(LOG_ERROR, "RTP Transmission error to %s:%d: %s\n", + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), strerror(errno)); +- if (rtp_debug_test_addr(&rtp->them)) +- ast_verbose("Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ if (rtp_debug_test_addr(&rtp->them) || rtpdebugdtmf) ++ ast_verbose("Channel: %s %s Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ rtp->chan_name, rtp->chan_id, + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), rtp->send_payload, rtp->seqno, rtp->lastdigitts, res - hdrlen); + +@@ -3481,6 +3502,16 @@ + return RESULT_SUCCESS; + } + ++static int rtp_do_debug_dtmf(int fd, int argc, char *argv[]) ++{ ++ if (argc != 3) ++ return RESULT_SHOWUSAGE; ++ ++ rtpdebugdtmf = 1; ++ ast_cli(fd, "RTP DTMF debugging enabled\n"); ++ return RESULT_SUCCESS; ++} ++ + static int rtp_do_debug(int fd, int argc, char *argv[]) + { + if (argc != 2) { +@@ -3541,6 +3572,7 @@ + if (argc != 3) + return RESULT_SHOWUSAGE; + rtpdebug = 0; ++ rtpdebugdtmf = 0; + ast_cli(fd,"RTP Debugging Disabled\n"); + return RESULT_SUCCESS; + } +@@ -3601,7 +3633,7 @@ + } + + static char debug_usage[] = +- "Usage: rtp debug [ip host[:port]]\n" ++ "Usage: rtp debug [ip host[:port] | dtmf]\n" + " Enable dumping of all RTP packets to and from host.\n"; + + static char no_debug_usage[] = +@@ -3676,6 +3708,10 @@ + rtp_do_debug, "Enable RTP debugging", + debug_usage }, + ++ { { "rtp", "debug", "dtmf", NULL }, ++ rtp_do_debug_dtmf, "Enable RTP debugging on DTMFs", ++ debug_usage }, ++ + { { "rtp", "debug", "off", NULL }, + rtp_no_debug, "Disable RTP debugging", + no_debug_usage, NULL, &cli_rtp_no_debug_deprecated }, diff --git a/net/asterisk10/files/feature_disconnect.diff b/net/asterisk10/files/feature_disconnect.diff new file mode 100644 index 000000000000..5be713b0da13 --- /dev/null +++ b/net/asterisk10/files/feature_disconnect.diff @@ -0,0 +1,292 @@ +--- 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) + { +--- 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 */ +--- res/res_features.c.orig 2008-04-08 14:55:25.000000000 +0300 ++++ res/res_features.c 2008-04-08 14:59:59.000000000 +0300 +@@ -485,18 +485,6 @@ + } + + +-#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 + */ +@@ -1061,32 +1049,35 @@ + 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, code=%s, sense=%d, features=%d dynamic=%s\n", chan->name, peer->name, code, 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) +@@ -1094,7 +1085,6 @@ + } + } + } +- ast_rwlock_unlock(&features_lock); + + if (ast_strlen_zero(dynamic_features)) + return res; +@@ -1102,9 +1092,7 @@ + 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; + } + +@@ -1112,21 +1100,52 @@ + 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; ++} ++ + static void set_config_flags(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config) + { + int x; diff --git a/net/asterisk10/files/nocodecnego-patch-Makefile b/net/asterisk10/files/nocodecnego-patch-Makefile index f73c3d83bcde..1d9675f1d664 100644 --- a/net/asterisk10/files/nocodecnego-patch-Makefile +++ b/net/asterisk10/files/nocodecnego-patch-Makefile @@ -1,6 +1,6 @@ ---- Makefile.orig Mon Dec 17 08:44:51 2007 -+++ Makefile Mon Dec 24 11:54:52 2007 -@@ -127,7 +127,7 @@ +--- Makefile.orig 2008-03-25 16:37:35.000000000 +0200 ++++ Makefile 2008-04-08 15:02:12.000000000 +0300 +@@ -129,7 +129,7 @@ ASTMANDIR=$(mandir) ifneq ($(findstring BSD,$(OSARCH)),) ASTVARLIBDIR=$(prefix)/share/asterisk @@ -9,7 +9,7 @@ else ASTVARLIBDIR=$(localstatedir)/lib/asterisk endif -@@ -222,7 +222,7 @@ +@@ -224,7 +224,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 -@@ -402,15 +402,15 @@ +@@ -404,15 +404,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: -@@ -431,45 +431,45 @@ +@@ -433,45 +433,45 @@ OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h))) bininstall: _all @@ -115,16 +115,16 @@ fi $(SUBDIRS_INSTALL): -@@ -496,7 +496,7 @@ - echo " WARNING WARNING WARNING" ;\ - fi +@@ -505,7 +505,7 @@ + @exit 1 + endif --install: datafiles bininstall $(SUBDIRS_INSTALL) -+install: datafiles bininstall $(SUBDIRS_INSTALL) samples +-install: badshell datafiles bininstall $(SUBDIRS_INSTALL) ++install: badshell datafiles bininstall $(SUBDIRS_INSTALL) samples @if [ -x /usr/sbin/asterisk-post-install ]; then \ /usr/sbin/asterisk-post-install $(DESTDIR) . ; \ fi -@@ -534,31 +534,23 @@ +@@ -543,31 +543,23 @@ upgrade: bininstall adsi: @@ -164,7 +164,7 @@ ( \ echo "[directories]" ; \ echo "astetcdir => $(ASTETCDIR)" ; \ -@@ -602,20 +594,23 @@ +@@ -612,20 +604,23 @@ echo ";astctlowner = root" ; \ echo ";astctlgroup = apache" ; \ echo ";astctl = asterisk.ctl" ; \ @@ -192,7 +192,7 @@ done @echo " +--------- Asterisk Web Voicemail ----------+" @echo " + +" -@@ -642,10 +637,10 @@ +@@ -652,10 +647,10 @@ __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec rm -rf /tmp/asterisk ; \ diff --git a/net/asterisk10/files/patch-apps::app_dial.c b/net/asterisk10/files/patch-apps::app_dial.c deleted file mode 100644 index 6abe48a17d9f..000000000000 --- a/net/asterisk10/files/patch-apps::app_dial.c +++ /dev/null @@ -1,88 +0,0 @@ ---- 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/asterisk10/files/patch-channels::chan_sip.c b/net/asterisk10/files/patch-channels::chan_sip.c index 916cc7ffa0ac..e54df0eb1bf1 100644 --- a/net/asterisk10/files/patch-channels::chan_sip.c +++ b/net/asterisk10/files/patch-channels::chan_sip.c @@ -1,6 +1,6 @@ ---- 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 @@ +--- channels/chan_sip.c.orig 2008-03-18 16:42:59.000000000 +0200 ++++ channels/chan_sip.c 2008-03-18 17:08:34.000000000 +0200 +@@ -495,7 +495,7 @@ #define DEFAULT_MOHINTERPRET "default" #define DEFAULT_MOHSUGGEST "" #define DEFAULT_VMEXTEN "asterisk" @@ -9,16 +9,7 @@ #define DEFAULT_NOTIFYMIME "application/simple-message-summary" #define DEFAULT_MWITIME 10 #define DEFAULT_ALLOWGUEST TRUE -@@ -3985,6 +3985,8 @@ - ast_codec_pref_remove2(&tmp->nativeformats, ~i->usercapability); - fmt = ast_codec_pref_index_audio(&tmp->nativeformats, 0); - -+ pbx_builtin_setvar_helper(tmp, "SIP_CODEC_USED", ast_getformatname(fmt)); -+ - /* 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. -@@ -15845,6 +15847,9 @@ +@@ -15873,6 +15881,9 @@ char *ext, *host; char tmp[256]; char *dest = data; @@ -26,9 +17,9 @@ + 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 @@ + oldformat = format; + if (!(format &= ((AST_FORMAT_MAX_AUDIO << 1) - 1))) { +@@ -15903,6 +15914,17 @@ if (host) { *host++ = '\0'; ext = tmp; @@ -46,7 +37,7 @@ } else { ext = strchr(tmp, '/'); if (ext) -@@ -15898,6 +15914,14 @@ +@@ -15933,6 +15955,14 @@ ast_string_field_set(p, username, ext); ast_string_field_free(p, fullcontact); } diff --git a/net/asterisk10/files/patch-channels::h323::ast_h323.cxx b/net/asterisk10/files/patch-channels::h323::ast_h323.cxx new file mode 100644 index 000000000000..bfc819452128 --- /dev/null +++ b/net/asterisk10/files/patch-channels::h323::ast_h323.cxx @@ -0,0 +1,29 @@ +--- channels/h323/ast_h323.cxx.orig 2008-04-08 15:08:37.000000000 +0300 ++++ channels/h323/ast_h323.cxx 2008-04-08 15:08:51.000000000 +0300 +@@ -81,8 +81,6 @@ + /** PWLib entry point */ + static MyProcess *localProcess = NULL; + +-static int _timerChangePipe[2]; +- + static unsigned traceOptions = PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine; + + class PAsteriskLog : public PObject, public iostream { +@@ -191,8 +189,6 @@ + + MyProcess::~MyProcess() + { +- _timerChangePipe[0] = timerChangePipe[0]; +- _timerChangePipe[1] = timerChangePipe[1]; + } + + void MyProcess::Main() +@@ -2460,8 +2456,6 @@ + if (localProcess) { + delete localProcess; + localProcess = NULL; +- close(_timerChangePipe[0]); +- close(_timerChangePipe[1]); + } + if (logstream) { + PTrace::SetLevel(0); diff --git a/net/asterisk10/files/patch-include::asterisk::features.h b/net/asterisk10/files/patch-include::asterisk::features.h deleted file mode 100644 index fa5c747eb316..000000000000 --- a/net/asterisk10/files/patch-include::asterisk::features.h +++ /dev/null @@ -1,57 +0,0 @@ ---- 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/asterisk10/files/patch-main::Makefile b/net/asterisk10/files/patch-main::Makefile index 3d1365ea46fa..56624065f61f 100644 --- a/net/asterisk10/files/patch-main::Makefile +++ b/net/asterisk10/files/patch-main::Makefile @@ -1,8 +1,5 @@ - -$FreeBSD$ - ---- main/Makefile.orig -+++ main/Makefile +--- main/Makefile.orig 2008-01-29 19:43:41.000000000 +0200 ++++ main/Makefile 2008-03-13 13:57:48.000000000 +0200 @@ -102,8 +102,8 @@ cd editline && test -f config.h || CFLAGS="$(PTHREAD_CFLAGS) $(subst $(ASTTOPDIR),../../,$(ASTCFLAGS:-Werror=))" LDFLAGS="$(ASTLDFLAGS)" ./configure --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) --with-ncurses=$(NCURSES_DIR) --with-curses=$(CURSES_DIR) --with-termcap=$(TERMCAP_DIR) --with-tinfo=$(TINFO_DIR) $(MAKE) -C editline libedit.a diff --git a/net/asterisk10/files/patch-main::manager.c b/net/asterisk10/files/patch-main::manager.c new file mode 100644 index 000000000000..686068b09e09 --- /dev/null +++ b/net/asterisk10/files/patch-main::manager.c @@ -0,0 +1,31 @@ +--- main/manager.c.orig 2008-04-02 15:49:38.000000000 +0300 ++++ main/manager.c 2008-04-02 15:42:18.000000000 +0300 +@@ -176,6 +176,7 @@ + struct eventqent *eventq; + /* Timeout for ast_carefulwrite() */ + int writetimeout; ++ int pending_event; + AST_LIST_ENTRY(mansession) list; + }; + +@@ -2214,6 +2215,11 @@ + fds[0].events = POLLIN; + do { + ast_mutex_lock(&s->__lock); ++ if (s->pending_event) { ++ s->pending_event = 0; ++ ast_mutex_unlock(&s->__lock); ++ return 0; ++ } + s->waiting_thread = pthread_self(); + ast_mutex_unlock(&s->__lock); + +@@ -2475,6 +2481,8 @@ + ast_mutex_lock(&s->__lock); + if (s->waiting_thread != AST_PTHREADT_NULL) + pthread_kill(s->waiting_thread, SIGURG); ++ else ++ s->pending_event = 1; + ast_mutex_unlock(&s->__lock); + } + AST_LIST_UNLOCK(&sessions); diff --git a/net/asterisk10/files/patch-res::res_features.c b/net/asterisk10/files/patch-res::res_features.c deleted file mode 100644 index c21775f1690d..000000000000 --- a/net/asterisk10/files/patch-res::res_features.c +++ /dev/null @@ -1,144 +0,0 @@ ---- 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; - } - diff --git a/net/asterisk10/files/rtp_force_dtmf-codecnego.diff b/net/asterisk10/files/rtp_force_dtmf-codecnego.diff new file mode 100644 index 000000000000..7cd43e08d238 --- /dev/null +++ b/net/asterisk10/files/rtp_force_dtmf-codecnego.diff @@ -0,0 +1,86 @@ +--- channels/chan_sip.c.orig 2008-03-12 17:37:00.000000000 +0200 ++++ channels/chan_sip.c 2008-03-12 18:17:33.000000000 +0200 +@@ -554,6 +554,9 @@ + static unsigned int global_tos_sip; /*!< IP type of service for SIP packets */ + static unsigned int global_tos_audio; /*!< IP type of service for audio RTP packets */ + static unsigned int global_tos_video; /*!< IP type of service for video RTP packets */ ++static int global_force_dtmf_relay = 0; ++static int global_force_dtmf_relay_pt = 101; ++ + static int compactheaders; /*!< send compact sip headers */ + static int recordhistory; /*!< Record SIP history. Off by default */ + static int dumphistory; /*!< Dump history to verbose before destroying SIP dialog */ +@@ -4983,6 +4986,8 @@ + int codec_index = 0; + int codec_pt_order[256]; + ++ int dtmf_present = 0; ++ + if (!p->rtp) { + ast_log(LOG_ERROR, "Got SDP but have no RTP session allocated.\n"); + return -1; +@@ -5408,12 +5413,20 @@ + for (x = 0; x < codec_index; ++x) { + struct rtpPayloadType pt; + pt = ast_rtp_lookup_pt(p->rtp, codec_pt_order[x]); ++ if (pt.code == AST_RTP_DTMF) ++ dtmf_present = 1; + if (!pt.isAstFormat && !pt.code && p->vrtp) + pt = ast_rtp_lookup_pt(p->vrtp, codec_pt_order[x]); + if (pt.isAstFormat) + ast_codec_pref_append(&p->formats, pt.code); + } + ast_codec_pref_remove2(&p->formats, ~p->usercapability); ++ if (!dtmf_present && global_force_dtmf_relay) { ++ newnoncodeccapability |= AST_RTP_DTMF; ++ ast_rtp_set_m_type(newaudiortp, global_force_dtmf_relay_pt); ++ codec_pt_order[codec_index++] = global_force_dtmf_relay_pt; ++ ast_rtp_set_rtpmap_type(newaudiortp, global_force_dtmf_relay_pt, "audio", "telephone-event", 0); ++ } + + /* Now gather all of the codecs that we are asked for: */ + ast_rtp_get_current_formats(newaudiortp, &peercapability, &peernoncodeccapability); +@@ -16845,6 +16858,9 @@ + + global_matchexterniplocally = FALSE; + ++ global_force_dtmf_relay = 0; ++ global_force_dtmf_relay_pt = 101; ++ + /* Copy the default jb config over global_jbconf */ + memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf)); + +@@ -16901,6 +16917,18 @@ + } + } else if (!strcasecmp(v->name, "vmexten")) { + ast_copy_string(default_vmexten, v->value, sizeof(default_vmexten)); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay")) { ++ if ((global_force_dtmf_relay = ast_true(v->value))) ++ ast_verbose("RTP DTMF relaying will be enforced\n"); ++ else ++ ast_verbose("RTP DTMF relaying will not be enforced\n"); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay_pt")) { ++ sscanf(v->value, "%d", &global_force_dtmf_relay_pt); ++ if (global_force_dtmf_relay_pt < 96 || global_force_dtmf_relay_pt > 255) { ++ ast_verbose("RTP forced DTMF relay payload type is not valid: %d. Using default (101)\n", global_force_dtmf_relay_pt); ++ global_force_dtmf_relay_pt = 101; ++ } else ++ ast_log(LOG_WARNING, "RTP forced DTMF relay payload type is %d\n", global_force_dtmf_relay_pt); + } else if (!strcasecmp(v->name, "rtptimeout")) { + if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) { + ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno); +--- configs/sip.conf.sample.orig 2008-03-12 17:57:19.000000000 +0200 ++++ configs/sip.conf.sample 2008-03-12 18:13:03.000000000 +0200 +@@ -53,6 +53,12 @@ + ; and multiline formatted headers for strict + ; SIP compatibility (defaults to "no") + ++;rtp_force_dtmf_relay=no ; Enable RFC2833 DTMFs to be sent even if peer ++ ; hasn't announced support for it. Default: no ++ ++;rtp_force_dtmf_relay_pt=101 ; RTP payload type value for enforced RFC2833 ++ ; DTMFs. Default: 101 ++ + ; See doc/README.tos for a description of these parameters. + ;tos_sip=cs3 ; Sets TOS for SIP packets. + ;tos_audio=ef ; Sets TOS for RTP audio packets. diff --git a/net/asterisk10/files/rtp_force_dtmf-nocodecnego.diff b/net/asterisk10/files/rtp_force_dtmf-nocodecnego.diff new file mode 100644 index 000000000000..776422b34645 --- /dev/null +++ b/net/asterisk10/files/rtp_force_dtmf-nocodecnego.diff @@ -0,0 +1,70 @@ +--- channels/chan_sip.c.orig 2008-01-31 21:52:49.000000000 +0200 ++++ channels/chan_sip.c 2008-03-14 17:50:57.000000000 +0200 +@@ -556,6 +556,9 @@ + static unsigned int global_tos_sip; /*!< IP type of service for SIP packets */ + static unsigned int global_tos_audio; /*!< IP type of service for audio RTP packets */ + static unsigned int global_tos_video; /*!< IP type of service for video RTP packets */ ++static int global_force_dtmf_relay = 0; ++static int global_force_dtmf_relay_pt = 101; ++ + static int compactheaders; /*!< send compact sip headers */ + static int recordhistory; /*!< Record SIP history. Off by default */ + static int dumphistory; /*!< Dump history to verbose before destroying SIP dialog */ +@@ -5392,6 +5395,13 @@ + + /* Now gather all of the codecs that we are asked for: */ + ast_rtp_get_current_formats(newaudiortp, &peercapability, &peernoncodeccapability); ++ /* Add telephone-event */ ++ if (global_force_dtmf_relay && !(peernoncodeccapability & AST_RTP_DTMF)) { ++ ast_rtp_set_m_type(newaudiortp, global_force_dtmf_relay_pt); ++ found_rtpmap_codecs[last_rtpmap_codec++] = global_force_dtmf_relay_pt; ++ ast_rtp_set_rtpmap_type(newaudiortp, global_force_dtmf_relay_pt, "audio", "telephone-event", 0); ++ peernoncodeccapability |= AST_RTP_DTMF; ++ } + ast_rtp_get_current_formats(newvideortp, &vpeercapability, &vpeernoncodeccapability); + + newjointcapability = p->capability & (peercapability | vpeercapability); +@@ -16833,6 +16843,9 @@ + + global_matchexterniplocally = FALSE; + ++ global_force_dtmf_relay = 0; ++ global_force_dtmf_relay_pt = 101; ++ + /* Copy the default jb config over global_jbconf */ + memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf)); + +@@ -16889,6 +16902,18 @@ + } + } else if (!strcasecmp(v->name, "vmexten")) { + ast_copy_string(default_vmexten, v->value, sizeof(default_vmexten)); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay")) { ++ if ((global_force_dtmf_relay = ast_true(v->value))) ++ ast_verbose("RTP DTMF relaying will be enforced\n"); ++ else ++ ast_verbose("RTP DTMF relaying will not be enforced\n"); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay_pt")) { ++ sscanf(v->value, "%d", &global_force_dtmf_relay_pt); ++ if (global_force_dtmf_relay_pt < 96 || global_force_dtmf_relay_pt > 255) { ++ ast_verbose("RTP forced DTMF relay payload type is not valid: %d. Using default (101)\n", global_force_dtmf_relay_pt); ++ global_force_dtmf_relay_pt = 101; ++ } else ++ ast_log(LOG_WARNING, "RTP forced DTMF relay payload type is %d\n", global_force_dtmf_relay_pt); + } else if (!strcasecmp(v->name, "rtptimeout")) { + if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) { + ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno); +--- configs/sip.conf.sample.orig 2008-03-12 17:57:19.000000000 +0200 ++++ configs/sip.conf.sample 2008-03-12 18:13:03.000000000 +0200 +@@ -53,6 +53,12 @@ + ; and multiline formatted headers for strict + ; SIP compatibility (defaults to "no") + ++;rtp_force_dtmf_relay=no ; Enable RFC2833 DTMFs to be sent even if peer ++ ; hasn't announced support for it. Default: no ++ ++;rtp_force_dtmf_relay_pt=101 ; RTP payload type value for enforced RFC2833 ++ ; DTMFs. Default: 101 ++ + ; See doc/README.tos for a description of these parameters. + ;tos_sip=cs3 ; Sets TOS for SIP packets. + ;tos_audio=ef ; Sets TOS for RTP audio packets. diff --git a/net/asterisk10/files/sip_force_callid.diff b/net/asterisk10/files/sip_force_callid.diff new file mode 100644 index 000000000000..67a3e0192633 --- /dev/null +++ b/net/asterisk10/files/sip_force_callid.diff @@ -0,0 +1,12 @@ +--- channels/chan_sip.c.orig 2008-04-09 11:39:09.000000000 +0300 ++++ channels/chan_sip.c 2008-04-09 11:40:28.000000000 +0300 +@@ -2998,6 +2998,9 @@ + p->t38.state = T38_LOCAL_DIRECT; + if (option_debug) + ast_log(LOG_DEBUG,"T38State change to %d on channel %s\n", p->t38.state, ast->name); ++ } else if (!strcasecmp(ast_var_name(current), "SIP_FORCE_CALLID")) { ++ ++ ast_string_field_set(p, callid, ast_var_value(current)); + } + + } diff --git a/net/asterisk10/pkg-plist b/net/asterisk10/pkg-plist index 7bcd9f5265f4..85ea7e48e505 100644 --- a/net/asterisk10/pkg-plist +++ b/net/asterisk10/pkg-plist @@ -295,7 +295,6 @@ lib/asterisk/modules/codec_adpcm.so lib/asterisk/modules/codec_alaw.so lib/asterisk/modules/codec_g726.so lib/asterisk/modules/codec_gsm.so -lib/asterisk/modules/codec_ilbc.so lib/asterisk/modules/codec_lpc10.so lib/asterisk/modules/codec_speex.so lib/asterisk/modules/codec_ulaw.so @@ -380,8 +379,9 @@ share/asterisk/moh/LICENSE-asterisk-moh-freeplay-wav share/asterisk/moh/fpm-calm-river.wav share/asterisk/moh/fpm-sunshine.wav share/asterisk/moh/fpm-world-mix.wav -share/asterisk/sounds/.asterisk-core-sounds-en-gsm-1.4.8 -share/asterisk/sounds/CREDITS-asterisk-core-en-1.4.8 +share/asterisk/sounds/.asterisk-core-sounds-en-gsm-1.4.9 +share/asterisk/sounds/CHANGES-asterisk-core-en-1.4.9 +share/asterisk/sounds/CREDITS-asterisk-core-en-1.4.9 share/asterisk/sounds/agent-alreadyon.gsm share/asterisk/sounds/agent-incorrect.gsm share/asterisk/sounds/agent-loggedoff.gsm @@ -526,15 +526,19 @@ share/asterisk/sounds/digits/thousand.gsm share/asterisk/sounds/digits/today.gsm share/asterisk/sounds/digits/tomorrow.gsm share/asterisk/sounds/digits/yesterday.gsm +share/asterisk/sounds/dir-first.gsm +share/asterisk/sounds/dir-firstlast.gsm share/asterisk/sounds/dir-instr.gsm share/asterisk/sounds/dir-intro-fn.gsm share/asterisk/sounds/dir-intro.gsm +share/asterisk/sounds/dir-last.gsm share/asterisk/sounds/dir-multi1.gsm share/asterisk/sounds/dir-multi2.gsm share/asterisk/sounds/dir-multi3.gsm share/asterisk/sounds/dir-multi9.gsm share/asterisk/sounds/dir-nomatch.gsm share/asterisk/sounds/dir-nomore.gsm +share/asterisk/sounds/dir-pls-enter.gsm share/asterisk/sounds/followme/call-from.gsm share/asterisk/sounds/followme/no-recording.gsm share/asterisk/sounds/followme/options.gsm @@ -669,12 +673,20 @@ share/asterisk/sounds/silence/7.gsm share/asterisk/sounds/silence/8.gsm share/asterisk/sounds/silence/9.gsm share/asterisk/sounds/spy-agent.gsm +share/asterisk/sounds/spy-console.gsm share/asterisk/sounds/spy-h323.gsm share/asterisk/sounds/spy-iax.gsm share/asterisk/sounds/spy-iax2.gsm +share/asterisk/sounds/spy-jingle.gsm +share/asterisk/sounds/spy-local.gsm share/asterisk/sounds/spy-mgcp.gsm +share/asterisk/sounds/spy-misdn.gsm +share/asterisk/sounds/spy-mobile.gsm +share/asterisk/sounds/spy-nbs.gsm share/asterisk/sounds/spy-sip.gsm share/asterisk/sounds/spy-skinny.gsm +share/asterisk/sounds/spy-unistim.gsm +share/asterisk/sounds/spy-usbradio.gsm share/asterisk/sounds/spy-zap.gsm share/asterisk/sounds/ss-noservice.gsm share/asterisk/sounds/transfer.gsm @@ -716,6 +728,7 @@ share/asterisk/sounds/vm-incorrect-mailbox.gsm share/asterisk/sounds/vm-incorrect.gsm share/asterisk/sounds/vm-instructions.gsm share/asterisk/sounds/vm-intro.gsm +share/asterisk/sounds/vm-invalidpassword.gsm share/asterisk/sounds/vm-isonphone.gsm share/asterisk/sounds/vm-isunavail.gsm share/asterisk/sounds/vm-last.gsm @@ -738,8 +751,10 @@ share/asterisk/sounds/vm-nomore.gsm share/asterisk/sounds/vm-nonumber.gsm share/asterisk/sounds/vm-num-i-have.gsm share/asterisk/sounds/vm-onefor.gsm +share/asterisk/sounds/vm-onefor-full.gsm share/asterisk/sounds/vm-options.gsm share/asterisk/sounds/vm-opts.gsm +share/asterisk/sounds/vm-opts-full.gsm share/asterisk/sounds/vm-passchanged.gsm share/asterisk/sounds/vm-password.gsm share/asterisk/sounds/vm-press.gsm @@ -767,6 +782,7 @@ share/asterisk/sounds/vm-tempgreeting2.gsm share/asterisk/sounds/vm-tempremoved.gsm share/asterisk/sounds/vm-then-pound.gsm share/asterisk/sounds/vm-theperson.gsm +share/asterisk/sounds/vm-tmpexists.gsm share/asterisk/sounds/vm-tocallback.gsm share/asterisk/sounds/vm-tocallnum.gsm share/asterisk/sounds/vm-tocancel.gsm diff --git a/net/asterisk14/Makefile b/net/asterisk14/Makefile index f972ca541c79..c1c8e5eaa5c1 100644 --- a/net/asterisk14/Makefile +++ b/net/asterisk14/Makefile @@ -6,8 +6,7 @@ # PORTNAME= asterisk -PORTVERSION= 1.4.18.1 -PORTREVISION= 1 +PORTVERSION= 1.4.19.2 CATEGORIES= net MASTER_SITES= http://ftp.digium.com/pub/asterisk/ \ http://ftp.digium.com/pub/asterisk/old-releases/ @@ -50,7 +49,8 @@ OPTIONS= OGGVORBIS "Enable Ogg Vorbis support" on \ FREETDS "Enable FreeTDS support" on \ JABBER "Enable Jabber and Gtalk support" on \ SQLITE "Enable SQLITE support" on \ - CODEC_PATCH "Apply codec negotiation patch" off + CODEC_PATCH "Apply codec negotiation patch" off \ + MISC_PATCHES "Apply additional patches" off .include <bsd.port.pre.mk> @@ -159,13 +159,23 @@ LIB_DEPENDS+= sqlite:${PORTSDIR}/databases/sqlite2 .endif .if defined(WITH_CODEC_PATCH) -PATCHFILES= asterisk-1.4.18-codec-negotiation-20080313.diff.gz +PATCHFILES= asterisk-1.4.19-codec-negotiation-20080408.diff.gz PATCH_SITES= http://b2bua.org/chrome/site/ EXTRA_PATCHES+= ${PATCHDIR}/codecnego-patch-Makefile .else EXTRA_PATCHES+= ${PATCHDIR}/nocodecnego-patch-Makefile .endif +.if defined(WITH_MISC_PATCHES) +EXTRA_PATCHES+= ${PATCHDIR}/dtmf_debug.diff +EXTRA_PATCHES+= ${PATCHDIR}/feature_disconnect.diff +EXTRA_PATCHES+= ${PATCHDIR}/sip_force_callid.diff +.if defined(WITH_CODEC_PATCH) +EXTRA_PATCHES+= ${PATCHDIR}/rtp_force_dtmf-codecnego.diff +.else +EXTRA_PATCHES+= ${PATCHDIR}/rtp_force_dtmf-nocodecnego.diff +.endif +.endif post-patch: ${REINPLACE_CMD} -e 's|/var/lib|${PREFIX}/share|g' ${WRKSRC}/configs/musiconhold.conf.sample diff --git a/net/asterisk14/distinfo b/net/asterisk14/distinfo index c65a3a6dbea6..64a1135cfcd3 100644 --- a/net/asterisk14/distinfo +++ b/net/asterisk14/distinfo @@ -1,6 +1,6 @@ -MD5 (asterisk-1.4.18.1.tar.gz) = a0d7ee4054a04529b745e60dd4e750c4 -SHA256 (asterisk-1.4.18.1.tar.gz) = 5ed2e8b66fc8ac96e516b0ddfea065012e39ef51c8f35ed69c6d7cd74e180d78 -SIZE (asterisk-1.4.18.1.tar.gz) = 11488923 -MD5 (asterisk-1.4.18-codec-negotiation-20080313.diff.gz) = c2bc3b82217383936961a61b239e4635 -SHA256 (asterisk-1.4.18-codec-negotiation-20080313.diff.gz) = 6a6ec9436de24e8c35d5922f7116e65e08052bc6bef6ecc12790736bcf058af5 -SIZE (asterisk-1.4.18-codec-negotiation-20080313.diff.gz) = 38966 +MD5 (asterisk-1.4.19.2.tar.gz) = a942367e20a364510881c086a3517321 +SHA256 (asterisk-1.4.19.2.tar.gz) = b3248b84ec824c3c21861607fdc0c71e4acee16edc570004ee6c9e2f712705c4 +SIZE (asterisk-1.4.19.2.tar.gz) = 11496546 +MD5 (asterisk-1.4.19-codec-negotiation-20080408.diff.gz) = 12db6a4bc354d3eeeee7a900a6060b2f +SHA256 (asterisk-1.4.19-codec-negotiation-20080408.diff.gz) = 55290639455b1117541c5bf560ef8326c3e9414d266459293893b0e3d36c64f9 +SIZE (asterisk-1.4.19-codec-negotiation-20080408.diff.gz) = 39004 diff --git a/net/asterisk14/files/codecnego-patch-Makefile b/net/asterisk14/files/codecnego-patch-Makefile index f474578c3a35..c94aad32f623 100644 --- a/net/asterisk14/files/codecnego-patch-Makefile +++ b/net/asterisk14/files/codecnego-patch-Makefile @@ -1,6 +1,6 @@ ---- Makefile.orig Mon Dec 24 11:53:33 2007 -+++ Makefile Mon Dec 24 11:53:33 2007 -@@ -127,7 +127,7 @@ +--- Makefile.orig 2008-04-08 14:50:57.000000000 +0300 ++++ Makefile 2008-04-08 14:52:01.000000000 +0300 +@@ -129,7 +129,7 @@ ASTMANDIR=$(mandir) ifneq ($(findstring BSD,$(OSARCH)),) ASTVARLIBDIR=$(prefix)/share/asterisk @@ -9,7 +9,7 @@ else ASTVARLIBDIR=$(localstatedir)/lib/asterisk endif -@@ -222,7 +222,7 @@ +@@ -224,7 +224,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 -@@ -402,15 +402,15 @@ +@@ -404,15 +404,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: -@@ -431,45 +431,45 @@ +@@ -433,45 +433,45 @@ OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h))) bininstall: _all @@ -115,16 +115,16 @@ fi $(SUBDIRS_INSTALL): -@@ -496,7 +496,7 @@ - echo " WARNING WARNING WARNING" ;\ - fi +@@ -505,7 +505,7 @@ + @exit 1 + endif --install: datafiles bininstall $(SUBDIRS_INSTALL) -+install: datafiles bininstall $(SUBDIRS_INSTALL) samples +-install: badshell datafiles bininstall $(SUBDIRS_INSTALL) ++install: badshell datafiles bininstall $(SUBDIRS_INSTALL) samples @if [ -x /usr/sbin/asterisk-post-install ]; then \ /usr/sbin/asterisk-post-install $(DESTDIR) . ; \ fi -@@ -534,31 +534,23 @@ +@@ -543,31 +543,23 @@ upgrade: bininstall adsi: @@ -164,7 +164,7 @@ ( \ echo "[directories]" ; \ echo "astetcdir => $(ASTETCDIR)" ; \ -@@ -643,20 +635,23 @@ +@@ -653,20 +645,23 @@ echo "; Default: strict"; \ echo ";"; \ echo ";translation_algorithm = strict"; \ @@ -192,7 +192,7 @@ done @echo " +--------- Asterisk Web Voicemail ----------+" @echo " + +" -@@ -683,10 +678,10 @@ +@@ -693,10 +688,10 @@ __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec rm -rf /tmp/asterisk ; \ diff --git a/net/asterisk14/files/dtmf_debug.diff b/net/asterisk14/files/dtmf_debug.diff new file mode 100644 index 000000000000..81205d40dd46 --- /dev/null +++ b/net/asterisk14/files/dtmf_debug.diff @@ -0,0 +1,225 @@ +--- channels/chan_sip.c.orig 2008-03-18 16:42:59.000000000 +0200 ++++ channels/chan_sip.c 2008-03-18 17:08:34.000000000 +0200 +@@ -3768,6 +3768,7 @@ + ast_log(LOG_WARNING, "old channel wasn't %p but was %p\n", oldchan, p->owner); + else { + p->owner = newchan; ++ ast_rtp_set_chan_name(p->rtp, newchan->name); + ret = 0; + } + if (option_debug > 2) +@@ -4032,6 +4035,7 @@ + if (i->rtp) { + tmp->fds[0] = ast_rtp_fd(i->rtp); + tmp->fds[1] = ast_rtcp_fd(i->rtp); ++ ast_rtp_set_chan_id(i->rtp, i->callid); + } + if (needvideo && i->vrtp) { + tmp->fds[2] = ast_rtp_fd(i->vrtp); +@@ -4059,6 +4063,8 @@ + if (!ast_strlen_zero(i->language)) + ast_string_field_set(tmp, language, i->language); + i->owner = tmp; ++ ast_rtp_set_chan_name(i->rtp, tmp->name); ++ + ast_module_ref(ast_module_info->self); + ast_copy_string(tmp->context, i->context, sizeof(tmp->context)); + /*Since it is valid to have extensions in the dialplan that have unescaped characters in them +@@ -4479,8 +4485,10 @@ + build_via(p); + if (!callid) + build_callid_pvt(p); +- else ++ else { + ast_string_field_set(p, callid, callid); ++ ast_rtp_set_chan_id(p->rtp, p->callid); ++ } + /* Assign default music on hold class */ + ast_string_field_set(p, mohinterpret, default_mohinterpret); + ast_string_field_set(p, mohsuggest, default_mohsuggest); +--- include/asterisk/rtp.h.orig 2008-03-18 13:35:42.000000000 +0200 ++++ include/asterisk/rtp.h 2008-03-18 13:35:58.000000000 +0200 +@@ -251,6 +251,9 @@ + + int ast_rtp_codec_getformat(int pt); + ++void ast_rtp_set_chan_name(struct ast_rtp *, const char *); ++void ast_rtp_set_chan_id(struct ast_rtp *, const char *); ++ + /*! \brief Set rtp timeout */ + void ast_rtp_set_rtptimeout(struct ast_rtp *rtp, int timeout); + /*! \brief Set rtp hold timeout */ +--- main/rtp.c.orig 2008-04-08 14:53:18.000000000 +0300 ++++ main/rtp.c 2008-04-08 14:54:14.000000000 +0300 +@@ -81,6 +81,7 @@ + static int rtpstart; /*!< First port for RTP sessions (set in rtp.conf) */ + static int rtpend; /*!< Last port for RTP sessions (set in rtp.conf) */ + static int rtpdebug; /*!< Are we debugging? */ ++static int rtpdebugdtmf; /*!< Are we debugging DTMFs? */ + static int rtcpdebug; /*!< Are we debugging RTCP? */ + static int rtcpstats; /*!< Are we debugging RTCP? */ + static int rtcpinterval = RTCP_DEFAULT_INTERVALMS; /*!< Time between rtcp reports in millisecs */ +@@ -168,6 +169,8 @@ + struct ast_codec_pref pref; + struct ast_rtp *bridged; /*!< Who we are Packet bridged to */ + int set_marker_bit:1; /*!< Whether to set the marker bit or not */ ++ char chan_name[100]; ++ char chan_id[100]; + }; + + /* Forward declarations */ +@@ -669,8 +672,8 @@ + struct ast_frame *f = NULL; + event = ntohl(*((unsigned int *)(data))); + event &= 0x001F; +- if (option_debug > 2 || rtpdebug) +- ast_log(LOG_DEBUG, "Cisco DTMF Digit: %08x (len = %d)\n", event, len); ++ if (option_debug > 2 || rtpdebug || rtpdebugdtmf) ++ ast_log(LOG_DEBUG, "Channel: %s %s Cisco DTMF packet: %08x (len = %d)\n", rtp->chan_name, rtp->chan_id, event, len); + if (event < 10) { + resp = '0' + event; + } else if (event < 11) { +@@ -684,12 +687,24 @@ + } + if (rtp->resp && (rtp->resp != resp)) { + f = send_dtmf(rtp, AST_FRAME_DTMF_END); ++ ast_log(LOG_DEBUG, "Channel: %s %s Cisco DTMF event: %c\n", rtp->chan_name, rtp->chan_id, rtp->resp); + } + rtp->resp = resp; + rtp->dtmfcount = dtmftimeout; + return f; + } + ++void ast_rtp_set_chan_id(struct ast_rtp *rtp, const char *chan_id) { ++ if (rtp == NULL || chan_id == NULL) ++ return; ++ snprintf(rtp->chan_id, sizeof(rtp->chan_id), "%s", chan_id); ++} ++ ++void ast_rtp_set_chan_name(struct ast_rtp *rtp, const char *chan_name) { ++ if (rtp == NULL || chan_name == NULL) ++ return; ++ snprintf(rtp->chan_name, sizeof(rtp->chan_name), "%s", chan_name); ++} + /*! + * \brief Process RTP DTMF and events according to RFC 2833. + * +@@ -1051,6 +1066,10 @@ + struct rtpPayloadType rtpPT; + int reconstruct = ntohl(rtpheader[0]); + ++ /* If we are listening for DTMF - then feed all packets into the core to keep the RTP stream consistent when relaying DTMFs */ ++ if (ast_test_flag(rtp, FLAG_P2P_NEED_DTMF)) ++ return -1; ++ + /* Get fields from packet */ + payload = (reconstruct & 0x7f0000) >> 16; + mark = (((reconstruct & 0x800000) >> 23) != 0); +@@ -1062,10 +1081,6 @@ + if (!bridged->current_RTP_PT[payload].code) + return -1; + +- /* If the payload is DTMF, and we are listening for DTMF - then feed it into the core */ +- if (ast_test_flag(rtp, FLAG_P2P_NEED_DTMF) && !rtpPT.isAstFormat && rtpPT.code == AST_RTP_DTMF) +- return -1; +- + /* Otherwise adjust bridged payload to match */ + bridged_payload = ast_rtp_lookup_code(bridged, rtpPT.isAstFormat, rtpPT.code); + +@@ -1254,11 +1269,12 @@ + /* This is special in-band data that's not one of our codecs */ + if (rtpPT.code == AST_RTP_DTMF) { + /* It's special -- rfc2833 process it */ +- if (rtp_debug_test_addr(&sin)) { ++ if (rtp_debug_test_addr(&sin) || rtpdebugdtmf) { + unsigned char *data; + unsigned int event; + unsigned int event_end; + unsigned int duration; ++ + data = rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen; + event = ntohl(*((unsigned int *)(data))); + event >>= 24; +@@ -1267,9 +1283,12 @@ + event_end >>= 24; + duration = ntohl(*((unsigned int *)(data))); + duration &= 0xFFFF; +- ast_verbose("Got RTP RFC2833 from %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d) \n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration); ++ ++ ast_verbose("Channel: %s %s Got RTP RFC2833 from %s:%u to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d)\n", rtp->chan_name, rtp->chan_id, ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), ast_inet_ntoa(rtp->us.sin_addr), ntohs(rtp->us.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration); + } + f = process_rfc2833(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen, seqno, timestamp); ++ if (rtpdebugdtmf && f) ++ ast_verbose("Channel: %s %s Got RFC2833 DTMF event %c of type %s\n", rtp->chan_name, rtp->chan_id, f->subclass, (f->frametype == AST_FRAME_DTMF_BEGIN ? "DTMF BEGIN" : (f->frametype == AST_FRAME_DTMF_END ? "DTMF_END" : "UNKNOWN"))); + } else if (rtpPT.code == AST_RTP_CISCO_DTMF) { + /* It's really special -- process it the Cisco way */ + if (rtp->lastevent <= seqno || (rtp->lastevent >= 65530 && seqno <= 6)) { +@@ -2198,8 +2217,9 @@ + ast_log(LOG_ERROR, "RTP Transmission error to %s:%u: %s\n", + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), strerror(errno)); +- if (rtp_debug_test_addr(&rtp->them)) +- ast_verbose("Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ if (rtp_debug_test_addr(&rtp->them) || rtpdebugdtmf) ++ ast_verbose("Channel: %s %s Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ rtp->chan_name, rtp->chan_id, + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), payload, rtp->seqno, rtp->lastdigitts, res - hdrlen); + /* Increment sequence number */ +@@ -2242,8 +2262,9 @@ + ast_log(LOG_ERROR, "RTP Transmission error to %s:%d: %s\n", + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), strerror(errno)); +- if (rtp_debug_test_addr(&rtp->them)) +- ast_verbose("Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ if (rtp_debug_test_addr(&rtp->them) || rtpdebugdtmf) ++ ast_verbose("Channel: %s %s Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ rtp->chan_name, rtp->chan_id, + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), rtp->send_payload, rtp->seqno, rtp->lastdigitts, res - hdrlen); + +@@ -3481,6 +3502,16 @@ + return RESULT_SUCCESS; + } + ++static int rtp_do_debug_dtmf(int fd, int argc, char *argv[]) ++{ ++ if (argc != 3) ++ return RESULT_SHOWUSAGE; ++ ++ rtpdebugdtmf = 1; ++ ast_cli(fd, "RTP DTMF debugging enabled\n"); ++ return RESULT_SUCCESS; ++} ++ + static int rtp_do_debug(int fd, int argc, char *argv[]) + { + if (argc != 2) { +@@ -3541,6 +3572,7 @@ + if (argc != 3) + return RESULT_SHOWUSAGE; + rtpdebug = 0; ++ rtpdebugdtmf = 0; + ast_cli(fd,"RTP Debugging Disabled\n"); + return RESULT_SUCCESS; + } +@@ -3601,7 +3633,7 @@ + } + + static char debug_usage[] = +- "Usage: rtp debug [ip host[:port]]\n" ++ "Usage: rtp debug [ip host[:port] | dtmf]\n" + " Enable dumping of all RTP packets to and from host.\n"; + + static char no_debug_usage[] = +@@ -3676,6 +3708,10 @@ + rtp_do_debug, "Enable RTP debugging", + debug_usage }, + ++ { { "rtp", "debug", "dtmf", NULL }, ++ rtp_do_debug_dtmf, "Enable RTP debugging on DTMFs", ++ debug_usage }, ++ + { { "rtp", "debug", "off", NULL }, + rtp_no_debug, "Disable RTP debugging", + no_debug_usage, NULL, &cli_rtp_no_debug_deprecated }, diff --git a/net/asterisk14/files/feature_disconnect.diff b/net/asterisk14/files/feature_disconnect.diff new file mode 100644 index 000000000000..5be713b0da13 --- /dev/null +++ b/net/asterisk14/files/feature_disconnect.diff @@ -0,0 +1,292 @@ +--- 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) + { +--- 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 */ +--- res/res_features.c.orig 2008-04-08 14:55:25.000000000 +0300 ++++ res/res_features.c 2008-04-08 14:59:59.000000000 +0300 +@@ -485,18 +485,6 @@ + } + + +-#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 + */ +@@ -1061,32 +1049,35 @@ + 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, code=%s, sense=%d, features=%d dynamic=%s\n", chan->name, peer->name, code, 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) +@@ -1094,7 +1085,6 @@ + } + } + } +- ast_rwlock_unlock(&features_lock); + + if (ast_strlen_zero(dynamic_features)) + return res; +@@ -1102,9 +1092,7 @@ + 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; + } + +@@ -1112,21 +1100,52 @@ + 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; ++} ++ + static void set_config_flags(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config) + { + int x; diff --git a/net/asterisk14/files/nocodecnego-patch-Makefile b/net/asterisk14/files/nocodecnego-patch-Makefile index f73c3d83bcde..1d9675f1d664 100644 --- a/net/asterisk14/files/nocodecnego-patch-Makefile +++ b/net/asterisk14/files/nocodecnego-patch-Makefile @@ -1,6 +1,6 @@ ---- Makefile.orig Mon Dec 17 08:44:51 2007 -+++ Makefile Mon Dec 24 11:54:52 2007 -@@ -127,7 +127,7 @@ +--- Makefile.orig 2008-03-25 16:37:35.000000000 +0200 ++++ Makefile 2008-04-08 15:02:12.000000000 +0300 +@@ -129,7 +129,7 @@ ASTMANDIR=$(mandir) ifneq ($(findstring BSD,$(OSARCH)),) ASTVARLIBDIR=$(prefix)/share/asterisk @@ -9,7 +9,7 @@ else ASTVARLIBDIR=$(localstatedir)/lib/asterisk endif -@@ -222,7 +222,7 @@ +@@ -224,7 +224,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 -@@ -402,15 +402,15 @@ +@@ -404,15 +404,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: -@@ -431,45 +431,45 @@ +@@ -433,45 +433,45 @@ OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h))) bininstall: _all @@ -115,16 +115,16 @@ fi $(SUBDIRS_INSTALL): -@@ -496,7 +496,7 @@ - echo " WARNING WARNING WARNING" ;\ - fi +@@ -505,7 +505,7 @@ + @exit 1 + endif --install: datafiles bininstall $(SUBDIRS_INSTALL) -+install: datafiles bininstall $(SUBDIRS_INSTALL) samples +-install: badshell datafiles bininstall $(SUBDIRS_INSTALL) ++install: badshell datafiles bininstall $(SUBDIRS_INSTALL) samples @if [ -x /usr/sbin/asterisk-post-install ]; then \ /usr/sbin/asterisk-post-install $(DESTDIR) . ; \ fi -@@ -534,31 +534,23 @@ +@@ -543,31 +543,23 @@ upgrade: bininstall adsi: @@ -164,7 +164,7 @@ ( \ echo "[directories]" ; \ echo "astetcdir => $(ASTETCDIR)" ; \ -@@ -602,20 +594,23 @@ +@@ -612,20 +604,23 @@ echo ";astctlowner = root" ; \ echo ";astctlgroup = apache" ; \ echo ";astctl = asterisk.ctl" ; \ @@ -192,7 +192,7 @@ done @echo " +--------- Asterisk Web Voicemail ----------+" @echo " + +" -@@ -642,10 +637,10 @@ +@@ -652,10 +647,10 @@ __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec rm -rf /tmp/asterisk ; \ diff --git a/net/asterisk14/files/patch-apps::app_dial.c b/net/asterisk14/files/patch-apps::app_dial.c deleted file mode 100644 index 6abe48a17d9f..000000000000 --- a/net/asterisk14/files/patch-apps::app_dial.c +++ /dev/null @@ -1,88 +0,0 @@ ---- 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/asterisk14/files/patch-channels::chan_sip.c b/net/asterisk14/files/patch-channels::chan_sip.c index 916cc7ffa0ac..e54df0eb1bf1 100644 --- a/net/asterisk14/files/patch-channels::chan_sip.c +++ b/net/asterisk14/files/patch-channels::chan_sip.c @@ -1,6 +1,6 @@ ---- 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 @@ +--- channels/chan_sip.c.orig 2008-03-18 16:42:59.000000000 +0200 ++++ channels/chan_sip.c 2008-03-18 17:08:34.000000000 +0200 +@@ -495,7 +495,7 @@ #define DEFAULT_MOHINTERPRET "default" #define DEFAULT_MOHSUGGEST "" #define DEFAULT_VMEXTEN "asterisk" @@ -9,16 +9,7 @@ #define DEFAULT_NOTIFYMIME "application/simple-message-summary" #define DEFAULT_MWITIME 10 #define DEFAULT_ALLOWGUEST TRUE -@@ -3985,6 +3985,8 @@ - ast_codec_pref_remove2(&tmp->nativeformats, ~i->usercapability); - fmt = ast_codec_pref_index_audio(&tmp->nativeformats, 0); - -+ pbx_builtin_setvar_helper(tmp, "SIP_CODEC_USED", ast_getformatname(fmt)); -+ - /* 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. -@@ -15845,6 +15847,9 @@ +@@ -15873,6 +15881,9 @@ char *ext, *host; char tmp[256]; char *dest = data; @@ -26,9 +17,9 @@ + 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 @@ + oldformat = format; + if (!(format &= ((AST_FORMAT_MAX_AUDIO << 1) - 1))) { +@@ -15903,6 +15914,17 @@ if (host) { *host++ = '\0'; ext = tmp; @@ -46,7 +37,7 @@ } else { ext = strchr(tmp, '/'); if (ext) -@@ -15898,6 +15914,14 @@ +@@ -15933,6 +15955,14 @@ ast_string_field_set(p, username, ext); ast_string_field_free(p, fullcontact); } diff --git a/net/asterisk14/files/patch-channels::h323::ast_h323.cxx b/net/asterisk14/files/patch-channels::h323::ast_h323.cxx new file mode 100644 index 000000000000..bfc819452128 --- /dev/null +++ b/net/asterisk14/files/patch-channels::h323::ast_h323.cxx @@ -0,0 +1,29 @@ +--- channels/h323/ast_h323.cxx.orig 2008-04-08 15:08:37.000000000 +0300 ++++ channels/h323/ast_h323.cxx 2008-04-08 15:08:51.000000000 +0300 +@@ -81,8 +81,6 @@ + /** PWLib entry point */ + static MyProcess *localProcess = NULL; + +-static int _timerChangePipe[2]; +- + static unsigned traceOptions = PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine; + + class PAsteriskLog : public PObject, public iostream { +@@ -191,8 +189,6 @@ + + MyProcess::~MyProcess() + { +- _timerChangePipe[0] = timerChangePipe[0]; +- _timerChangePipe[1] = timerChangePipe[1]; + } + + void MyProcess::Main() +@@ -2460,8 +2456,6 @@ + if (localProcess) { + delete localProcess; + localProcess = NULL; +- close(_timerChangePipe[0]); +- close(_timerChangePipe[1]); + } + if (logstream) { + PTrace::SetLevel(0); diff --git a/net/asterisk14/files/patch-include::asterisk::features.h b/net/asterisk14/files/patch-include::asterisk::features.h deleted file mode 100644 index fa5c747eb316..000000000000 --- a/net/asterisk14/files/patch-include::asterisk::features.h +++ /dev/null @@ -1,57 +0,0 @@ ---- 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/asterisk14/files/patch-main::Makefile b/net/asterisk14/files/patch-main::Makefile index 3d1365ea46fa..56624065f61f 100644 --- a/net/asterisk14/files/patch-main::Makefile +++ b/net/asterisk14/files/patch-main::Makefile @@ -1,8 +1,5 @@ - -$FreeBSD$ - ---- main/Makefile.orig -+++ main/Makefile +--- main/Makefile.orig 2008-01-29 19:43:41.000000000 +0200 ++++ main/Makefile 2008-03-13 13:57:48.000000000 +0200 @@ -102,8 +102,8 @@ cd editline && test -f config.h || CFLAGS="$(PTHREAD_CFLAGS) $(subst $(ASTTOPDIR),../../,$(ASTCFLAGS:-Werror=))" LDFLAGS="$(ASTLDFLAGS)" ./configure --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) --with-ncurses=$(NCURSES_DIR) --with-curses=$(CURSES_DIR) --with-termcap=$(TERMCAP_DIR) --with-tinfo=$(TINFO_DIR) $(MAKE) -C editline libedit.a diff --git a/net/asterisk14/files/patch-main::manager.c b/net/asterisk14/files/patch-main::manager.c new file mode 100644 index 000000000000..686068b09e09 --- /dev/null +++ b/net/asterisk14/files/patch-main::manager.c @@ -0,0 +1,31 @@ +--- main/manager.c.orig 2008-04-02 15:49:38.000000000 +0300 ++++ main/manager.c 2008-04-02 15:42:18.000000000 +0300 +@@ -176,6 +176,7 @@ + struct eventqent *eventq; + /* Timeout for ast_carefulwrite() */ + int writetimeout; ++ int pending_event; + AST_LIST_ENTRY(mansession) list; + }; + +@@ -2214,6 +2215,11 @@ + fds[0].events = POLLIN; + do { + ast_mutex_lock(&s->__lock); ++ if (s->pending_event) { ++ s->pending_event = 0; ++ ast_mutex_unlock(&s->__lock); ++ return 0; ++ } + s->waiting_thread = pthread_self(); + ast_mutex_unlock(&s->__lock); + +@@ -2475,6 +2481,8 @@ + ast_mutex_lock(&s->__lock); + if (s->waiting_thread != AST_PTHREADT_NULL) + pthread_kill(s->waiting_thread, SIGURG); ++ else ++ s->pending_event = 1; + ast_mutex_unlock(&s->__lock); + } + AST_LIST_UNLOCK(&sessions); diff --git a/net/asterisk14/files/patch-res::res_features.c b/net/asterisk14/files/patch-res::res_features.c deleted file mode 100644 index c21775f1690d..000000000000 --- a/net/asterisk14/files/patch-res::res_features.c +++ /dev/null @@ -1,144 +0,0 @@ ---- 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; - } - diff --git a/net/asterisk14/files/rtp_force_dtmf-codecnego.diff b/net/asterisk14/files/rtp_force_dtmf-codecnego.diff new file mode 100644 index 000000000000..7cd43e08d238 --- /dev/null +++ b/net/asterisk14/files/rtp_force_dtmf-codecnego.diff @@ -0,0 +1,86 @@ +--- channels/chan_sip.c.orig 2008-03-12 17:37:00.000000000 +0200 ++++ channels/chan_sip.c 2008-03-12 18:17:33.000000000 +0200 +@@ -554,6 +554,9 @@ + static unsigned int global_tos_sip; /*!< IP type of service for SIP packets */ + static unsigned int global_tos_audio; /*!< IP type of service for audio RTP packets */ + static unsigned int global_tos_video; /*!< IP type of service for video RTP packets */ ++static int global_force_dtmf_relay = 0; ++static int global_force_dtmf_relay_pt = 101; ++ + static int compactheaders; /*!< send compact sip headers */ + static int recordhistory; /*!< Record SIP history. Off by default */ + static int dumphistory; /*!< Dump history to verbose before destroying SIP dialog */ +@@ -4983,6 +4986,8 @@ + int codec_index = 0; + int codec_pt_order[256]; + ++ int dtmf_present = 0; ++ + if (!p->rtp) { + ast_log(LOG_ERROR, "Got SDP but have no RTP session allocated.\n"); + return -1; +@@ -5408,12 +5413,20 @@ + for (x = 0; x < codec_index; ++x) { + struct rtpPayloadType pt; + pt = ast_rtp_lookup_pt(p->rtp, codec_pt_order[x]); ++ if (pt.code == AST_RTP_DTMF) ++ dtmf_present = 1; + if (!pt.isAstFormat && !pt.code && p->vrtp) + pt = ast_rtp_lookup_pt(p->vrtp, codec_pt_order[x]); + if (pt.isAstFormat) + ast_codec_pref_append(&p->formats, pt.code); + } + ast_codec_pref_remove2(&p->formats, ~p->usercapability); ++ if (!dtmf_present && global_force_dtmf_relay) { ++ newnoncodeccapability |= AST_RTP_DTMF; ++ ast_rtp_set_m_type(newaudiortp, global_force_dtmf_relay_pt); ++ codec_pt_order[codec_index++] = global_force_dtmf_relay_pt; ++ ast_rtp_set_rtpmap_type(newaudiortp, global_force_dtmf_relay_pt, "audio", "telephone-event", 0); ++ } + + /* Now gather all of the codecs that we are asked for: */ + ast_rtp_get_current_formats(newaudiortp, &peercapability, &peernoncodeccapability); +@@ -16845,6 +16858,9 @@ + + global_matchexterniplocally = FALSE; + ++ global_force_dtmf_relay = 0; ++ global_force_dtmf_relay_pt = 101; ++ + /* Copy the default jb config over global_jbconf */ + memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf)); + +@@ -16901,6 +16917,18 @@ + } + } else if (!strcasecmp(v->name, "vmexten")) { + ast_copy_string(default_vmexten, v->value, sizeof(default_vmexten)); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay")) { ++ if ((global_force_dtmf_relay = ast_true(v->value))) ++ ast_verbose("RTP DTMF relaying will be enforced\n"); ++ else ++ ast_verbose("RTP DTMF relaying will not be enforced\n"); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay_pt")) { ++ sscanf(v->value, "%d", &global_force_dtmf_relay_pt); ++ if (global_force_dtmf_relay_pt < 96 || global_force_dtmf_relay_pt > 255) { ++ ast_verbose("RTP forced DTMF relay payload type is not valid: %d. Using default (101)\n", global_force_dtmf_relay_pt); ++ global_force_dtmf_relay_pt = 101; ++ } else ++ ast_log(LOG_WARNING, "RTP forced DTMF relay payload type is %d\n", global_force_dtmf_relay_pt); + } else if (!strcasecmp(v->name, "rtptimeout")) { + if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) { + ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno); +--- configs/sip.conf.sample.orig 2008-03-12 17:57:19.000000000 +0200 ++++ configs/sip.conf.sample 2008-03-12 18:13:03.000000000 +0200 +@@ -53,6 +53,12 @@ + ; and multiline formatted headers for strict + ; SIP compatibility (defaults to "no") + ++;rtp_force_dtmf_relay=no ; Enable RFC2833 DTMFs to be sent even if peer ++ ; hasn't announced support for it. Default: no ++ ++;rtp_force_dtmf_relay_pt=101 ; RTP payload type value for enforced RFC2833 ++ ; DTMFs. Default: 101 ++ + ; See doc/README.tos for a description of these parameters. + ;tos_sip=cs3 ; Sets TOS for SIP packets. + ;tos_audio=ef ; Sets TOS for RTP audio packets. diff --git a/net/asterisk14/files/rtp_force_dtmf-nocodecnego.diff b/net/asterisk14/files/rtp_force_dtmf-nocodecnego.diff new file mode 100644 index 000000000000..776422b34645 --- /dev/null +++ b/net/asterisk14/files/rtp_force_dtmf-nocodecnego.diff @@ -0,0 +1,70 @@ +--- channels/chan_sip.c.orig 2008-01-31 21:52:49.000000000 +0200 ++++ channels/chan_sip.c 2008-03-14 17:50:57.000000000 +0200 +@@ -556,6 +556,9 @@ + static unsigned int global_tos_sip; /*!< IP type of service for SIP packets */ + static unsigned int global_tos_audio; /*!< IP type of service for audio RTP packets */ + static unsigned int global_tos_video; /*!< IP type of service for video RTP packets */ ++static int global_force_dtmf_relay = 0; ++static int global_force_dtmf_relay_pt = 101; ++ + static int compactheaders; /*!< send compact sip headers */ + static int recordhistory; /*!< Record SIP history. Off by default */ + static int dumphistory; /*!< Dump history to verbose before destroying SIP dialog */ +@@ -5392,6 +5395,13 @@ + + /* Now gather all of the codecs that we are asked for: */ + ast_rtp_get_current_formats(newaudiortp, &peercapability, &peernoncodeccapability); ++ /* Add telephone-event */ ++ if (global_force_dtmf_relay && !(peernoncodeccapability & AST_RTP_DTMF)) { ++ ast_rtp_set_m_type(newaudiortp, global_force_dtmf_relay_pt); ++ found_rtpmap_codecs[last_rtpmap_codec++] = global_force_dtmf_relay_pt; ++ ast_rtp_set_rtpmap_type(newaudiortp, global_force_dtmf_relay_pt, "audio", "telephone-event", 0); ++ peernoncodeccapability |= AST_RTP_DTMF; ++ } + ast_rtp_get_current_formats(newvideortp, &vpeercapability, &vpeernoncodeccapability); + + newjointcapability = p->capability & (peercapability | vpeercapability); +@@ -16833,6 +16843,9 @@ + + global_matchexterniplocally = FALSE; + ++ global_force_dtmf_relay = 0; ++ global_force_dtmf_relay_pt = 101; ++ + /* Copy the default jb config over global_jbconf */ + memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf)); + +@@ -16889,6 +16902,18 @@ + } + } else if (!strcasecmp(v->name, "vmexten")) { + ast_copy_string(default_vmexten, v->value, sizeof(default_vmexten)); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay")) { ++ if ((global_force_dtmf_relay = ast_true(v->value))) ++ ast_verbose("RTP DTMF relaying will be enforced\n"); ++ else ++ ast_verbose("RTP DTMF relaying will not be enforced\n"); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay_pt")) { ++ sscanf(v->value, "%d", &global_force_dtmf_relay_pt); ++ if (global_force_dtmf_relay_pt < 96 || global_force_dtmf_relay_pt > 255) { ++ ast_verbose("RTP forced DTMF relay payload type is not valid: %d. Using default (101)\n", global_force_dtmf_relay_pt); ++ global_force_dtmf_relay_pt = 101; ++ } else ++ ast_log(LOG_WARNING, "RTP forced DTMF relay payload type is %d\n", global_force_dtmf_relay_pt); + } else if (!strcasecmp(v->name, "rtptimeout")) { + if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) { + ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno); +--- configs/sip.conf.sample.orig 2008-03-12 17:57:19.000000000 +0200 ++++ configs/sip.conf.sample 2008-03-12 18:13:03.000000000 +0200 +@@ -53,6 +53,12 @@ + ; and multiline formatted headers for strict + ; SIP compatibility (defaults to "no") + ++;rtp_force_dtmf_relay=no ; Enable RFC2833 DTMFs to be sent even if peer ++ ; hasn't announced support for it. Default: no ++ ++;rtp_force_dtmf_relay_pt=101 ; RTP payload type value for enforced RFC2833 ++ ; DTMFs. Default: 101 ++ + ; See doc/README.tos for a description of these parameters. + ;tos_sip=cs3 ; Sets TOS for SIP packets. + ;tos_audio=ef ; Sets TOS for RTP audio packets. diff --git a/net/asterisk14/files/sip_force_callid.diff b/net/asterisk14/files/sip_force_callid.diff new file mode 100644 index 000000000000..67a3e0192633 --- /dev/null +++ b/net/asterisk14/files/sip_force_callid.diff @@ -0,0 +1,12 @@ +--- channels/chan_sip.c.orig 2008-04-09 11:39:09.000000000 +0300 ++++ channels/chan_sip.c 2008-04-09 11:40:28.000000000 +0300 +@@ -2998,6 +2998,9 @@ + p->t38.state = T38_LOCAL_DIRECT; + if (option_debug) + ast_log(LOG_DEBUG,"T38State change to %d on channel %s\n", p->t38.state, ast->name); ++ } else if (!strcasecmp(ast_var_name(current), "SIP_FORCE_CALLID")) { ++ ++ ast_string_field_set(p, callid, ast_var_value(current)); + } + + } diff --git a/net/asterisk14/pkg-plist b/net/asterisk14/pkg-plist index 7bcd9f5265f4..85ea7e48e505 100644 --- a/net/asterisk14/pkg-plist +++ b/net/asterisk14/pkg-plist @@ -295,7 +295,6 @@ lib/asterisk/modules/codec_adpcm.so lib/asterisk/modules/codec_alaw.so lib/asterisk/modules/codec_g726.so lib/asterisk/modules/codec_gsm.so -lib/asterisk/modules/codec_ilbc.so lib/asterisk/modules/codec_lpc10.so lib/asterisk/modules/codec_speex.so lib/asterisk/modules/codec_ulaw.so @@ -380,8 +379,9 @@ share/asterisk/moh/LICENSE-asterisk-moh-freeplay-wav share/asterisk/moh/fpm-calm-river.wav share/asterisk/moh/fpm-sunshine.wav share/asterisk/moh/fpm-world-mix.wav -share/asterisk/sounds/.asterisk-core-sounds-en-gsm-1.4.8 -share/asterisk/sounds/CREDITS-asterisk-core-en-1.4.8 +share/asterisk/sounds/.asterisk-core-sounds-en-gsm-1.4.9 +share/asterisk/sounds/CHANGES-asterisk-core-en-1.4.9 +share/asterisk/sounds/CREDITS-asterisk-core-en-1.4.9 share/asterisk/sounds/agent-alreadyon.gsm share/asterisk/sounds/agent-incorrect.gsm share/asterisk/sounds/agent-loggedoff.gsm @@ -526,15 +526,19 @@ share/asterisk/sounds/digits/thousand.gsm share/asterisk/sounds/digits/today.gsm share/asterisk/sounds/digits/tomorrow.gsm share/asterisk/sounds/digits/yesterday.gsm +share/asterisk/sounds/dir-first.gsm +share/asterisk/sounds/dir-firstlast.gsm share/asterisk/sounds/dir-instr.gsm share/asterisk/sounds/dir-intro-fn.gsm share/asterisk/sounds/dir-intro.gsm +share/asterisk/sounds/dir-last.gsm share/asterisk/sounds/dir-multi1.gsm share/asterisk/sounds/dir-multi2.gsm share/asterisk/sounds/dir-multi3.gsm share/asterisk/sounds/dir-multi9.gsm share/asterisk/sounds/dir-nomatch.gsm share/asterisk/sounds/dir-nomore.gsm +share/asterisk/sounds/dir-pls-enter.gsm share/asterisk/sounds/followme/call-from.gsm share/asterisk/sounds/followme/no-recording.gsm share/asterisk/sounds/followme/options.gsm @@ -669,12 +673,20 @@ share/asterisk/sounds/silence/7.gsm share/asterisk/sounds/silence/8.gsm share/asterisk/sounds/silence/9.gsm share/asterisk/sounds/spy-agent.gsm +share/asterisk/sounds/spy-console.gsm share/asterisk/sounds/spy-h323.gsm share/asterisk/sounds/spy-iax.gsm share/asterisk/sounds/spy-iax2.gsm +share/asterisk/sounds/spy-jingle.gsm +share/asterisk/sounds/spy-local.gsm share/asterisk/sounds/spy-mgcp.gsm +share/asterisk/sounds/spy-misdn.gsm +share/asterisk/sounds/spy-mobile.gsm +share/asterisk/sounds/spy-nbs.gsm share/asterisk/sounds/spy-sip.gsm share/asterisk/sounds/spy-skinny.gsm +share/asterisk/sounds/spy-unistim.gsm +share/asterisk/sounds/spy-usbradio.gsm share/asterisk/sounds/spy-zap.gsm share/asterisk/sounds/ss-noservice.gsm share/asterisk/sounds/transfer.gsm @@ -716,6 +728,7 @@ share/asterisk/sounds/vm-incorrect-mailbox.gsm share/asterisk/sounds/vm-incorrect.gsm share/asterisk/sounds/vm-instructions.gsm share/asterisk/sounds/vm-intro.gsm +share/asterisk/sounds/vm-invalidpassword.gsm share/asterisk/sounds/vm-isonphone.gsm share/asterisk/sounds/vm-isunavail.gsm share/asterisk/sounds/vm-last.gsm @@ -738,8 +751,10 @@ share/asterisk/sounds/vm-nomore.gsm share/asterisk/sounds/vm-nonumber.gsm share/asterisk/sounds/vm-num-i-have.gsm share/asterisk/sounds/vm-onefor.gsm +share/asterisk/sounds/vm-onefor-full.gsm share/asterisk/sounds/vm-options.gsm share/asterisk/sounds/vm-opts.gsm +share/asterisk/sounds/vm-opts-full.gsm share/asterisk/sounds/vm-passchanged.gsm share/asterisk/sounds/vm-password.gsm share/asterisk/sounds/vm-press.gsm @@ -767,6 +782,7 @@ share/asterisk/sounds/vm-tempgreeting2.gsm share/asterisk/sounds/vm-tempremoved.gsm share/asterisk/sounds/vm-then-pound.gsm share/asterisk/sounds/vm-theperson.gsm +share/asterisk/sounds/vm-tmpexists.gsm share/asterisk/sounds/vm-tocallback.gsm share/asterisk/sounds/vm-tocallnum.gsm share/asterisk/sounds/vm-tocancel.gsm diff --git a/net/asterisk16/Makefile b/net/asterisk16/Makefile index f972ca541c79..c1c8e5eaa5c1 100644 --- a/net/asterisk16/Makefile +++ b/net/asterisk16/Makefile @@ -6,8 +6,7 @@ # PORTNAME= asterisk -PORTVERSION= 1.4.18.1 -PORTREVISION= 1 +PORTVERSION= 1.4.19.2 CATEGORIES= net MASTER_SITES= http://ftp.digium.com/pub/asterisk/ \ http://ftp.digium.com/pub/asterisk/old-releases/ @@ -50,7 +49,8 @@ OPTIONS= OGGVORBIS "Enable Ogg Vorbis support" on \ FREETDS "Enable FreeTDS support" on \ JABBER "Enable Jabber and Gtalk support" on \ SQLITE "Enable SQLITE support" on \ - CODEC_PATCH "Apply codec negotiation patch" off + CODEC_PATCH "Apply codec negotiation patch" off \ + MISC_PATCHES "Apply additional patches" off .include <bsd.port.pre.mk> @@ -159,13 +159,23 @@ LIB_DEPENDS+= sqlite:${PORTSDIR}/databases/sqlite2 .endif .if defined(WITH_CODEC_PATCH) -PATCHFILES= asterisk-1.4.18-codec-negotiation-20080313.diff.gz +PATCHFILES= asterisk-1.4.19-codec-negotiation-20080408.diff.gz PATCH_SITES= http://b2bua.org/chrome/site/ EXTRA_PATCHES+= ${PATCHDIR}/codecnego-patch-Makefile .else EXTRA_PATCHES+= ${PATCHDIR}/nocodecnego-patch-Makefile .endif +.if defined(WITH_MISC_PATCHES) +EXTRA_PATCHES+= ${PATCHDIR}/dtmf_debug.diff +EXTRA_PATCHES+= ${PATCHDIR}/feature_disconnect.diff +EXTRA_PATCHES+= ${PATCHDIR}/sip_force_callid.diff +.if defined(WITH_CODEC_PATCH) +EXTRA_PATCHES+= ${PATCHDIR}/rtp_force_dtmf-codecnego.diff +.else +EXTRA_PATCHES+= ${PATCHDIR}/rtp_force_dtmf-nocodecnego.diff +.endif +.endif post-patch: ${REINPLACE_CMD} -e 's|/var/lib|${PREFIX}/share|g' ${WRKSRC}/configs/musiconhold.conf.sample diff --git a/net/asterisk16/distinfo b/net/asterisk16/distinfo index c65a3a6dbea6..64a1135cfcd3 100644 --- a/net/asterisk16/distinfo +++ b/net/asterisk16/distinfo @@ -1,6 +1,6 @@ -MD5 (asterisk-1.4.18.1.tar.gz) = a0d7ee4054a04529b745e60dd4e750c4 -SHA256 (asterisk-1.4.18.1.tar.gz) = 5ed2e8b66fc8ac96e516b0ddfea065012e39ef51c8f35ed69c6d7cd74e180d78 -SIZE (asterisk-1.4.18.1.tar.gz) = 11488923 -MD5 (asterisk-1.4.18-codec-negotiation-20080313.diff.gz) = c2bc3b82217383936961a61b239e4635 -SHA256 (asterisk-1.4.18-codec-negotiation-20080313.diff.gz) = 6a6ec9436de24e8c35d5922f7116e65e08052bc6bef6ecc12790736bcf058af5 -SIZE (asterisk-1.4.18-codec-negotiation-20080313.diff.gz) = 38966 +MD5 (asterisk-1.4.19.2.tar.gz) = a942367e20a364510881c086a3517321 +SHA256 (asterisk-1.4.19.2.tar.gz) = b3248b84ec824c3c21861607fdc0c71e4acee16edc570004ee6c9e2f712705c4 +SIZE (asterisk-1.4.19.2.tar.gz) = 11496546 +MD5 (asterisk-1.4.19-codec-negotiation-20080408.diff.gz) = 12db6a4bc354d3eeeee7a900a6060b2f +SHA256 (asterisk-1.4.19-codec-negotiation-20080408.diff.gz) = 55290639455b1117541c5bf560ef8326c3e9414d266459293893b0e3d36c64f9 +SIZE (asterisk-1.4.19-codec-negotiation-20080408.diff.gz) = 39004 diff --git a/net/asterisk16/files/codecnego-patch-Makefile b/net/asterisk16/files/codecnego-patch-Makefile index f474578c3a35..c94aad32f623 100644 --- a/net/asterisk16/files/codecnego-patch-Makefile +++ b/net/asterisk16/files/codecnego-patch-Makefile @@ -1,6 +1,6 @@ ---- Makefile.orig Mon Dec 24 11:53:33 2007 -+++ Makefile Mon Dec 24 11:53:33 2007 -@@ -127,7 +127,7 @@ +--- Makefile.orig 2008-04-08 14:50:57.000000000 +0300 ++++ Makefile 2008-04-08 14:52:01.000000000 +0300 +@@ -129,7 +129,7 @@ ASTMANDIR=$(mandir) ifneq ($(findstring BSD,$(OSARCH)),) ASTVARLIBDIR=$(prefix)/share/asterisk @@ -9,7 +9,7 @@ else ASTVARLIBDIR=$(localstatedir)/lib/asterisk endif -@@ -222,7 +222,7 @@ +@@ -224,7 +224,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 -@@ -402,15 +402,15 @@ +@@ -404,15 +404,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: -@@ -431,45 +431,45 @@ +@@ -433,45 +433,45 @@ OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h))) bininstall: _all @@ -115,16 +115,16 @@ fi $(SUBDIRS_INSTALL): -@@ -496,7 +496,7 @@ - echo " WARNING WARNING WARNING" ;\ - fi +@@ -505,7 +505,7 @@ + @exit 1 + endif --install: datafiles bininstall $(SUBDIRS_INSTALL) -+install: datafiles bininstall $(SUBDIRS_INSTALL) samples +-install: badshell datafiles bininstall $(SUBDIRS_INSTALL) ++install: badshell datafiles bininstall $(SUBDIRS_INSTALL) samples @if [ -x /usr/sbin/asterisk-post-install ]; then \ /usr/sbin/asterisk-post-install $(DESTDIR) . ; \ fi -@@ -534,31 +534,23 @@ +@@ -543,31 +543,23 @@ upgrade: bininstall adsi: @@ -164,7 +164,7 @@ ( \ echo "[directories]" ; \ echo "astetcdir => $(ASTETCDIR)" ; \ -@@ -643,20 +635,23 @@ +@@ -653,20 +645,23 @@ echo "; Default: strict"; \ echo ";"; \ echo ";translation_algorithm = strict"; \ @@ -192,7 +192,7 @@ done @echo " +--------- Asterisk Web Voicemail ----------+" @echo " + +" -@@ -683,10 +678,10 @@ +@@ -693,10 +688,10 @@ __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec rm -rf /tmp/asterisk ; \ diff --git a/net/asterisk16/files/dtmf_debug.diff b/net/asterisk16/files/dtmf_debug.diff new file mode 100644 index 000000000000..81205d40dd46 --- /dev/null +++ b/net/asterisk16/files/dtmf_debug.diff @@ -0,0 +1,225 @@ +--- channels/chan_sip.c.orig 2008-03-18 16:42:59.000000000 +0200 ++++ channels/chan_sip.c 2008-03-18 17:08:34.000000000 +0200 +@@ -3768,6 +3768,7 @@ + ast_log(LOG_WARNING, "old channel wasn't %p but was %p\n", oldchan, p->owner); + else { + p->owner = newchan; ++ ast_rtp_set_chan_name(p->rtp, newchan->name); + ret = 0; + } + if (option_debug > 2) +@@ -4032,6 +4035,7 @@ + if (i->rtp) { + tmp->fds[0] = ast_rtp_fd(i->rtp); + tmp->fds[1] = ast_rtcp_fd(i->rtp); ++ ast_rtp_set_chan_id(i->rtp, i->callid); + } + if (needvideo && i->vrtp) { + tmp->fds[2] = ast_rtp_fd(i->vrtp); +@@ -4059,6 +4063,8 @@ + if (!ast_strlen_zero(i->language)) + ast_string_field_set(tmp, language, i->language); + i->owner = tmp; ++ ast_rtp_set_chan_name(i->rtp, tmp->name); ++ + ast_module_ref(ast_module_info->self); + ast_copy_string(tmp->context, i->context, sizeof(tmp->context)); + /*Since it is valid to have extensions in the dialplan that have unescaped characters in them +@@ -4479,8 +4485,10 @@ + build_via(p); + if (!callid) + build_callid_pvt(p); +- else ++ else { + ast_string_field_set(p, callid, callid); ++ ast_rtp_set_chan_id(p->rtp, p->callid); ++ } + /* Assign default music on hold class */ + ast_string_field_set(p, mohinterpret, default_mohinterpret); + ast_string_field_set(p, mohsuggest, default_mohsuggest); +--- include/asterisk/rtp.h.orig 2008-03-18 13:35:42.000000000 +0200 ++++ include/asterisk/rtp.h 2008-03-18 13:35:58.000000000 +0200 +@@ -251,6 +251,9 @@ + + int ast_rtp_codec_getformat(int pt); + ++void ast_rtp_set_chan_name(struct ast_rtp *, const char *); ++void ast_rtp_set_chan_id(struct ast_rtp *, const char *); ++ + /*! \brief Set rtp timeout */ + void ast_rtp_set_rtptimeout(struct ast_rtp *rtp, int timeout); + /*! \brief Set rtp hold timeout */ +--- main/rtp.c.orig 2008-04-08 14:53:18.000000000 +0300 ++++ main/rtp.c 2008-04-08 14:54:14.000000000 +0300 +@@ -81,6 +81,7 @@ + static int rtpstart; /*!< First port for RTP sessions (set in rtp.conf) */ + static int rtpend; /*!< Last port for RTP sessions (set in rtp.conf) */ + static int rtpdebug; /*!< Are we debugging? */ ++static int rtpdebugdtmf; /*!< Are we debugging DTMFs? */ + static int rtcpdebug; /*!< Are we debugging RTCP? */ + static int rtcpstats; /*!< Are we debugging RTCP? */ + static int rtcpinterval = RTCP_DEFAULT_INTERVALMS; /*!< Time between rtcp reports in millisecs */ +@@ -168,6 +169,8 @@ + struct ast_codec_pref pref; + struct ast_rtp *bridged; /*!< Who we are Packet bridged to */ + int set_marker_bit:1; /*!< Whether to set the marker bit or not */ ++ char chan_name[100]; ++ char chan_id[100]; + }; + + /* Forward declarations */ +@@ -669,8 +672,8 @@ + struct ast_frame *f = NULL; + event = ntohl(*((unsigned int *)(data))); + event &= 0x001F; +- if (option_debug > 2 || rtpdebug) +- ast_log(LOG_DEBUG, "Cisco DTMF Digit: %08x (len = %d)\n", event, len); ++ if (option_debug > 2 || rtpdebug || rtpdebugdtmf) ++ ast_log(LOG_DEBUG, "Channel: %s %s Cisco DTMF packet: %08x (len = %d)\n", rtp->chan_name, rtp->chan_id, event, len); + if (event < 10) { + resp = '0' + event; + } else if (event < 11) { +@@ -684,12 +687,24 @@ + } + if (rtp->resp && (rtp->resp != resp)) { + f = send_dtmf(rtp, AST_FRAME_DTMF_END); ++ ast_log(LOG_DEBUG, "Channel: %s %s Cisco DTMF event: %c\n", rtp->chan_name, rtp->chan_id, rtp->resp); + } + rtp->resp = resp; + rtp->dtmfcount = dtmftimeout; + return f; + } + ++void ast_rtp_set_chan_id(struct ast_rtp *rtp, const char *chan_id) { ++ if (rtp == NULL || chan_id == NULL) ++ return; ++ snprintf(rtp->chan_id, sizeof(rtp->chan_id), "%s", chan_id); ++} ++ ++void ast_rtp_set_chan_name(struct ast_rtp *rtp, const char *chan_name) { ++ if (rtp == NULL || chan_name == NULL) ++ return; ++ snprintf(rtp->chan_name, sizeof(rtp->chan_name), "%s", chan_name); ++} + /*! + * \brief Process RTP DTMF and events according to RFC 2833. + * +@@ -1051,6 +1066,10 @@ + struct rtpPayloadType rtpPT; + int reconstruct = ntohl(rtpheader[0]); + ++ /* If we are listening for DTMF - then feed all packets into the core to keep the RTP stream consistent when relaying DTMFs */ ++ if (ast_test_flag(rtp, FLAG_P2P_NEED_DTMF)) ++ return -1; ++ + /* Get fields from packet */ + payload = (reconstruct & 0x7f0000) >> 16; + mark = (((reconstruct & 0x800000) >> 23) != 0); +@@ -1062,10 +1081,6 @@ + if (!bridged->current_RTP_PT[payload].code) + return -1; + +- /* If the payload is DTMF, and we are listening for DTMF - then feed it into the core */ +- if (ast_test_flag(rtp, FLAG_P2P_NEED_DTMF) && !rtpPT.isAstFormat && rtpPT.code == AST_RTP_DTMF) +- return -1; +- + /* Otherwise adjust bridged payload to match */ + bridged_payload = ast_rtp_lookup_code(bridged, rtpPT.isAstFormat, rtpPT.code); + +@@ -1254,11 +1269,12 @@ + /* This is special in-band data that's not one of our codecs */ + if (rtpPT.code == AST_RTP_DTMF) { + /* It's special -- rfc2833 process it */ +- if (rtp_debug_test_addr(&sin)) { ++ if (rtp_debug_test_addr(&sin) || rtpdebugdtmf) { + unsigned char *data; + unsigned int event; + unsigned int event_end; + unsigned int duration; ++ + data = rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen; + event = ntohl(*((unsigned int *)(data))); + event >>= 24; +@@ -1267,9 +1283,12 @@ + event_end >>= 24; + duration = ntohl(*((unsigned int *)(data))); + duration &= 0xFFFF; +- ast_verbose("Got RTP RFC2833 from %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d) \n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration); ++ ++ ast_verbose("Channel: %s %s Got RTP RFC2833 from %s:%u to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d)\n", rtp->chan_name, rtp->chan_id, ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), ast_inet_ntoa(rtp->us.sin_addr), ntohs(rtp->us.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration); + } + f = process_rfc2833(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen, seqno, timestamp); ++ if (rtpdebugdtmf && f) ++ ast_verbose("Channel: %s %s Got RFC2833 DTMF event %c of type %s\n", rtp->chan_name, rtp->chan_id, f->subclass, (f->frametype == AST_FRAME_DTMF_BEGIN ? "DTMF BEGIN" : (f->frametype == AST_FRAME_DTMF_END ? "DTMF_END" : "UNKNOWN"))); + } else if (rtpPT.code == AST_RTP_CISCO_DTMF) { + /* It's really special -- process it the Cisco way */ + if (rtp->lastevent <= seqno || (rtp->lastevent >= 65530 && seqno <= 6)) { +@@ -2198,8 +2217,9 @@ + ast_log(LOG_ERROR, "RTP Transmission error to %s:%u: %s\n", + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), strerror(errno)); +- if (rtp_debug_test_addr(&rtp->them)) +- ast_verbose("Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ if (rtp_debug_test_addr(&rtp->them) || rtpdebugdtmf) ++ ast_verbose("Channel: %s %s Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ rtp->chan_name, rtp->chan_id, + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), payload, rtp->seqno, rtp->lastdigitts, res - hdrlen); + /* Increment sequence number */ +@@ -2242,8 +2262,9 @@ + ast_log(LOG_ERROR, "RTP Transmission error to %s:%d: %s\n", + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), strerror(errno)); +- if (rtp_debug_test_addr(&rtp->them)) +- ast_verbose("Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ if (rtp_debug_test_addr(&rtp->them) || rtpdebugdtmf) ++ ast_verbose("Channel: %s %s Sent RTP DTMF packet to %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n", ++ rtp->chan_name, rtp->chan_id, + ast_inet_ntoa(rtp->them.sin_addr), + ntohs(rtp->them.sin_port), rtp->send_payload, rtp->seqno, rtp->lastdigitts, res - hdrlen); + +@@ -3481,6 +3502,16 @@ + return RESULT_SUCCESS; + } + ++static int rtp_do_debug_dtmf(int fd, int argc, char *argv[]) ++{ ++ if (argc != 3) ++ return RESULT_SHOWUSAGE; ++ ++ rtpdebugdtmf = 1; ++ ast_cli(fd, "RTP DTMF debugging enabled\n"); ++ return RESULT_SUCCESS; ++} ++ + static int rtp_do_debug(int fd, int argc, char *argv[]) + { + if (argc != 2) { +@@ -3541,6 +3572,7 @@ + if (argc != 3) + return RESULT_SHOWUSAGE; + rtpdebug = 0; ++ rtpdebugdtmf = 0; + ast_cli(fd,"RTP Debugging Disabled\n"); + return RESULT_SUCCESS; + } +@@ -3601,7 +3633,7 @@ + } + + static char debug_usage[] = +- "Usage: rtp debug [ip host[:port]]\n" ++ "Usage: rtp debug [ip host[:port] | dtmf]\n" + " Enable dumping of all RTP packets to and from host.\n"; + + static char no_debug_usage[] = +@@ -3676,6 +3708,10 @@ + rtp_do_debug, "Enable RTP debugging", + debug_usage }, + ++ { { "rtp", "debug", "dtmf", NULL }, ++ rtp_do_debug_dtmf, "Enable RTP debugging on DTMFs", ++ debug_usage }, ++ + { { "rtp", "debug", "off", NULL }, + rtp_no_debug, "Disable RTP debugging", + no_debug_usage, NULL, &cli_rtp_no_debug_deprecated }, diff --git a/net/asterisk16/files/feature_disconnect.diff b/net/asterisk16/files/feature_disconnect.diff new file mode 100644 index 000000000000..5be713b0da13 --- /dev/null +++ b/net/asterisk16/files/feature_disconnect.diff @@ -0,0 +1,292 @@ +--- 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) + { +--- 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 */ +--- res/res_features.c.orig 2008-04-08 14:55:25.000000000 +0300 ++++ res/res_features.c 2008-04-08 14:59:59.000000000 +0300 +@@ -485,18 +485,6 @@ + } + + +-#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 + */ +@@ -1061,32 +1049,35 @@ + 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, code=%s, sense=%d, features=%d dynamic=%s\n", chan->name, peer->name, code, 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) +@@ -1094,7 +1085,6 @@ + } + } + } +- ast_rwlock_unlock(&features_lock); + + if (ast_strlen_zero(dynamic_features)) + return res; +@@ -1102,9 +1092,7 @@ + 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; + } + +@@ -1112,21 +1100,52 @@ + 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; ++} ++ + static void set_config_flags(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config) + { + int x; diff --git a/net/asterisk16/files/nocodecnego-patch-Makefile b/net/asterisk16/files/nocodecnego-patch-Makefile index f73c3d83bcde..1d9675f1d664 100644 --- a/net/asterisk16/files/nocodecnego-patch-Makefile +++ b/net/asterisk16/files/nocodecnego-patch-Makefile @@ -1,6 +1,6 @@ ---- Makefile.orig Mon Dec 17 08:44:51 2007 -+++ Makefile Mon Dec 24 11:54:52 2007 -@@ -127,7 +127,7 @@ +--- Makefile.orig 2008-03-25 16:37:35.000000000 +0200 ++++ Makefile 2008-04-08 15:02:12.000000000 +0300 +@@ -129,7 +129,7 @@ ASTMANDIR=$(mandir) ifneq ($(findstring BSD,$(OSARCH)),) ASTVARLIBDIR=$(prefix)/share/asterisk @@ -9,7 +9,7 @@ else ASTVARLIBDIR=$(localstatedir)/lib/asterisk endif -@@ -222,7 +222,7 @@ +@@ -224,7 +224,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 -@@ -402,15 +402,15 @@ +@@ -404,15 +404,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: -@@ -431,45 +431,45 @@ +@@ -433,45 +433,45 @@ OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h))) bininstall: _all @@ -115,16 +115,16 @@ fi $(SUBDIRS_INSTALL): -@@ -496,7 +496,7 @@ - echo " WARNING WARNING WARNING" ;\ - fi +@@ -505,7 +505,7 @@ + @exit 1 + endif --install: datafiles bininstall $(SUBDIRS_INSTALL) -+install: datafiles bininstall $(SUBDIRS_INSTALL) samples +-install: badshell datafiles bininstall $(SUBDIRS_INSTALL) ++install: badshell datafiles bininstall $(SUBDIRS_INSTALL) samples @if [ -x /usr/sbin/asterisk-post-install ]; then \ /usr/sbin/asterisk-post-install $(DESTDIR) . ; \ fi -@@ -534,31 +534,23 @@ +@@ -543,31 +543,23 @@ upgrade: bininstall adsi: @@ -164,7 +164,7 @@ ( \ echo "[directories]" ; \ echo "astetcdir => $(ASTETCDIR)" ; \ -@@ -602,20 +594,23 @@ +@@ -612,20 +604,23 @@ echo ";astctlowner = root" ; \ echo ";astctlgroup = apache" ; \ echo ";astctl = asterisk.ctl" ; \ @@ -192,7 +192,7 @@ done @echo " +--------- Asterisk Web Voicemail ----------+" @echo " + +" -@@ -642,10 +637,10 @@ +@@ -652,10 +647,10 @@ __rpm: include/asterisk/version.h include/asterisk/buildopts.h spec rm -rf /tmp/asterisk ; \ diff --git a/net/asterisk16/files/patch-apps::app_dial.c b/net/asterisk16/files/patch-apps::app_dial.c deleted file mode 100644 index 6abe48a17d9f..000000000000 --- a/net/asterisk16/files/patch-apps::app_dial.c +++ /dev/null @@ -1,88 +0,0 @@ ---- 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/asterisk16/files/patch-channels::chan_sip.c b/net/asterisk16/files/patch-channels::chan_sip.c index 916cc7ffa0ac..e54df0eb1bf1 100644 --- a/net/asterisk16/files/patch-channels::chan_sip.c +++ b/net/asterisk16/files/patch-channels::chan_sip.c @@ -1,6 +1,6 @@ ---- 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 @@ +--- channels/chan_sip.c.orig 2008-03-18 16:42:59.000000000 +0200 ++++ channels/chan_sip.c 2008-03-18 17:08:34.000000000 +0200 +@@ -495,7 +495,7 @@ #define DEFAULT_MOHINTERPRET "default" #define DEFAULT_MOHSUGGEST "" #define DEFAULT_VMEXTEN "asterisk" @@ -9,16 +9,7 @@ #define DEFAULT_NOTIFYMIME "application/simple-message-summary" #define DEFAULT_MWITIME 10 #define DEFAULT_ALLOWGUEST TRUE -@@ -3985,6 +3985,8 @@ - ast_codec_pref_remove2(&tmp->nativeformats, ~i->usercapability); - fmt = ast_codec_pref_index_audio(&tmp->nativeformats, 0); - -+ pbx_builtin_setvar_helper(tmp, "SIP_CODEC_USED", ast_getformatname(fmt)); -+ - /* 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. -@@ -15845,6 +15847,9 @@ +@@ -15873,6 +15881,9 @@ char *ext, *host; char tmp[256]; char *dest = data; @@ -26,9 +17,9 @@ + 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 @@ + oldformat = format; + if (!(format &= ((AST_FORMAT_MAX_AUDIO << 1) - 1))) { +@@ -15903,6 +15914,17 @@ if (host) { *host++ = '\0'; ext = tmp; @@ -46,7 +37,7 @@ } else { ext = strchr(tmp, '/'); if (ext) -@@ -15898,6 +15914,14 @@ +@@ -15933,6 +15955,14 @@ ast_string_field_set(p, username, ext); ast_string_field_free(p, fullcontact); } diff --git a/net/asterisk16/files/patch-channels::h323::ast_h323.cxx b/net/asterisk16/files/patch-channels::h323::ast_h323.cxx new file mode 100644 index 000000000000..bfc819452128 --- /dev/null +++ b/net/asterisk16/files/patch-channels::h323::ast_h323.cxx @@ -0,0 +1,29 @@ +--- channels/h323/ast_h323.cxx.orig 2008-04-08 15:08:37.000000000 +0300 ++++ channels/h323/ast_h323.cxx 2008-04-08 15:08:51.000000000 +0300 +@@ -81,8 +81,6 @@ + /** PWLib entry point */ + static MyProcess *localProcess = NULL; + +-static int _timerChangePipe[2]; +- + static unsigned traceOptions = PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine; + + class PAsteriskLog : public PObject, public iostream { +@@ -191,8 +189,6 @@ + + MyProcess::~MyProcess() + { +- _timerChangePipe[0] = timerChangePipe[0]; +- _timerChangePipe[1] = timerChangePipe[1]; + } + + void MyProcess::Main() +@@ -2460,8 +2456,6 @@ + if (localProcess) { + delete localProcess; + localProcess = NULL; +- close(_timerChangePipe[0]); +- close(_timerChangePipe[1]); + } + if (logstream) { + PTrace::SetLevel(0); diff --git a/net/asterisk16/files/patch-include::asterisk::features.h b/net/asterisk16/files/patch-include::asterisk::features.h deleted file mode 100644 index fa5c747eb316..000000000000 --- a/net/asterisk16/files/patch-include::asterisk::features.h +++ /dev/null @@ -1,57 +0,0 @@ ---- 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/asterisk16/files/patch-main::Makefile b/net/asterisk16/files/patch-main::Makefile index 3d1365ea46fa..56624065f61f 100644 --- a/net/asterisk16/files/patch-main::Makefile +++ b/net/asterisk16/files/patch-main::Makefile @@ -1,8 +1,5 @@ - -$FreeBSD$ - ---- main/Makefile.orig -+++ main/Makefile +--- main/Makefile.orig 2008-01-29 19:43:41.000000000 +0200 ++++ main/Makefile 2008-03-13 13:57:48.000000000 +0200 @@ -102,8 +102,8 @@ cd editline && test -f config.h || CFLAGS="$(PTHREAD_CFLAGS) $(subst $(ASTTOPDIR),../../,$(ASTCFLAGS:-Werror=))" LDFLAGS="$(ASTLDFLAGS)" ./configure --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) --with-ncurses=$(NCURSES_DIR) --with-curses=$(CURSES_DIR) --with-termcap=$(TERMCAP_DIR) --with-tinfo=$(TINFO_DIR) $(MAKE) -C editline libedit.a diff --git a/net/asterisk16/files/patch-main::manager.c b/net/asterisk16/files/patch-main::manager.c new file mode 100644 index 000000000000..686068b09e09 --- /dev/null +++ b/net/asterisk16/files/patch-main::manager.c @@ -0,0 +1,31 @@ +--- main/manager.c.orig 2008-04-02 15:49:38.000000000 +0300 ++++ main/manager.c 2008-04-02 15:42:18.000000000 +0300 +@@ -176,6 +176,7 @@ + struct eventqent *eventq; + /* Timeout for ast_carefulwrite() */ + int writetimeout; ++ int pending_event; + AST_LIST_ENTRY(mansession) list; + }; + +@@ -2214,6 +2215,11 @@ + fds[0].events = POLLIN; + do { + ast_mutex_lock(&s->__lock); ++ if (s->pending_event) { ++ s->pending_event = 0; ++ ast_mutex_unlock(&s->__lock); ++ return 0; ++ } + s->waiting_thread = pthread_self(); + ast_mutex_unlock(&s->__lock); + +@@ -2475,6 +2481,8 @@ + ast_mutex_lock(&s->__lock); + if (s->waiting_thread != AST_PTHREADT_NULL) + pthread_kill(s->waiting_thread, SIGURG); ++ else ++ s->pending_event = 1; + ast_mutex_unlock(&s->__lock); + } + AST_LIST_UNLOCK(&sessions); diff --git a/net/asterisk16/files/patch-res::res_features.c b/net/asterisk16/files/patch-res::res_features.c deleted file mode 100644 index c21775f1690d..000000000000 --- a/net/asterisk16/files/patch-res::res_features.c +++ /dev/null @@ -1,144 +0,0 @@ ---- 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; - } - diff --git a/net/asterisk16/files/rtp_force_dtmf-codecnego.diff b/net/asterisk16/files/rtp_force_dtmf-codecnego.diff new file mode 100644 index 000000000000..7cd43e08d238 --- /dev/null +++ b/net/asterisk16/files/rtp_force_dtmf-codecnego.diff @@ -0,0 +1,86 @@ +--- channels/chan_sip.c.orig 2008-03-12 17:37:00.000000000 +0200 ++++ channels/chan_sip.c 2008-03-12 18:17:33.000000000 +0200 +@@ -554,6 +554,9 @@ + static unsigned int global_tos_sip; /*!< IP type of service for SIP packets */ + static unsigned int global_tos_audio; /*!< IP type of service for audio RTP packets */ + static unsigned int global_tos_video; /*!< IP type of service for video RTP packets */ ++static int global_force_dtmf_relay = 0; ++static int global_force_dtmf_relay_pt = 101; ++ + static int compactheaders; /*!< send compact sip headers */ + static int recordhistory; /*!< Record SIP history. Off by default */ + static int dumphistory; /*!< Dump history to verbose before destroying SIP dialog */ +@@ -4983,6 +4986,8 @@ + int codec_index = 0; + int codec_pt_order[256]; + ++ int dtmf_present = 0; ++ + if (!p->rtp) { + ast_log(LOG_ERROR, "Got SDP but have no RTP session allocated.\n"); + return -1; +@@ -5408,12 +5413,20 @@ + for (x = 0; x < codec_index; ++x) { + struct rtpPayloadType pt; + pt = ast_rtp_lookup_pt(p->rtp, codec_pt_order[x]); ++ if (pt.code == AST_RTP_DTMF) ++ dtmf_present = 1; + if (!pt.isAstFormat && !pt.code && p->vrtp) + pt = ast_rtp_lookup_pt(p->vrtp, codec_pt_order[x]); + if (pt.isAstFormat) + ast_codec_pref_append(&p->formats, pt.code); + } + ast_codec_pref_remove2(&p->formats, ~p->usercapability); ++ if (!dtmf_present && global_force_dtmf_relay) { ++ newnoncodeccapability |= AST_RTP_DTMF; ++ ast_rtp_set_m_type(newaudiortp, global_force_dtmf_relay_pt); ++ codec_pt_order[codec_index++] = global_force_dtmf_relay_pt; ++ ast_rtp_set_rtpmap_type(newaudiortp, global_force_dtmf_relay_pt, "audio", "telephone-event", 0); ++ } + + /* Now gather all of the codecs that we are asked for: */ + ast_rtp_get_current_formats(newaudiortp, &peercapability, &peernoncodeccapability); +@@ -16845,6 +16858,9 @@ + + global_matchexterniplocally = FALSE; + ++ global_force_dtmf_relay = 0; ++ global_force_dtmf_relay_pt = 101; ++ + /* Copy the default jb config over global_jbconf */ + memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf)); + +@@ -16901,6 +16917,18 @@ + } + } else if (!strcasecmp(v->name, "vmexten")) { + ast_copy_string(default_vmexten, v->value, sizeof(default_vmexten)); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay")) { ++ if ((global_force_dtmf_relay = ast_true(v->value))) ++ ast_verbose("RTP DTMF relaying will be enforced\n"); ++ else ++ ast_verbose("RTP DTMF relaying will not be enforced\n"); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay_pt")) { ++ sscanf(v->value, "%d", &global_force_dtmf_relay_pt); ++ if (global_force_dtmf_relay_pt < 96 || global_force_dtmf_relay_pt > 255) { ++ ast_verbose("RTP forced DTMF relay payload type is not valid: %d. Using default (101)\n", global_force_dtmf_relay_pt); ++ global_force_dtmf_relay_pt = 101; ++ } else ++ ast_log(LOG_WARNING, "RTP forced DTMF relay payload type is %d\n", global_force_dtmf_relay_pt); + } else if (!strcasecmp(v->name, "rtptimeout")) { + if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) { + ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno); +--- configs/sip.conf.sample.orig 2008-03-12 17:57:19.000000000 +0200 ++++ configs/sip.conf.sample 2008-03-12 18:13:03.000000000 +0200 +@@ -53,6 +53,12 @@ + ; and multiline formatted headers for strict + ; SIP compatibility (defaults to "no") + ++;rtp_force_dtmf_relay=no ; Enable RFC2833 DTMFs to be sent even if peer ++ ; hasn't announced support for it. Default: no ++ ++;rtp_force_dtmf_relay_pt=101 ; RTP payload type value for enforced RFC2833 ++ ; DTMFs. Default: 101 ++ + ; See doc/README.tos for a description of these parameters. + ;tos_sip=cs3 ; Sets TOS for SIP packets. + ;tos_audio=ef ; Sets TOS for RTP audio packets. diff --git a/net/asterisk16/files/rtp_force_dtmf-nocodecnego.diff b/net/asterisk16/files/rtp_force_dtmf-nocodecnego.diff new file mode 100644 index 000000000000..776422b34645 --- /dev/null +++ b/net/asterisk16/files/rtp_force_dtmf-nocodecnego.diff @@ -0,0 +1,70 @@ +--- channels/chan_sip.c.orig 2008-01-31 21:52:49.000000000 +0200 ++++ channels/chan_sip.c 2008-03-14 17:50:57.000000000 +0200 +@@ -556,6 +556,9 @@ + static unsigned int global_tos_sip; /*!< IP type of service for SIP packets */ + static unsigned int global_tos_audio; /*!< IP type of service for audio RTP packets */ + static unsigned int global_tos_video; /*!< IP type of service for video RTP packets */ ++static int global_force_dtmf_relay = 0; ++static int global_force_dtmf_relay_pt = 101; ++ + static int compactheaders; /*!< send compact sip headers */ + static int recordhistory; /*!< Record SIP history. Off by default */ + static int dumphistory; /*!< Dump history to verbose before destroying SIP dialog */ +@@ -5392,6 +5395,13 @@ + + /* Now gather all of the codecs that we are asked for: */ + ast_rtp_get_current_formats(newaudiortp, &peercapability, &peernoncodeccapability); ++ /* Add telephone-event */ ++ if (global_force_dtmf_relay && !(peernoncodeccapability & AST_RTP_DTMF)) { ++ ast_rtp_set_m_type(newaudiortp, global_force_dtmf_relay_pt); ++ found_rtpmap_codecs[last_rtpmap_codec++] = global_force_dtmf_relay_pt; ++ ast_rtp_set_rtpmap_type(newaudiortp, global_force_dtmf_relay_pt, "audio", "telephone-event", 0); ++ peernoncodeccapability |= AST_RTP_DTMF; ++ } + ast_rtp_get_current_formats(newvideortp, &vpeercapability, &vpeernoncodeccapability); + + newjointcapability = p->capability & (peercapability | vpeercapability); +@@ -16833,6 +16843,9 @@ + + global_matchexterniplocally = FALSE; + ++ global_force_dtmf_relay = 0; ++ global_force_dtmf_relay_pt = 101; ++ + /* Copy the default jb config over global_jbconf */ + memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf)); + +@@ -16889,6 +16902,18 @@ + } + } else if (!strcasecmp(v->name, "vmexten")) { + ast_copy_string(default_vmexten, v->value, sizeof(default_vmexten)); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay")) { ++ if ((global_force_dtmf_relay = ast_true(v->value))) ++ ast_verbose("RTP DTMF relaying will be enforced\n"); ++ else ++ ast_verbose("RTP DTMF relaying will not be enforced\n"); ++ } else if (!strcasecmp(v->name, "rtp_force_dtmf_relay_pt")) { ++ sscanf(v->value, "%d", &global_force_dtmf_relay_pt); ++ if (global_force_dtmf_relay_pt < 96 || global_force_dtmf_relay_pt > 255) { ++ ast_verbose("RTP forced DTMF relay payload type is not valid: %d. Using default (101)\n", global_force_dtmf_relay_pt); ++ global_force_dtmf_relay_pt = 101; ++ } else ++ ast_log(LOG_WARNING, "RTP forced DTMF relay payload type is %d\n", global_force_dtmf_relay_pt); + } else if (!strcasecmp(v->name, "rtptimeout")) { + if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) { + ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno); +--- configs/sip.conf.sample.orig 2008-03-12 17:57:19.000000000 +0200 ++++ configs/sip.conf.sample 2008-03-12 18:13:03.000000000 +0200 +@@ -53,6 +53,12 @@ + ; and multiline formatted headers for strict + ; SIP compatibility (defaults to "no") + ++;rtp_force_dtmf_relay=no ; Enable RFC2833 DTMFs to be sent even if peer ++ ; hasn't announced support for it. Default: no ++ ++;rtp_force_dtmf_relay_pt=101 ; RTP payload type value for enforced RFC2833 ++ ; DTMFs. Default: 101 ++ + ; See doc/README.tos for a description of these parameters. + ;tos_sip=cs3 ; Sets TOS for SIP packets. + ;tos_audio=ef ; Sets TOS for RTP audio packets. diff --git a/net/asterisk16/files/sip_force_callid.diff b/net/asterisk16/files/sip_force_callid.diff new file mode 100644 index 000000000000..67a3e0192633 --- /dev/null +++ b/net/asterisk16/files/sip_force_callid.diff @@ -0,0 +1,12 @@ +--- channels/chan_sip.c.orig 2008-04-09 11:39:09.000000000 +0300 ++++ channels/chan_sip.c 2008-04-09 11:40:28.000000000 +0300 +@@ -2998,6 +2998,9 @@ + p->t38.state = T38_LOCAL_DIRECT; + if (option_debug) + ast_log(LOG_DEBUG,"T38State change to %d on channel %s\n", p->t38.state, ast->name); ++ } else if (!strcasecmp(ast_var_name(current), "SIP_FORCE_CALLID")) { ++ ++ ast_string_field_set(p, callid, ast_var_value(current)); + } + + } diff --git a/net/asterisk16/pkg-plist b/net/asterisk16/pkg-plist index 7bcd9f5265f4..85ea7e48e505 100644 --- a/net/asterisk16/pkg-plist +++ b/net/asterisk16/pkg-plist @@ -295,7 +295,6 @@ lib/asterisk/modules/codec_adpcm.so lib/asterisk/modules/codec_alaw.so lib/asterisk/modules/codec_g726.so lib/asterisk/modules/codec_gsm.so -lib/asterisk/modules/codec_ilbc.so lib/asterisk/modules/codec_lpc10.so lib/asterisk/modules/codec_speex.so lib/asterisk/modules/codec_ulaw.so @@ -380,8 +379,9 @@ share/asterisk/moh/LICENSE-asterisk-moh-freeplay-wav share/asterisk/moh/fpm-calm-river.wav share/asterisk/moh/fpm-sunshine.wav share/asterisk/moh/fpm-world-mix.wav -share/asterisk/sounds/.asterisk-core-sounds-en-gsm-1.4.8 -share/asterisk/sounds/CREDITS-asterisk-core-en-1.4.8 +share/asterisk/sounds/.asterisk-core-sounds-en-gsm-1.4.9 +share/asterisk/sounds/CHANGES-asterisk-core-en-1.4.9 +share/asterisk/sounds/CREDITS-asterisk-core-en-1.4.9 share/asterisk/sounds/agent-alreadyon.gsm share/asterisk/sounds/agent-incorrect.gsm share/asterisk/sounds/agent-loggedoff.gsm @@ -526,15 +526,19 @@ share/asterisk/sounds/digits/thousand.gsm share/asterisk/sounds/digits/today.gsm share/asterisk/sounds/digits/tomorrow.gsm share/asterisk/sounds/digits/yesterday.gsm +share/asterisk/sounds/dir-first.gsm +share/asterisk/sounds/dir-firstlast.gsm share/asterisk/sounds/dir-instr.gsm share/asterisk/sounds/dir-intro-fn.gsm share/asterisk/sounds/dir-intro.gsm +share/asterisk/sounds/dir-last.gsm share/asterisk/sounds/dir-multi1.gsm share/asterisk/sounds/dir-multi2.gsm share/asterisk/sounds/dir-multi3.gsm share/asterisk/sounds/dir-multi9.gsm share/asterisk/sounds/dir-nomatch.gsm share/asterisk/sounds/dir-nomore.gsm +share/asterisk/sounds/dir-pls-enter.gsm share/asterisk/sounds/followme/call-from.gsm share/asterisk/sounds/followme/no-recording.gsm share/asterisk/sounds/followme/options.gsm @@ -669,12 +673,20 @@ share/asterisk/sounds/silence/7.gsm share/asterisk/sounds/silence/8.gsm share/asterisk/sounds/silence/9.gsm share/asterisk/sounds/spy-agent.gsm +share/asterisk/sounds/spy-console.gsm share/asterisk/sounds/spy-h323.gsm share/asterisk/sounds/spy-iax.gsm share/asterisk/sounds/spy-iax2.gsm +share/asterisk/sounds/spy-jingle.gsm +share/asterisk/sounds/spy-local.gsm share/asterisk/sounds/spy-mgcp.gsm +share/asterisk/sounds/spy-misdn.gsm +share/asterisk/sounds/spy-mobile.gsm +share/asterisk/sounds/spy-nbs.gsm share/asterisk/sounds/spy-sip.gsm share/asterisk/sounds/spy-skinny.gsm +share/asterisk/sounds/spy-unistim.gsm +share/asterisk/sounds/spy-usbradio.gsm share/asterisk/sounds/spy-zap.gsm share/asterisk/sounds/ss-noservice.gsm share/asterisk/sounds/transfer.gsm @@ -716,6 +728,7 @@ share/asterisk/sounds/vm-incorrect-mailbox.gsm share/asterisk/sounds/vm-incorrect.gsm share/asterisk/sounds/vm-instructions.gsm share/asterisk/sounds/vm-intro.gsm +share/asterisk/sounds/vm-invalidpassword.gsm share/asterisk/sounds/vm-isonphone.gsm share/asterisk/sounds/vm-isunavail.gsm share/asterisk/sounds/vm-last.gsm @@ -738,8 +751,10 @@ share/asterisk/sounds/vm-nomore.gsm share/asterisk/sounds/vm-nonumber.gsm share/asterisk/sounds/vm-num-i-have.gsm share/asterisk/sounds/vm-onefor.gsm +share/asterisk/sounds/vm-onefor-full.gsm share/asterisk/sounds/vm-options.gsm share/asterisk/sounds/vm-opts.gsm +share/asterisk/sounds/vm-opts-full.gsm share/asterisk/sounds/vm-passchanged.gsm share/asterisk/sounds/vm-password.gsm share/asterisk/sounds/vm-press.gsm @@ -767,6 +782,7 @@ share/asterisk/sounds/vm-tempgreeting2.gsm share/asterisk/sounds/vm-tempremoved.gsm share/asterisk/sounds/vm-then-pound.gsm share/asterisk/sounds/vm-theperson.gsm +share/asterisk/sounds/vm-tmpexists.gsm share/asterisk/sounds/vm-tocallback.gsm share/asterisk/sounds/vm-tocallnum.gsm share/asterisk/sounds/vm-tocancel.gsm |