Call Parking and Pickup API Includes code and algorithms from the Zapata library. More...
#include "asterisk/pbx.h"#include "asterisk/linkedlists.h"

Go to the source code of this file.
Data Structures | |
| struct | ast_call_feature |
Defines | |
| #define | AST_FEATURE_RETURN_HANGUP -1 |
| #define | AST_FEATURE_RETURN_KEEPTRYING 24 |
| #define | AST_FEATURE_RETURN_NO_HANGUP_PEER AST_PBX_NO_HANGUP_PEER |
| #define | AST_FEATURE_RETURN_PARKFAILED 25 |
| #define | AST_FEATURE_RETURN_PASSDIGITS 21 |
| #define | AST_FEATURE_RETURN_PBX_KEEPALIVE AST_PBX_KEEPALIVE |
| #define | AST_FEATURE_RETURN_STOREDIGITS 22 |
| #define | AST_FEATURE_RETURN_SUCCESS 23 |
| #define | AST_FEATURE_RETURN_SUCCESSBREAK 0 |
| #define | DEFAULT_PARKINGLOT "default" |
| #define | FEATURE_APP_ARGS_LEN 256 |
| #define | FEATURE_APP_LEN 64 |
| #define | FEATURE_EXTEN_LEN 32 |
| #define | FEATURE_MAX_LEN 11 |
| #define | FEATURE_MOH_LEN 80 |
| #define | FEATURE_SENSE_CHAN (1 << 0) |
| #define | FEATURE_SENSE_PEER (1 << 1) |
| #define | FEATURE_SNAME_LEN 32 |
Typedefs | |
| typedef int(* | ast_feature_operation )(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data) |
Enumerations | |
| enum | { AST_FEATURE_FLAG_NEEDSDTMF = (1 << 0), AST_FEATURE_FLAG_ONPEER = (1 << 1), AST_FEATURE_FLAG_ONSELF = (1 << 2), AST_FEATURE_FLAG_BYCALLEE = (1 << 3), AST_FEATURE_FLAG_BYCALLER = (1 << 4), AST_FEATURE_FLAG_BYBOTH = (3 << 3) } |
main call feature structure More... | |
Functions | |
| int | ast_bridge_call (struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config) |
| Bridge a call, optionally allowing redirection. | |
| void | ast_bridge_end_dtmf (struct ast_channel *chan, char digit, struct timeval start, const char *why) |
| Simulate a DTMF end on a broken bridge channel. | |
| int | ast_bridge_timelimit (struct ast_channel *chan, struct ast_bridge_config *config, char *parse, struct timeval *calldurationlimit) |
| parse L option and read associated channel variables to set warning, warning frequency, and timelimit | |
| int | ast_can_pickup (struct ast_channel *chan) |
| Test if a channel can be picked up. | |
| int | ast_do_pickup (struct ast_channel *chan, struct ast_channel *target) |
| Pickup a call target. | |
| int | ast_feature_detect (struct ast_channel *chan, struct ast_flags *features, const char *code, struct ast_call_feature *feature) |
| detect a feature before bridging | |
| int | ast_features_reload (void) |
| Reload call features from features.conf. | |
| struct ast_call_feature * | ast_find_call_feature (const char *name) |
| look for a call feature entry by its sname | |
| int | ast_masq_park_call (struct ast_channel *park_me, struct ast_channel *parker, int timeout, int *extout) |
| Park a call via a masqueraded channel. | |
| int | ast_masq_park_call_exten (struct ast_channel *park_me, struct ast_channel *parker, const char *park_exten, const char *park_context, int timeout, int *extout) |
| Park a call via a masqueraded channel. | |
| int | ast_park_call (struct ast_channel *park_me, struct ast_channel *parker, int timeout, const char *park_exten, int *extout) |
| Park a call and read back parked location. | |
| int | ast_park_call_exten (struct ast_channel *park_me, struct ast_channel *parker, const char *park_exten, const char *park_context, int timeout, int *extout) |
| Park a call and read back parked location. | |
| int | ast_parking_ext_valid (const char *exten_str, struct ast_channel *chan, const char *context) |
| Determine if parking extension exists in a given context. | |
| int | ast_pickup_call (struct ast_channel *chan) |
| Pickup a call. | |
| const char * | ast_pickup_ext (void) |
| Determine system call pickup extension. | |
| void | ast_rdlock_call_features (void) |
| void | ast_register_feature (struct ast_call_feature *feature) |
| register new feature into feature_set | |
| void | ast_unlock_call_features (void) |
| void | ast_unregister_feature (struct ast_call_feature *feature) |
| unregister feature from feature_set | |
Call Parking and Pickup API Includes code and algorithms from the Zapata library.
Definition in file features.h.
| #define AST_FEATURE_RETURN_HANGUP -1 |
Definition at line 39 of file features.h.
Referenced by builtin_disconnect().
| #define AST_FEATURE_RETURN_KEEPTRYING 24 |
Definition at line 46 of file features.h.
Referenced by feature_exec_app(), and feature_interpret_helper().
| #define AST_FEATURE_RETURN_NO_HANGUP_PEER AST_PBX_NO_HANGUP_PEER |
Definition at line 42 of file features.h.
| #define AST_FEATURE_RETURN_PARKFAILED 25 |
Definition at line 47 of file features.h.
| #define AST_FEATURE_RETURN_PASSDIGITS 21 |
Definition at line 43 of file features.h.
Referenced by ast_bridge_call(), and feature_interpret_helper().
| #define AST_FEATURE_RETURN_PBX_KEEPALIVE AST_PBX_KEEPALIVE |
Definition at line 41 of file features.h.
| #define AST_FEATURE_RETURN_STOREDIGITS 22 |
Definition at line 44 of file features.h.
Referenced by detect_disconnect(), and feature_interpret_helper().
| #define AST_FEATURE_RETURN_SUCCESS 23 |
Definition at line 45 of file features.h.
Referenced by ast_bridge_call(), builtin_atxfer(), builtin_automixmonitor(), builtin_automonitor(), builtin_blindtransfer(), builtin_parkcall(), feature_exec_app(), feature_interpret_helper(), and xfer_park_call_helper().
| #define AST_FEATURE_RETURN_SUCCESSBREAK 0 |
Definition at line 40 of file features.h.
Referenced by builtin_blindtransfer(), and feature_exec_app().
| #define DEFAULT_PARKINGLOT "default" |
Default parking lot
Definition at line 37 of file features.h.
Referenced by build_parkinglot(), load_config(), process_config(), and reload_config().
| #define FEATURE_APP_ARGS_LEN 256 |
Definition at line 32 of file features.h.
Referenced by process_applicationmap_line().
| #define FEATURE_APP_LEN 64 |
Definition at line 31 of file features.h.
Referenced by process_applicationmap_line().
| #define FEATURE_EXTEN_LEN 32 |
Definition at line 34 of file features.h.
Referenced by process_applicationmap_line().
| #define FEATURE_MAX_LEN 11 |
Definition at line 30 of file features.h.
Referenced by ast_bridge_call(), and wait_for_answer().
| #define FEATURE_MOH_LEN 80 |
Definition at line 35 of file features.h.
Referenced by process_applicationmap_line().
| #define FEATURE_SENSE_CHAN (1 << 0) |
Definition at line 49 of file features.h.
Referenced by ast_bridge_call(), feature_exec_app(), and feature_interpret().
| #define FEATURE_SENSE_PEER (1 << 1) |
Definition at line 50 of file features.h.
Referenced by ast_bridge_call(), and set_peers().
| #define FEATURE_SNAME_LEN 32 |
Definition at line 33 of file features.h.
Referenced by process_applicationmap_line().
| typedef int(* ast_feature_operation)(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data) |
Definition at line 52 of file features.h.
| anonymous enum |
main call feature structure
| AST_FEATURE_FLAG_NEEDSDTMF | |
| AST_FEATURE_FLAG_ONPEER | |
| AST_FEATURE_FLAG_ONSELF | |
| AST_FEATURE_FLAG_BYCALLEE | |
| AST_FEATURE_FLAG_BYCALLER | |
| AST_FEATURE_FLAG_BYBOTH |
Definition at line 56 of file features.h.
00056 { 00057 AST_FEATURE_FLAG_NEEDSDTMF = (1 << 0), 00058 AST_FEATURE_FLAG_ONPEER = (1 << 1), 00059 AST_FEATURE_FLAG_ONSELF = (1 << 2), 00060 AST_FEATURE_FLAG_BYCALLEE = (1 << 3), 00061 AST_FEATURE_FLAG_BYCALLER = (1 << 4), 00062 AST_FEATURE_FLAG_BYBOTH = (3 << 3), 00063 };
| int ast_bridge_call | ( | struct ast_channel * | chan, | |
| struct ast_channel * | peer, | |||
| struct ast_bridge_config * | config | |||
| ) |
Bridge a call, optionally allowing redirection.
Bridge a call, optionally allowing redirection.
| chan | The bridge considers this channel the caller. | |
| peer | The bridge considers this channel the callee. | |
| config | Configuration for this bridge. |
Set start time, check for two channels,check if monitor on check for feature activation, create new CDR
| res | on success. | |
| -1 | on failure to bridge. |
append the event to featurecode. we rely on the string being zero-filled, and not overflowing it.
Definition at line 3929 of file features.c.
References ast_channel::_softhangup, ast_channel::_state, ast_cdr::accountcode, add_features_datastores(), ast_channel::amaflags, ast_cdr::amaflags, ast_cdr::answer, ast_channel::appl, ast_bridge_end_dtmf(), AST_BRIDGE_RETRY, ast_bridged_channel(), ast_cdr_alloc(), ast_cdr_answer(), AST_CDR_ANSWERED, ast_cdr_appenduserfield(), ast_cdr_copy_vars(), ast_cdr_detach(), ast_cdr_discard(), ast_cdr_dup_unique_swap(), ast_cdr_end(), AST_CDR_FLAG_BRIDGED, AST_CDR_FLAG_DIALED, AST_CDR_FLAG_MAIN, AST_CDR_FLAG_POST_DISABLED, AST_CDR_NULL, ast_cdr_setaccount(), ast_cdr_setanswer(), ast_cdr_setcid(), ast_cdr_setdisposition(), ast_cdr_setuserfield(), ast_cdr_specialized_reset(), ast_cdr_start(), ast_cdr_update(), AST_CEL_BRIDGE_END, AST_CEL_BRIDGE_START, ast_cel_report_event(), ast_channel_bridge(), ast_channel_connected_line_macro(), ast_channel_get_by_name(), ast_channel_lock, ast_channel_lock_both, ast_channel_log(), AST_CHANNEL_NAME, ast_channel_redirecting_macro(), ast_channel_set_linkgroup(), ast_channel_setoption(), ast_channel_start_silence_generator(), ast_channel_stop_silence_generator(), ast_channel_unlock, ast_channel_unref, ast_check_hangup(), ast_clear_flag, AST_CONTROL_AOC, AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_CONNECTED_LINE, AST_CONTROL_FLASH, AST_CONTROL_HANGUP, AST_CONTROL_HOLD, AST_CONTROL_OPTION, AST_CONTROL_REDIRECTING, AST_CONTROL_RINGING, AST_CONTROL_UNHOLD, ast_copy_string(), ast_debug, ast_default_amaflags, ast_dtmf_stream(), ast_exists_extension(), AST_FEATURE_NO_H_EXTEN, AST_FEATURE_RETURN_PASSDIGITS, AST_FEATURE_RETURN_SUCCESS, AST_FEATURE_WARNING_ACTIVE, AST_FLAG_BRIDGE_HANGUP_DONT, AST_FLAG_BRIDGE_HANGUP_RUN, AST_FLAG_IN_AUTOLOOP, AST_FLAG_ZOMBIE, AST_FRAME_CONTROL, AST_FRAME_DTMF_BEGIN, AST_FRAME_DTMF_END, ast_frfree, ast_indicate(), ast_indicate_data(), ast_log(), AST_MAX_CONTEXT, AST_MAX_EXTENSION, ast_opt_end_cdr_before_h_exten, ast_opt_transmit_silence, AST_OPTION_AUDIO_MODE, AST_OPTION_DIGIT_DETECT, AST_OPTION_FAX_DETECT, AST_OPTION_FLAG_REQUEST, AST_OPTION_RELAXDTMF, AST_OPTION_TDD, AST_OPTION_TONE_VERIFY, ast_raw_answer(), ast_set2_flag, ast_set_flag, ast_softhangup(), AST_SOFTHANGUP_APPUNLOAD, AST_SOFTHANGUP_ASYNCGOTO, AST_SOFTHANGUP_UNBRIDGE, ast_spawn_extension(), AST_STATE_RINGING, AST_STATE_UP, ast_strdupa, ast_strlen_zero(), ast_test_flag, ast_tvcmp(), ast_tvdiff_ms(), ast_tvnow(), ast_tvzero(), ast_verb, ast_write(), ast_channel::caller, ast_channel::cdr, ast_cdr::channel, clear_dialed_interfaces(), ast_channel::context, ast_option_header::data, ast_frame::data, ast_channel::data, ast_frame::datalen, ast_cdr::dcontext, ast_cdr::disposition, ast_cdr::dst, ast_cdr::dstchannel, ast_bridge_config::end_bridge_callback, ast_bridge_config::end_bridge_callback_data, ast_channel::exten, f, feature_check(), feature_interpret(), FEATURE_MAX_LEN, FEATURE_SENSE_CHAN, FEATURE_SENSE_PEER, ast_bridge_config::feature_start_time, ast_bridge_config::feature_timer, featuredigittimeout, ast_bridge_config::features_callee, ast_bridge_config::features_caller, ast_frame::frametype, ast_party_caller::id, ast_frame_subclass::integer, ast_cdr::lastapp, ast_cdr::lastdata, LOG_DEBUG, LOG_WARNING, ast_channel::macrocontext, monitor_app, monitor_ok, ast_cdr::next, ast_party_id::number, option_debug, pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), pbx_exec(), pbx_findapp(), pick_unlocked_cdr(), ast_channel::priority, ast_frame::ptr, S_COR, S_OR, ast_channel::sending_dtmf_digit, ast_channel::sending_dtmf_tv, set_bridge_features_on_config(), set_config_flags(), ast_cdr::start, ast_party_number::str, ast_frame::subclass, ast_bridge_config::timelimit, ast_cdr::uniqueid, ast_cdr::userfield, ast_party_number::valid, and ast_channel::visible_indication.
Referenced by app_exec(), bridge_call_thread(), bridge_exec(), builtin_atxfer(), dial_exec_full(), parked_call_exec(), and try_calling().
03930 { 03931 /* Copy voice back and forth between the two channels. Give the peer 03932 the ability to transfer calls with '#<extension' syntax. */ 03933 struct ast_frame *f; 03934 struct ast_channel *who; 03935 char chan_featurecode[FEATURE_MAX_LEN + 1]=""; 03936 char peer_featurecode[FEATURE_MAX_LEN + 1]=""; 03937 char orig_channame[AST_CHANNEL_NAME]; 03938 char orig_peername[AST_CHANNEL_NAME]; 03939 int res; 03940 int diff; 03941 int hasfeatures=0; 03942 int hadfeatures=0; 03943 int autoloopflag; 03944 int sendingdtmfdigit = 0; 03945 int we_disabled_peer_cdr = 0; 03946 struct ast_option_header *aoh; 03947 struct ast_cdr *bridge_cdr = NULL; 03948 struct ast_cdr *chan_cdr = chan->cdr; /* the proper chan cdr, if there are forked cdrs */ 03949 struct ast_cdr *peer_cdr = peer->cdr; /* the proper chan cdr, if there are forked cdrs */ 03950 struct ast_cdr *new_chan_cdr = NULL; /* the proper chan cdr, if there are forked cdrs */ 03951 struct ast_cdr *new_peer_cdr = NULL; /* the proper chan cdr, if there are forked cdrs */ 03952 struct ast_silence_generator *silgen = NULL; 03953 const char *h_context; 03954 03955 pbx_builtin_setvar_helper(chan, "BRIDGEPEER", peer->name); 03956 pbx_builtin_setvar_helper(peer, "BRIDGEPEER", chan->name); 03957 03958 /* Clear any BLINDTRANSFER since the transfer has completed. */ 03959 pbx_builtin_setvar_helper(chan, "BLINDTRANSFER", NULL); 03960 pbx_builtin_setvar_helper(peer, "BLINDTRANSFER", NULL); 03961 03962 set_bridge_features_on_config(config, pbx_builtin_getvar_helper(chan, "BRIDGE_FEATURES")); 03963 add_features_datastores(chan, peer, config); 03964 03965 /* This is an interesting case. One example is if a ringing channel gets redirected to 03966 * an extension that picks up a parked call. This will make sure that the call taken 03967 * out of parking gets told that the channel it just got bridged to is still ringing. */ 03968 if (chan->_state == AST_STATE_RINGING && peer->visible_indication != AST_CONTROL_RINGING) { 03969 ast_indicate(peer, AST_CONTROL_RINGING); 03970 } 03971 03972 if (monitor_ok) { 03973 const char *monitor_exec; 03974 struct ast_channel *src = NULL; 03975 if (!monitor_app) { 03976 if (!(monitor_app = pbx_findapp("Monitor"))) 03977 monitor_ok=0; 03978 } 03979 if ((monitor_exec = pbx_builtin_getvar_helper(chan, "AUTO_MONITOR"))) 03980 src = chan; 03981 else if ((monitor_exec = pbx_builtin_getvar_helper(peer, "AUTO_MONITOR"))) 03982 src = peer; 03983 if (monitor_app && src) { 03984 char *tmp = ast_strdupa(monitor_exec); 03985 pbx_exec(src, monitor_app, tmp); 03986 } 03987 } 03988 03989 set_config_flags(chan, peer, config); 03990 03991 /* Answer if need be */ 03992 if (chan->_state != AST_STATE_UP) { 03993 if (ast_raw_answer(chan, 1)) { 03994 return -1; 03995 } 03996 } 03997 03998 #ifdef FOR_DEBUG 03999 /* show the two channels and cdrs involved in the bridge for debug & devel purposes */ 04000 ast_channel_log("Pre-bridge CHAN Channel info", chan); 04001 ast_channel_log("Pre-bridge PEER Channel info", peer); 04002 #endif 04003 /* two channels are being marked as linked here */ 04004 ast_channel_set_linkgroup(chan,peer); 04005 04006 /* copy the userfield from the B-leg to A-leg if applicable */ 04007 if (chan->cdr && peer->cdr && !ast_strlen_zero(peer->cdr->userfield)) { 04008 char tmp[256]; 04009 04010 ast_channel_lock(chan); 04011 if (!ast_strlen_zero(chan->cdr->userfield)) { 04012 snprintf(tmp, sizeof(tmp), "%s;%s", chan->cdr->userfield, peer->cdr->userfield); 04013 ast_cdr_appenduserfield(chan, tmp); 04014 } else { 04015 ast_cdr_setuserfield(chan, peer->cdr->userfield); 04016 } 04017 ast_channel_unlock(chan); 04018 /* Don't delete the CDR; just disable it. */ 04019 ast_set_flag(peer->cdr, AST_CDR_FLAG_POST_DISABLED); 04020 we_disabled_peer_cdr = 1; 04021 } 04022 ast_copy_string(orig_channame,chan->name,sizeof(orig_channame)); 04023 ast_copy_string(orig_peername,peer->name,sizeof(orig_peername)); 04024 04025 if (!chan_cdr || (chan_cdr && !ast_test_flag(chan_cdr, AST_CDR_FLAG_POST_DISABLED))) { 04026 ast_channel_lock_both(chan, peer); 04027 if (chan_cdr) { 04028 ast_set_flag(chan_cdr, AST_CDR_FLAG_MAIN); 04029 ast_cdr_update(chan); 04030 bridge_cdr = ast_cdr_dup_unique_swap(chan_cdr); 04031 /* rip any forked CDR's off of the chan_cdr and attach 04032 * them to the bridge_cdr instead */ 04033 bridge_cdr->next = chan_cdr->next; 04034 chan_cdr->next = NULL; 04035 ast_copy_string(bridge_cdr->lastapp, S_OR(chan->appl, ""), sizeof(bridge_cdr->lastapp)); 04036 ast_copy_string(bridge_cdr->lastdata, S_OR(chan->data, ""), sizeof(bridge_cdr->lastdata)); 04037 if (peer_cdr && !ast_strlen_zero(peer_cdr->userfield)) { 04038 ast_copy_string(bridge_cdr->userfield, peer_cdr->userfield, sizeof(bridge_cdr->userfield)); 04039 } 04040 ast_cdr_setaccount(peer, chan->accountcode); 04041 } else { 04042 /* better yet, in a xfer situation, find out why the chan cdr got zapped (pun unintentional) */ 04043 bridge_cdr = ast_cdr_alloc(); /* this should be really, really rare/impossible? */ 04044 ast_copy_string(bridge_cdr->channel, chan->name, sizeof(bridge_cdr->channel)); 04045 ast_copy_string(bridge_cdr->dstchannel, peer->name, sizeof(bridge_cdr->dstchannel)); 04046 ast_copy_string(bridge_cdr->uniqueid, chan->uniqueid, sizeof(bridge_cdr->uniqueid)); 04047 ast_copy_string(bridge_cdr->lastapp, S_OR(chan->appl, ""), sizeof(bridge_cdr->lastapp)); 04048 ast_copy_string(bridge_cdr->lastdata, S_OR(chan->data, ""), sizeof(bridge_cdr->lastdata)); 04049 ast_cdr_setcid(bridge_cdr, chan); 04050 bridge_cdr->disposition = (chan->_state == AST_STATE_UP) ? AST_CDR_ANSWERED : AST_CDR_NULL; 04051 bridge_cdr->amaflags = chan->amaflags ? chan->amaflags : ast_default_amaflags; 04052 ast_copy_string(bridge_cdr->accountcode, chan->accountcode, sizeof(bridge_cdr->accountcode)); 04053 /* Destination information */ 04054 ast_copy_string(bridge_cdr->dst, chan->exten, sizeof(bridge_cdr->dst)); 04055 ast_copy_string(bridge_cdr->dcontext, chan->context, sizeof(bridge_cdr->dcontext)); 04056 if (peer_cdr) { 04057 bridge_cdr->start = peer_cdr->start; 04058 ast_copy_string(bridge_cdr->userfield, peer_cdr->userfield, sizeof(bridge_cdr->userfield)); 04059 } else { 04060 ast_cdr_start(bridge_cdr); 04061 } 04062 } 04063 ast_channel_unlock(chan); 04064 ast_channel_unlock(peer); 04065 04066 ast_debug(4,"bridge answer set, chan answer set\n"); 04067 /* peer_cdr->answer will be set when a macro runs on the peer; 04068 in that case, the bridge answer will be delayed while the 04069 macro plays on the peer channel. The peer answered the call 04070 before the macro started playing. To the phone system, 04071 this is billable time for the call, even tho the caller 04072 hears nothing but ringing while the macro does its thing. */ 04073 04074 /* Another case where the peer cdr's time will be set, is when 04075 A self-parks by pickup up phone and dialing 700, then B 04076 picks up A by dialing its parking slot; there may be more 04077 practical paths that get the same result, tho... in which 04078 case you get the previous answer time from the Park... which 04079 is before the bridge's start time, so I added in the 04080 tvcmp check to the if below */ 04081 04082 if (peer_cdr && !ast_tvzero(peer_cdr->answer) && ast_tvcmp(peer_cdr->answer, bridge_cdr->start) >= 0) { 04083 ast_cdr_setanswer(bridge_cdr, peer_cdr->answer); 04084 ast_cdr_setdisposition(bridge_cdr, peer_cdr->disposition); 04085 if (chan_cdr) { 04086 ast_cdr_setanswer(chan_cdr, peer_cdr->answer); 04087 ast_cdr_setdisposition(chan_cdr, peer_cdr->disposition); 04088 } 04089 } else { 04090 ast_cdr_answer(bridge_cdr); 04091 if (chan_cdr) { 04092 ast_cdr_answer(chan_cdr); /* for the sake of cli status checks */ 04093 } 04094 } 04095 if (ast_test_flag(chan,AST_FLAG_BRIDGE_HANGUP_DONT) && (chan_cdr || peer_cdr)) { 04096 if (chan_cdr) { 04097 ast_set_flag(chan_cdr, AST_CDR_FLAG_BRIDGED); 04098 } 04099 if (peer_cdr) { 04100 ast_set_flag(peer_cdr, AST_CDR_FLAG_BRIDGED); 04101 } 04102 } 04103 /* the DIALED flag may be set if a dialed channel is transfered 04104 * and then bridged to another channel. In order for the 04105 * bridge CDR to be written, the DIALED flag must not be 04106 * present. */ 04107 ast_clear_flag(bridge_cdr, AST_CDR_FLAG_DIALED); 04108 } 04109 ast_cel_report_event(chan, AST_CEL_BRIDGE_START, NULL, NULL, peer); 04110 04111 /* If we are bridging a call, stop worrying about forwarding loops. We presume that if 04112 * a call is being bridged, that the humans in charge know what they're doing. If they 04113 * don't, well, what can we do about that? */ 04114 clear_dialed_interfaces(chan); 04115 clear_dialed_interfaces(peer); 04116 04117 for (;;) { 04118 struct ast_channel *other; /* used later */ 04119 04120 res = ast_channel_bridge(chan, peer, config, &f, &who); 04121 04122 if (ast_test_flag(chan, AST_FLAG_ZOMBIE) 04123 || ast_test_flag(peer, AST_FLAG_ZOMBIE)) { 04124 /* Zombies are present time to leave! */ 04125 res = -1; 04126 if (f) { 04127 ast_frfree(f); 04128 } 04129 goto before_you_go; 04130 } 04131 04132 /* When frame is not set, we are probably involved in a situation 04133 where we've timed out. 04134 When frame is set, we'll come this code twice; once for DTMF_BEGIN 04135 and also for DTMF_END. If we flow into the following 'if' for both, then 04136 our wait times are cut in half, as both will subtract from the 04137 feature_timer. Not good! 04138 */ 04139 if (config->feature_timer && (!f || f->frametype == AST_FRAME_DTMF_END)) { 04140 /* Update feature timer for next pass */ 04141 diff = ast_tvdiff_ms(ast_tvnow(), config->feature_start_time); 04142 if (res == AST_BRIDGE_RETRY) { 04143 /* The feature fully timed out but has not been updated. Skip 04144 * the potential round error from the diff calculation and 04145 * explicitly set to expired. */ 04146 config->feature_timer = -1; 04147 } else { 04148 config->feature_timer -= diff; 04149 } 04150 04151 if (hasfeatures) { 04152 if (config->feature_timer <= 0) { 04153 /* Not *really* out of time, just out of time for 04154 digits to come in for features. */ 04155 ast_debug(1, "Timed out for feature!\n"); 04156 if (!ast_strlen_zero(peer_featurecode)) { 04157 ast_dtmf_stream(chan, peer, peer_featurecode, 0, 0); 04158 memset(peer_featurecode, 0, sizeof(peer_featurecode)); 04159 } 04160 if (!ast_strlen_zero(chan_featurecode)) { 04161 ast_dtmf_stream(peer, chan, chan_featurecode, 0, 0); 04162 memset(chan_featurecode, 0, sizeof(chan_featurecode)); 04163 } 04164 if (f) 04165 ast_frfree(f); 04166 hasfeatures = !ast_strlen_zero(chan_featurecode) || !ast_strlen_zero(peer_featurecode); 04167 if (!hasfeatures) { 04168 /* No more digits expected - reset the timer */ 04169 config->feature_timer = 0; 04170 } 04171 hadfeatures = hasfeatures; 04172 /* Continue as we were */ 04173 continue; 04174 } else if (!f) { 04175 /* The bridge returned without a frame and there is a feature in progress. 04176 * However, we don't think the feature has quite yet timed out, so just 04177 * go back into the bridge. */ 04178 continue; 04179 } 04180 } else { 04181 if (config->feature_timer <=0) { 04182 /* We ran out of time */ 04183 config->feature_timer = 0; 04184 who = chan; 04185 if (f) 04186 ast_frfree(f); 04187 f = NULL; 04188 res = 0; 04189 } 04190 } 04191 } 04192 if (res < 0) { 04193 if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_test_flag(peer, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan) && !ast_check_hangup(peer)) { 04194 ast_log(LOG_WARNING, "Bridge failed on channels %s and %s\n", chan->name, peer->name); 04195 } 04196 goto before_you_go; 04197 } 04198 04199 if (!f || (f->frametype == AST_FRAME_CONTROL && 04200 (f->subclass.integer == AST_CONTROL_HANGUP || f->subclass.integer == AST_CONTROL_BUSY || 04201 f->subclass.integer == AST_CONTROL_CONGESTION))) { 04202 /* 04203 * If the bridge was broken for a hangup that isn't real, 04204 * then don't run the h extension, because the channel isn't 04205 * really hung up. This should really only happen with AST_SOFTHANGUP_ASYNCGOTO, 04206 * but it doesn't hurt to check AST_SOFTHANGUP_UNBRIDGE either. 04207 */ 04208 ast_channel_lock(chan); 04209 if (chan->_softhangup & (AST_SOFTHANGUP_ASYNCGOTO | AST_SOFTHANGUP_UNBRIDGE)) { 04210 ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT); 04211 } 04212 ast_channel_unlock(chan); 04213 res = -1; 04214 break; 04215 } 04216 /* many things should be sent to the 'other' channel */ 04217 other = (who == chan) ? peer : chan; 04218 if (f->frametype == AST_FRAME_CONTROL) { 04219 switch (f->subclass.integer) { 04220 case AST_CONTROL_RINGING: 04221 case AST_CONTROL_FLASH: 04222 case -1: 04223 ast_indicate(other, f->subclass.integer); 04224 break; 04225 case AST_CONTROL_CONNECTED_LINE: 04226 if (!ast_channel_connected_line_macro(who, other, f, who != chan, 1)) { 04227 break; 04228 } 04229 ast_indicate_data(other, f->subclass.integer, f->data.ptr, f->datalen); 04230 break; 04231 case AST_CONTROL_REDIRECTING: 04232 if (!ast_channel_redirecting_macro(who, other, f, who != chan, 1)) { 04233 break; 04234 } 04235 ast_indicate_data(other, f->subclass.integer, f->data.ptr, f->datalen); 04236 break; 04237 case AST_CONTROL_AOC: 04238 case AST_CONTROL_HOLD: 04239 case AST_CONTROL_UNHOLD: 04240 ast_indicate_data(other, f->subclass.integer, f->data.ptr, f->datalen); 04241 break; 04242 case AST_CONTROL_OPTION: 04243 aoh = f->data.ptr; 04244 /* Forward option Requests, but only ones we know are safe 04245 * These are ONLY sent by chan_iax2 and I'm not convinced that 04246 * they are useful. I haven't deleted them entirely because I 04247 * just am not sure of the ramifications of removing them. */ 04248 if (aoh && aoh->flag == AST_OPTION_FLAG_REQUEST) { 04249 switch (ntohs(aoh->option)) { 04250 case AST_OPTION_TONE_VERIFY: 04251 case AST_OPTION_TDD: 04252 case AST_OPTION_RELAXDTMF: 04253 case AST_OPTION_AUDIO_MODE: 04254 case AST_OPTION_DIGIT_DETECT: 04255 case AST_OPTION_FAX_DETECT: 04256 ast_channel_setoption(other, ntohs(aoh->option), aoh->data, 04257 f->datalen - sizeof(struct ast_option_header), 0); 04258 } 04259 } 04260 break; 04261 } 04262 } else if (f->frametype == AST_FRAME_DTMF_BEGIN) { 04263 struct ast_flags *cfg; 04264 char dtmfcode[2] = { f->subclass.integer, }; 04265 size_t featurelen; 04266 04267 if (who == chan) { 04268 featurelen = strlen(chan_featurecode); 04269 cfg = &(config->features_caller); 04270 } else { 04271 featurelen = strlen(peer_featurecode); 04272 cfg = &(config->features_callee); 04273 } 04274 /* Take a peek if this (possibly) matches a feature. If not, just pass this 04275 * DTMF along untouched. If this is not the first digit of a multi-digit code 04276 * then we need to fall through and stream the characters if it matches */ 04277 if (featurelen == 0 04278 && feature_check(chan, cfg, &dtmfcode[0]) == AST_FEATURE_RETURN_PASSDIGITS) { 04279 if (option_debug > 3) { 04280 ast_log(LOG_DEBUG, "Passing DTMF through, since it is not a feature code\n"); 04281 } 04282 ast_write(other, f); 04283 sendingdtmfdigit = 1; 04284 } else { 04285 /* If ast_opt_transmit_silence is set, then we need to make sure we are 04286 * transmitting something while we hold on to the DTMF waiting for a 04287 * feature. */ 04288 if (!silgen && ast_opt_transmit_silence) { 04289 silgen = ast_channel_start_silence_generator(other); 04290 } 04291 if (option_debug > 3) { 04292 ast_log(LOG_DEBUG, "Not passing DTMF through, since it may be a feature code\n"); 04293 } 04294 } 04295 } else if (f->frametype == AST_FRAME_DTMF_END) { 04296 char *featurecode; 04297 int sense; 04298 04299 hadfeatures = hasfeatures; 04300 /* This cannot overrun because the longest feature is one shorter than our buffer */ 04301 if (who == chan) { 04302 sense = FEATURE_SENSE_CHAN; 04303 featurecode = chan_featurecode; 04304 } else { 04305 sense = FEATURE_SENSE_PEER; 04306 featurecode = peer_featurecode; 04307 } 04308 04309 if (sendingdtmfdigit == 1) { 04310 /* We let the BEGIN go through happily, so let's not bother with the END, 04311 * since we already know it's not something we bother with */ 04312 ast_write(other, f); 04313 sendingdtmfdigit = 0; 04314 } else { 04315 /*! append the event to featurecode. we rely on the string being zero-filled, and 04316 * not overflowing it. 04317 * \todo XXX how do we guarantee the latter ? 04318 */ 04319 featurecode[strlen(featurecode)] = f->subclass.integer; 04320 /* Get rid of the frame before we start doing "stuff" with the channels */ 04321 ast_frfree(f); 04322 f = NULL; 04323 if (silgen) { 04324 ast_channel_stop_silence_generator(other, silgen); 04325 silgen = NULL; 04326 } 04327 config->feature_timer = 0; 04328 res = feature_interpret(chan, peer, config, featurecode, sense); 04329 switch(res) { 04330 case AST_FEATURE_RETURN_PASSDIGITS: 04331 ast_dtmf_stream(other, who, featurecode, 0, 0); 04332 /* Fall through */ 04333 case AST_FEATURE_RETURN_SUCCESS: 04334 memset(featurecode, 0, sizeof(chan_featurecode)); 04335 break; 04336 } 04337 if (res >= AST_FEATURE_RETURN_PASSDIGITS) { 04338 res = 0; 04339 } else { 04340 break; 04341 } 04342 hasfeatures = !ast_strlen_zero(chan_featurecode) || !ast_strlen_zero(peer_featurecode); 04343 if (hadfeatures && !hasfeatures) { 04344 /* Feature completed or timed out */ 04345 config->feature_timer = 0; 04346 } else if (hasfeatures) { 04347 if (config->timelimit) { 04348 /* No warning next time - we are waiting for feature code */ 04349 ast_set_flag(config, AST_FEATURE_WARNING_ACTIVE); 04350 } 04351 config->feature_start_time = ast_tvnow(); 04352 config->feature_timer = featuredigittimeout; 04353 ast_debug(1, "Set feature timer to %ld ms\n", config->feature_timer); 04354 } 04355 } 04356 } 04357 if (f) 04358 ast_frfree(f); 04359 } 04360 ast_cel_report_event(chan, AST_CEL_BRIDGE_END, NULL, NULL, peer); 04361 04362 before_you_go: 04363 if (chan->sending_dtmf_digit) { 04364 ast_bridge_end_dtmf(chan, chan->sending_dtmf_digit, chan->sending_dtmf_tv, 04365 "bridge end"); 04366 } 04367 if (peer->sending_dtmf_digit) { 04368 ast_bridge_end_dtmf(peer, peer->sending_dtmf_digit, peer->sending_dtmf_tv, 04369 "bridge end"); 04370 } 04371 04372 /* Just in case something weird happened and we didn't clean up the silence generator... */ 04373 if (silgen) { 04374 ast_channel_stop_silence_generator(who == chan ? peer : chan, silgen); 04375 silgen = NULL; 04376 } 04377 04378 if (ast_test_flag(chan,AST_FLAG_BRIDGE_HANGUP_DONT)) { 04379 ast_clear_flag(chan,AST_FLAG_BRIDGE_HANGUP_DONT); /* its job is done */ 04380 if (bridge_cdr) { 04381 ast_cdr_discard(bridge_cdr); 04382 /* QUESTION: should we copy bridge_cdr fields to the peer before we throw it away? */ 04383 } 04384 return res; /* if we shouldn't do the h-exten, we shouldn't do the bridge cdr, either! */ 04385 } 04386 04387 if (config->end_bridge_callback) { 04388 config->end_bridge_callback(config->end_bridge_callback_data); 04389 } 04390 04391 /* run the hangup exten on the chan object IFF it was NOT involved in a parking situation 04392 * if it were, then chan belongs to a different thread now, and might have been hung up long 04393 * ago. 04394 */ 04395 if (ast_test_flag(&config->features_caller, AST_FEATURE_NO_H_EXTEN)) { 04396 h_context = NULL; 04397 } else if (ast_exists_extension(chan, chan->context, "h", 1, 04398 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 04399 h_context = chan->context; 04400 } else if (!ast_strlen_zero(chan->macrocontext) 04401 && ast_exists_extension(chan, chan->macrocontext, "h", 1, 04402 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 04403 h_context = chan->macrocontext; 04404 } else { 04405 h_context = NULL; 04406 } 04407 if (h_context) { 04408 struct ast_cdr *swapper = NULL; 04409 char savelastapp[AST_MAX_EXTENSION]; 04410 char savelastdata[AST_MAX_EXTENSION]; 04411 char save_context[AST_MAX_CONTEXT]; 04412 char save_exten[AST_MAX_EXTENSION]; 04413 int save_prio; 04414 int found = 0; /* set if we find at least one match */ 04415 int spawn_error = 0; 04416 04417 /* 04418 * Make sure that the channel is marked as hungup since we are 04419 * going to run the "h" exten on it. 04420 */ 04421 ast_softhangup(chan, AST_SOFTHANGUP_APPUNLOAD); 04422 04423 autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP); 04424 ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP); 04425 if (bridge_cdr && ast_opt_end_cdr_before_h_exten) { 04426 ast_cdr_end(bridge_cdr); 04427 } 04428 04429 /* swap the bridge cdr and the chan cdr for a moment, and let the endbridge 04430 dialplan code operate on it */ 04431 ast_channel_lock(chan); 04432 if (bridge_cdr) { 04433 swapper = chan->cdr; 04434 ast_copy_string(savelastapp, bridge_cdr->lastapp, sizeof(bridge_cdr->lastapp)); 04435 ast_copy_string(savelastdata, bridge_cdr->lastdata, sizeof(bridge_cdr->lastdata)); 04436 chan->cdr = bridge_cdr; 04437 } 04438 ast_copy_string(save_context, chan->context, sizeof(save_context)); 04439 ast_copy_string(save_exten, chan->exten, sizeof(save_exten)); 04440 save_prio = chan->priority; 04441 if (h_context != chan->context) { 04442 ast_copy_string(chan->context, h_context, sizeof(chan->context)); 04443 } 04444 ast_copy_string(chan->exten, "h", sizeof(chan->exten)); 04445 chan->priority = 1; 04446 ast_channel_unlock(chan); 04447 04448 while ((spawn_error = ast_spawn_extension(chan, chan->context, chan->exten, 04449 chan->priority, 04450 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), 04451 &found, 1)) == 0) { 04452 chan->priority++; 04453 } 04454 if (found && spawn_error) { 04455 /* Something bad happened, or a hangup has been requested. */ 04456 ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", chan->context, chan->exten, chan->priority, chan->name); 04457 ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", chan->context, chan->exten, chan->priority, chan->name); 04458 } 04459 04460 /* swap it back */ 04461 ast_channel_lock(chan); 04462 ast_copy_string(chan->context, save_context, sizeof(chan->context)); 04463 ast_copy_string(chan->exten, save_exten, sizeof(chan->exten)); 04464 chan->priority = save_prio; 04465 if (bridge_cdr) { 04466 if (chan->cdr == bridge_cdr) { 04467 chan->cdr = swapper; 04468 } else { 04469 bridge_cdr = NULL; 04470 } 04471 } 04472 /* An "h" exten has been run, so indicate that one has been run. */ 04473 ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_RUN); 04474 ast_channel_unlock(chan); 04475 04476 /* protect the lastapp/lastdata against the effects of the hangup/dialplan code */ 04477 if (bridge_cdr) { 04478 ast_copy_string(bridge_cdr->lastapp, savelastapp, sizeof(bridge_cdr->lastapp)); 04479 ast_copy_string(bridge_cdr->lastdata, savelastdata, sizeof(bridge_cdr->lastdata)); 04480 } 04481 ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP); 04482 } 04483 04484 /* obey the NoCDR() wishes. -- move the DISABLED flag to the bridge CDR if it was set on the channel during the bridge... */ 04485 new_chan_cdr = pick_unlocked_cdr(chan->cdr); /* the proper chan cdr, if there are forked cdrs */ 04486 /* If the channel CDR has been modified during the call, record the changes in the bridge cdr, 04487 * BUT, if we've gone through the h extension block above, the CDR got swapped so don't overwrite 04488 * what was done in the h extension. What a mess. This is why you never touch CDR code. */ 04489 if (new_chan_cdr && bridge_cdr && !h_context) { 04490 ast_cdr_copy_vars(bridge_cdr, new_chan_cdr); 04491 ast_copy_string(bridge_cdr->userfield, new_chan_cdr->userfield, sizeof(bridge_cdr->userfield)); 04492 bridge_cdr->amaflags = new_chan_cdr->amaflags; 04493 ast_copy_string(bridge_cdr->accountcode, new_chan_cdr->accountcode, sizeof(bridge_cdr->accountcode)); 04494 if (ast_test_flag(new_chan_cdr, AST_CDR_FLAG_POST_DISABLED)) { 04495 ast_set_flag(bridge_cdr, AST_CDR_FLAG_POST_DISABLED); 04496 } 04497 } 04498 04499 /* we can post the bridge CDR at this point */ 04500 if (bridge_cdr) { 04501 ast_cdr_end(bridge_cdr); 04502 ast_cdr_detach(bridge_cdr); 04503 } 04504 04505 /* do a specialized reset on the beginning channel 04506 CDR's, if they still exist, so as not to mess up 04507 issues in future bridges; 04508 04509 Here are the rules of the game: 04510 1. The chan and peer channel pointers will not change 04511 during the life of the bridge. 04512 2. But, in transfers, the channel names will change. 04513 between the time the bridge is started, and the 04514 time the channel ends. 04515 Usually, when a channel changes names, it will 04516 also change CDR pointers. 04517 3. Usually, only one of the two channels (chan or peer) 04518 will change names. 04519 4. Usually, if a channel changes names during a bridge, 04520 it is because of a transfer. Usually, in these situations, 04521 it is normal to see 2 bridges running simultaneously, and 04522 it is not unusual to see the two channels that change 04523 swapped between bridges. 04524 5. After a bridge occurs, we have 2 or 3 channels' CDRs 04525 to attend to; if the chan or peer changed names, 04526 we have the before and after attached CDR's. 04527 */ 04528 04529 if (new_chan_cdr) { 04530 struct ast_channel *chan_ptr = NULL; 04531 04532 if (strcasecmp(orig_channame, chan->name) != 0) { 04533 /* old channel */ 04534 if ((chan_ptr = ast_channel_get_by_name(orig_channame))) { 04535 ast_channel_lock(chan_ptr); 04536 if (!ast_bridged_channel(chan_ptr)) { 04537 struct ast_cdr *cur; 04538 for (cur = chan_ptr->cdr; cur; cur = cur->next) { 04539 if (cur == chan_cdr) { 04540 break; 04541 } 04542 } 04543 if (cur) { 04544 ast_cdr_specialized_reset(chan_cdr, 0); 04545 } 04546 } 04547 ast_channel_unlock(chan_ptr); 04548 chan_ptr = ast_channel_unref(chan_ptr); 04549 } 04550 /* new channel */ 04551 ast_cdr_specialized_reset(new_chan_cdr, 0); 04552 } else { 04553 ast_cdr_specialized_reset(chan->cdr, 0); /* nothing changed, reset the chan cdr */ 04554 } 04555 } 04556 04557 { 04558 struct ast_channel *chan_ptr = NULL; 04559 new_peer_cdr = pick_unlocked_cdr(peer->cdr); /* the proper chan cdr, if there are forked cdrs */ 04560 if (new_chan_cdr && ast_test_flag(new_chan_cdr, AST_CDR_FLAG_POST_DISABLED) && new_peer_cdr && !ast_test_flag(new_peer_cdr, AST_CDR_FLAG_POST_DISABLED)) 04561 ast_set_flag(new_peer_cdr, AST_CDR_FLAG_POST_DISABLED); /* DISABLED is viral-- it will propagate across a bridge */ 04562 if (strcasecmp(orig_peername, peer->name) != 0) { 04563 /* old channel */ 04564 if ((chan_ptr = ast_channel_get_by_name(orig_peername))) { 04565 ast_channel_lock(chan_ptr); 04566 if (!ast_bridged_channel(chan_ptr)) { 04567 struct ast_cdr *cur; 04568 for (cur = chan_ptr->cdr; cur; cur = cur->next) { 04569 if (cur == peer_cdr) { 04570 break; 04571 } 04572 } 04573 if (cur) { 04574 ast_cdr_specialized_reset(peer_cdr, 0); 04575 } 04576 } 04577 ast_channel_unlock(chan_ptr); 04578 chan_ptr = ast_channel_unref(chan_ptr); 04579 } 04580 /* new channel */ 04581 if (new_peer_cdr) { 04582 ast_cdr_specialized_reset(new_peer_cdr, 0); 04583 } 04584 } else { 04585 if (we_disabled_peer_cdr) { 04586 ast_clear_flag(peer->cdr, AST_CDR_FLAG_POST_DISABLED); 04587 } 04588 ast_cdr_specialized_reset(peer->cdr, 0); /* nothing changed, reset the peer cdr */ 04589 } 04590 } 04591 04592 return res; 04593 }
| void ast_bridge_end_dtmf | ( | struct ast_channel * | chan, | |
| char | digit, | |||
| struct timeval | start, | |||
| const char * | why | |||
| ) |
Simulate a DTMF end on a broken bridge channel.
| chan | Channel sending DTMF that has not ended. | |
| digit | DTMF digit to stop. | |
| start | DTMF digit start time. | |
| why | Reason bridge broken. |
Definition at line 3899 of file features.c.
References ast_channel_lock, ast_channel_unlock, ast_check_hangup(), AST_FLAG_ZOMBIE, ast_log(), ast_senddigit_end(), ast_test_flag, ast_tvdiff_ms(), ast_tvnow(), and LOG_DTMF.
Referenced by ast_bridge_call(), and ast_do_masquerade().
03900 { 03901 int dead; 03902 long duration; 03903 03904 ast_channel_lock(chan); 03905 dead = ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan); 03906 ast_channel_unlock(chan); 03907 if (dead) { 03908 return; 03909 } 03910 03911 duration = ast_tvdiff_ms(ast_tvnow(), start); 03912 ast_senddigit_end(chan, digit, duration); 03913 ast_log(LOG_DTMF, "DTMF end '%c' simulated on %s due to %s, duration %ld ms\n", 03914 digit, chan->name, why, duration); 03915 }
| int ast_bridge_timelimit | ( | struct ast_channel * | chan, | |
| struct ast_bridge_config * | config, | |||
| char * | parse, | |||
| struct timeval * | calldurationlimit | |||
| ) |
parse L option and read associated channel variables to set warning, warning frequency, and timelimit
Definition at line 7475 of file features.c.
References ast_channel_lock, ast_channel_unlock, AST_FEATURE_PLAY_WARNING, ast_log(), ast_set_flag, ast_strdup, ast_strdupa, ast_strlen_zero(), ast_true(), ast_verb, ast_bridge_config::end_sound, ast_bridge_config::features_callee, ast_bridge_config::features_caller, LOG_WARNING, pbx_builtin_getvar_helper(), ast_bridge_config::play_warning, S_OR, ast_bridge_config::start_sound, ast_bridge_config::timelimit, var, ast_bridge_config::warning_freq, and ast_bridge_config::warning_sound.
Referenced by bridge_exec(), and dial_exec_full().
07477 { 07478 char *stringp = ast_strdupa(parse); 07479 char *limit_str, *warning_str, *warnfreq_str; 07480 const char *var; 07481 int play_to_caller = 0, play_to_callee = 0; 07482 int delta; 07483 07484 limit_str = strsep(&stringp, ":"); 07485 warning_str = strsep(&stringp, ":"); 07486 warnfreq_str = strsep(&stringp, ":"); 07487 07488 config->timelimit = atol(limit_str); 07489 if (warning_str) 07490 config->play_warning = atol(warning_str); 07491 if (warnfreq_str) 07492 config->warning_freq = atol(warnfreq_str); 07493 07494 if (!config->timelimit) { 07495 ast_log(LOG_WARNING, "Bridge does not accept L(%s), hanging up.\n", limit_str); 07496 config->timelimit = config->play_warning = config->warning_freq = 0; 07497 config->warning_sound = NULL; 07498 return -1; /* error */ 07499 } else if ( (delta = config->play_warning - config->timelimit) > 0) { 07500 int w = config->warning_freq; 07501 07502 /* 07503 * If the first warning is requested _after_ the entire call 07504 * would end, and no warning frequency is requested, then turn 07505 * off the warning. If a warning frequency is requested, reduce 07506 * the 'first warning' time by that frequency until it falls 07507 * within the call's total time limit. 07508 * 07509 * Graphically: 07510 * timelim->| delta |<-playwarning 07511 * 0__________________|_________________| 07512 * | w | | | | 07513 * 07514 * so the number of intervals to cut is 1+(delta-1)/w 07515 */ 07516 if (w == 0) { 07517 config->play_warning = 0; 07518 } else { 07519 config->play_warning -= w * ( 1 + (delta-1)/w ); 07520 if (config->play_warning < 1) 07521 config->play_warning = config->warning_freq = 0; 07522 } 07523 } 07524 07525 ast_channel_lock(chan); 07526 07527 var = pbx_builtin_getvar_helper(chan, "LIMIT_PLAYAUDIO_CALLER"); 07528 play_to_caller = var ? ast_true(var) : 1; 07529 07530 var = pbx_builtin_getvar_helper(chan, "LIMIT_PLAYAUDIO_CALLEE"); 07531 play_to_callee = var ? ast_true(var) : 0; 07532 07533 if (!play_to_caller && !play_to_callee) 07534 play_to_caller = 1; 07535 07536 var = pbx_builtin_getvar_helper(chan, "LIMIT_WARNING_FILE"); 07537 config->warning_sound = !ast_strlen_zero(var) ? ast_strdup(var) : ast_strdup("timeleft"); 07538 07539 /* The code looking at config wants a NULL, not just "", to decide 07540 * that the message should not be played, so we replace "" with NULL. 07541 * Note, pbx_builtin_getvar_helper _can_ return NULL if the variable is 07542 * not found. 07543 */ 07544 07545 var = pbx_builtin_getvar_helper(chan, "LIMIT_TIMEOUT_FILE"); 07546 config->end_sound = !ast_strlen_zero(var) ? ast_strdup(var) : NULL; 07547 07548 var = pbx_builtin_getvar_helper(chan, "LIMIT_CONNECT_FILE"); 07549 config->start_sound = !ast_strlen_zero(var) ? ast_strdup(var) : NULL; 07550 07551 ast_channel_unlock(chan); 07552 07553 /* undo effect of S(x) in case they are both used */ 07554 calldurationlimit->tv_sec = 0; 07555 calldurationlimit->tv_usec = 0; 07556 07557 /* more efficient to do it like S(x) does since no advanced opts */ 07558 if (!config->play_warning && !config->start_sound && !config->end_sound && config->timelimit) { 07559 calldurationlimit->tv_sec = config->timelimit / 1000; 07560 calldurationlimit->tv_usec = (config->timelimit % 1000) * 1000; 07561 ast_verb(3, "Setting call duration limit to %.3lf seconds.\n", 07562 calldurationlimit->tv_sec + calldurationlimit->tv_usec / 1000000.0); 07563 config->timelimit = play_to_caller = play_to_callee = 07564 config->play_warning = config->warning_freq = 0; 07565 } else { 07566 ast_verb(4, "Limit Data for this call:\n"); 07567 ast_verb(4, "timelimit = %ld ms (%.3lf s)\n", config->timelimit, config->timelimit / 1000.0); 07568 ast_verb(4, "play_warning = %ld ms (%.3lf s)\n", config->play_warning, config->play_warning / 1000.0); 07569 ast_verb(4, "play_to_caller = %s\n", play_to_caller ? "yes" : "no"); 07570 ast_verb(4, "play_to_callee = %s\n", play_to_callee ? "yes" : "no"); 07571 ast_verb(4, "warning_freq = %ld ms (%.3lf s)\n", config->warning_freq, config->warning_freq / 1000.0); 07572 ast_verb(4, "start_sound = %s\n", S_OR(config->start_sound, "")); 07573 ast_verb(4, "warning_sound = %s\n", config->warning_sound); 07574 ast_verb(4, "end_sound = %s\n", S_OR(config->end_sound, "")); 07575 } 07576 if (play_to_caller) 07577 ast_set_flag(&(config->features_caller), AST_FEATURE_PLAY_WARNING); 07578 if (play_to_callee) 07579 ast_set_flag(&(config->features_callee), AST_FEATURE_PLAY_WARNING); 07580 return 0; 07581 }
| int ast_can_pickup | ( | struct ast_channel * | chan | ) |
Test if a channel can be picked up.
| chan | Channel to test if can be picked up. |
Definition at line 7281 of file features.c.
References ast_channel::_state, ast_channel_datastore_find(), AST_FLAG_ZOMBIE, AST_STATE_DOWN, AST_STATE_RING, AST_STATE_RINGING, ast_test_flag, ast_channel::masq, and ast_channel::pbx.
Referenced by find_by_mark(), find_by_part(), find_channel_by_group(), pickup_by_exten(), and pickup_by_name_cb().
07282 { 07283 if (!chan->pbx && !chan->masq && !ast_test_flag(chan, AST_FLAG_ZOMBIE) 07284 && (chan->_state == AST_STATE_RINGING 07285 || chan->_state == AST_STATE_RING 07286 /* 07287 * Check the down state as well because some SIP devices do not 07288 * give 180 ringing when they can just give 183 session progress 07289 * instead. Issue 14005. (Some ISDN switches as well for that 07290 * matter.) 07291 */ 07292 || chan->_state == AST_STATE_DOWN) 07293 && !ast_channel_datastore_find(chan, &pickup_active, NULL)) { 07294 return 1; 07295 } 07296 return 0; 07297 }
| int ast_do_pickup | ( | struct ast_channel * | chan, | |
| struct ast_channel * | target | |||
| ) |
Pickup a call target.
| chan | channel that initiated pickup. | |
| target | channel to be picked up. |
| 0 | on success. | |
| -1 | on failure. |
< A masquerade changes channel names.
< A masquerade changes channel names.
Definition at line 7357 of file features.c.
References ast_answer(), AST_CEL_PICKUP, ast_cel_report_event(), ast_channel_connected_line_macro(), ast_channel_datastore_add(), ast_channel_datastore_remove(), ast_channel_lock, ast_channel_masquerade(), ast_channel_queue_connected_line_update(), ast_channel_unlock, ast_channel_update_connected_line(), ast_connected_line_copy_from_caller(), AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER, AST_CONTROL_ANSWER, ast_datastore_alloc, ast_datastore_free(), ast_debug, ast_do_masquerade(), AST_FLAG_ANSWERED_ELSEWHERE, ast_log(), ast_manager_event_multichan, ast_party_connected_line_copy(), ast_party_connected_line_free(), ast_party_connected_line_init(), ast_queue_control(), ast_set_flag, ast_strdupa, ast_channel::caller, ast_channel::connected, EVENT_FLAG_CALL, LOG_WARNING, and ast_party_connected_line::source.
Referenced by ast_pickup_call(), pickup_by_channel(), pickup_by_exten(), pickup_by_group(), pickup_by_mark(), and pickup_by_part().
07358 { 07359 struct ast_party_connected_line connected_caller; 07360 struct ast_channel *chans[2] = { chan, target }; 07361 struct ast_datastore *ds_pickup; 07362 const char *chan_name;/*!< A masquerade changes channel names. */ 07363 const char *target_name;/*!< A masquerade changes channel names. */ 07364 int res = -1; 07365 07366 target_name = ast_strdupa(target->name); 07367 ast_debug(1, "Call pickup on '%s' by '%s'\n", target_name, chan->name); 07368 07369 /* Mark the target to block any call pickup race. */ 07370 ds_pickup = ast_datastore_alloc(&pickup_active, NULL); 07371 if (!ds_pickup) { 07372 ast_log(LOG_WARNING, 07373 "Unable to create channel datastore on '%s' for call pickup\n", target_name); 07374 return -1; 07375 } 07376 ast_channel_datastore_add(target, ds_pickup); 07377 07378 ast_party_connected_line_init(&connected_caller); 07379 ast_party_connected_line_copy(&connected_caller, &target->connected); 07380 ast_channel_unlock(target);/* The pickup race is avoided so we do not need the lock anymore. */ 07381 connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; 07382 if (ast_channel_connected_line_macro(NULL, chan, &connected_caller, 0, 0)) { 07383 ast_channel_update_connected_line(chan, &connected_caller, NULL); 07384 } 07385 ast_party_connected_line_free(&connected_caller); 07386 07387 ast_channel_lock(chan); 07388 chan_name = ast_strdupa(chan->name); 07389 ast_connected_line_copy_from_caller(&connected_caller, &chan->caller); 07390 ast_channel_unlock(chan); 07391 connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; 07392 07393 ast_cel_report_event(target, AST_CEL_PICKUP, NULL, NULL, chan); 07394 07395 if (ast_answer(chan)) { 07396 ast_log(LOG_WARNING, "Unable to answer '%s'\n", chan_name); 07397 goto pickup_failed; 07398 } 07399 07400 if (ast_queue_control(chan, AST_CONTROL_ANSWER)) { 07401 ast_log(LOG_WARNING, "Unable to queue answer on '%s'\n", chan_name); 07402 goto pickup_failed; 07403 } 07404 07405 ast_channel_queue_connected_line_update(chan, &connected_caller, NULL); 07406 07407 /* setting this flag to generate a reason header in the cancel message to the ringing channel */ 07408 ast_set_flag(chan, AST_FLAG_ANSWERED_ELSEWHERE); 07409 07410 if (ast_channel_masquerade(target, chan)) { 07411 ast_log(LOG_WARNING, "Unable to masquerade '%s' into '%s'\n", chan_name, 07412 target_name); 07413 goto pickup_failed; 07414 } 07415 07416 /* If you want UniqueIDs, set channelvars in manager.conf to CHANNEL(uniqueid) */ 07417 ast_manager_event_multichan(EVENT_FLAG_CALL, "Pickup", 2, chans, 07418 "Channel: %s\r\n" 07419 "TargetChannel: %s\r\n", 07420 chan_name, target_name); 07421 07422 /* Do the masquerade manually to make sure that it is completed. */ 07423 ast_do_masquerade(target); 07424 res = 0; 07425 07426 pickup_failed: 07427 ast_channel_lock(target); 07428 if (!ast_channel_datastore_remove(target, ds_pickup)) { 07429 ast_datastore_free(ds_pickup); 07430 } 07431 ast_party_connected_line_free(&connected_caller); 07432 07433 return res; 07434 }
| int ast_feature_detect | ( | struct ast_channel * | chan, | |
| struct ast_flags * | features, | |||
| const char * | code, | |||
| struct ast_call_feature * | feature | |||
| ) |
detect a feature before bridging
| chan | ||
| features | an ast_flags ptr | |
| code | ptr of input code | |
| feature |
| ast_call_feature | ptr to be set if found |
Definition at line 3406 of file features.c.
References FEATURE_INTERPRET_DETECT, and feature_interpret_helper().
Referenced by detect_disconnect().
03406 { 03407 03408 return feature_interpret_helper(chan, NULL, NULL, code, 0, NULL, features, FEATURE_INTERPRET_DETECT, feature); 03409 }
| int ast_features_reload | ( | void | ) |
Reload call features from features.conf.
Definition at line 6822 of file features.c.
References ast_context_destroy(), ast_context_find(), ast_mutex_lock, ast_mutex_unlock, features_reload_lock, load_config(), parking_con_dial, and registrar.
Referenced by handle_features_reload().
06823 { 06824 struct ast_context *con; 06825 int res; 06826 06827 ast_mutex_lock(&features_reload_lock);/* Searialize reloading features.conf */ 06828 06829 /* 06830 * Always destroy the parking_con_dial context to remove buildup 06831 * of recalled extensions in the context. At worst, the parked 06832 * call gets hungup attempting to run an invalid extension when 06833 * we are trying to callback the parker or the preset return 06834 * extension. This is a small window of opportunity on an 06835 * execution chain that is not expected to happen very often. 06836 */ 06837 con = ast_context_find(parking_con_dial); 06838 if (con) { 06839 ast_context_destroy(con, registrar); 06840 } 06841 06842 res = load_config(1); 06843 ast_mutex_unlock(&features_reload_lock); 06844 06845 return res; 06846 }
| struct ast_call_feature* ast_find_call_feature | ( | const char * | name | ) | [read] |
look for a call feature entry by its sname
| name | a string ptr, should match "automon", "blindxfer", "atxfer", etc. |
Definition at line 3138 of file features.c.
References FEATURES_COUNT, and ast_call_feature::sname.
Referenced by action_atxfer(), handle_request_info(), and process_config().
03139 { 03140 int x; 03141 for (x = 0; x < FEATURES_COUNT; x++) { 03142 if (!strcasecmp(name, builtin_features[x].sname)) 03143 return &builtin_features[x]; 03144 } 03145 return NULL; 03146 }
| int ast_masq_park_call | ( | struct ast_channel * | park_me, | |
| struct ast_channel * | parker, | |||
| int | timeout, | |||
| int * | extout | |||
| ) |
Park a call via a masqueraded channel.
| park_me | Channel to be parked. | |
| parker | Channel parking the call. | |
| timeout | is a timeout in milliseconds | |
| extout | is a parameter to an int that will hold the parked location, or NULL if you want. |
Masquerade the park_me channel into a new, empty channel which is then parked.
| 0 | on success. | |
| -1 | on failure. |
Definition at line 1850 of file features.c.
References ast_strdupa, masq_park_call(), ast_park_call_args::orig_chan_name, and ast_park_call_args::timeout.
Referenced by handle_soft_key_event_message(), handle_stimulus_message(), and parkandannounce_exec().
01851 { 01852 struct ast_park_call_args args = { 01853 .timeout = timeout, 01854 .extout = extout, 01855 }; 01856 01857 if (peer) { 01858 args.orig_chan_name = ast_strdupa(peer->name); 01859 } 01860 return masq_park_call(rchan, peer, &args); 01861 }
| int ast_masq_park_call_exten | ( | struct ast_channel * | park_me, | |
| struct ast_channel * | parker, | |||
| const char * | park_exten, | |||
| const char * | park_context, | |||
| int | timeout, | |||
| int * | extout | |||
| ) |
Park a call via a masqueraded channel.
| park_me | Channel to be parked. | |
| parker | Channel parking the call. | |
| park_exten | Parking lot access extension | |
| park_context | Parking lot context | |
| timeout | is a timeout in milliseconds | |
| extout | is a parameter to an int that will hold the parked location, or NULL if you want. |
Masquerade the park_me channel into a new, empty channel which is then parked.
| 0 | on success. | |
| -1 | on failure. |
Definition at line 1796 of file features.c.
References ast_autoservice_start(), ast_autoservice_stop(), ast_get_extension_app_data(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), create_dynamic_parkinglot(), find_parkinglot(), get_parking_exten(), masq_park_call(), ast_park_call_args::orig_chan_name, parkeddynamic, ast_park_call_args::parkinglot, parkinglot_unref(), parse(), park_app_args::pl_name, and ast_park_call_args::timeout.
Referenced by __analog_ss_thread(), analog_ss_thread(), and mgcp_ss().
01797 { 01798 int res; 01799 char *parse; 01800 const char *app_data; 01801 struct ast_exten *exten; 01802 struct park_app_args app_args; 01803 struct ast_park_call_args args = { 01804 .timeout = timeout, 01805 .extout = extout, 01806 }; 01807 01808 if (parker) { 01809 args.orig_chan_name = ast_strdupa(parker->name); 01810 } 01811 if (!park_exten || !park_context) { 01812 return masq_park_call(park_me, parker, &args); 01813 } 01814 01815 /* 01816 * Determiine if the specified park extension has an exclusive 01817 * parking lot to use. 01818 */ 01819 if (parker && parker != park_me) { 01820 ast_autoservice_start(park_me); 01821 } 01822 exten = get_parking_exten(park_exten, parker, park_context); 01823 if (exten) { 01824 app_data = ast_get_extension_app_data(exten); 01825 if (!app_data) { 01826 app_data = ""; 01827 } 01828 parse = ast_strdupa(app_data); 01829 AST_STANDARD_APP_ARGS(app_args, parse); 01830 01831 if (!ast_strlen_zero(app_args.pl_name)) { 01832 /* Find the specified exclusive parking lot */ 01833 args.parkinglot = find_parkinglot(app_args.pl_name); 01834 if (!args.parkinglot && parkeddynamic) { 01835 args.parkinglot = create_dynamic_parkinglot(app_args.pl_name, park_me); 01836 } 01837 } 01838 } 01839 if (parker && parker != park_me) { 01840 ast_autoservice_stop(park_me); 01841 } 01842 01843 res = masq_park_call(park_me, parker, &args); 01844 if (args.parkinglot) { 01845 parkinglot_unref(args.parkinglot); 01846 } 01847 return res; 01848 }
| int ast_park_call | ( | struct ast_channel * | park_me, | |
| struct ast_channel * | parker, | |||
| int | timeout, | |||
| const char * | park_exten, | |||
| int * | extout | |||
| ) |
Park a call and read back parked location.
| park_me | Channel to be parked. | |
| parker | Channel parking the call. | |
| timeout | is a timeout in milliseconds | |
| park_exten | Parking lot access extension (Not used) | |
| extout | is a parameter to an int that will hold the parked location, or NULL if you want. |
Park the park_me channel, and read back the parked location to the parker channel. If the call is not picked up within a specified period of time, then the call will return to the last step that it was in (in terms of exten, priority and context).
| 0 | on success. | |
| -1 | on failure. |
Definition at line 1699 of file features.c.
References park_call_full(), and ast_park_call_args::timeout.
01700 { 01701 struct ast_park_call_args args = { 01702 .timeout = timeout, 01703 .extout = extout, 01704 }; 01705 01706 return park_call_full(park_me, parker, &args); 01707 }
| int ast_park_call_exten | ( | struct ast_channel * | park_me, | |
| struct ast_channel * | parker, | |||
| const char * | park_exten, | |||
| const char * | park_context, | |||
| int | timeout, | |||
| int * | extout | |||
| ) |
Park a call and read back parked location.
| park_me | Channel to be parked. | |
| parker | Channel parking the call. | |
| park_exten | Parking lot access extension | |
| park_context | Parking lot context | |
| timeout | is a timeout in milliseconds | |
| extout | is a parameter to an int that will hold the parked location, or NULL if you want. |
Park the park_me channel, and read back the parked location to the parker channel. If the call is not picked up within a specified period of time, then the call will return to the last step that it was in (in terms of exten, priority and context).
| 0 | on success. | |
| -1 | on failure. |
Definition at line 1648 of file features.c.
References ast_autoservice_start(), ast_autoservice_stop(), ast_get_extension_app_data(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), create_dynamic_parkinglot(), find_parkinglot(), get_parking_exten(), park_call_full(), parkeddynamic, ast_park_call_args::parkinglot, parkinglot_unref(), parse(), park_app_args::pl_name, and ast_park_call_args::timeout.
Referenced by iax_park_thread(), and sip_park_thread().
01649 { 01650 int res; 01651 char *parse; 01652 const char *app_data; 01653 struct ast_exten *exten; 01654 struct park_app_args app_args; 01655 struct ast_park_call_args args = { 01656 .timeout = timeout, 01657 .extout = extout, 01658 }; 01659 01660 if (!park_exten || !park_context) { 01661 return park_call_full(park_me, parker, &args); 01662 } 01663 01664 /* 01665 * Determiine if the specified park extension has an exclusive 01666 * parking lot to use. 01667 */ 01668 if (parker && parker != park_me) { 01669 ast_autoservice_start(park_me); 01670 } 01671 exten = get_parking_exten(park_exten, parker, park_context); 01672 if (exten) { 01673 app_data = ast_get_extension_app_data(exten); 01674 if (!app_data) { 01675 app_data = ""; 01676 } 01677 parse = ast_strdupa(app_data); 01678 AST_STANDARD_APP_ARGS(app_args, parse); 01679 01680 if (!ast_strlen_zero(app_args.pl_name)) { 01681 /* Find the specified exclusive parking lot */ 01682 args.parkinglot = find_parkinglot(app_args.pl_name); 01683 if (!args.parkinglot && parkeddynamic) { 01684 args.parkinglot = create_dynamic_parkinglot(app_args.pl_name, park_me); 01685 } 01686 } 01687 } 01688 if (parker && parker != park_me) { 01689 ast_autoservice_stop(park_me); 01690 } 01691 01692 res = park_call_full(park_me, parker, &args); 01693 if (args.parkinglot) { 01694 parkinglot_unref(args.parkinglot); 01695 } 01696 return res; 01697 }
| int ast_parking_ext_valid | ( | const char * | exten_str, | |
| struct ast_channel * | chan, | |||
| const char * | context | |||
| ) |
Determine if parking extension exists in a given context.
Definition at line 840 of file features.c.
References get_parking_exten().
Referenced by __analog_ss_thread(), analog_ss_thread(), dp_lookup(), handle_request_refer(), mgcp_ss(), and socket_process().
00841 { 00842 return get_parking_exten(exten_str, chan, context) ? 1 : 0; 00843 }
| int ast_pickup_call | ( | struct ast_channel * | chan | ) |
Pickup a call.
| chan | channel that initiated pickup. |
Walk list of channels, checking it is not itself, channel is pbx one, check that the callgroup for both channels are the same and the channel is ringing. Answer calling channel, flag channel as answered on queue, masq channels together.
< Potential pickup target
Definition at line 7323 of file features.c.
References ast_answer(), ast_channel_callback(), ast_channel_unlock, ast_channel_unref, ast_debug, ast_do_pickup(), ast_log(), ast_stream_and_wait(), ast_strlen_zero(), find_channel_by_group(), LOG_NOTICE, LOG_WARNING, pbx_builtin_setvar_helper(), pickupfailsound, and pickupsound.
Referenced by __analog_ss_thread(), analog_ss_thread(), cb_events(), mgcp_ss(), and sip_pickup_thread().
07324 { 07325 struct ast_channel *target;/*!< Potential pickup target */ 07326 int res = -1; 07327 ast_debug(1, "pickup attempt by %s\n", chan->name); 07328 07329 /* The found channel is already locked. */ 07330 target = ast_channel_callback(find_channel_by_group, NULL, chan, 0); 07331 if (target) { 07332 ast_log(LOG_NOTICE, "pickup %s attempt by %s\n", target->name, chan->name); 07333 07334 res = ast_do_pickup(chan, target); 07335 ast_channel_unlock(target); 07336 if (!res) { 07337 if (!ast_strlen_zero(pickupsound)) { 07338 pbx_builtin_setvar_helper(target, "BRIDGE_PLAY_SOUND", pickupsound); 07339 } 07340 } else { 07341 ast_log(LOG_WARNING, "pickup %s failed by %s\n", target->name, chan->name); 07342 } 07343 target = ast_channel_unref(target); 07344 } 07345 07346 if (res < 0) { 07347 ast_debug(1, "No call pickup possible... for %s\n", chan->name); 07348 if (!ast_strlen_zero(pickupfailsound)) { 07349 ast_answer(chan); 07350 ast_stream_and_wait(chan, pickupfailsound, ""); 07351 } 07352 } 07353 07354 return res; 07355 }
| const char* ast_pickup_ext | ( | void | ) |
Determine system call pickup extension.
Definition at line 845 of file features.c.
Referenced by __analog_ss_thread(), analog_canmatch_featurecode(), analog_ss_thread(), canmatch_featurecode(), cb_events(), get_destination(), handle_feature_show(), handle_request_invite(), and mgcp_ss().
00846 { 00847 return pickup_ext; 00848 }
| void ast_rdlock_call_features | ( | void | ) |
Definition at line 3128 of file features.c.
References ast_rwlock_rdlock, and features_lock.
Referenced by handle_request_info().
03129 { 03130 ast_rwlock_rdlock(&features_lock); 03131 }
| void ast_register_feature | ( | struct ast_call_feature * | feature | ) |
register new feature into feature_set
| feature | an ast_call_feature object which contains a keysequence and a callback function which is called when this keysequence is pressed during a call. |
Definition at line 2972 of file features.c.
References ast_log(), AST_RWLIST_INSERT_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, LOG_NOTICE, and ast_call_feature::sname.
Referenced by process_applicationmap_line().
02973 { 02974 if (!feature) { 02975 ast_log(LOG_NOTICE,"You didn't pass a feature!\n"); 02976 return; 02977 } 02978 02979 AST_RWLIST_WRLOCK(&feature_list); 02980 AST_RWLIST_INSERT_HEAD(&feature_list,feature,feature_entry); 02981 AST_RWLIST_UNLOCK(&feature_list); 02982 02983 ast_verb(2, "Registered Feature '%s'\n",feature->sname); 02984 }
| void ast_unlock_call_features | ( | void | ) |
Definition at line 3133 of file features.c.
References ast_rwlock_unlock, and features_lock.
Referenced by handle_request_info().
03134 { 03135 ast_rwlock_unlock(&features_lock); 03136 }
| void ast_unregister_feature | ( | struct ast_call_feature * | feature | ) |
unregister feature from feature_set
| feature | the ast_call_feature object which was registered before |
Definition at line 3052 of file features.c.
References ast_free, AST_RWLIST_REMOVE, AST_RWLIST_UNLOCK, and AST_RWLIST_WRLOCK.
03053 { 03054 if (!feature) { 03055 return; 03056 } 03057 03058 AST_RWLIST_WRLOCK(&feature_list); 03059 AST_RWLIST_REMOVE(&feature_list, feature, feature_entry); 03060 AST_RWLIST_UNLOCK(&feature_list); 03061 03062 ast_free(feature); 03063 }
1.6.1