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. | |
| 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 3875 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_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, 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().
03876 { 03877 /* Copy voice back and forth between the two channels. Give the peer 03878 the ability to transfer calls with '#<extension' syntax. */ 03879 struct ast_frame *f; 03880 struct ast_channel *who; 03881 char chan_featurecode[FEATURE_MAX_LEN + 1]=""; 03882 char peer_featurecode[FEATURE_MAX_LEN + 1]=""; 03883 char orig_channame[AST_CHANNEL_NAME]; 03884 char orig_peername[AST_CHANNEL_NAME]; 03885 int res; 03886 int diff; 03887 int hasfeatures=0; 03888 int hadfeatures=0; 03889 int autoloopflag; 03890 int sendingdtmfdigit = 0; 03891 int we_disabled_peer_cdr = 0; 03892 struct ast_option_header *aoh; 03893 struct ast_cdr *bridge_cdr = NULL; 03894 struct ast_cdr *chan_cdr = chan->cdr; /* the proper chan cdr, if there are forked cdrs */ 03895 struct ast_cdr *peer_cdr = peer->cdr; /* the proper chan cdr, if there are forked cdrs */ 03896 struct ast_cdr *new_chan_cdr = NULL; /* the proper chan cdr, if there are forked cdrs */ 03897 struct ast_cdr *new_peer_cdr = NULL; /* the proper chan cdr, if there are forked cdrs */ 03898 struct ast_silence_generator *silgen = NULL; 03899 const char *h_context; 03900 03901 pbx_builtin_setvar_helper(chan, "BRIDGEPEER", peer->name); 03902 pbx_builtin_setvar_helper(peer, "BRIDGEPEER", chan->name); 03903 03904 /* Clear any BLINDTRANSFER since the transfer has completed. */ 03905 pbx_builtin_setvar_helper(chan, "BLINDTRANSFER", NULL); 03906 pbx_builtin_setvar_helper(peer, "BLINDTRANSFER", NULL); 03907 03908 set_bridge_features_on_config(config, pbx_builtin_getvar_helper(chan, "BRIDGE_FEATURES")); 03909 add_features_datastores(chan, peer, config); 03910 03911 /* This is an interesting case. One example is if a ringing channel gets redirected to 03912 * an extension that picks up a parked call. This will make sure that the call taken 03913 * out of parking gets told that the channel it just got bridged to is still ringing. */ 03914 if (chan->_state == AST_STATE_RINGING && peer->visible_indication != AST_CONTROL_RINGING) { 03915 ast_indicate(peer, AST_CONTROL_RINGING); 03916 } 03917 03918 if (monitor_ok) { 03919 const char *monitor_exec; 03920 struct ast_channel *src = NULL; 03921 if (!monitor_app) { 03922 if (!(monitor_app = pbx_findapp("Monitor"))) 03923 monitor_ok=0; 03924 } 03925 if ((monitor_exec = pbx_builtin_getvar_helper(chan, "AUTO_MONITOR"))) 03926 src = chan; 03927 else if ((monitor_exec = pbx_builtin_getvar_helper(peer, "AUTO_MONITOR"))) 03928 src = peer; 03929 if (monitor_app && src) { 03930 char *tmp = ast_strdupa(monitor_exec); 03931 pbx_exec(src, monitor_app, tmp); 03932 } 03933 } 03934 03935 set_config_flags(chan, peer, config); 03936 03937 /* Answer if need be */ 03938 if (chan->_state != AST_STATE_UP) { 03939 if (ast_raw_answer(chan, 1)) { 03940 return -1; 03941 } 03942 } 03943 03944 #ifdef FOR_DEBUG 03945 /* show the two channels and cdrs involved in the bridge for debug & devel purposes */ 03946 ast_channel_log("Pre-bridge CHAN Channel info", chan); 03947 ast_channel_log("Pre-bridge PEER Channel info", peer); 03948 #endif 03949 /* two channels are being marked as linked here */ 03950 ast_channel_set_linkgroup(chan,peer); 03951 03952 /* copy the userfield from the B-leg to A-leg if applicable */ 03953 if (chan->cdr && peer->cdr && !ast_strlen_zero(peer->cdr->userfield)) { 03954 char tmp[256]; 03955 03956 ast_channel_lock(chan); 03957 if (!ast_strlen_zero(chan->cdr->userfield)) { 03958 snprintf(tmp, sizeof(tmp), "%s;%s", chan->cdr->userfield, peer->cdr->userfield); 03959 ast_cdr_appenduserfield(chan, tmp); 03960 } else { 03961 ast_cdr_setuserfield(chan, peer->cdr->userfield); 03962 } 03963 ast_channel_unlock(chan); 03964 /* Don't delete the CDR; just disable it. */ 03965 ast_set_flag(peer->cdr, AST_CDR_FLAG_POST_DISABLED); 03966 we_disabled_peer_cdr = 1; 03967 } 03968 ast_copy_string(orig_channame,chan->name,sizeof(orig_channame)); 03969 ast_copy_string(orig_peername,peer->name,sizeof(orig_peername)); 03970 03971 if (!chan_cdr || (chan_cdr && !ast_test_flag(chan_cdr, AST_CDR_FLAG_POST_DISABLED))) { 03972 ast_channel_lock_both(chan, peer); 03973 if (chan_cdr) { 03974 ast_set_flag(chan_cdr, AST_CDR_FLAG_MAIN); 03975 ast_cdr_update(chan); 03976 bridge_cdr = ast_cdr_dup_unique_swap(chan_cdr); 03977 /* rip any forked CDR's off of the chan_cdr and attach 03978 * them to the bridge_cdr instead */ 03979 bridge_cdr->next = chan_cdr->next; 03980 chan_cdr->next = NULL; 03981 ast_copy_string(bridge_cdr->lastapp, S_OR(chan->appl, ""), sizeof(bridge_cdr->lastapp)); 03982 ast_copy_string(bridge_cdr->lastdata, S_OR(chan->data, ""), sizeof(bridge_cdr->lastdata)); 03983 if (peer_cdr && !ast_strlen_zero(peer_cdr->userfield)) { 03984 ast_copy_string(bridge_cdr->userfield, peer_cdr->userfield, sizeof(bridge_cdr->userfield)); 03985 } 03986 ast_cdr_setaccount(peer, chan->accountcode); 03987 } else { 03988 /* better yet, in a xfer situation, find out why the chan cdr got zapped (pun unintentional) */ 03989 bridge_cdr = ast_cdr_alloc(); /* this should be really, really rare/impossible? */ 03990 ast_copy_string(bridge_cdr->channel, chan->name, sizeof(bridge_cdr->channel)); 03991 ast_copy_string(bridge_cdr->dstchannel, peer->name, sizeof(bridge_cdr->dstchannel)); 03992 ast_copy_string(bridge_cdr->uniqueid, chan->uniqueid, sizeof(bridge_cdr->uniqueid)); 03993 ast_copy_string(bridge_cdr->lastapp, S_OR(chan->appl, ""), sizeof(bridge_cdr->lastapp)); 03994 ast_copy_string(bridge_cdr->lastdata, S_OR(chan->data, ""), sizeof(bridge_cdr->lastdata)); 03995 ast_cdr_setcid(bridge_cdr, chan); 03996 bridge_cdr->disposition = (chan->_state == AST_STATE_UP) ? AST_CDR_ANSWERED : AST_CDR_NULL; 03997 bridge_cdr->amaflags = chan->amaflags ? chan->amaflags : ast_default_amaflags; 03998 ast_copy_string(bridge_cdr->accountcode, chan->accountcode, sizeof(bridge_cdr->accountcode)); 03999 /* Destination information */ 04000 ast_copy_string(bridge_cdr->dst, chan->exten, sizeof(bridge_cdr->dst)); 04001 ast_copy_string(bridge_cdr->dcontext, chan->context, sizeof(bridge_cdr->dcontext)); 04002 if (peer_cdr) { 04003 bridge_cdr->start = peer_cdr->start; 04004 ast_copy_string(bridge_cdr->userfield, peer_cdr->userfield, sizeof(bridge_cdr->userfield)); 04005 } else { 04006 ast_cdr_start(bridge_cdr); 04007 } 04008 } 04009 ast_channel_unlock(chan); 04010 ast_channel_unlock(peer); 04011 04012 ast_debug(4,"bridge answer set, chan answer set\n"); 04013 /* peer_cdr->answer will be set when a macro runs on the peer; 04014 in that case, the bridge answer will be delayed while the 04015 macro plays on the peer channel. The peer answered the call 04016 before the macro started playing. To the phone system, 04017 this is billable time for the call, even tho the caller 04018 hears nothing but ringing while the macro does its thing. */ 04019 04020 /* Another case where the peer cdr's time will be set, is when 04021 A self-parks by pickup up phone and dialing 700, then B 04022 picks up A by dialing its parking slot; there may be more 04023 practical paths that get the same result, tho... in which 04024 case you get the previous answer time from the Park... which 04025 is before the bridge's start time, so I added in the 04026 tvcmp check to the if below */ 04027 04028 if (peer_cdr && !ast_tvzero(peer_cdr->answer) && ast_tvcmp(peer_cdr->answer, bridge_cdr->start) >= 0) { 04029 ast_cdr_setanswer(bridge_cdr, peer_cdr->answer); 04030 ast_cdr_setdisposition(bridge_cdr, peer_cdr->disposition); 04031 if (chan_cdr) { 04032 ast_cdr_setanswer(chan_cdr, peer_cdr->answer); 04033 ast_cdr_setdisposition(chan_cdr, peer_cdr->disposition); 04034 } 04035 } else { 04036 ast_cdr_answer(bridge_cdr); 04037 if (chan_cdr) { 04038 ast_cdr_answer(chan_cdr); /* for the sake of cli status checks */ 04039 } 04040 } 04041 if (ast_test_flag(chan,AST_FLAG_BRIDGE_HANGUP_DONT) && (chan_cdr || peer_cdr)) { 04042 if (chan_cdr) { 04043 ast_set_flag(chan_cdr, AST_CDR_FLAG_BRIDGED); 04044 } 04045 if (peer_cdr) { 04046 ast_set_flag(peer_cdr, AST_CDR_FLAG_BRIDGED); 04047 } 04048 } 04049 /* the DIALED flag may be set if a dialed channel is transfered 04050 * and then bridged to another channel. In order for the 04051 * bridge CDR to be written, the DIALED flag must not be 04052 * present. */ 04053 ast_clear_flag(bridge_cdr, AST_CDR_FLAG_DIALED); 04054 } 04055 ast_cel_report_event(chan, AST_CEL_BRIDGE_START, NULL, NULL, peer); 04056 04057 /* If we are bridging a call, stop worrying about forwarding loops. We presume that if 04058 * a call is being bridged, that the humans in charge know what they're doing. If they 04059 * don't, well, what can we do about that? */ 04060 clear_dialed_interfaces(chan); 04061 clear_dialed_interfaces(peer); 04062 04063 for (;;) { 04064 struct ast_channel *other; /* used later */ 04065 04066 res = ast_channel_bridge(chan, peer, config, &f, &who); 04067 04068 if (ast_test_flag(chan, AST_FLAG_ZOMBIE) 04069 || ast_test_flag(peer, AST_FLAG_ZOMBIE)) { 04070 /* Zombies are present time to leave! */ 04071 res = -1; 04072 if (f) { 04073 ast_frfree(f); 04074 } 04075 goto before_you_go; 04076 } 04077 04078 /* When frame is not set, we are probably involved in a situation 04079 where we've timed out. 04080 When frame is set, we'll come this code twice; once for DTMF_BEGIN 04081 and also for DTMF_END. If we flow into the following 'if' for both, then 04082 our wait times are cut in half, as both will subtract from the 04083 feature_timer. Not good! 04084 */ 04085 if (config->feature_timer && (!f || f->frametype == AST_FRAME_DTMF_END)) { 04086 /* Update feature timer for next pass */ 04087 diff = ast_tvdiff_ms(ast_tvnow(), config->feature_start_time); 04088 if (res == AST_BRIDGE_RETRY) { 04089 /* The feature fully timed out but has not been updated. Skip 04090 * the potential round error from the diff calculation and 04091 * explicitly set to expired. */ 04092 config->feature_timer = -1; 04093 } else { 04094 config->feature_timer -= diff; 04095 } 04096 04097 if (hasfeatures) { 04098 if (config->feature_timer <= 0) { 04099 /* Not *really* out of time, just out of time for 04100 digits to come in for features. */ 04101 ast_debug(1, "Timed out for feature!\n"); 04102 if (!ast_strlen_zero(peer_featurecode)) { 04103 ast_dtmf_stream(chan, peer, peer_featurecode, 0, 0); 04104 memset(peer_featurecode, 0, sizeof(peer_featurecode)); 04105 } 04106 if (!ast_strlen_zero(chan_featurecode)) { 04107 ast_dtmf_stream(peer, chan, chan_featurecode, 0, 0); 04108 memset(chan_featurecode, 0, sizeof(chan_featurecode)); 04109 } 04110 if (f) 04111 ast_frfree(f); 04112 hasfeatures = !ast_strlen_zero(chan_featurecode) || !ast_strlen_zero(peer_featurecode); 04113 if (!hasfeatures) { 04114 /* No more digits expected - reset the timer */ 04115 config->feature_timer = 0; 04116 } 04117 hadfeatures = hasfeatures; 04118 /* Continue as we were */ 04119 continue; 04120 } else if (!f) { 04121 /* The bridge returned without a frame and there is a feature in progress. 04122 * However, we don't think the feature has quite yet timed out, so just 04123 * go back into the bridge. */ 04124 continue; 04125 } 04126 } else { 04127 if (config->feature_timer <=0) { 04128 /* We ran out of time */ 04129 config->feature_timer = 0; 04130 who = chan; 04131 if (f) 04132 ast_frfree(f); 04133 f = NULL; 04134 res = 0; 04135 } 04136 } 04137 } 04138 if (res < 0) { 04139 if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_test_flag(peer, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan) && !ast_check_hangup(peer)) { 04140 ast_log(LOG_WARNING, "Bridge failed on channels %s and %s\n", chan->name, peer->name); 04141 } 04142 goto before_you_go; 04143 } 04144 04145 if (!f || (f->frametype == AST_FRAME_CONTROL && 04146 (f->subclass.integer == AST_CONTROL_HANGUP || f->subclass.integer == AST_CONTROL_BUSY || 04147 f->subclass.integer == AST_CONTROL_CONGESTION))) { 04148 /* 04149 * If the bridge was broken for a hangup that isn't real, 04150 * then don't run the h extension, because the channel isn't 04151 * really hung up. This should really only happen with AST_SOFTHANGUP_ASYNCGOTO, 04152 * but it doesn't hurt to check AST_SOFTHANGUP_UNBRIDGE either. 04153 */ 04154 ast_channel_lock(chan); 04155 if (chan->_softhangup & (AST_SOFTHANGUP_ASYNCGOTO | AST_SOFTHANGUP_UNBRIDGE)) { 04156 ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT); 04157 } 04158 ast_channel_unlock(chan); 04159 res = -1; 04160 break; 04161 } 04162 /* many things should be sent to the 'other' channel */ 04163 other = (who == chan) ? peer : chan; 04164 if (f->frametype == AST_FRAME_CONTROL) { 04165 switch (f->subclass.integer) { 04166 case AST_CONTROL_RINGING: 04167 case AST_CONTROL_FLASH: 04168 case -1: 04169 ast_indicate(other, f->subclass.integer); 04170 break; 04171 case AST_CONTROL_CONNECTED_LINE: 04172 if (!ast_channel_connected_line_macro(who, other, f, who != chan, 1)) { 04173 break; 04174 } 04175 ast_indicate_data(other, f->subclass.integer, f->data.ptr, f->datalen); 04176 break; 04177 case AST_CONTROL_REDIRECTING: 04178 if (!ast_channel_redirecting_macro(who, other, f, who != chan, 1)) { 04179 break; 04180 } 04181 ast_indicate_data(other, f->subclass.integer, f->data.ptr, f->datalen); 04182 break; 04183 case AST_CONTROL_AOC: 04184 case AST_CONTROL_HOLD: 04185 case AST_CONTROL_UNHOLD: 04186 ast_indicate_data(other, f->subclass.integer, f->data.ptr, f->datalen); 04187 break; 04188 case AST_CONTROL_OPTION: 04189 aoh = f->data.ptr; 04190 /* Forward option Requests, but only ones we know are safe 04191 * These are ONLY sent by chan_iax2 and I'm not convinced that 04192 * they are useful. I haven't deleted them entirely because I 04193 * just am not sure of the ramifications of removing them. */ 04194 if (aoh && aoh->flag == AST_OPTION_FLAG_REQUEST) { 04195 switch (ntohs(aoh->option)) { 04196 case AST_OPTION_TONE_VERIFY: 04197 case AST_OPTION_TDD: 04198 case AST_OPTION_RELAXDTMF: 04199 case AST_OPTION_AUDIO_MODE: 04200 case AST_OPTION_DIGIT_DETECT: 04201 case AST_OPTION_FAX_DETECT: 04202 ast_channel_setoption(other, ntohs(aoh->option), aoh->data, 04203 f->datalen - sizeof(struct ast_option_header), 0); 04204 } 04205 } 04206 break; 04207 } 04208 } else if (f->frametype == AST_FRAME_DTMF_BEGIN) { 04209 struct ast_flags *cfg; 04210 char dtmfcode[2] = { f->subclass.integer, }; 04211 size_t featurelen; 04212 04213 if (who == chan) { 04214 featurelen = strlen(chan_featurecode); 04215 cfg = &(config->features_caller); 04216 } else { 04217 featurelen = strlen(peer_featurecode); 04218 cfg = &(config->features_callee); 04219 } 04220 /* Take a peek if this (possibly) matches a feature. If not, just pass this 04221 * DTMF along untouched. If this is not the first digit of a multi-digit code 04222 * then we need to fall through and stream the characters if it matches */ 04223 if (featurelen == 0 04224 && feature_check(chan, cfg, &dtmfcode[0]) == AST_FEATURE_RETURN_PASSDIGITS) { 04225 if (option_debug > 3) { 04226 ast_log(LOG_DEBUG, "Passing DTMF through, since it is not a feature code\n"); 04227 } 04228 ast_write(other, f); 04229 sendingdtmfdigit = 1; 04230 } else { 04231 /* If ast_opt_transmit_silence is set, then we need to make sure we are 04232 * transmitting something while we hold on to the DTMF waiting for a 04233 * feature. */ 04234 if (!silgen && ast_opt_transmit_silence) { 04235 silgen = ast_channel_start_silence_generator(other); 04236 } 04237 if (option_debug > 3) { 04238 ast_log(LOG_DEBUG, "Not passing DTMF through, since it may be a feature code\n"); 04239 } 04240 } 04241 } else if (f->frametype == AST_FRAME_DTMF_END) { 04242 char *featurecode; 04243 int sense; 04244 04245 hadfeatures = hasfeatures; 04246 /* This cannot overrun because the longest feature is one shorter than our buffer */ 04247 if (who == chan) { 04248 sense = FEATURE_SENSE_CHAN; 04249 featurecode = chan_featurecode; 04250 } else { 04251 sense = FEATURE_SENSE_PEER; 04252 featurecode = peer_featurecode; 04253 } 04254 04255 if (sendingdtmfdigit == 1) { 04256 /* We let the BEGIN go through happily, so let's not bother with the END, 04257 * since we already know it's not something we bother with */ 04258 ast_write(other, f); 04259 sendingdtmfdigit = 0; 04260 } else { 04261 /*! append the event to featurecode. we rely on the string being zero-filled, and 04262 * not overflowing it. 04263 * \todo XXX how do we guarantee the latter ? 04264 */ 04265 featurecode[strlen(featurecode)] = f->subclass.integer; 04266 /* Get rid of the frame before we start doing "stuff" with the channels */ 04267 ast_frfree(f); 04268 f = NULL; 04269 if (silgen) { 04270 ast_channel_stop_silence_generator(other, silgen); 04271 silgen = NULL; 04272 } 04273 config->feature_timer = 0; 04274 res = feature_interpret(chan, peer, config, featurecode, sense); 04275 switch(res) { 04276 case AST_FEATURE_RETURN_PASSDIGITS: 04277 ast_dtmf_stream(other, who, featurecode, 0, 0); 04278 /* Fall through */ 04279 case AST_FEATURE_RETURN_SUCCESS: 04280 memset(featurecode, 0, sizeof(chan_featurecode)); 04281 break; 04282 } 04283 if (res >= AST_FEATURE_RETURN_PASSDIGITS) { 04284 res = 0; 04285 } else { 04286 break; 04287 } 04288 hasfeatures = !ast_strlen_zero(chan_featurecode) || !ast_strlen_zero(peer_featurecode); 04289 if (hadfeatures && !hasfeatures) { 04290 /* Feature completed or timed out */ 04291 config->feature_timer = 0; 04292 } else if (hasfeatures) { 04293 if (config->timelimit) { 04294 /* No warning next time - we are waiting for feature code */ 04295 ast_set_flag(config, AST_FEATURE_WARNING_ACTIVE); 04296 } 04297 config->feature_start_time = ast_tvnow(); 04298 config->feature_timer = featuredigittimeout; 04299 ast_debug(1, "Set feature timer to %ld ms\n", config->feature_timer); 04300 } 04301 } 04302 } 04303 if (f) 04304 ast_frfree(f); 04305 } 04306 ast_cel_report_event(chan, AST_CEL_BRIDGE_END, NULL, NULL, peer); 04307 04308 before_you_go: 04309 /* Just in case something weird happened and we didn't clean up the silence generator... */ 04310 if (silgen) { 04311 ast_channel_stop_silence_generator(who == chan ? peer : chan, silgen); 04312 silgen = NULL; 04313 } 04314 04315 if (ast_test_flag(chan,AST_FLAG_BRIDGE_HANGUP_DONT)) { 04316 ast_clear_flag(chan,AST_FLAG_BRIDGE_HANGUP_DONT); /* its job is done */ 04317 if (bridge_cdr) { 04318 ast_cdr_discard(bridge_cdr); 04319 /* QUESTION: should we copy bridge_cdr fields to the peer before we throw it away? */ 04320 } 04321 return res; /* if we shouldn't do the h-exten, we shouldn't do the bridge cdr, either! */ 04322 } 04323 04324 if (config->end_bridge_callback) { 04325 config->end_bridge_callback(config->end_bridge_callback_data); 04326 } 04327 04328 /* run the hangup exten on the chan object IFF it was NOT involved in a parking situation 04329 * if it were, then chan belongs to a different thread now, and might have been hung up long 04330 * ago. 04331 */ 04332 if (ast_test_flag(&config->features_caller, AST_FEATURE_NO_H_EXTEN)) { 04333 h_context = NULL; 04334 } else if (ast_exists_extension(chan, chan->context, "h", 1, 04335 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 04336 h_context = chan->context; 04337 } else if (!ast_strlen_zero(chan->macrocontext) 04338 && ast_exists_extension(chan, chan->macrocontext, "h", 1, 04339 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { 04340 h_context = chan->macrocontext; 04341 } else { 04342 h_context = NULL; 04343 } 04344 if (h_context) { 04345 struct ast_cdr *swapper = NULL; 04346 char savelastapp[AST_MAX_EXTENSION]; 04347 char savelastdata[AST_MAX_EXTENSION]; 04348 char save_context[AST_MAX_CONTEXT]; 04349 char save_exten[AST_MAX_EXTENSION]; 04350 int save_prio; 04351 int found = 0; /* set if we find at least one match */ 04352 int spawn_error = 0; 04353 04354 /* 04355 * Make sure that the channel is marked as hungup since we are 04356 * going to run the "h" exten on it. 04357 */ 04358 ast_softhangup(chan, AST_SOFTHANGUP_APPUNLOAD); 04359 04360 autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP); 04361 ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP); 04362 if (bridge_cdr && ast_opt_end_cdr_before_h_exten) { 04363 ast_cdr_end(bridge_cdr); 04364 } 04365 04366 /* swap the bridge cdr and the chan cdr for a moment, and let the endbridge 04367 dialplan code operate on it */ 04368 ast_channel_lock(chan); 04369 if (bridge_cdr) { 04370 swapper = chan->cdr; 04371 ast_copy_string(savelastapp, bridge_cdr->lastapp, sizeof(bridge_cdr->lastapp)); 04372 ast_copy_string(savelastdata, bridge_cdr->lastdata, sizeof(bridge_cdr->lastdata)); 04373 chan->cdr = bridge_cdr; 04374 } 04375 ast_copy_string(save_context, chan->context, sizeof(save_context)); 04376 ast_copy_string(save_exten, chan->exten, sizeof(save_exten)); 04377 save_prio = chan->priority; 04378 if (h_context != chan->context) { 04379 ast_copy_string(chan->context, h_context, sizeof(chan->context)); 04380 } 04381 ast_copy_string(chan->exten, "h", sizeof(chan->exten)); 04382 chan->priority = 1; 04383 ast_channel_unlock(chan); 04384 04385 while ((spawn_error = ast_spawn_extension(chan, chan->context, chan->exten, 04386 chan->priority, 04387 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), 04388 &found, 1)) == 0) { 04389 chan->priority++; 04390 } 04391 if (found && spawn_error) { 04392 /* Something bad happened, or a hangup has been requested. */ 04393 ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", chan->context, chan->exten, chan->priority, chan->name); 04394 ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", chan->context, chan->exten, chan->priority, chan->name); 04395 } 04396 04397 /* swap it back */ 04398 ast_channel_lock(chan); 04399 ast_copy_string(chan->context, save_context, sizeof(chan->context)); 04400 ast_copy_string(chan->exten, save_exten, sizeof(chan->exten)); 04401 chan->priority = save_prio; 04402 if (bridge_cdr) { 04403 if (chan->cdr == bridge_cdr) { 04404 chan->cdr = swapper; 04405 } else { 04406 bridge_cdr = NULL; 04407 } 04408 } 04409 /* An "h" exten has been run, so indicate that one has been run. */ 04410 ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_RUN); 04411 ast_channel_unlock(chan); 04412 04413 /* protect the lastapp/lastdata against the effects of the hangup/dialplan code */ 04414 if (bridge_cdr) { 04415 ast_copy_string(bridge_cdr->lastapp, savelastapp, sizeof(bridge_cdr->lastapp)); 04416 ast_copy_string(bridge_cdr->lastdata, savelastdata, sizeof(bridge_cdr->lastdata)); 04417 } 04418 ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP); 04419 } 04420 04421 /* obey the NoCDR() wishes. -- move the DISABLED flag to the bridge CDR if it was set on the channel during the bridge... */ 04422 new_chan_cdr = pick_unlocked_cdr(chan->cdr); /* the proper chan cdr, if there are forked cdrs */ 04423 /* If the channel CDR has been modified during the call, record the changes in the bridge cdr, 04424 * BUT, if we've gone through the h extension block above, the CDR got swapped so don't overwrite 04425 * what was done in the h extension. What a mess. This is why you never touch CDR code. */ 04426 if (new_chan_cdr && bridge_cdr && !h_context) { 04427 ast_cdr_copy_vars(bridge_cdr, new_chan_cdr); 04428 ast_copy_string(bridge_cdr->userfield, new_chan_cdr->userfield, sizeof(bridge_cdr->userfield)); 04429 bridge_cdr->amaflags = new_chan_cdr->amaflags; 04430 ast_copy_string(bridge_cdr->accountcode, new_chan_cdr->accountcode, sizeof(bridge_cdr->accountcode)); 04431 if (ast_test_flag(new_chan_cdr, AST_CDR_FLAG_POST_DISABLED)) { 04432 ast_set_flag(bridge_cdr, AST_CDR_FLAG_POST_DISABLED); 04433 } 04434 } 04435 04436 /* we can post the bridge CDR at this point */ 04437 if (bridge_cdr) { 04438 ast_cdr_end(bridge_cdr); 04439 ast_cdr_detach(bridge_cdr); 04440 } 04441 04442 /* do a specialized reset on the beginning channel 04443 CDR's, if they still exist, so as not to mess up 04444 issues in future bridges; 04445 04446 Here are the rules of the game: 04447 1. The chan and peer channel pointers will not change 04448 during the life of the bridge. 04449 2. But, in transfers, the channel names will change. 04450 between the time the bridge is started, and the 04451 time the channel ends. 04452 Usually, when a channel changes names, it will 04453 also change CDR pointers. 04454 3. Usually, only one of the two channels (chan or peer) 04455 will change names. 04456 4. Usually, if a channel changes names during a bridge, 04457 it is because of a transfer. Usually, in these situations, 04458 it is normal to see 2 bridges running simultaneously, and 04459 it is not unusual to see the two channels that change 04460 swapped between bridges. 04461 5. After a bridge occurs, we have 2 or 3 channels' CDRs 04462 to attend to; if the chan or peer changed names, 04463 we have the before and after attached CDR's. 04464 */ 04465 04466 if (new_chan_cdr) { 04467 struct ast_channel *chan_ptr = NULL; 04468 04469 if (strcasecmp(orig_channame, chan->name) != 0) { 04470 /* old channel */ 04471 if ((chan_ptr = ast_channel_get_by_name(orig_channame))) { 04472 ast_channel_lock(chan_ptr); 04473 if (!ast_bridged_channel(chan_ptr)) { 04474 struct ast_cdr *cur; 04475 for (cur = chan_ptr->cdr; cur; cur = cur->next) { 04476 if (cur == chan_cdr) { 04477 break; 04478 } 04479 } 04480 if (cur) { 04481 ast_cdr_specialized_reset(chan_cdr, 0); 04482 } 04483 } 04484 ast_channel_unlock(chan_ptr); 04485 chan_ptr = ast_channel_unref(chan_ptr); 04486 } 04487 /* new channel */ 04488 ast_cdr_specialized_reset(new_chan_cdr, 0); 04489 } else { 04490 ast_cdr_specialized_reset(chan->cdr, 0); /* nothing changed, reset the chan cdr */ 04491 } 04492 } 04493 04494 { 04495 struct ast_channel *chan_ptr = NULL; 04496 new_peer_cdr = pick_unlocked_cdr(peer->cdr); /* the proper chan cdr, if there are forked cdrs */ 04497 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)) 04498 ast_set_flag(new_peer_cdr, AST_CDR_FLAG_POST_DISABLED); /* DISABLED is viral-- it will propagate across a bridge */ 04499 if (strcasecmp(orig_peername, peer->name) != 0) { 04500 /* old channel */ 04501 if ((chan_ptr = ast_channel_get_by_name(orig_peername))) { 04502 ast_channel_lock(chan_ptr); 04503 if (!ast_bridged_channel(chan_ptr)) { 04504 struct ast_cdr *cur; 04505 for (cur = chan_ptr->cdr; cur; cur = cur->next) { 04506 if (cur == peer_cdr) { 04507 break; 04508 } 04509 } 04510 if (cur) { 04511 ast_cdr_specialized_reset(peer_cdr, 0); 04512 } 04513 } 04514 ast_channel_unlock(chan_ptr); 04515 chan_ptr = ast_channel_unref(chan_ptr); 04516 } 04517 /* new channel */ 04518 if (new_peer_cdr) { 04519 ast_cdr_specialized_reset(new_peer_cdr, 0); 04520 } 04521 } else { 04522 if (we_disabled_peer_cdr) { 04523 ast_clear_flag(peer->cdr, AST_CDR_FLAG_POST_DISABLED); 04524 } 04525 ast_cdr_specialized_reset(peer->cdr, 0); /* nothing changed, reset the peer cdr */ 04526 } 04527 } 04528 04529 return res; 04530 }
| 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 7413 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().
07415 { 07416 char *stringp = ast_strdupa(parse); 07417 char *limit_str, *warning_str, *warnfreq_str; 07418 const char *var; 07419 int play_to_caller = 0, play_to_callee = 0; 07420 int delta; 07421 07422 limit_str = strsep(&stringp, ":"); 07423 warning_str = strsep(&stringp, ":"); 07424 warnfreq_str = strsep(&stringp, ":"); 07425 07426 config->timelimit = atol(limit_str); 07427 if (warning_str) 07428 config->play_warning = atol(warning_str); 07429 if (warnfreq_str) 07430 config->warning_freq = atol(warnfreq_str); 07431 07432 if (!config->timelimit) { 07433 ast_log(LOG_WARNING, "Bridge does not accept L(%s), hanging up.\n", limit_str); 07434 config->timelimit = config->play_warning = config->warning_freq = 0; 07435 config->warning_sound = NULL; 07436 return -1; /* error */ 07437 } else if ( (delta = config->play_warning - config->timelimit) > 0) { 07438 int w = config->warning_freq; 07439 07440 /* 07441 * If the first warning is requested _after_ the entire call 07442 * would end, and no warning frequency is requested, then turn 07443 * off the warning. If a warning frequency is requested, reduce 07444 * the 'first warning' time by that frequency until it falls 07445 * within the call's total time limit. 07446 * 07447 * Graphically: 07448 * timelim->| delta |<-playwarning 07449 * 0__________________|_________________| 07450 * | w | | | | 07451 * 07452 * so the number of intervals to cut is 1+(delta-1)/w 07453 */ 07454 if (w == 0) { 07455 config->play_warning = 0; 07456 } else { 07457 config->play_warning -= w * ( 1 + (delta-1)/w ); 07458 if (config->play_warning < 1) 07459 config->play_warning = config->warning_freq = 0; 07460 } 07461 } 07462 07463 ast_channel_lock(chan); 07464 07465 var = pbx_builtin_getvar_helper(chan, "LIMIT_PLAYAUDIO_CALLER"); 07466 play_to_caller = var ? ast_true(var) : 1; 07467 07468 var = pbx_builtin_getvar_helper(chan, "LIMIT_PLAYAUDIO_CALLEE"); 07469 play_to_callee = var ? ast_true(var) : 0; 07470 07471 if (!play_to_caller && !play_to_callee) 07472 play_to_caller = 1; 07473 07474 var = pbx_builtin_getvar_helper(chan, "LIMIT_WARNING_FILE"); 07475 config->warning_sound = !ast_strlen_zero(var) ? ast_strdup(var) : ast_strdup("timeleft"); 07476 07477 /* The code looking at config wants a NULL, not just "", to decide 07478 * that the message should not be played, so we replace "" with NULL. 07479 * Note, pbx_builtin_getvar_helper _can_ return NULL if the variable is 07480 * not found. 07481 */ 07482 07483 var = pbx_builtin_getvar_helper(chan, "LIMIT_TIMEOUT_FILE"); 07484 config->end_sound = !ast_strlen_zero(var) ? ast_strdup(var) : NULL; 07485 07486 var = pbx_builtin_getvar_helper(chan, "LIMIT_CONNECT_FILE"); 07487 config->start_sound = !ast_strlen_zero(var) ? ast_strdup(var) : NULL; 07488 07489 ast_channel_unlock(chan); 07490 07491 /* undo effect of S(x) in case they are both used */ 07492 calldurationlimit->tv_sec = 0; 07493 calldurationlimit->tv_usec = 0; 07494 07495 /* more efficient to do it like S(x) does since no advanced opts */ 07496 if (!config->play_warning && !config->start_sound && !config->end_sound && config->timelimit) { 07497 calldurationlimit->tv_sec = config->timelimit / 1000; 07498 calldurationlimit->tv_usec = (config->timelimit % 1000) * 1000; 07499 ast_verb(3, "Setting call duration limit to %.3lf seconds.\n", 07500 calldurationlimit->tv_sec + calldurationlimit->tv_usec / 1000000.0); 07501 config->timelimit = play_to_caller = play_to_callee = 07502 config->play_warning = config->warning_freq = 0; 07503 } else { 07504 ast_verb(4, "Limit Data for this call:\n"); 07505 ast_verb(4, "timelimit = %ld ms (%.3lf s)\n", config->timelimit, config->timelimit / 1000.0); 07506 ast_verb(4, "play_warning = %ld ms (%.3lf s)\n", config->play_warning, config->play_warning / 1000.0); 07507 ast_verb(4, "play_to_caller = %s\n", play_to_caller ? "yes" : "no"); 07508 ast_verb(4, "play_to_callee = %s\n", play_to_callee ? "yes" : "no"); 07509 ast_verb(4, "warning_freq = %ld ms (%.3lf s)\n", config->warning_freq, config->warning_freq / 1000.0); 07510 ast_verb(4, "start_sound = %s\n", S_OR(config->start_sound, "")); 07511 ast_verb(4, "warning_sound = %s\n", config->warning_sound); 07512 ast_verb(4, "end_sound = %s\n", S_OR(config->end_sound, "")); 07513 } 07514 if (play_to_caller) 07515 ast_set_flag(&(config->features_caller), AST_FEATURE_PLAY_WARNING); 07516 if (play_to_callee) 07517 ast_set_flag(&(config->features_callee), AST_FEATURE_PLAY_WARNING); 07518 return 0; 07519 }
| 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 7219 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().
07220 { 07221 if (!chan->pbx && !chan->masq && !ast_test_flag(chan, AST_FLAG_ZOMBIE) 07222 && (chan->_state == AST_STATE_RINGING 07223 || chan->_state == AST_STATE_RING 07224 /* 07225 * Check the down state as well because some SIP devices do not 07226 * give 180 ringing when they can just give 183 session progress 07227 * instead. Issue 14005. (Some ISDN switches as well for that 07228 * matter.) 07229 */ 07230 || chan->_state == AST_STATE_DOWN) 07231 && !ast_channel_datastore_find(chan, &pickup_active, NULL)) { 07232 return 1; 07233 } 07234 return 0; 07235 }
| 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 7295 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().
07296 { 07297 struct ast_party_connected_line connected_caller; 07298 struct ast_channel *chans[2] = { chan, target }; 07299 struct ast_datastore *ds_pickup; 07300 const char *chan_name;/*!< A masquerade changes channel names. */ 07301 const char *target_name;/*!< A masquerade changes channel names. */ 07302 int res = -1; 07303 07304 target_name = ast_strdupa(target->name); 07305 ast_debug(1, "Call pickup on '%s' by '%s'\n", target_name, chan->name); 07306 07307 /* Mark the target to block any call pickup race. */ 07308 ds_pickup = ast_datastore_alloc(&pickup_active, NULL); 07309 if (!ds_pickup) { 07310 ast_log(LOG_WARNING, 07311 "Unable to create channel datastore on '%s' for call pickup\n", target_name); 07312 return -1; 07313 } 07314 ast_channel_datastore_add(target, ds_pickup); 07315 07316 ast_party_connected_line_init(&connected_caller); 07317 ast_party_connected_line_copy(&connected_caller, &target->connected); 07318 ast_channel_unlock(target);/* The pickup race is avoided so we do not need the lock anymore. */ 07319 connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; 07320 if (ast_channel_connected_line_macro(NULL, chan, &connected_caller, 0, 0)) { 07321 ast_channel_update_connected_line(chan, &connected_caller, NULL); 07322 } 07323 ast_party_connected_line_free(&connected_caller); 07324 07325 ast_channel_lock(chan); 07326 chan_name = ast_strdupa(chan->name); 07327 ast_connected_line_copy_from_caller(&connected_caller, &chan->caller); 07328 ast_channel_unlock(chan); 07329 connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; 07330 07331 ast_cel_report_event(target, AST_CEL_PICKUP, NULL, NULL, chan); 07332 07333 if (ast_answer(chan)) { 07334 ast_log(LOG_WARNING, "Unable to answer '%s'\n", chan_name); 07335 goto pickup_failed; 07336 } 07337 07338 if (ast_queue_control(chan, AST_CONTROL_ANSWER)) { 07339 ast_log(LOG_WARNING, "Unable to queue answer on '%s'\n", chan_name); 07340 goto pickup_failed; 07341 } 07342 07343 ast_channel_queue_connected_line_update(chan, &connected_caller, NULL); 07344 07345 /* setting this flag to generate a reason header in the cancel message to the ringing channel */ 07346 ast_set_flag(chan, AST_FLAG_ANSWERED_ELSEWHERE); 07347 07348 if (ast_channel_masquerade(target, chan)) { 07349 ast_log(LOG_WARNING, "Unable to masquerade '%s' into '%s'\n", chan_name, 07350 target_name); 07351 goto pickup_failed; 07352 } 07353 07354 /* If you want UniqueIDs, set channelvars in manager.conf to CHANNEL(uniqueid) */ 07355 ast_manager_event_multichan(EVENT_FLAG_CALL, "Pickup", 2, chans, 07356 "Channel: %s\r\n" 07357 "TargetChannel: %s\r\n", 07358 chan_name, target_name); 07359 07360 /* Do the masquerade manually to make sure that it is completed. */ 07361 ast_do_masquerade(target); 07362 res = 0; 07363 07364 pickup_failed: 07365 ast_channel_lock(target); 07366 if (!ast_channel_datastore_remove(target, ds_pickup)) { 07367 ast_datastore_free(ds_pickup); 07368 } 07369 ast_party_connected_line_free(&connected_caller); 07370 07371 return res; 07372 }
| 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 3370 of file features.c.
References FEATURE_INTERPRET_DETECT, and feature_interpret_helper().
Referenced by detect_disconnect().
03370 { 03371 03372 return feature_interpret_helper(chan, NULL, NULL, code, 0, NULL, features, FEATURE_INTERPRET_DETECT, feature); 03373 }
| int ast_features_reload | ( | void | ) |
Reload call features from features.conf.
Definition at line 6760 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().
06761 { 06762 struct ast_context *con; 06763 int res; 06764 06765 ast_mutex_lock(&features_reload_lock);/* Searialize reloading features.conf */ 06766 06767 /* 06768 * Always destroy the parking_con_dial context to remove buildup 06769 * of recalled extensions in the context. At worst, the parked 06770 * call gets hungup attempting to run an invalid extension when 06771 * we are trying to callback the parker or the preset return 06772 * extension. This is a small window of opportunity on an 06773 * execution chain that is not expected to happen very often. 06774 */ 06775 con = ast_context_find(parking_con_dial); 06776 if (con) { 06777 ast_context_destroy(con, registrar); 06778 } 06779 06780 res = load_config(1); 06781 ast_mutex_unlock(&features_reload_lock); 06782 06783 return res; 06784 }
| 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 3102 of file features.c.
References FEATURES_COUNT, and ast_call_feature::sname.
Referenced by action_atxfer(), handle_request_info(), and process_config().
03103 { 03104 int x; 03105 for (x = 0; x < FEATURES_COUNT; x++) { 03106 if (!strcasecmp(name, builtin_features[x].sname)) 03107 return &builtin_features[x]; 03108 } 03109 return NULL; 03110 }
| 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 1814 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().
01815 { 01816 struct ast_park_call_args args = { 01817 .timeout = timeout, 01818 .extout = extout, 01819 }; 01820 01821 if (peer) { 01822 args.orig_chan_name = ast_strdupa(peer->name); 01823 } 01824 return masq_park_call(rchan, peer, &args); 01825 }
| 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 1760 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().
01761 { 01762 int res; 01763 char *parse; 01764 const char *app_data; 01765 struct ast_exten *exten; 01766 struct park_app_args app_args; 01767 struct ast_park_call_args args = { 01768 .timeout = timeout, 01769 .extout = extout, 01770 }; 01771 01772 if (parker) { 01773 args.orig_chan_name = ast_strdupa(parker->name); 01774 } 01775 if (!park_exten || !park_context) { 01776 return masq_park_call(park_me, parker, &args); 01777 } 01778 01779 /* 01780 * Determiine if the specified park extension has an exclusive 01781 * parking lot to use. 01782 */ 01783 if (parker && parker != park_me) { 01784 ast_autoservice_start(park_me); 01785 } 01786 exten = get_parking_exten(park_exten, parker, park_context); 01787 if (exten) { 01788 app_data = ast_get_extension_app_data(exten); 01789 if (!app_data) { 01790 app_data = ""; 01791 } 01792 parse = ast_strdupa(app_data); 01793 AST_STANDARD_APP_ARGS(app_args, parse); 01794 01795 if (!ast_strlen_zero(app_args.pl_name)) { 01796 /* Find the specified exclusive parking lot */ 01797 args.parkinglot = find_parkinglot(app_args.pl_name); 01798 if (!args.parkinglot && parkeddynamic) { 01799 args.parkinglot = create_dynamic_parkinglot(app_args.pl_name, park_me); 01800 } 01801 } 01802 } 01803 if (parker && parker != park_me) { 01804 ast_autoservice_stop(park_me); 01805 } 01806 01807 res = masq_park_call(park_me, parker, &args); 01808 if (args.parkinglot) { 01809 parkinglot_unref(args.parkinglot); 01810 } 01811 return res; 01812 }
| 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 1663 of file features.c.
References park_call_full(), and ast_park_call_args::timeout.
01664 { 01665 struct ast_park_call_args args = { 01666 .timeout = timeout, 01667 .extout = extout, 01668 }; 01669 01670 return park_call_full(park_me, parker, &args); 01671 }
| 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 1612 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().
01613 { 01614 int res; 01615 char *parse; 01616 const char *app_data; 01617 struct ast_exten *exten; 01618 struct park_app_args app_args; 01619 struct ast_park_call_args args = { 01620 .timeout = timeout, 01621 .extout = extout, 01622 }; 01623 01624 if (!park_exten || !park_context) { 01625 return park_call_full(park_me, parker, &args); 01626 } 01627 01628 /* 01629 * Determiine if the specified park extension has an exclusive 01630 * parking lot to use. 01631 */ 01632 if (parker && parker != park_me) { 01633 ast_autoservice_start(park_me); 01634 } 01635 exten = get_parking_exten(park_exten, parker, park_context); 01636 if (exten) { 01637 app_data = ast_get_extension_app_data(exten); 01638 if (!app_data) { 01639 app_data = ""; 01640 } 01641 parse = ast_strdupa(app_data); 01642 AST_STANDARD_APP_ARGS(app_args, parse); 01643 01644 if (!ast_strlen_zero(app_args.pl_name)) { 01645 /* Find the specified exclusive parking lot */ 01646 args.parkinglot = find_parkinglot(app_args.pl_name); 01647 if (!args.parkinglot && parkeddynamic) { 01648 args.parkinglot = create_dynamic_parkinglot(app_args.pl_name, park_me); 01649 } 01650 } 01651 } 01652 if (parker && parker != park_me) { 01653 ast_autoservice_stop(park_me); 01654 } 01655 01656 res = park_call_full(park_me, parker, &args); 01657 if (args.parkinglot) { 01658 parkinglot_unref(args.parkinglot); 01659 } 01660 return res; 01661 }
| 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 7261 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().
07262 { 07263 struct ast_channel *target;/*!< Potential pickup target */ 07264 int res = -1; 07265 ast_debug(1, "pickup attempt by %s\n", chan->name); 07266 07267 /* The found channel is already locked. */ 07268 target = ast_channel_callback(find_channel_by_group, NULL, chan, 0); 07269 if (target) { 07270 ast_log(LOG_NOTICE, "pickup %s attempt by %s\n", target->name, chan->name); 07271 07272 res = ast_do_pickup(chan, target); 07273 ast_channel_unlock(target); 07274 if (!res) { 07275 if (!ast_strlen_zero(pickupsound)) { 07276 pbx_builtin_setvar_helper(target, "BRIDGE_PLAY_SOUND", pickupsound); 07277 } 07278 } else { 07279 ast_log(LOG_WARNING, "pickup %s failed by %s\n", target->name, chan->name); 07280 } 07281 target = ast_channel_unref(target); 07282 } 07283 07284 if (res < 0) { 07285 ast_debug(1, "No call pickup possible... for %s\n", chan->name); 07286 if (!ast_strlen_zero(pickupfailsound)) { 07287 ast_answer(chan); 07288 ast_stream_and_wait(chan, pickupfailsound, ""); 07289 } 07290 } 07291 07292 return res; 07293 }
| 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 3092 of file features.c.
References ast_rwlock_rdlock, and features_lock.
Referenced by handle_request_info().
03093 { 03094 ast_rwlock_rdlock(&features_lock); 03095 }
| 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 2936 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().
02937 { 02938 if (!feature) { 02939 ast_log(LOG_NOTICE,"You didn't pass a feature!\n"); 02940 return; 02941 } 02942 02943 AST_RWLIST_WRLOCK(&feature_list); 02944 AST_RWLIST_INSERT_HEAD(&feature_list,feature,feature_entry); 02945 AST_RWLIST_UNLOCK(&feature_list); 02946 02947 ast_verb(2, "Registered Feature '%s'\n",feature->sname); 02948 }
| void ast_unlock_call_features | ( | void | ) |
Definition at line 3097 of file features.c.
References ast_rwlock_unlock, and features_lock.
Referenced by handle_request_info().
03098 { 03099 ast_rwlock_unlock(&features_lock); 03100 }
| 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 3016 of file features.c.
References ast_free, AST_RWLIST_REMOVE, AST_RWLIST_UNLOCK, and AST_RWLIST_WRLOCK.
03017 { 03018 if (!feature) { 03019 return; 03020 } 03021 03022 AST_RWLIST_WRLOCK(&feature_list); 03023 AST_RWLIST_REMOVE(&feature_list, feature, feature_entry); 03024 AST_RWLIST_UNLOCK(&feature_list); 03025 03026 ast_free(feature); 03027 }
1.6.1