< TRUE if force CallerID on call forward only. Legacy behaviour.
Forced CallerID party information to send.
Stored CallerID information if needed.
CallerID party information to store.
2305 int to_answer, to_progress;
2307 int cause, hanguptreecause = -1;
2310 struct timeval calldurationlimit = { 0, };
2311 char *dtmfcalled = NULL, *dtmfcalling = NULL, *dtmf_progress = NULL;
2312 char *mf_progress = NULL, *mf_wink = NULL;
2313 char *sf_progress = NULL, *sf_wink = NULL;
2317 .status =
"INVALIDARGS",
2320 int sentringing = 0, moh = 0;
2321 const char *outbound_group = NULL;
2325 int delprivintro = 0;
2333 char *opt_args[OPT_ARG_ARRAY_SIZE];
2334 int fulldial = 0, num_dialed = 0;
2339 int force_forwards_only;
2362 SCOPE_ENTER(1,
"%s: Data: %s\n", ast_channel_name(chan),
data);
2365 ast_channel_lock(chan);
2379 max_forwards = ast_max_forwards_get(chan);
2380 ast_channel_unlock(chan);
2382 if (max_forwards <= 0) {
2383 ast_log(LOG_WARNING,
"Cannot place outbound call from channel '%s'. Max forwards exceeded\n",
2384 ast_channel_name(chan));
2386 SCOPE_EXIT_RTN_VALUE(-1,
"%s: Max forwards exceeded\n", ast_channel_name(chan));
2389 if (ast_check_hangup_locked(chan)) {
2402 ast_verb(3,
"Caller hung up before dial.\n");
2404 SCOPE_EXIT_RTN_VALUE(-1,
"%s: Caller hung up before dial\n", ast_channel_name(chan));
2411 if (!ast_strlen_zero(args.options) &&
2421 if (ast_test_flag64(&opts, OPT_SCREEN_NOINTRO) && !ast_strlen_zero(opt_args[OPT_ARG_SCREEN_NOINTRO])) {
2422 delprivintro = atoi(opt_args[OPT_ARG_SCREEN_NOINTRO]);
2424 if (delprivintro < 0 || delprivintro > 1) {
2425 ast_log(LOG_WARNING,
"Unknown argument %d specified to n option, ignoring\n", delprivintro);
2430 if (!ast_test_flag64(&opts, OPT_RINGBACK)) {
2431 opt_args[OPT_ARG_RINGBACK] = NULL;
2434 if (ast_test_flag64(&opts, OPT_OPERMODE)) {
2435 opermode = ast_strlen_zero(opt_args[OPT_ARG_OPERMODE]) ? 1 : atoi(opt_args[OPT_ARG_OPERMODE]);
2436 ast_verb(3,
"Setting operator services mode to %d.\n", opermode);
2439 if (ast_test_flag64(&opts, OPT_DURATION_STOP) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_STOP])) {
2440 calldurationlimit.tv_sec = atoi(opt_args[OPT_ARG_DURATION_STOP]);
2441 if (!calldurationlimit.tv_sec) {
2442 ast_log(LOG_WARNING,
"Dial does not accept S(%s)\n", opt_args[OPT_ARG_DURATION_STOP]);
2446 ast_verb(3,
"Setting call duration limit to %.3lf seconds.\n", calldurationlimit.tv_sec + calldurationlimit.tv_usec / 1000000.0);
2449 if (ast_test_flag64(&opts, OPT_SENDDTMF) && !ast_strlen_zero(opt_args[OPT_ARG_SENDDTMF])) {
2450 sf_wink = opt_args[OPT_ARG_SENDDTMF];
2451 dtmfcalled = strsep(&sf_wink,
":");
2452 dtmfcalling = strsep(&sf_wink,
":");
2453 dtmf_progress = strsep(&sf_wink,
":");
2454 mf_progress = strsep(&sf_wink,
":");
2455 mf_wink = strsep(&sf_wink,
":");
2456 sf_progress = strsep(&sf_wink,
":");
2459 if (ast_test_flag64(&opts, OPT_DURATION_LIMIT) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_LIMIT])) {
2466 force_forwards_only = 0;
2467 if (ast_test_flag64(&opts, OPT_FORCECLID)) {
2468 if (ast_strlen_zero(opt_args[OPT_ARG_FORCECLID])) {
2469 ast_channel_lock(chan);
2470 forced_clid.number.str =
ast_strdupa(ast_channel_exten(chan));
2471 ast_channel_unlock(chan);
2472 forced_clid_name[0] =
'\0';
2473 forced_clid.name.str = (
char *) get_cid_name(forced_clid_name,
2474 sizeof(forced_clid_name), chan);
2475 force_forwards_only = 1;
2479 &forced_clid.number.str);
2481 if (!ast_strlen_zero(forced_clid.name.str)) {
2482 forced_clid.name.valid = 1;
2484 if (!ast_strlen_zero(forced_clid.number.str)) {
2485 forced_clid.number.valid = 1;
2488 if (ast_test_flag64(&opts, OPT_FORCE_CID_TAG)
2489 && !ast_strlen_zero(opt_args[OPT_ARG_FORCE_CID_TAG])) {
2490 forced_clid.tag = opt_args[OPT_ARG_FORCE_CID_TAG];
2492 forced_clid.number.presentation = AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN;
2493 if (ast_test_flag64(&opts, OPT_FORCE_CID_PRES)
2494 && !ast_strlen_zero(opt_args[OPT_ARG_FORCE_CID_PRES])) {
2499 forced_clid.number.presentation = pres;
2505 if (ast_test_flag64(&opts, OPT_ORIGINAL_CLID)) {
2506 if (ast_strlen_zero(opt_args[OPT_ARG_ORIGINAL_CLID])) {
2507 ast_channel_lock(chan);
2509 if (!ast_strlen_zero(ast_channel_caller(chan)->
id.name.str)) {
2510 stored_clid.name.str =
ast_strdupa(ast_channel_caller(chan)->
id.name.str);
2512 if (!ast_strlen_zero(ast_channel_caller(chan)->
id.
number.str)) {
2515 if (!ast_strlen_zero(ast_channel_caller(chan)->
id.subaddress.str)) {
2516 stored_clid.subaddress.str =
ast_strdupa(ast_channel_caller(chan)->
id.subaddress.str);
2518 if (!ast_strlen_zero(ast_channel_caller(chan)->
id.tag)) {
2519 stored_clid.tag =
ast_strdupa(ast_channel_caller(chan)->
id.tag);
2521 ast_channel_unlock(chan);
2525 &stored_clid.number.str);
2526 if (!ast_strlen_zero(stored_clid.name.str)) {
2527 stored_clid.name.valid = 1;
2529 if (!ast_strlen_zero(stored_clid.number.str)) {
2530 stored_clid.number.valid = 1;
2538 stored_clid_name[0] =
'\0';
2539 stored_clid.name.str = (
char *) get_cid_name(stored_clid_name,
2540 sizeof(stored_clid_name), chan);
2541 if (ast_strlen_zero(stored_clid.name.str)) {
2542 stored_clid.name.str = NULL;
2544 stored_clid.name.valid = 1;
2546 ast_channel_lock(chan);
2547 stored_clid.number.str =
ast_strdupa(ast_channel_exten(chan));
2548 stored_clid.number.valid = 1;
2549 ast_channel_unlock(chan);
2552 if (ast_test_flag64(&opts, OPT_RESETCDR)) {
2555 if (ast_test_flag64(&opts, OPT_PRIVACY) && ast_strlen_zero(opt_args[OPT_ARG_PRIVACY]))
2556 opt_args[OPT_ARG_PRIVACY] =
ast_strdupa(ast_channel_exten(chan));
2558 if (ast_test_flag64(&opts, OPT_PRIVACY) || ast_test_flag64(&opts, OPT_SCREENING)) {
2570 ast_channel_lock(chan);
2577 ast_channel_unlock(chan);
2580 ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID
2581 | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING | OPT_CANCEL_TIMEOUT
2582 | OPT_ANNOUNCE | OPT_CALLEE_GOSUB | OPT_FORCECLID);
2585 if (ast_test_flag64(&opts, OPT_PREDIAL_CALLER)
2586 && !ast_strlen_zero(opt_args[OPT_ARG_PREDIAL_CALLER])) {
2593 while ((cur = strsep(&rest,
"&"))) {
2604 if (ast_strlen_zero(cur)) {
2611 tech = strsep(&number,
"/");
2614 if (ast_strlen_zero(number)) {
2615 ast_log(LOG_WARNING,
"Dial argument takes format (technology/resource)\n");
2619 tech_len = strlen(tech) + 1;
2620 number_len = strlen(number) + 1;
2621 tmp =
ast_calloc(1,
sizeof(*tmp) + (2 * tech_len) + number_len);
2632 cur[tech_len - 1] =
'/';
2635 strcpy(cur, number);
2640 ast_copy_flags64(tmp, &opts,
2641 OPT_CANCEL_ELSEWHERE |
2642 OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
2643 OPT_CALLEE_HANGUP | OPT_CALLER_HANGUP |
2644 OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR |
2645 OPT_CALLEE_PARK | OPT_CALLER_PARK |
2646 OPT_CALLEE_MIXMONITOR | OPT_CALLER_MIXMONITOR |
2647 OPT_RINGBACK | OPT_MUSICBACK | OPT_FORCECLID | OPT_IGNORE_CONNECTEDLINE |
2648 OPT_RING_WITH_EARLY_MEDIA);
2649 ast_set2_flag64(tmp, args.url, DIAL_NOFORWARDHTML);
2654 ast_channel_lock(chan);
2663 if (ast_test_flag64(&opts, OPT_TOPOLOGY_PRESERVE)) {
2666 if (!topology_ds && (topology_ds = ast_datastore_alloc(&topology_ds_info, NULL))) {
2674 topology = topology_ds->
data;
2679 ast_channel_unlock(chan);
2703 ast_log(LOG_NOTICE,
"Unable to create channel of type '%s' (cause %d - %s)\n",
2705 handle_cause(cause, &num);
2708 ast_channel_hangupcause_set(chan, cause);
2710 if (!ignore_cc && (cause == AST_CAUSE_BUSY || cause == AST_CAUSE_CONGESTION)) {
2730 if (!
AST_LIST_FIRST(&out_chans) && !rest && CAN_EARLY_BRIDGE(peerflags, chan, tc)) {
2738 ast_max_forwards_decrement(tc);
2740 ast_channel_appl_set(tc,
"AppDial");
2741 ast_channel_data_set(tc,
"(Outgoing Line)");
2743 memset(ast_channel_whentohangup(tc), 0,
sizeof(*ast_channel_whentohangup(tc)));
2747 if (ast_test_flag64(peerflags, OPT_ORIGINAL_CLID)) {
2748 caller.id = stored_clid;
2750 ast_set_flag64(tmp, DIAL_CALLERID_ABSENT);
2751 }
else if (ast_strlen_zero(
S_COR(ast_channel_caller(tc)->
id.number.valid,
2752 ast_channel_caller(tc)->
id.number.str, NULL))) {
2757 caller.id = stored_clid;
2758 if (!caller.id.name.valid
2759 && !ast_strlen_zero(
S_COR(ast_channel_connected(chan)->
id.
name.valid,
2760 ast_channel_connected(chan)->
id.
name.str, NULL))) {
2765 caller.id.name.valid = 1;
2766 caller.id.name = ast_channel_connected(chan)->
id.
name;
2769 ast_set_flag64(tmp, DIAL_CALLERID_ABSENT);
2770 }
else if (ast_strlen_zero(
S_COR(ast_channel_caller(tc)->
id.
name.valid, ast_channel_caller(tc)->
id.
name.str,
2773 if (!ast_strlen_zero(
S_COR(ast_channel_connected(chan)->
id.
name.valid,
2774 ast_channel_connected(chan)->
id.
name.str, NULL))) {
2779 caller.id.name.valid = 1;
2780 caller.id.name = ast_channel_connected(chan)->
id.
name;
2786 if (ast_test_flag64(peerflags, OPT_FORCECLID) && !force_forwards_only) {
2790 connected.id = forced_clid;
2801 if (ast_strlen_zero(ast_channel_musicclass(tc))) {
2802 ast_channel_musicclass_set(tc, ast_channel_musicclass(chan));
2806 ast_channel_adsicpe_set(tc, ast_channel_adsicpe(chan));
2807 ast_channel_transfercapability_set(tc, ast_channel_transfercapability(chan));
2813 if (ast_channel_hangupcause(chan) == AST_CAUSE_ANSWERED_ELSEWHERE)
2814 ast_channel_hangupcause_set(tc, AST_CAUSE_ANSWERED_ELSEWHERE);
2817 if (ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE))
2818 ast_channel_hangupcause_set(tc, AST_CAUSE_ANSWERED_ELSEWHERE);
2822 ast_channel_dialcontext_set(tc, ast_channel_context(chan));
2823 ast_channel_exten_set(tc, ast_channel_exten(chan));
2830 ast_channel_unlock(tc);
2831 ast_channel_unlock(chan);
2841 ast_verb(3,
"No devices or endpoints to dial (technology/resource)\n");
2842 if (continue_exec) {
2846 strcpy(pa.status,
"CHANUNAVAIL");
2863 if (ast_test_flag64(&opts, OPT_PREDIAL_CALLEE)
2864 && !ast_strlen_zero(opt_args[OPT_ARG_PREDIAL_CALLEE])
2866 const char *predial_callee;
2870 if (predial_callee) {
2876 ast_free((
char *) predial_callee);
2883 ast_channel_lock(chan);
2888 ast_debug(1,
"ast call on peer returned %d\n", res);
2889 ast_verb(3,
"Couldn't call %s\n", tmp->
interface);
2890 if (ast_channel_hangupcause(tmp->chan)) {
2891 ast_channel_hangupcause_set(chan, ast_channel_hangupcause(tmp->chan));
2893 ast_channel_unlock(chan);
2903 ast_channel_unlock(chan);
2905 ast_verb(3,
"Called %s\n", tmp->
interface);
2906 ast_set_flag64(tmp, DIAL_STILLGOING);
2915 if (ast_strlen_zero(args.timeout)) {
2919 char *anstimeout = strsep(&args.timeout,
"^");
2920 if (!ast_strlen_zero(anstimeout)) {
2921 to_answer = atoi(anstimeout);
2922 if (to_answer > 0) {
2925 ast_log(LOG_WARNING,
"Invalid answer timeout specified: '%s'. Setting timeout to infinite\n", args.timeout);
2931 if (!ast_strlen_zero(args.timeout)) {
2932 to_progress = atoi(args.timeout);
2933 if (to_progress > 0) {
2934 to_progress *= 1000;
2936 ast_log(LOG_WARNING,
"Invalid progress timeout specified: '%s'. Setting timeout to infinite\n", args.timeout);
2946 strcpy(pa.status,
"CHANUNAVAIL");
2947 if (fulldial == num_dialed) {
2953 strcpy(pa.status,
"NOANSWER");
2954 if (ast_test_flag64(outgoing, OPT_MUSICBACK)) {
2956 if (!ast_strlen_zero(opt_args[OPT_ARG_MUSICBACK])) {
2957 char *original_moh =
ast_strdupa(ast_channel_musicclass(chan));
2958 ast_channel_musicclass_set(chan, opt_args[OPT_ARG_MUSICBACK]);
2960 ast_channel_musicclass_set(chan, original_moh);
2965 }
else if (ast_test_flag64(outgoing, OPT_RINGBACK) || ast_test_flag64(outgoing, OPT_RING_WITH_EARLY_MEDIA)) {
2966 if (!ast_strlen_zero(opt_args[OPT_ARG_RINGBACK])) {
2967 if (dial_handle_playtones(chan, opt_args[OPT_ARG_RINGBACK])){
2980 peer =
wait_for_answer(chan, &out_chans, &to_answer, &to_progress, peerflags, opt_args, &pa, &num, &result,
2981 dtmf_progress, mf_progress, mf_wink, sf_progress, sf_wink,
2982 (ast_test_flag64(&opts, OPT_HEARPULSING) ? 1 : 0),
2983 ignore_cc, &forced_clid, &stored_clid, &config);
2988 }
else if (to_answer) {
2996 int dial_end_raised = 0;
2999 if (ast_test_flag64(&opts, OPT_CALLER_ANSWER)) {
3007 if (ast_test_flag64(&opts, OPT_HANGUPCAUSE)
3008 && !ast_strlen_zero(opt_args[OPT_ARG_HANGUPCAUSE])) {
3011 if (!strcasecmp(opt_args[OPT_ARG_HANGUPCAUSE],
"NONE")) {
3013 }
else if (sscanf(opt_args[OPT_ARG_HANGUPCAUSE],
"%30d", &cause) != 1
3015 ast_log(LOG_WARNING,
"Invalid cause given to Dial(...Q(<cause>)): \"%s\"\n",
3016 opt_args[OPT_ARG_HANGUPCAUSE]);
3021 hanguptree(&out_chans, peer, cause >= 0 ? cause : AST_CAUSE_ANSWERED_ELSEWHERE);
3025 ast_channel_lock(peer);
3029 if (ast_strlen_zero(number)) {
3034 ast_channel_unlock(peer);
3036 ast_channel_lock(chan);
3039 strcpy(pa.status,
"ANSWER");
3046 ast_channel_unlock(chan);
3049 ast_debug(1,
"app_dial: sendurl=%s.\n", args.url);
3052 if ( (ast_test_flag64(&opts, OPT_PRIVACY) || ast_test_flag64(&opts, OPT_SCREENING)) && pa.privdb_val == AST_PRIVACY_UNKNOWN) {
3053 if (do_privacy(chan, peer, &opts, opt_args, &pa)) {
3061 if (!ast_test_flag64(&opts, OPT_ANNOUNCE) || ast_strlen_zero(opt_args[OPT_ARG_ANNOUNCE])) {
3067 char *calledfile = NULL, *callerfile = NULL;
3068 int calledstream = 0, callerstream = 0;
3074 callerfile = opt_args[OPT_ARG_ANNOUNCE];
3075 calledfile = strsep(&callerfile,
":");
3078 if (!ast_strlen_zero(calledfile)) {
3079 res =
ast_streamfile(peer, calledfile, ast_channel_language(peer));
3082 ast_log(LOG_ERROR,
"error streaming file '%s' to callee\n", calledfile);
3087 if (!ast_strlen_zero(callerfile)) {
3088 res =
ast_streamfile(chan, callerfile, ast_channel_language(chan));
3091 ast_log(LOG_ERROR,
"error streaming file '%s' to caller\n", callerfile);
3101 while (ast_channel_stream(peer) || ast_channel_stream(chan)) {
3108 if (mspeer < 0 && !ast_channel_timingfunc(peer)) {
3114 if (mschan < 0 && !ast_channel_timingfunc(chan)) {
3120 if (!calledstream && !callerstream) {
3131 active_chan =
ast_waitfor_n(chans, 2, (mspeer > mschan ? &mschan : &mspeer));
3144 if (active_chan == peer && strchr(AST_DIGIT_ANY, res)) {
3158 if (active_chan == chan) {
3184 if (chan && peer && ast_test_flag64(&opts, OPT_GOTO) && !ast_strlen_zero(opt_args[OPT_ARG_GOTO])) {
3192 ast_channel_lock(peer);
3195 ast_channel_context_set(peer, ast_channel_context(chan));
3196 ast_channel_exten_set(peer, ast_channel_exten(chan));
3197 ast_channel_priority_set(peer, ast_channel_priority(chan) + 2);
3199 ast_channel_unlock(peer);
3210 if (ast_test_flag64(&opts, OPT_CALLEE_GOSUB) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GOSUB])) {
3211 const char *gosub_result_peer;
3212 char *gosub_argstart;
3213 char *gosub_args = NULL;
3217 gosub_argstart = strchr(opt_args[OPT_ARG_CALLEE_GOSUB],
',');
3218 if (gosub_argstart) {
3219 const char *what_is_s =
"s";
3220 *gosub_argstart = 0;
3221 if (!
ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB],
"s", 1,
S_COR(ast_channel_caller(peer)->
id.number.valid, ast_channel_caller(peer)->
id.number.str, NULL)) &&
3222 ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB],
"~~s~~", 1,
S_COR(ast_channel_caller(peer)->
id.number.valid, ast_channel_caller(peer)->
id.number.str, NULL))) {
3223 what_is_s =
"~~s~~";
3225 if (
ast_asprintf(&gosub_args,
"%s,%s,1(%s)", opt_args[OPT_ARG_CALLEE_GOSUB], what_is_s, gosub_argstart + 1) < 0) {
3228 *gosub_argstart =
',';
3230 const char *what_is_s =
"s";
3231 if (!
ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB],
"s", 1,
S_COR(ast_channel_caller(peer)->
id.number.valid, ast_channel_caller(peer)->
id.number.str, NULL)) &&
3232 ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB],
"~~s~~", 1,
S_COR(ast_channel_caller(peer)->
id.number.valid, ast_channel_caller(peer)->
id.number.str, NULL))) {
3233 what_is_s =
"~~s~~";
3235 if (
ast_asprintf(&gosub_args,
"%s,%s,1", opt_args[OPT_ARG_CALLEE_GOSUB], what_is_s) < 0) {
3241 ast_free(gosub_args);
3243 ast_log(LOG_ERROR,
"Could not Allocate string for Gosub arguments -- Gosub Call Aborted!\n");
3249 char *gosub_transfer_dest;
3250 char *gosub_result =
ast_strdupa(gosub_result_peer);
3258 ast_channel_unlock(peer);
3259 ast_channel_unlock(chan);
3261 if (!strcasecmp(gosub_result,
"BUSY")) {
3263 ast_set_flag64(peerflags, OPT_GO_ON);
3265 }
else if (!strcasecmp(gosub_result,
"CONGESTION") || !strcasecmp(gosub_result,
"CHANUNAVAIL")) {
3267 ast_set_flag64(peerflags, OPT_GO_ON);
3269 }
else if (!strcasecmp(gosub_result,
"CONTINUE")) {
3271 ast_set_flag64(peerflags, OPT_GO_ON);
3273 }
else if (!strcasecmp(gosub_result,
"ABORT")) {
3276 }
else if (!strncasecmp(gosub_result,
"GOTO:", 5)) {
3277 gosub_transfer_dest = gosub_result + 5;
3280 if (strchr(gosub_transfer_dest,
'^')) {
3284 ast_set_flag64(peerflags, OPT_GO_ON);
3289 if (!dial_end_raised) {
3291 dial_end_raised = 1;
3295 ast_channel_unlock(peer);
3296 ast_channel_unlock(chan);
3305 if (!dial_end_raised) {
3307 dial_end_raised = 1;
3312 ast_channel_lock(peer);
3314 ast_channel_unlock(peer);
3316 if (!ast_strlen_zero(dtmfcalled)) {
3317 ast_verb(3,
"Sending DTMF '%s' to the called party.\n", dtmfcalled);
3320 if (!ast_strlen_zero(dtmfcalling)) {
3321 ast_verb(3,
"Sending DTMF '%s' to the calling party.\n", dtmfcalling);
3328 ast_channel_hangupcause_set(chan, ast_channel_hangupcause(peer));
3330 setup_peer_after_bridge_goto(chan, peer, &opts, opt_args);
3337 if (ast_test_flag64(peerflags, OPT_CALLEE_TRANSFER))
3338 ast_set_flag(&(config.features_callee), AST_FEATURE_REDIRECT);
3339 if (ast_test_flag64(peerflags, OPT_CALLER_TRANSFER))
3340 ast_set_flag(&(config.features_caller), AST_FEATURE_REDIRECT);
3341 if (ast_test_flag64(peerflags, OPT_CALLEE_HANGUP))
3342 ast_set_flag(&(config.features_callee), AST_FEATURE_DISCONNECT);
3343 if (ast_test_flag64(peerflags, OPT_CALLER_HANGUP))
3344 ast_set_flag(&(config.features_caller), AST_FEATURE_DISCONNECT);
3345 if (ast_test_flag64(peerflags, OPT_CALLEE_MONITOR))
3346 ast_set_flag(&(config.features_callee), AST_FEATURE_AUTOMON);
3347 if (ast_test_flag64(peerflags, OPT_CALLER_MONITOR))
3348 ast_set_flag(&(config.features_caller), AST_FEATURE_AUTOMON);
3349 if (ast_test_flag64(peerflags, OPT_CALLEE_PARK))
3350 ast_set_flag(&(config.features_callee), AST_FEATURE_PARKCALL);
3351 if (ast_test_flag64(peerflags, OPT_CALLER_PARK))
3352 ast_set_flag(&(config.features_caller), AST_FEATURE_PARKCALL);
3353 if (ast_test_flag64(peerflags, OPT_CALLEE_MIXMONITOR))
3354 ast_set_flag(&(config.features_callee), AST_FEATURE_AUTOMIXMON);
3355 if (ast_test_flag64(peerflags, OPT_CALLER_MIXMONITOR))
3356 ast_set_flag(&(config.features_caller), AST_FEATURE_AUTOMIXMON);
3365 }
else if (sentringing) {
3371 ast_channel_visible_indication_set(chan, 0);
3375 ast_log(LOG_WARNING,
"Had to drop call because I couldn't make %s compatible with %s\n", ast_channel_name(chan), ast_channel_name(peer));
3388 setup_peer_after_bridge_goto(chan, peer, &opts, opt_args);
3397 }
else if (sentringing) {
3402 if (delprivintro &&
ast_fileexists(pa.privintro, NULL, NULL) > 0) {
3405 ast_log(LOG_NOTICE,
"privacy: ast_filedelete didn't do its job on %s\n", pa.privintro);
3407 ast_verb(3,
"Successfully deleted %s intro file\n", pa.privintro);
3413 if (ast_channel_hangupcause(chan) == AST_CAUSE_ANSWERED_ELSEWHERE || ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE)) {
3414 hanguptreecause = AST_CAUSE_ANSWERED_ELSEWHERE;
3415 }
else if (pa.canceled) {
3416 if (ast_channel_hangupcause(chan))
3417 hanguptreecause = ast_channel_hangupcause(chan);
3419 hanguptreecause = AST_CAUSE_NORMAL_CLEARING;
3421 hanguptree(&out_chans, NULL, hanguptreecause);
3423 ast_debug(1,
"Exiting with DIALSTATUS=%s.\n", pa.status);
3427 memset(ast_channel_whentohangup(chan), 0,
sizeof(*ast_channel_whentohangup(chan)));
3433 ast_trace(2,
"%s Cleaning up topology: %p %s\n",
3434 peer ? ast_channel_name(peer) :
"<no channel>", &config.
answer_topology,
3444 if (config.warning_sound) {
3445 ast_free((
char *)config.warning_sound);
3447 if (config.end_sound) {
3448 ast_free((
char *)config.end_sound);
3450 if (config.start_sound) {
3451 ast_free((
char *)config.start_sound);
3454 SCOPE_EXIT_RTN_VALUE(res,
"%s: Done\n", ast_channel_name(chan));
int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, const char *digits, int between, unsigned int duration)
Send a string of DTMF digits to a channel.
struct ast_channel * ast_waitfor_n(struct ast_channel **chan, int n, int *ms)
Waits for input on a group of channels Wait for input on an array of channels for a given # of millis...
int ast_channel_early_bridge(struct ast_channel *c0, struct ast_channel *c1)
Bridge two channels together (early)
Information needed to identify an endpoint in a call.
Main Channel structure associated with a channel.
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
void ast_channel_set_caller_event(struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update)
Set the caller id information in the Asterisk channel and generate an AMI event if the caller id name...
void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value)
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
struct ast_stream_topology * ast_channel_get_stream_topology(const struct ast_channel *chan)
Retrieve the topology of streams on a channel.
int ast_sched_runq(struct ast_sched_context *con)
Runs the queue.
struct ast_stream_topology * answer_topology
struct ast_party_id id
Connected party ID.
const char * ast_app_expand_sub_args(struct ast_channel *chan, const char *args)
Add missing context/exten to subroutine argument string.
void ast_party_connected_line_set_init(struct ast_party_connected_line *init, const struct ast_party_connected_line *guide)
Initialize the given connected line structure using the given guide for a set update operation...
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
struct ast_party_name name
Subscriber name.
void ast_channel_publish_dial(struct ast_channel *caller, struct ast_channel *peer, const char *dialstring, const char *dialstatus)
Publish in the ast_channel_topic or ast_channel_topic_all topics a stasis message for the channels in...
int ast_channel_supports_html(struct ast_channel *channel)
Checks for HTML support on a channel.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
int ast_call(struct ast_channel *chan, const char *addr, int timeout)
Make a call.
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
void ast_channel_clear_flag(struct ast_channel *chan, unsigned int flag)
Clear a flag on a channel.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
ast_channel_state
ast_channel states
int ast_indicate_data(struct ast_channel *chan, int condition, const void *data, size_t datalen)
Indicates condition of channel, with payload.
int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config)
Bridge a call, optionally allowing redirection.
const char * ast_cause2str(int cause) attribute_pure
Gives the string form of a given cause code.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
#define ast_strdup(str)
A wrapper for strdup()
Structure for a data store object.
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
struct ast_stream * ast_stream_topology_get_stream(const struct ast_stream_topology *topology, unsigned int position)
Get a specific stream from the topology.
int ast_senddigit(struct ast_channel *chan, char digit, unsigned int duration)
Send a DTMF digit to a channel.
int ast_filedelete(const char *filename, const char *fmt)
Deletes a file.
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
Structure used to handle a large number of boolean flags == used only in app_dial?
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
struct ast_frame_subclass subclass
void ast_cc_call_failed(struct ast_channel *incoming, struct ast_channel *outgoing, const char *const dialstring)
Make CCBS available in the case that ast_call fails.
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
char name[0]
Name for the stream within the context of the channel it is on.
const struct ast_channel_tech * tech
static struct callattempt * wait_for_answer(struct queue_ent *qe, struct callattempt *outgoing, int *to, char *digit, int prebusies, int caller_disconnect, int forwardsallowed)
Wait for a member to answer the call.
int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to)
Inherit datastores from a parent to a child.
static int setup_privacy_args(struct privacy_args *pa, struct ast_flags64 *opts, char *opt_args[], struct ast_channel *chan)
returns 1 if successful, 0 or <0 if the caller should 'goto out'
#define ast_str_tmp(init_len, __expr)
Provides a temporary ast_str and returns a copy of its buffer.
void ast_replace_subargument_delimiter(char *s)
Replace '^' in a string with ','.
void ast_cc_extension_monitor_add_dialstring(struct ast_channel *incoming, const char *const dialstring, const char *const device_name)
Add a child dialstring to an extension monitor.
int ast_channel_make_compatible(struct ast_channel *chan, struct ast_channel *peer)
Make the frame formats of two channels compatible.
const char * ast_stream_topology_to_str(const struct ast_stream_topology *topology, struct ast_str **buf)
Get a string representing the topology for debugging/display purposes.
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
int ast_parseable_goto(struct ast_channel *chan, const char *goto_string)
#define AST_MAX_EXTENSION
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
void * end_bridge_callback_data
Caller Party information.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
void(* end_bridge_callback_data_fixup)(struct ast_bridge_config *bconfig, struct ast_channel *originator, struct ast_channel *terminator)
int ast_cdr_reset(const char *channel_name, int keep_variables)
Reset the detail record.
struct ast_channel * ast_request_with_stream_topology(const char *type, struct ast_stream_topology *topology, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
Requests a channel (specifying stream topology)
#define ast_debug(level,...)
Log a DEBUG message.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
int ast_pre_call(struct ast_channel *chan, const char *sub_args)
Execute a Gosub call on the channel before a call is placed.
void ast_channel_req_accountcodes(struct ast_channel *chan, const struct ast_channel *requestor, enum ast_channel_requestor_relationship relationship)
Setup new channel accountcodes from the requestor channel after ast_request().
int ast_parse_caller_presentation(const char *data)
Convert caller ID text code to value (used in config file parsing)
int ast_app_parse_options64(const struct ast_app_option *options, struct ast_flags64 *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
struct ast_party_connected_line connected
int ast_cc_callback(struct ast_channel *inbound, const char *const tech, const char *const dest, ast_cc_callback_fn callback)
Run a callback for potential matching destinations.
int ast_cc_call_init(struct ast_channel *chan, int *ignore_cc)
Start the CC process on a call.
#define AST_PBX_INCOMPLETE
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
void ast_party_caller_set_init(struct ast_party_caller *init, const struct ast_party_caller *guide)
Initialize the given caller structure using the given guide for a set update operation.
void ast_channel_set_flag(struct ast_channel *chan, unsigned int flag)
Set a flag on a channel.
int ast_channel_connected_line_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *connected_info, int frame)
Run a connected line interception subroutine and update a channel's connected line information...
Channel datastore data for max forwards.
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
Connected Line/Party information.
void ast_party_id_set_init(struct ast_party_id *init, const struct ast_party_id *guide)
Initialize the given party id structure using the given guide for a set update operation.
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
int ast_channel_sendurl(struct ast_channel *channel, const char *url)
Sends a URL on a given link Send URL on link.
Set when the stream is sending media only.
union ast_frame::@224 data
void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
Inherits channel variable from parent to child channel.
#define ast_calloc(num, len)
A wrapper for calloc()
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
void ast_stream_set_state(struct ast_stream *stream, enum ast_stream_state state)
Set the state of a stream.
void ast_autoservice_chan_hangup_peer(struct ast_channel *chan, struct ast_channel *peer)
Put chan into autoservice while hanging up peer.
void ast_party_id_init(struct ast_party_id *init)
Initialize the given party id structure.
int ast_stream_topology_get_count(const struct ast_stream_topology *topology)
Get the number of streams in a topology.
#define AST_LIST_HEAD_NOLOCK_INIT_VALUE
Defines initial values for a declaration of AST_LIST_HEAD_NOLOCK.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
struct ast_stream_topology * ast_stream_topology_clone(const struct ast_stream_topology *topology)
Create a deep clone of an existing stream topology.
void ast_cc_busy_interface(struct ast_channel *inbound, struct ast_cc_config_params *cc_params, const char *monitor_type, const char *const device_name, const char *const dialstring, void *private_data)
Callback made from ast_cc_callback for certain channel types.
void(* end_bridge_callback)(void *)
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
void ast_ignore_cc(struct ast_channel *chan)
Mark the channel to ignore further CC activity.
void ast_deactivate_generator(struct ast_channel *chan)
int transit_network_select
Transit Network Select.
void ast_party_connected_line_copy(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src)
Copy the source connected line information to the destination connected line.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
void ast_connected_line_copy_from_caller(struct ast_party_connected_line *dest, const struct ast_party_caller *src)
Copy the caller information to the connected line information.
int ast_fileexists(const char *filename, const char *fmt, const char *preflang)
Checks for the existence of a given file.
int ast_answer(struct ast_channel *chan)
Answer a channel.
int ast_sched_wait(struct ast_sched_context *con) attribute_warn_unused_result
Determines number of seconds until the next outstanding event to take place.
int ast_channel_get_device_name(struct ast_channel *chan, char *device_name, size_t name_buffer_length)
Get a device name given its channel structure.
Data structure associated with a single frame of data.
int ast_app_exec_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const char *sub_args, int ignore_hangup)
Run a subroutine on a channel, placing an optional second channel into autoservice.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
enum ast_frame_type frametype
int ast_str2cause(const char *name) attribute_pure
Convert the string form of a cause code to a number.
void ast_stream_topology_free(struct ast_stream_topology *topology)
Unreference and destroy a stream topology.
void ast_rtp_instance_early_bridge_make_compatible(struct ast_channel *c_dst, struct ast_channel *c_src)
Make two channels compatible for early bridging.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
int ast_bridge_setup_after_goto(struct ast_channel *chan)
Setup any after bridge goto location to begin execution.
Set when the stream is receiving media only.
void ast_channel_set_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Set the connected line information in the Asterisk channel.
enum ast_stream_state ast_stream_get_state(const struct ast_stream *stream)
Get the current state of a stream.
int ast_app_group_set_channel(struct ast_channel *chan, const char *data)
Set the group for a channel, splitting the provided data into group and category, if specified...
int ast_stopstream(struct ast_channel *c)
Stops a stream.
void ast_party_redirecting_copy(struct ast_party_redirecting *dest, const struct ast_party_redirecting *src)
Copy the source redirecting information to the destination redirecting.
#define AST_APP_ARG(name)
Define an application argument.
int ast_callerid_parse(char *instr, char **name, char **location)
Destructively parse inbuf into name and location (or number)
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