3361
3361
if (contains_switch(statement)) { /* only run contains_switch if you haven't checked before */
3362
3362
if (mother_exten) {
3363
3363
if (!mother_exten->has_switch) {
3364
switch_set = new_prio();
3365
switch_set->type = AEL_APPCALL;
3366
if (!ast_compat_app_set) {
3367
switch_set->app = strdup("MSet");
3369
switch_set->app = strdup("Set");
3364
for (first = 1; first >= 0; first--) {
3365
switch_set = new_prio();
3366
switch_set->type = AEL_APPCALL;
3367
if (!ast_compat_app_set) {
3368
switch_set->app = strdup("MSet");
3370
switch_set->app = strdup("Set");
3372
/* Are we likely inside a gosub subroutine? */
3373
if (!strcmp(mother_exten->name, "s") && first) {
3374
/* If we're not actually within a gosub, this will fail, but the
3375
* second time through, it will get set. If we are within gosub,
3376
* the second time through is redundant, but acceptable. */
3377
switch_set->appargs = strdup("LOCAL(~~EXTEN~~)=${EXTEN}");
3379
switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
3382
linkprio(exten, switch_set, mother_exten);
3383
mother_exten->has_switch = 1;
3384
mother_exten->checked_switch = 1;
3386
exten->has_switch = 1;
3387
exten->checked_switch = 1;
3371
switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
3372
linkprio(exten, switch_set, mother_exten);
3373
mother_exten->has_switch = 1;
3374
mother_exten->checked_switch = 1;
3392
if (!exten->has_switch) {
3393
for (first = 1; first >= 0; first--) {
3394
switch_set = new_prio();
3395
switch_set->type = AEL_APPCALL;
3396
if (!ast_compat_app_set) {
3397
switch_set->app = strdup("MSet");
3399
switch_set->app = strdup("Set");
3401
/* Are we likely inside a gosub subroutine? */
3402
if (!strcmp(exten->name, "s")) {
3403
/* If we're not actually within a gosub, this will fail, but the
3404
* second time through, it will get set. If we are within gosub,
3405
* the second time through is redundant, but acceptable. */
3406
switch_set->appargs = strdup("LOCAL(~~EXTEN~~)=${EXTEN}");
3408
switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
3411
linkprio(exten, switch_set, mother_exten);
3376
3412
exten->has_switch = 1;
3377
3413
exten->checked_switch = 1;
3381
if (!exten->has_switch) {
3382
switch_set = new_prio();
3383
switch_set->type = AEL_APPCALL;
3384
if (!ast_compat_app_set) {
3385
switch_set->app = strdup("MSet");
3387
switch_set->app = strdup("Set");
3389
switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
3390
linkprio(exten, switch_set, mother_exten);
3391
exten->has_switch = 1;
3392
exten->checked_switch = 1;
3394
mother_exten->has_switch = 1;
3395
mother_exten->checked_switch = 1;
3415
mother_exten->has_switch = 1;
3416
mother_exten->checked_switch = 1;